2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00
Commit Graph

17132 Commits

Author SHA1 Message Date
Martin Xu
24ea309555 rhel: fix wrong condition check for ovs-kmod-manage.sh, fedora
In post-install in kmod fedora spec file, the variables storing
different parts of kernel version numbers are renamed. The condition
check to run ovs-kmod-manage.sh for RHEL 7.2 and 7.4 uses the older
variables.

Fixes: c3570519ec (rhel: add 4.4 kernel in kmod build with mulitple versions, fedora)
Signed-off-by: Martin Xu <martinxu9.ovs@gmail.com>
CC: Greg Rose <gvrose8192@gmail.com>
CC: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-26 13:30:17 -07:00
Ben Pfaff
2f114c7e11 ovsdb-data: Drop redundant initialization from ovsdb_datum_apply_diff().
The call to ovsdb_datum_diff() initializes 'new', so it's not necessary to
also do it in ovsdb_datum_apply_diff().

Found by inspection.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-09-26 13:26:05 -07:00
Ben Pfaff
4c1e8cb942 acinclude.m4: Really check whether GCC support -Wno-null-pointer-arithmetic.
I've noticed recently an annoying quantity of error messages like the
following in builds in various places:

    gcc: error: unrecognized command line option ‘-Wunknown-warning-option’

This didn't really make sense because OVS checks whether the compiler
supports warning options before it uses them.  Looking closer, the GCC
manual has a note that explains the issue:

     When an unrecognized warning option is requested (e.g.,
    '-Wunknown-warning'), GCC emits a diagnostic stating that the
    option is not recognized.  However, if the '-Wno-' form is used,
    the behavior is slightly different: no diagnostic is produced for
    '-Wno-unknown-warning' unless other diagnostics are being
    produced.  This allows the use of new '-Wno-' options with old
    compilers, but if something goes wrong, the compiler warns that
    an unrecognized option is present.

Thus, we can properly check only for the *positive* version of a warning
option, so this commit makes the OVS tests do that.

