2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 21:07:47 +00:00

1727 Commits

Author SHA1 Message Date
Lin Huang
ccd26e79e5 ovs-tcpdump: Fix bond port unable to capture jumbo frames.
Currently the ovs-tcpdump utility creates a tap port to capture the
frames of a bond port.

If a user want to capture the packets from the bond port which member
interface's mtu is more than 1500. By default the utility creates a
tap port which mtu is 1500, regardless the member interface's mtu config.
So that user can't get the bond port frames which mtu is lager than 1500.

This patch fix this issue by checking the member interface's mtu and
set maximal mtu value to the tap port.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Lin Huang <linhuang@ruijie.com.cn>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-10-11 21:10:46 +02:00
Ilya Maximets
950aee1f7e checkpatch: Add check for egrep/fgrep.
GNU grep 3.8 started complaining about use of obsolete egrep/fgrep:

  egrep: warning: egrep is obsolescent; using grep -E

This breaks tests on such systems.  All the instances was cleaned up
from the testsuite, but the checkpatch check is needed to catch issues
in new patches.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-09-15 14:18:25 +02:00
Ilya Maximets
516f181a21 docs: Remove remaining references to OVS kmod and XenServer.
README file still mentions a kernel module and some parts of
the documentation still have XenServer references, e.g. 'xs-*'
database configuration options.  Removing them.

Fixes: 422e90437854 ("make: Remove the Linux datapath.")
Fixes: 83c9518e7c67 ("xenserver: Remove xenserver.")
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-08-15 19:46:00 +02:00
Han Ding
269a947c7b ovs-save: Use right OpenFlow version for add-tlv-map.
When the bridge protocols is not included Openflow10, printing an error
message "version negotiation failed" when doing "Restoring saved flows".

Signed-off-by: Han Ding <handing@chinatelecom.cn>
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-08-08 19:03:48 +02:00
Ilya Maximets
434025a154 python: Fix E275 missing whitespace after keyword.
With just released flake8 5.0 we're getting a bunch of E275 errors:

 utilities/bugtool/ovs-bugtool.in:959:23: E275 missing whitespace after keyword
 tests/test-ovsdb.py:623:11: E275 missing whitespace after keyword
 python/setup.py:105:8: E275 missing whitespace after keyword
 python/setup.py:106:8: E275 missing whitespace after keyword
 python/ovs/db/idl.py:145:15: E275 missing whitespace after keyword
 python/ovs/db/idl.py:167:15: E275 missing whitespace after keyword
 make[2]: *** [flake8-check] Error 1

This breaks CI on branches below 2.16.  We don't see a problem right
now on newer branches because we're installing extra dependencies
that backtrack flake8 down to 4.1 or even 3.9.

Acked-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-08-04 18:13:20 +02:00
Ilya Maximets
91b41af0d9 checkpatch: Add check for a Fixes tag.
A new check for common mistakes while formatting a 'Fixes:' tag.

Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-08-04 14:06:37 +02:00
Greg Rose
422e904378 make: Remove the Linux datapath.
Update the necessary make and configure files to remove the Linux
datapath and then remove the datapath.

Move datapath/linux/compat/include/linux/openvswitch.h to
include/linux/openvswitch.h because it is needed to generate header
files used by the userspace switch.