Fixes: a7021b08b0 ("configure: Disable -Wnull-pointer-arithmetic Clang warning.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
2018-09-26 13:19:00 -07:00
Martin Xu
8821b212df rhel: use _datadir as path prefix for ovs-kmod-manage.sh, fedora
This patch fixes the path for ovs-kmod-manage.sh script in the
openvswitch-kmod RPM in fedora spec file. Currently the path prefix is
hard coded to /usr/share. Use %{_datadir} instead.

Fixes: 22c33c3039 (rhel: support kmod build against mulitple kernel versions, fedora)
Signed-off-by: Martin Xu <martinxu9.ovs@gmail.com>
CC: Greg Rose <gvrose8192@gmail.com>
CC: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
2018-09-25 15:21:47 -07:00
Matteo Croce
69c51582ff dpif-netlink: don't allocate per thread netlink sockets
When using the kernel datapath, OVS allocates a pool of sockets to handle
netlink events. The number of sockets is: ports * n-handler-threads, where
n-handler-threads is user configurable and defaults to 3/4*number of cores.

This because vswitchd starts n-handler-threads threads, each one with a
netlink socket for every port of the switch. Every thread then, starts
listening on events on its set of sockets with epoll().

On setup with lot of CPUs and ports, the number of sockets easily hits
the process file descriptor limit, and ovs-vswitchd will exit with -EMFILE.

Change the number of allocated sockets to just one per port by moving
the socket array from a per handler structure to a per datapath one,
and let all the handlers share the same sockets by using EPOLLEXCLUSIVE
epoll flag which avoids duplicate events, on systems that support it.

The patch was tested on a 56 core machine running Linux 4.18 and latest
Open vSwitch. A bridge was created with 2000+ ports, some of them being
veth interfaces with the peer outside the bridge. The latency of the upcall
is measured by setting a single 'action=controller,local' OpenFlow rule to
force all the packets going to the slow path and then to the local port.
A tool[1] injects some packets to the veth outside the bridge, and measures
the delay until the packet is captured on the local port. The rx timestamp
is get from the socket ancillary data in the attribute SO_TIMESTAMPNS, to
avoid having the scheduler delay in the measured time.

The first test measures the average latency for an upcall generated from
a single port. To measure it 100k packets, one every msec, are sent to a
single port and the latencies are measured.

The second test is meant to check latency fairness among ports, namely if
latency is equal between ports or if some ports have lower priority.
The previous test is repeated for every port, the average of the average
latencies and the standard deviation between averages is measured.

The third test serves to measure responsiveness under load. Heavy traffic
is sent through all ports, latency and packet loss is measured
on a single idle port.

The fourth test is all about fairness. Heavy traffic is injected in all
ports but one, latency and packet loss is measured on the single idle port.

This is the test setup:

  # nproc
  56
  # ovs-vsctl show |grep -c Port
  2223
  # ovs-ofctl dump-flows ovs_upc_br
   cookie=0x0, duration=4.827s, table=0, n_packets=0, n_bytes=0, actions=CONTROLLER:65535,LOCAL
  # uname -a
  Linux fc28 4.18.7-200.fc28.x86_64 #1 SMP Mon Sep 10 15:44:45 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

And these are the results of the tests:

                                          Stock OVS                 Patched
  netlink sockets
  in use by vswitchd
  lsof -p $(pidof ovs-vswitchd) \
      |grep -c GENERIC                        91187                    2227

  Test 1
  one port latency
  min/avg/max/mdev (us)           2.7/6.6/238.7/1.8       1.6/6.8/160.6/1.7

  Test 2
  all port
  avg latency/mdev (us)                   6.51/0.97               6.86/0.17

  Test 3
  single port latency
  under load
  avg/mdev (us)                             7.5/5.9                 3.8/4.8
  packet loss                                  95 %                    62 %

  Test 4
  idle port latency
  under load
  min/avg/max/mdev (us)           0.8/1.5/210.5/0.9       1.0/2.1/344.5/1.2
  packet loss                                  94 %                     4 %

CPU and RAM usage seems not to be affected, the resource usage of vswitchd
idle with 2000+ ports is unchanged:

  # ps u $(pidof ovs-vswitchd)
  USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
  openvsw+  5430 54.3  0.3 4263964 510968 pts/1  RLl+ 16:20   0:50 ovs-vswitchd

Additionally, to check if vswitchd is thread safe with this patch, the
following test was run for circa 48 hours: on a 56 core machine, a
bridge with kernel datapath is filled with 2200 dummy interfaces and 22
veth, then 22 traffic generators are run in parallel piping traffic into
the veths peers outside the bridge.
To generate as many upcalls as possible, all packets were forced to the
slowpath with an openflow rule like 'action=controller,local' and packet
size was set to 64 byte. Also, to avoid overflowing the FDB early and
slowing down the upcall processing, generated mac addresses were restricted
to a small interval. vswitchd ran without problems for 48+ hours,
obviously with all the handler threads with almost 99% CPU usage.

[1] https://github.com/teknoraver/network-tools/blob/master/weed.c

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
2018-09-25 14:52:20 -07:00
Zak Whittington
83cf865ef8 ovs-save: save and restore groups on restart
VMware-BZ: 2192560
Signed-off-by: Zak Whittington <zwhitt.vmware@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-25 14:16:20 -07:00
Flavio Leitner
4c7e176644 sparse: check if floatn-common.h is available.
This skip including floatn-common.h if it's not available since it
was introduced in glibc 2.27 and OVS doesn't not actually require
that to work with previous glibc version.

Fixes: 07aec2ac1 sparse: Support newer GCC/glibc versions.
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-25 14:11:13 -07:00
Ben Pfaff
97bc5b2326 flow: Fix uninitialized flow fields in IPv6 error case.
When parse_ipv6_ext_hdrs__() returned false, half a 64-bit word had been
pushed into the miniflow and the second half was left uninitialized.  This
commit fixes the problem.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10518
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-09-21 20:10:23 -07:00
James Page
333ea340a0 ovs-kmod-ctl: source ovs-lib dynamically
Determine installation location of ovs-lib using runtime location
of script, rather than build-time parameters.

Signed-off-by: James Page <james.page@ubuntu.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-21 13:59:57 -07:00
Yifeng Sun
348f1f6732 tests: Fix broken test of 'truncate and output to gre tunnel'
The test 'truncate and output to gre tunnel' is broken on certain kernels
where OVS kernel module and upstream GRE module can't co-exist. This
patch creates a test that doesn't depend on upstream GRE module but
provides the same testing.

The replaced test is skipped on problematic kernel versions.

On centos, this test may fail due to the default rules of iptables.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
2018-09-21 13:23:17 -07:00
Yi-Hung Wei
2f355bffcd ofproto-dpif: Fix NXT_RESUME flow stats
Currently, OVS does not update the flow stats after a packet is
restarted by NXT_RESUME message.  This patch fixes the aforementioned
issue and adds an unit test to prevent regression.

Fixes: 77ab5fd2a9 ("Implement serializing the state of packet traversal in "continuations".")
VMware-BZ: #2198435
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-21 13:21:50 -07:00
Lorenzo Bianconi
b37f8c15ca OVN: add CT_LB action to ovn-trace
Add CT_LB action to ovn-trace utility in order to fix the
following ovn-trace error if a load balancer rule is added to
OVN configuration

ct_next(ct_state=est|trk /* default (use --ct to customize) */) {
	    *** ct_lb action not implemented;
};

Add '--lb_dst' option in order to specify the ip address to use
in VIP pool. If --lb_dst is not provided the destination ip will be
randomly choosen

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-21 12:36:19 -07:00
Gurucharan Shetty
ecc7744bcd ovs-ofctl.8: Fix reference to 'ip_frag'.
The description of 'ip_frag' is now available
in 'man ovs-fields'

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2018-09-20 03:37:57 -07:00
Numan Siddique
33f7f735c3 ovn: Add the documentation for the DHCP opt 'wpad' in proper section
The commit "6f01617442" added the documenation for the DHCPv4 option
252 in the wrong section. This patch fixes it.

Fixes: 6f01617442 ("ovn: Add DHCP support for option 252.")
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
2018-09-20 14:17:44 -07:00
Ben Pfaff
586ebdec0b meta-flow: Make "nw_frag" a synonym for "ip_frag".
Since the time that OVS introduced support for IP fragments, the OVS
functions that format flows have used "nw_frag", but the ones that parse
flows have expected "ip_frag".  Obviously this is a bug and it's a surprise
that it's gone so long without anyone reporting the problem.  This fixes
it and adds a test.

Reported-by: Gurucharan Shetty <guru@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Gurucharan Shetty <guru@ovn.org>
2018-09-20 14:14:00 -07:00
Alin Gabriel Serdean
ef1ebd3f33 datapath-windows: Fix payload length calculation in Conntrack.h
The payload calculation in OvsGetTcpHeader is wrong:
`ntohs(ipHdr->tot_len) - expr` instead of `ntohs((ipHdr->tot_len) - expr)`.

We already have a macro for that calculation defined in NetProto.h so use it.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
2018-09-20 17:49:32 +03:00
Pieter Jansen van Vuuren
a468645c6d lib/tc: add geneve with option match offload
Add TC offload support for classifying geneve tunnels with options.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
2018-09-20 15:58:24 +02:00
Pieter Jansen van Vuuren
202469aa9e lib/tc: add geneve with option encap action offload
Add TC offload support for encapsulating geneve tunnels with options.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
2018-09-20 15:58:22 +02:00
Anand Kumar
a1d4207e2c datapath-windows: Add support to configure ct zone limits
This patch implements limiting conntrack entries
per zone using dpctl commands.

Example:
ovs-appctl dpctl/ct-set-limits default=5 zone=1,limit=2 zone=1,limit=3
ovs-appctl dpct/ct-del-limits zone=4
ovs-appctl dpct/ct-get-limits zone=1,2,3

- Also update the netlink-socket.c to support netlink family
  'OVS_WIN_NL_CTLIMIT_FAMILY_ID' for conntrack zone limit.

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
2018-09-20 14:31:34 +03:00
Yifeng Sun
37ed637239 gre: Rename fallback devices to avoid udev's interference
On certain kernel versions, when openvswitch kernel module creates
a gre0 interface, the kernel’s gre module will jump out and compete
to control the gre0 interface. This will cause the failure of
openvswitch kernel module loading.

This fix renames fallback devices by adding a prefix "ovs-".

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
VMware Issue: #2162866
2018-09-18 16:02:37 -07:00
Justin Pettit
52499f66f6 Set release dates for 2.10.0.
Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2018-09-18 15:55:46 -07:00
Numan Siddique
ecf44dd3b2 ovsdb-server: Alleviate the possible data loss in an active/standby setup
The present code resets the database when it is in the state -
'RPL_S_SCHEMA_REQUESTED' and repopulates the database when it
receives the monitor reply when it is in the state -
'RPL_S_MONITOR_REQUESTED'. If however, it goes to active mode
before it processes the monitor reply, the whole data is lost.

This patch alleviates the problem by resetting the database when it
receives the monitor reply (before processing it). So that
reset and repopulation of the db happens in the same state.

This approach still has a window for data loss if the function
process_notification() when processing the monitor reply fails for
some reason or ovsdb-server crashes for some reason during
process_notification().

Reported-by: Han Zhou <zhouhan@gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-August/047161.html
Tested-by: aginwala <aginwala@ebay.com>
Acked-by: Han Zhou <zhouhan@gmail.com>
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-17 22:21:50 -07:00
Ben Pfaff
4043c30028 util: Better document ALIGNED_CAST.
CC: Han Zhou <zhouhan@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Han Zhou <hzhou8@ebay.com>
2018-09-17 22:20:54 -07:00
Ben Pfaff
491fdb0e71 ovsdb-idlc: Use ALIGNED_CAST to avoid spurious warnings for index rows.
The *_index_init_row() function casts a generic ovsdb_idl_row pointer to
a specific type of row pointer.  This can cause an increase in required
alignment with some kinds of data on some architectures.  GCC complains,
e.g.:

    lib/vswitch-idl.c: In function 'ovsrec_flow_sample_collector_set_index_init_row'
    lib/vswitch-idl.c:9277:12: warning: cast increases required alignment of target

However, rows are always allocated with malloc(), which returns member
suitable for any type, so this is a false positive warning and this commit
suppresses it.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Han Zhou <zhouhan@gmail.com>
2018-09-17 21:54:01 -07:00
Martin Xu
bc4fd43958 rhel: Ship ovs shared libraries, fedora
This patch extends 4886d4d249 (debian, rhel: Ship ovs shared libraries
and header files) to fedora, by packaging the shared libraries in
openvswitch and openvswitch-dvel RPM. These files are always packaged in
the RPMs built with rhel6 spec file.

VMware-BZ: #2036847

CC: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Martin Xu <martinxu9.ovs@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Flavio Leitner <fbl@redhat.com>
2018-09-17 21:43:34 -07:00
Ben Pfaff
03121ac4ef ofproto-dpif-xlate: Fix translation of groups with no buckets.
A group can have no buckets, in which case ovs_list_back() assert-fails.
This fixes the problem.

Found by OFTest.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1626488
Tested-by: Eelco Chaudron <echaudro@redhat.com>
Fixes: a04e58881e ("ofproto-dpif-xlate: Simplify translation for groups.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
2018-09-17 21:41:00 -07:00
Ben Pfaff
d9564a2fcc Merge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD 2018-09-17 21:33:29 -07:00
Justin Pettit
9539528def ofp-port: Don't leak on error in ofputil_pull_ofp14_port_stats().
With this change, we can remove a case of free done in the error code
path.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-09-14 15:22:16 -07:00
Yifeng Sun
cd2c1d3b1e ofp-print: Fix a memory leak reported by fuzz
When ofputil_decode_port_stats returns error, it is possible that
custom_stats_counters is valid and still need freed.

The fuzz report link is
https://oss-fuzz.com/testcase?key=5739356233400320

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
2018-09-14 10:52:02 -07:00
Greg Rose
e1a64872da Revert "Revert "utilities/ovs-ctl: Force removal of ip_gre/gre""
This reverts commit a94f9524db.

This is a revert of a previously reverted commit
2bdd1f3d96.

When we originally added commit 2bdd1f3d96 it was part of an
effort to work around gre module conflicts found while enabling
the ERSPAN feature. Testing at the time did not show any benefit
so in commit a94f9524db we reverted it.  However, further
developments showed that in some corner cases it did have a
benefit and it did not do any harm so we reverted the original
revert to restore the code.

Signed-off-by: Greg Rose <roseg@vmware.com>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
2018-09-14 10:52:02 -07:00
Kevin Traynor
e77c97b9d6 dpif-netdev: Add round-robin based rxq to pmd assignment.
Prior to OVS 2.9 automatic assignment of Rxqs to PMDs
(i.e. CPUs) was done by round-robin.

That was changed in OVS 2.9 to ordering the Rxqs based on
their measured processing cycles. This was to assign the
busiest Rxqs to different PMDs, improving aggregate
throughput.

For the most part the new scheme should be better, but
there could be situations where a user prefers a simple
round-robin scheme because Rxqs from a single port are
more likely to be spread across multiple PMDs, and/or
traffic is very bursty/unpredictable.

Add 'pmd-rxq-assign' config to allow a user to select
round-robin based assignment.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2018-09-14 11:45:05 +01:00
Timothy Redaelli
9497589467 ovs-save: Don't always include the default flow during restore
Currently the default flow (actions=NORMAL) is present in the flow table after
the flow table is restored also when the default flow is removed.

This commit changes the behaviour of the "ovs-save save-flows" command to use
"replace-flows" instead of "add-flows" to restore the flows. This is needed in
order to always have the new flow table as it was before restoring it.

Reported-by: Flavio Leitner <fbl@sysclose.org>
Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1626096
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
2018-09-13 05:19:54 -07:00
Gavi Teitz
a692410af0 dpctl: Expand the flow dump type filter
Added new types to the flow dump filter, and allowed multiple filter
types to be passed at once, as a comma separated list. The new types
added are:
 * tc - specifies flows handled by the tc dp
 * non-offloaded - specifies flows not offloaded to the HW
 * all - specifies flows of all types

The type list is now fully parsed by the dpctl, and a new struct was
added to dpif which enables dpctl to define which types of dumps to
provide, rather than passing the type string and having dpif parse it.

Signed-off-by: Gavi Teitz <gavi@mellanox.com>
Acked-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
2018-09-13 16:56:25 +02:00
Gavi Teitz
0d6b401cf6 dpif-netdev: Initialize dpif_flow attrs
In a previous commit, the dpif_flow struct was expanded, with the
'offloaded' field being moved into a new struct which also includes a
field for the dp layer the flow is handled on. The initialization of
these fields was only done in dpif-netlink.

This completes that commit, by initializing the fields in dpif-netdev
as well. As the 'offloaded' field was previously ignored by
dpif-netdev, the attrs are initialized to the default values of
'false' for the offloaded state, and 'ovs' for the dp layer.

Fixes: d63ca5329f ("dpctl: Properly reflect a rule's offloaded to HW state")
Signed-off-by: Gavi Teitz <gavi@mellanox.com>
Acked-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
2018-09-13 16:56:25 +02:00
Nicolas Haller
205639c253 Documentation: cosmetic fix for example flows
Signed-off-by: Nicolas Haller <nicolas@boiteameuh.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-12 15:16:51 -07:00
Yunjian Wang
1657366f6e datapath: lisp: Fix uninitialized field in tunnel_cfg.
The tunnel_cfg had the gro_receive and gro_complete fields uninitialized
in function lisp_open(). This caused an uninitialized memory read.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
2018-09-12 15:09:56 -07:00
Ben Pfaff
34c2c34334 flow: Document parse_tcp_flags() assumptions and semantics.
Reported-by: Bhargava Shastry <bshastry@sect.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-09-12 14:39:06 -07:00
Ben Pfaff
f89771542a odp-util: Don't attempt to write IPv6 flow label bits that don't exist.
The ipv6_label field member of struct ovs_key_ipv6 is 32 bits in size,
but an IPv6 label is only 20 bits, so the upper 12 bits are not writable
and must be 0 in the mask.  The code wasn't careful about this so it could
try to write them anyway.  This commit fixes the problem.

Reported-by: nm_r@directbox.com
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-September/047357.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-09-12 14:25:41 -07:00
Pieter Jansen van Vuuren
7f02f26c2e lib/tc: treat vlan id and prio as independent fields
Previously the key was used to check the presence of vlan id and
prio fields instead of using the mask. Additionally the vlan id
field was considered to be present if only the prio field was set,
and vice versa. f.e. setting the following:

ovs-ofctl -OOpenFlow13,OpenFlow15 add-flow br0 \
priority=10,cookie=1,table=0,ip,dl_vlan_pcp=2,actions=output:2

Resulted in (instead of wildcarding vlan_id, filter matches 0):
filter protocol 802.1Q pref 1 flower chain 0
filter protocol 802.1Q pref 1 flower chain 0 handle 0x1
 vlan_id 0
 vlan_prio 2
 vlan_ethtype ip
 eth_type ipv4
 ip_flags nofrag
 in_hw
       action order 1: mirred (Egress Redirect to device eth1) stolen
       index 2 ref 1 bind 1 installed 5 sec used 5 sec
       Action statistics:
       Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
       backlog 0b 0p requeues 0
       cookie 47040ae7a94fff6afd7ed8aa04b11ba4

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
2018-09-12 14:30:24 +02:00
Ben Pfaff
af8ba76451 tests: Add $(AM_V_GEN) annotation to fuzz-regression-list.at target.
Fixes: 2bdeb9a70e ("tests: Add regression tests for all the bugs found by oss-fuzz so far.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-10 12:51:50 -07:00
Ben Pfaff
2bdeb9a70e tests: Add regression tests for all the bugs found by oss-fuzz so far.
This will make it harder for bugs found by oss-fuzz to reappear.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-10 12:33:57 -07:00
Ben Pfaff
49b21677f4 ofp-port: Further cleanups and fixes for ofputil_decode_port_stats().
This fixes leaks on the error path in parse_intel_port_custom_property().

ofp_print_ofpst_port_reply() failed to free the custom_stats in decoded
port stats.  This fixes the problem.

parse_intel_port_custom_property() had a memory leak if there was more than
one custom stats property (which there shouldn't be, but still).  This
fixes the problem.

There was a function netdev_free_custom_stats_counters() meant for freeing
custom_stats, but hardly anything used it.  This adopts it consistently.

It wasn't safe to free the custom stats if ofputil_decode_port_stats()
returned an error.  Using netdev_free_custom_stats_counters() avoids this
pitfall.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9972
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
2018-09-10 12:33:50 -07:00
Bhargava Shastry
5ff53df674 oss-fuzz: Fuzz miniflow APIs also.
This patch increases coverage of `lib/flow.c` from 39% to 43%, covers three
additional files and increases coverage in five other source/header files.

Signed-off-by: Bhargava Shastry <bshastry at sect.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-10 12:28:55 -07:00
Louis Peens
662a6fd4c2 lib/tc: reject offloading of non-Ethernet packets
When a packet is marked with the special ethtype of OFP_DL_TYPE_NOT_ETH_TYPE
it got wrongly installed into tc datapath as a match on a packet with that
ethtype. This prevents that from happening.

Signed-off-by: Louis Peens <louis.peens@netronome.com>
Reviewed-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
2018-09-10 13:50:47 +02:00
Ben Pfaff
c7e22c6e4e vswitch.xml: Better explain vlan-limit.
CC: Eric Garver <e@erig.me>
Requested-by: Jerry Lilijun <jerry.lilijun@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Eric Garver <e@erig.me>
2018-09-07 10:59:01 -07:00
Eelco Chaudron
189de33f02 netdev-vport: reject concomitant incompatible tunnels
This patch will make sure VXLAN tunnels with and without the group
based policy (GBP) option enabled can not coexist on the same
destination UDP port.

In theory, VXLAN tunnel with and without GBP enables can be
multiplexed on the same UDP port as long as different VNI's are
used. However currently OVS does not support this, hence this patch to
check for this condition.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-07 10:28:56 -07:00
Bhargava Shastry
ca3556541c ossfuzz: Add parse_tcp_flags() to flow_extract_target.
This patch invokes parse_tcp_flags() in flow_extract_target.c after doing a
basic sanitization check (that packet contains at least an ETH header).

A cursory evaluation shows that the patch improves line coverage of
lib/flow.c from 37% to 39%.

Signed-off-by: Bhargava Shastry <bshastry at sect.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-07 10:11:19 -07:00
Timothy Redaelli
dc041eae50 dhparams: Fix .c file generation with OpenSSL >= 1.1.1-pre9
Since OpenSSL upstream commit 201b305a2409
("apps/dsaparam.c generates code that is intended to be pasted or included into
an existing source file: the function is static, and the code doesn't include
dsa.h.  Match the generated C source style of dsaparam.") "openssl dhparam -C"
generates the get_dh functions as static, but the functions are used inside
stream-ssl.c and so the static keyword cannot be used.

This commit removes the static keyword from the get_dh functions during
dhparams.c file generation by restoring the current behaviour.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-09-07 09:57:43 -07:00
Yunjian Wang
3869435f1a datapath: stt: Remove unused if statement in function stt_cleanup().
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
2018-09-07 09:53:12 -07:00
Pieter Jansen van Vuuren
34b1695506 lib/tc: add single mpls match offload support
Add TC offload support for classifying single MPLS tagged traffic.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
2018-09-07 15:07:53 +02:00