Also remove references to the Linux datapath from auxiliary files
and utilities since it is no longer supported.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-07-15 13:45:55 +02:00
Frode Nordahl
9f4f2bb7dc checkpatch: Ignore line length and leading whitespace for debian/*.
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-07-15 13:43:39 +02:00
Frode Nordahl
2fc29c4278 man: Fix various typos across manual pages.
As reported by Debian lintian.

Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-07-14 15:24:07 +02:00
Frode Nordahl
cfba951585 utilities/bashcomp: Fix incorrect file mode.
The bash completion scripts shipped with Open vSwitch currently
have the executable bit set.  This is problematic because the
files do not start with a shebang and as such a user may end up
executing them using the wrong shell.  When installed in a system
the bash shell will source these files and not execute them.

This also triggers Debian lintian warnings [0] and defies Debian
policy [1].

0: https://lintian.debian.org/tags/executable-not-elf-or-script
1: https://www.debian.org/doc/debian-policy/ch-files.html#scripts
Fixes: 423ede182b65 ("utilities: Add bash command-line completion script.")
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-07-12 15:45:42 +02:00
Mike Pattrick
8c1c447a1d ovs-tcpdump: Default to OVS_RUNDIR if present.
Now ovs-tcpdump will check for an OVS_RUNDIR environment variable and
if present, use it instead of the default RUNDIR. This is useful when
used in conjunction with OVS_PAUSE_TEST while running the test suite.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-06-28 13:34:58 +02:00
Han Ding
c0d7d630be ovs-tcpdump: Fix error when stopping ovs-tcpdump.
Sometimes we need to dump packets on more than two interfaces in a bridge
at the same time. Then when we stop dumping in order, ovs-tcpdump print
traceback and fail to delete mirror interface for some interface.

For example:
br-int has two interface tap1 and br-int. We use ovs-tcpdump dump tap1 first
and dump br-int next. Then stopping tap1 ovs-tcpdump first, and stopping
br-int second. When we stop ovs-tcpdump for br-int, the screen show the error
like this:
__main__.OVSDBException: Unable to delete Mirror m_br-int

Signed-off-by: Han Ding <handing@chinatelecom.cn>
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-06-07 15:08:33 +02:00
Peng He
071b802c61 checkpatch.py: Add checks for easy-to-misuse APIs.
Signed-off-by: Peng He <hepeng.0320@bytedance.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-05-30 23:39:56 +02:00
Han Ding
8ce7ead8cf ovs-save: Get highest ofp version error.
When setting just one ofp version to protocols of bridge, The function
get_highest_ofp_version in ovs-save parse it error.

For example:
$ ovs-vsctl get bridge br-int protocols
[OpenFlow15]

$ ovs-vsctl get bridge br-int protocols |
  sed 's/[][]//g' | sed 's/\ //g' | awk -F ',' '{ print (NF>1)? $(NF) : "OpenFlow14" }'
OpenFlow14

Signed-off-by: Han Ding <handing@chinatelecom.cn>
Acked-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-05-17 23:18:37 +02:00
Mike Pattrick
b3bbfc1729 utilities: Handle dumping packets in GDB TUI.
Currently, ovs_dump_packets will break the formatting of the GDB
terminal UI, resulting in artifacts displayed on the screen that
may make packets difficult to read. This patch suppresses stderr
output from tcpdump and feeds tcpdumps stdout into the paginated
output stream.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-05-04 21:44:59 +02:00
Vasu Dasari
c3e64047d1 ofp-monitor: Support flow monitoring for OpenFlow 1.3, 1.4+.
Extended OpenFlow monitoring support
* OpenFlow 1.3 with ONF extensions
* OpenFlow 1.4+ as defined in OpenFlow specification 1.4+.

ONF extensions are similar to Nicira extensions except for onf_flow_monitor_request{}
where out_port is defined as 32-bit number OF(1.1) number, oxm match formats are
used in update and request messages.

Flow monitoring support in 1.4+ is slightly different from Nicira and ONF
extensions.
 * More flow monitoring flags are defined.
 * Monitor add/modify/delete command is introduced in flow_monitor
   request message.
 * Addition of out_group as part of flow_monitor request message

Description of changes:
1. Generate ofp-msgs.inc to be able to support 1.3, 1.4+ flow Monitoring messages.
    include/openvswitch/ofp-msgs.h

2. Modify openflow header files with protocol specific headers.
    include/openflow/openflow-1.3.h
    include/openflow/openflow-1.4.h

3. Modify OvS abstraction of openflow headers. ofp-monitor.h leverages  enums
   from on nicira extensions for creating protocol abstraction headers. OF(1.4+)
   enums are superset of nicira extensions.
    include/openvswitch/ofp-monitor.h

4. Changes to these files reflect encoding and decoding of new protocol messages.
    lib/ofp-monitor.c

5. Changes to modules using ofp-monitor APIs. Most of the changes here are to
   migrate enums from nicira to OF 1.4+ versions.
    ofproto/connmgr.c
    ofproto/connmgr.h
    ofproto/ofproto-provider.h
    ofproto/ofproto.c

6. Extended protocol decoding tests to verify all protocol versions
        FLOW_MONITOR_CANCEL
        FLOW_MONITOR_PAUSED
        FLOW_MONITOR_RESUMED
        FLOW_MONITOR request
        FLOW_MONITOR reply
    tests/ofp-print.at

7. Modify flow monitoring tests to be able executed by all protocol versions.
    tests/ofproto.at

7. Modified documentation highlighting the change
    utilities/ovs-ofctl.8.in
    NEWS

Signed-off-by: Vasu Dasari <vdasari@gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2021-June/383915.html
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-04-28 21:27:11 +02:00
Vasu Dasari
d8ab75cd69 ofp-monitor: Extend Flow Monitoring support for OF 1.0-1.2 with Nicira Extensions.
Currently OVS supports flow-monitoring for OpenFlow 1.0 and Nicira Extenstions.
Any other OpenFlow versioned messages are not accepted. This change will allow
OpenFlow1.0-1.2 Flow Monitoring with Nicira extensions be accepted. Also made
sure that flow-monitoring updates, flow monitoring pause messages, resume
messages are sent in the same OpenFlow version as that of flow-monitor request.

Description of changes:

1. Generate ofp-msgs.inc to be able to support 1.0-1.2 Flow Monitoring messages.
include/openvswitch/ofp-msgs.h

2. Support vconn to accept user specified version and use it for vconn
flow-monitoring session
ofproto/ofproto.c

3. Modify APIs to use protocol as an argument to encode and decode messages
include/openvswitch/ofp-monitor.h
lib/ofp-monitor.c
ofproto/connmgr.c
ofproto/connmgr.h
ofproto/ofproto.c

4. Modified following testcases to be verified across supported OF Versions
    ofproto - flow monitoring
    ofproto - flow monitoring with !own
    ofproto - flow monitoring with out_port
    ofproto - flow monitoring pause and resume
    ofproto - flow monitoring usable protocols
tests/ofproto.at

5. Updated NEWS with the support added with this commit

Signed-off-by: Vasu Dasari <vdasari@gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2020-December/050820.html
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-04-28 21:26:40 +02:00
Adrian Moreno
b54067b24a idlc: support short version of SAFE macros.
In order to be consistent with the rest of the SAFE loop macros,
overload each of the generated *_SAFE macro with a SHORT version that
does not require the user to provide the NEXT variable.

Acked-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-03-30 16:59:03 +02:00
Adrian Moreno
9e56549c2b hmap: use short version of safe loops if possible.
Using SHORT version of the *_SAFE loops makes the code cleaner and less
error prone. So, use the SHORT version and remove the extra variable
when possible for hmap and all its derived types.

In order to be able to use both long and short versions without changing
the name of the macro for all the clients, overload the existing name
and select the appropriate version depending on the number of arguments.

Acked-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-03-30 16:59:02 +02:00
Adrian Moreno
e9bf5bffb0 list: use short version of safe loops if possible.
Using the SHORT version of the *_SAFE loops makes the code cleaner
and less error-prone. So, use the SHORT version and remove the extra
variable when possible.

In order to be able to use both long and short versions without changing
the name of the macro for all the clients, overload the existing name
and select the appropriate version depending on the number of arguments.

Acked-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-03-30 16:59:02 +02:00
Eelco Chaudron
85d3785e6a utilities: Add netlink flow operation USDT probes and upcall_cost script.
This patch adds a series of NetLink flow operation USDT probes.
These probes are in turn used in the upcall_cost Python script,
which in addition of some kernel tracepoints, give an insight into
the time spent on processing upcall.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-01-18 00:46:30 +01:00
Eelco Chaudron
51ec98635e utilities: Add upcall USDT probe and associated script.
Added the dpif_recv:recv_upcall USDT probe, which is used by the
included upcall_monitor.py script. This script receives all upcall
packets sent by the kernel to ovs-vswitchd. By default, it will
show all  upcall events, which looks something like this:

 TIME               CPU  COMM      PID      DPIF_NAME          TYPE PKT_LEN FLOW_KEY_LEN
 5952147.003848809  2    handler4  1381158  system@ovs-system  0    98      132
 5952147.003879643  2    handler4  1381158  system@ovs-system  0    70      160
 5952147.003914924  2    handler4  1381158  system@ovs-system  0    98      152

It can also dump the packet and NetLink content, and if required,
the packets can also be written to a pcap file.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-01-18 00:46:30 +01:00
Eelco Chaudron
ff4c712d45 Documentation: Add USDT documentation and bpftrace example.
Add the USDT documentation and a bpftrace example using the
bridge run USDT probes.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-01-18 00:46:30 +01:00
Mike Pattrick
0d1ffb7756 checkpatch: Detect "trojan source" attack.
Recently there has been a lot of press about the "trojan source" attack,
where Unicode characters are used to obfuscate the true functionality of
code. This attack didn't effect OVS, but adding the check here will help
guard against it sneaking in later.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Gaetan Rivet <grive@u256.net>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-01-04 19:14:11 +01:00
Mike Pattrick
428b11caa7 utilities: Add another GDB macro for ovs-vswitchd.
This commit adds a basic packet metadata macro to the already existing
macros in ovs_gdb.py, ovs_dump_packets will print out information about
one or more packets. It feeds packets into tcpdump, and the user can
pass in tcpdump options to modify how packets are parsed or even write
out packets to a pcap file.

Example usage:
(gdb) break fast_path_processing
(gdb) commands
 ovs_dump_packets packets_
 continue
 end
(gdb) continue

Thread 1 "ovs-vswitchd" hit Breakpoint 2, fast_path_processing ...
12:01:05.962485 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has
    10.1.1.1 tell 10.1.1.2, length 28

Thread 1 "ovs-vswitchd" hit Breakpoint 1, fast_path_processing ...
12:01:05.981214 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.1.1.1
    is-at a6:0f:c3:f0:5f:bd (oui Unknown), length 28

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-01-04 19:14:11 +01:00
Eli Britstein
0b6d2faace ci: Remove -Wno-cast-align from CI.
Following [1]-[3] in DPDK, there are no more such warnings from DPDK.
Remove ignoring them if they occur.

GitHub actions:
v1: https://github.com/elibritstein/OVS/actions/runs/1540651133

[1] a3f8d0587188 ("net: avoid cast-align warning in VLAN insert function")
[2] da0333c8790b ("mbuf: avoid cast-align warning in data offset macro")
[3] 6de430b7079e ("eal/x86: avoid cast-align warning in memcpy functions")

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-01-04 19:14:11 +01:00
Mike Pattrick
d652fc6a5a checkpatch: Correct line count in error messages.
As part of some previous checkpatch work, we discovered that checkpatch
isn't always reporting correct line numbers. As it turns out, Python's
splitlines function considers several characters to be new lines which
common text editors do not typically consider to be new lines. For
example, form feed characters, which this code base uses to cluster
functionality.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-01-04 17:23:30 +01:00
Mike Pattrick
4490792dd3 ofproto-dpif: Increase dp_hash default max buckets.
Currently when a user creates an openflow group with with multiple
buckets without specifying a selection type, the efficient dp_hash is
only selected if the user is creating fewer than 64 buckets. But when
dp_hash is explicitly selected, up to 256 buckets are supported.

While up to 64 buckets seems like a lot, certain OVN/Open Stack
workloads could result in the user creating more than 64 buckets. For
example, when using OVN to load balance. This patch increases the
default maximum from 64 to 256.

This change to the default limit doesn't affect how many buckets are
actually created, that is specified by the user when the group is
created, just how traffic is distributed across buckets.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Gaetan Rivet <grive@u256.net>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-12-03 15:40:53 +01:00
Mike Pattrick
958ca7ba3b ovs-tcpdump: Improve performance with dummy interface.
Currently the ovs-tcpdump utility creates a virtual tunnel to send
packets to. This method functions perfectly fine, however, it can
greatly impact performance of the monitored port.

It has been reported to reduce packet throughput significantly. I was
able to reproduce a reduction in throughput of up 70 percent in some
tests with a simple setup of two hosts communicating through a single
bridge on Linux with the kernel module datapath. Another more complex
test was configured for the usermode datapath both with and without
DPDK. This test involved a data path going from a VM, through a port
into one OVS bridge, out through a network card which could be DPDK
enabled for the relevant tests, in to a different network interface,
then into a different OVS bridge, through another port, and then into
a virtual machine.

Using the dummy driver resulted in the following impact to performance
compared to no ovs-tcpdump. Due to intra-test variance and fluctuations
during the first few seconds after installing a tap; multiple samples
were taken over multiple test runs. The first few seconds worth of
results were discarded and then results were averaged out.

If the dummy driver isn't present, falls back on the existing tap code.

Original Script
===============
Category             Impact on Throughput
Kernel datapath    - 65%
Usermode (no DPDK) - 26%
DPDK ports in use  - 37%

New Script
==========
Category             Impact on Throughput
Kernel datapath    - 5%
Usermode (no DPDK) - 16%
DPDK ports in use  - 29%

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-11-30 01:24:00 +01:00
Terry Wilson
c60eec0649 ovs-lib: Backup and remove existing DB when joining cluster.
ovsdb-tool join-cluster requires a remote addr, so the existing
code that tried to join a cluster without it when there was an
existing $DB_FILE would fail.

Instead, if we are trying to specifically join a cluster and there
is an existing $DB_FILE, back it up and remove the original before
continuing to join the cluster.

Signed-off-by: Terry Wilson <twilson@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Flavio Fernandes <flavio@flaviof.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-11-30 01:24:00 +01:00
Salvatore Daniele
59622fd1bc ovs-save: Save igmp flows in ofp_parse syntax.
match.c generates the keyword "igmp", which is not supported in ofp-parse.
This means that flow dumps containing 'igmp' can not be restored.

Removing the 'igmp' keyword entirely could break existing scripts in stable
branches, so this patch creates a workaround within ovs-save by converting any
instances of "igmp" within $bridge.flows.dump into "ip, nw_proto=2", and any
instances of igmp_type/code into the generic tp_src/dst.

Signed-off-by: Salvatore Daniele <sdaniele@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-11-29 22:28:04 +01:00
Eelco Chaudron
9b20df73a6 dpctl: dpif: Allow viewing and configuring dp cache sizes.
This patch adds a general way of viewing/configuring datapath
cache sizes. With an implementation for the netlink interface.

The ovs-dpctl/ovs-appctl show commands will display the
current cache sizes configured:

 $ ovs-dpctl show
 system@ovs-system:
   lookups: hit:25 missed:63 lost:0
   flows: 0
   masks: hit:282 total:0 hit/pkt:3.20
   cache: hit:4 hit-rate:4.54%
   caches:
     masks-cache: size:256
   port 0: ovs-system (internal)
   port 1: br-int (internal)
   port 2: genev_sys_6081 (geneve: packet_type=ptap)
   port 3: br-ex (internal)
   port 4: eth2
   port 5: sw0p1 (internal)
   port 6: sw0p3 (internal)

A specific cache can be configured as follows:

 $ ovs-appctl dpctl/cache-set-size DP CACHE SIZE
 $ ovs-dpctl cache-set-size DP CACHE SIZE

For example to disable the cache do:

 $ ovs-dpctl cache-set-size system@ovs-system masks-cache 0
 Setting cache size successful, new size 0.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-11-08 21:48:05 +01:00
Timothy Redaelli
c5d384f77b checkpatch: Check if some tags are wrongly written.
Currently, there are some patches with the tags wrongly written (with
space instead of dash ) and this may prevent some automatic system or CI
to detect them correctly.

This commit adds a check in checkpatch to be sure the tag is written
correctly with dash and not with space.

The tags supported by the commit are:
Acked-by, Reported-at, Reported-by, Requested-by, Reviewed-by, Submitted-at
and Suggested-by.

It's not necessary to add "Signed-off-by" since it's already checked in
checkpatch.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-11-04 22:26:00 +01:00
Remi Jouannet
f9f3919828 ovs-ctl: Add missing description for --ovs-vswitchd-options and --ovsdb-server-options to usage().
The options commit by fce20b8b73b1 were missing a description in
ovs-ctl help message.

Fixes: fce20b8b73b1 ("ovs-ctl: Permit to specify additional options")
Signed-off-by: Remi Jouannet <remi.jouannet@outscale.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-10-12 17:49:11 +02:00
Aaron Conole
00d3d4a7d3 checkpatch: Avoid catastrophic backtracking.
As Frode Nordahl points out in [0], it is possible for the
python regex module to enter a case of catastrophic backtracking
which causes oscillation between states and hangs the checkpatch
script.

One suggested solution to these cases is to use an anchor[1] in
the regex, which should force the backtrack to exit early.
However, when I tested this, it didn't seem to improve anything
(since the start is already anchored, and trying to anchor the
end results in the same hang).

Instead, we explicitly check that the line ends with '\\' before
trying to match on the 'if-inside-a-macro' check.  A new check
is added to catch the case in checkpatch.

0: https://mail.openvswitch.org/pipermail/ovs-dev/2021-August/386881.html
1: https://stackoverflow.com/questions/22072406/preventing-any-backtracking-in-regex-past-a-specific-pattern

Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-09-08 21:29:03 +02:00
lin huang
911adb93ee ovs-save: Use right OpenFlow version for "ovs-ofctl dump-tlv-map".
"ovs-ofctl dump-tlv-map ${bridge}" command need right ofp_version.

Signed-off-by: linhuang <linhuang@ruijie.com.cn>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2021-07-02 12:04:20 -07:00
Aaron Conole
b6c5f30cfa checkpatch: Ignore macro definitions of FOR_EACH.
When defining a FOR_EACH macro, checkpatch freaks out and generates a
control block whitespace error.  Create an exception so that it doesn't
generate errors for this case.

Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2020-August/373509.html
Reported-by: Toshiaki Makita <toshiaki.makita1@gmail.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-07-01 16:31:55 +02:00
Dan Williams
e5b5008acd ovs-lib: pass optional --election-timer arg to ovsdb-tool
This doesn't have any current users within the OVS repository.  OVN will
use it.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2021-06-25 10:14:41 -07:00
Rosemarie O'Riorden
bd90524550 Remove Python 2 leftovers.
Fixes: 1ca0323e7c29 ("Require Python 3 and remove support for Python 2.")
Reported at: https://bugzilla.redhat.com/show_bug.cgi?id=1949875
Signed-off-by: Rosemarie O'Riorden <roriorde@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-06-22 21:29:57 +02:00
lin huang
f1951d41fb ovs-save: Fix awk command to return highest ofp version.
"ovs-vsctl get Bridge "$1" protocols" prints something like this:
  [OpenFlow12, OpenFlow13]

The code in ovs-save didn't parse it properly.  This fixes the
problem.

Signed-off-by: linhuang <linhuang@ruijie.com.cn>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2021-06-02 18:30:08 -07:00
Wang Yibo
f173527ec8 ovs-ofctl: Fix coredump when using "add-groups" command.
When using ovs-ofctl add-groups with only "switch" argument, a coredump
is generated.  The main reason is that the command "ovs-ofctl add-groups"
need two arguments but the limitation of min-args of this command is
set to 1.

Fixes: 7395c05254df ("Implement OpenFlow 1.1+ "groups" protocol.")
Submitted-at: https://github.com/openvswitch/ovs/pull/360
Signed-off-by: Wang Yibo <bobxxwang@126.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-05-14 16:08:43 +02:00
Flavio Fernandes
31629b5383 ovs-ofctl: Fix segfault due to bad meter n_bands.
Meter commands internally use ofctl_meter_mod__() and
ofctl_meter_request__() functions, which have an optional parameter
called str.  When str is NULL, these 2 functions initialize a struct
with meter bands set as NULL. It also needs to set meter n_bands to 0.

Once del-meters change in test dpif-netdev.at is added, the valgrind
report on test '992: dpif-netdev - meters' shows this issue:

   Conditional jump or move depends on uninitialised value(s)
      at 0x473534: ofputil_put_bands (ofp-meter.c:207)
      by 0x473534: ofputil_encode_meter_mod (ofp-meter.c:557)
      by 0x40FBA2: ofctl_meter_mod__ (ovs-ofctl.c:4038)
      by 0x417BD3: ovs_cmdl_run_command__ (command-line.c:247)
      by 0x4078BA: main (ovs-ofctl.c:179)
    Uninitialised value was created by a stack allocation
      at 0x409350: ofctl_del_meters (ovs-ofctl.c:4088)

Fixes: 3200ed5805 ("ovs-ofctl: Add meter support.")
Signed-off-by: Flavio Fernandes <flavio@flaviof.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-04-01 01:42:28 +02:00
Frode Nordahl
2ad201659c ovs-ctl: Allow recording hostname separately.
ovs-ctl determines the system FQDN or hostname and records it in
the `external-ids:hostname` field of the `Open-vSwitch` table on
system startup if it is not already set.

This value may be consumed by downstream software and having it
unset or set to a incorrect value could lead to erratic behavior
of a system.

When a system is configured to use an Open vSwitch controlled
datapath as its only network connection, the current ordering of
events would always record a unreliable hostname.

To tackle this problem this patch adds an optional argument that
allows starting Open vSwitch without recording the hostname in
the database as well as a new ctl command to record the hostname
separately. This command can be called by the system startup
scripts when the system is ready to collect and record this
information.

Reported-At: https://bugs.launchpad.net/bugs/1915829
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-03-01 20:14:35 +01:00
Yunjian Wang
59611d6fe0 ovs-lib: Remove second parameter for stop_daemon.
The stop_daemon no longer takes second argument after
commit f3e24610ea18 ("Remove OVN.").

Fixes: f3e24610ea18 ("Remove OVN.")
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-02-02 17:56:06 +01:00
Flavio Leitner
25eb72a26b ovs-ctl: Prepend OVS binary directories to PATH.
The inclusion of LSB functions in ovs-lib resets $PATH to
system's default. Then ovs-ctl appends missing directories
including the OVS default ones $sbindir and $bindir.

The problem is that the wrong binaries can be used if they
are available in the system's default locations because of
the PATH wrong order. The same issue happens if one changes
$OVS_BINDIR or $OVS_SBINDIR variables.

The solution is to prepend those directories if they are not
already in PATH.

Reported-by: Mark Gray <mark.d.gray@redhat.com>
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Mark Gray <mark.d.gray@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-01-27 13:26:07 +01:00
Mark Gray
fe5ff26a49 ovs-monitor-ipsec: Add option to not restart IKE daemon.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-01-06 12:04:45 +01:00
Mark Gray
409c35a2f1 ovs-ctl: Use 'stop_daemon' to stop ovs-monitor-ipsec.
Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-01-05 19:44:30 +01:00
Eelco Chaudron
bf8812cd7e dpctl: Add add/mod/del-flows command.
When you would like to add, modify, or delete a lot of flows in the
datapath, for example when you want to measure performance, adding
one flow at the time won't scale. This as it takes a decent amount
of time to set up the datapath connection.

This new command is in-line with the same command available in
ovs-ofctl which allows the same thing, with the only difference that
we do not verify all lines before we start execution. This allows for
a continuous add/delete stream. For example with a command like this:

python3 -c 'while True:
  for i in range(0, 1000):
    print("add in_port(0),eth(),eth_type(0x800),ipv4(src=100.1.{}.{}) 1".format(int(i / 256), i % 256))
  for i in range(0, 1000):
    print("delete in_port(0),eth(),eth_type(0x800),ipv4(src=100.1.{}.{})".format(int(i / 256), i % 256))' \
|  sudo utilities/ovs-dpctl add-flows -

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-01-05 18:55:45 +01:00
Daniel Alvarez
2221e8b034 ovs-ctl: Don't overwrite external-id hostname.
ovs-ctl started to add the hostname as external-id [0] at some point.

However, this can be problematic as if it's already set by an external
entity it will get overwritten. In RHEL systems, systemd will invoke
ovs-ctl to start OVS and that will overwrite it to the hostname of the
machine.

For OVN this can have a big impact because if, for whatever reason the
hostname changes and the host gets restarted, ovn-controller won't
claim the ports back leaving the workloads unaccessible.

Also, it makes sense to not overwrite it as 1) it's an external_id,
so it will actually let external entities to configure it (unlike now),
and 2) it's optional. In the case that some systems were relying on
ovs-ctl to set the external-id for the first time (e.g onboarding
of a new hypervisor), this patch is not changing such behavior.

For more details, see discussion at [1].

[0] https://mail.openvswitch.org/pipermail/ovs-dev/2016-March/312054.html
[1] https://mail.openvswitch.org/pipermail/ovs-dev/2020-May/370813.html

Signed-off-by: Daniel Alvarez <dalvarez@redhat.com>
Acked-by: Han Zhou <hzhou@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-01-05 18:23:32 +01:00
Ilya Maximets
dc497e36fc checkpatch: Add check for a whitespace after cast.
Coding style says: "Put a space between the ``()`` used in a cast and
the expression whose type is cast: ``(void *) 0``.".
This style rule is frequently overlooked.  Let's check for it.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Ian Stokes <ian.stokes@intel.com>
2020-11-27 14:31:27 +01:00