]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
6 years agotravis: Update kernel test list from kernel.org
Greg Rose [Wed, 7 Feb 2018 15:50:01 +0000 (07:50 -0800)]
travis: Update kernel test list from kernel.org

Also add package libelf-dev - since 4.14 it's required for making
the source.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agoacinclude.m4: Enable Linux 4.14
Greg Rose [Wed, 7 Feb 2018 15:50:00 +0000 (07:50 -0800)]
acinclude.m4: Enable Linux 4.14

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agoDocumentation: Update NEWS and faq
Pravin Shelar [Tue, 13 Feb 2018 23:52:44 +0000 (15:52 -0800)]
Documentation: Update NEWS and faq

Per the Linux 4.14 kernel support.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: meter: Use 64-bit arithmetic instead of 32-bit
Gustavo A. R. Silva [Wed, 7 Feb 2018 15:49:58 +0000 (07:49 -0800)]
datapath: meter: Use 64-bit arithmetic instead of 32-bit

Upstream commit:
    commit 5b7789e8fa8f353ad8f2c44de2385cb161b22d32
    Author: Gustavo A. R. Silva <gustavo@embeddedor.com>
    Date:   Tue Jan 30 22:55:33 2018 -0600

    Add suffix LL to constant 1000 in order to give the compiler
    complete information about the proper arithmetic to use. Notice
    that this constant is used in a context that expects an expression
    of type long long int (64 bits, signed).

    The expression (band->burst_size + band->rate) * 1000 is currently
    being evaluated using 32-bit arithmetic.

    Addresses-Coverity-ID: 1461563 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start
Gustavo A. R. Silva [Wed, 7 Feb 2018 15:49:57 +0000 (07:49 -0800)]
datapath: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start

Upstream commit:
    commit b74912a2fdae9aadd20da502644aa8848c861954
    Author: Gustavo A. R. Silva <garsilva@embeddedor.com>
    Date:   Tue Nov 14 14:26:16 2017 -0600

    openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_star

    It seems that the intention of the code is to null check the value
    returned by function genlmsg_put. But the current code is null
    checking the address of the pointer that holds the value returned
    by genlmsg_put.

    Fix this by properly null checking the value returned by function
    genlmsg_put in order to avoid a pontential null pointer dereference.

    Addresses-Coverity-ID: 1461561 ("Dereference before null check")
    Addresses-Coverity-ID: 1461562 ("Dereference null return value")
Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Using kfree_rcu() to simplify the code
Wei Yongjun [Wed, 7 Feb 2018 15:49:56 +0000 (07:49 -0800)]
datapath: Using kfree_rcu() to simplify the code

Upstream commit:
    commit 6dc14dc40a1d1dafd8491c349b5f3e15aabc4edb
    Author: Wei Yongjun <weiyongjun1@huawei.com>
    Date:   Tue Nov 14 06:27:12 2017 +0000

    openvswitch: Using kfree_rcu() to simplify the code

    The callback function of call_rcu() just calls a kfree(), so we
    can use kfree_rcu() instead of call_rcu() + callback function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Fix return value check in ovs_meter_cmd_features()
Wei Yongjun [Wed, 7 Feb 2018 15:49:55 +0000 (07:49 -0800)]
datapath: Fix return value check in ovs_meter_cmd_features()

Upstream commit:
    commit 8a860c2bcc84a8e4fbcabb928cd97e4c51b17d93
    Author: Wei Yongjun <weiyongjun1@huawei.com>
    Date:   Tue Nov 14 06:20:16 2017 +0000

    openvswitch: Fix return value check in ovs_meter_cmd_features()

    In case of error, the function ovs_meter_cmd_reply_start() returns
    ERR_PTR() not NULL. The NULL test in the return value check should
    be replaced with IS_ERR().

Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Add meter infrastructure
Andy Zhou [Tue, 13 Feb 2018 23:48:24 +0000 (15:48 -0800)]
datapath: Add meter infrastructure

Upstream commit:
    commit 96fbc13d7e770b542d2d1fcf700d0baadc6e8063
    Author: Andy Zhou <azhou@ovn.org>
    Date:   Fri Nov 10 12:09:42 2017 -0800

    openvswitch: Add meter infrastructure

    OVS kernel datapath so far does not support Openflow meter action.
    This is the first stab at adding kernel datapath meter support.
    This implementation supports only drop band type.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Added a compat layer fixup for nla_parse.
Added another compat fixup for ktime_get_ns.

Cc: Andy Zhou <azhou@ovn.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Add meter netlink definitions
Andy Zhou [Wed, 7 Feb 2018 15:49:53 +0000 (07:49 -0800)]
datapath: Add meter netlink definitions

Upstream commit:
    commit 5794040647de4011598a6d005fdad95d24fd385b
    Author: Andy Zhou <azhou@ovn.org>
    Date:   Fri Nov 10 12:09:40 2017 -0800

    openvswitch: Add meter netlink definitions

    Meter has its own netlink family. Define netlink messages and attributes
    for communicating with the user space programs.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Andy Zhou <azhou@ovn.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: reliable interface indentification in port dumps
Jiri Benc [Wed, 7 Feb 2018 15:49:52 +0000 (07:49 -0800)]
datapath: reliable interface indentification in port dumps

Upstream commit:
    commit 9354d452034273a50a4fd703bea31e5d6b1fc20b
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Nov 2 17:04:37 2017 -0200

    openvswitch: reliable interface indentification in port dumps

    This patch allows reliable identification of netdevice interfaces connected
    to openvswitch bridges. In particular, user space queries the netdev
    interfaces belonging to the ports for statistics, up/down state, etc.
    Datapath dump needs to provide enough information for the user space to be
    able to do that.

    Currently, only interface names are returned. This is not sufficient, as
    openvswitch allows its ports to be in different name spaces and the
    interface name is valid only in its name space. What is needed and generally
    used in other netlink APIs, is the pair ifindex+netnsid.

    The solution is addition of the ifindex+netnsid pair (or only ifindex if in
    the same name space) to vport get/dump operation.

    On request side, ideally the ifindex+netnsid pair could be used to
    get/set/del the corresponding vport. This is not implemented by this patch
    and can be added later if needed.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Added compat fixup for peernet2id.

Cc: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: export get_dp() API
Andy Zhou [Wed, 7 Feb 2018 15:49:51 +0000 (07:49 -0800)]
datapath: export get_dp() API

Upstream commit:
    commit 9602c01e57f7b868d748c2ba2aef0efa64b71ffc
    Author: Andy Zhou <azhou@ovn.org>
    Date:   Fri Nov 10 12:09:41 2017 -0800

    openvswitch: export get_dp() API.

    Later patches will invoke get_dp() outside of datapath.c. Export it.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Andy Zhou <azhou@ovn.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agoofp-flow: Fix return value for ofputil_decode_flow_stats_reply().
Ben Pfaff [Mon, 12 Feb 2018 17:57:14 +0000 (09:57 -0800)]
ofp-flow: Fix return value for ofputil_decode_flow_stats_reply().

This function returned errno values for some errors and OFPERR_* values
for others.  The callers all expected OFPERR_* values.  This fixes the
problem.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoopenflow: Update list of features.
Ben Pfaff [Thu, 8 Feb 2018 22:56:02 +0000 (14:56 -0800)]
openflow: Update list of features.

Bundles are implemented for both OF1.3 and OF1.4+, so no need to keep it
in the list.  Packet type aware pipeline is now implemented too.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agoofp-errors: Add remaining OF1.4 and OF1.5 errors.
Ben Pfaff [Thu, 8 Feb 2018 22:58:17 +0000 (14:58 -0800)]
ofp-errors: Add remaining OF1.4 and OF1.5 errors.

Also implements the backports of relevant errors to OF1.3 as specified in
ONF extension pack 1 for OF1.3.

ONF-JIRA: EXT-237
ONF-JIRA: EXT-230
ONF-JIRA: EXT-264
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agoextract-ofp-errors: Minor improvements.
Ben Pfaff [Thu, 8 Feb 2018 22:54:09 +0000 (14:54 -0800)]
extract-ofp-errors: Minor improvements.

This removes the requirement of exactly two spaces before the error
description (now one or more is fine).  It also makes an error message
clearer.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agoImplement OF1.3 extension for OF1.4 role status feature.
Ben Pfaff [Thu, 8 Feb 2018 21:25:39 +0000 (13:25 -0800)]
Implement OF1.3 extension for OF1.4 role status feature.

ONF extension pack 1 for OpenFlow 1.3 defines how to implement the OpenFlow
1.4 "role status" message in OpenFlow 1.3.  This commit implements that
feature.

ONF-JIRA: EXT-191
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agoofp-util, ofp-parse: Break up into many separate modules.
Ben Pfaff [Fri, 9 Feb 2018 18:04:26 +0000 (10:04 -0800)]
ofp-util, ofp-parse: Break up into many separate modules.

ofp-util had been far too large and monolithic for a long time.  This
commit breaks it up into units that make some logical sense.  It also
moves the pieces of ofp-parse that were specific to each unit into the
relevant unit.

Most of this commit is just moving code around.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoofp-util: Remove prototypes for unimplemented functions.
Ben Pfaff [Fri, 9 Feb 2018 18:30:46 +0000 (10:30 -0800)]
ofp-util: Remove prototypes for unimplemented functions.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agodocs: Update supported DPDK versions.
Ian Stokes [Mon, 29 Jan 2018 17:17:56 +0000 (17:17 +0000)]
docs: Update supported DPDK versions.

Update the OVS to DPDK release table to use the latest stable
DPDK 16.11.4 for OVS 2.7.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agopoc: Introduce Proof of Concepts (Package building)
Ansis Atteka [Tue, 16 Jan 2018 00:18:30 +0000 (16:18 -0800)]
poc: Introduce Proof of Concepts (Package building)

This patch sets up foundations for Proof of Concepts that
simply materialize documentation into Ansible instructions
executed in virtualized Vagrant environment.

This Proof of Concept allows to easily build:
1. *.deb packages on Ubuntu 16.04; AND
2. *.rpm packages on CentOS 7.4.
It also sets up DEB and RPM repository over HTTP that can
be used to pull these openvswitch packages with apt-get
or yum from another host.

This particular Proof of Concept is intended to address
following use-cases:
1. for new OVS users to see how debian and rpm packages are
   built;
2. for developers to easily check for packaging build
   regressions;
3. for developers to easily share their sandbox builds
   into QE setups (opposed to manually copying binaries);
4. for developers to add other Proof of Concepts
   that possibly may require full end-to-end integration
   with other thirdparty projects (e.g. DPI, libvirt, IPsec)
   and need Open vSwitch packages.

Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ansis Atteka <aatteka@ovn.org>
6 years agodatapath: use ktime_get_ts64() instead of ktime_get_ts()
Arnd Bergmann [Wed, 7 Feb 2018 15:30:10 +0000 (07:30 -0800)]
datapath: use ktime_get_ts64() instead of ktime_get_ts()

Upstream commit:
    commit 311af51dcb5629f04976a8e451673f77e3301041
    Author: Arnd Bergmann <arnd@arndb.de>
    Date:   Mon Nov 27 12:41:38 2017 +0100

    openvswitch: use ktime_get_ts64() instead of ktime_get_ts()

    timespec is deprecated because of the y2038 overflow, so let's convert
    this one to ktime_get_ts64(). The code is already safe even on 32-bit
    architectures, since it uses monotonic times. On 64-bit architectures,
    nothing changes, while on 32-bit architectures this avoids one
    type conversion.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Additional compatability check for ktime_get_ts64() exists or not.
If not, then just continue using ktime_get_ts(). I added a new
compatability header file "timekeeping.h".

Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: fix the incorrect flow action alloc size
zhangliping [Wed, 7 Feb 2018 15:30:09 +0000 (07:30 -0800)]
datapath: fix the incorrect flow action alloc size

Upstream commit:
    commit 67c8d22a73128ff910e2287567132530abcf5b71
    Author: zhangliping <zhangliping02@baidu.com>
    Date:   Sat Nov 25 22:02:12 2017 +0800

    openvswitch: fix the incorrect flow action alloc size

    If we want to add a datapath flow, which has more than 500 vxlan outputs'
    action, we will get the following error reports:
      openvswitch: netlink: Flow action size 32832 bytes exceeds max
      openvswitch: netlink: Flow action size 32832 bytes exceeds max
      openvswitch: netlink: Actions may not be safe on all matching packets
      ... ...

    It seems that we can simply enlarge the MAX_ACTIONS_BUFSIZE to fix it, but
    this is not the root cause. For example, for a vxlan output action, we need
    about 60 bytes for the nlattr, but after it is converted to the flow
    action, it only occupies 24 bytes. This means that we can still support
    more than 1000 vxlan output actions for a single datapath flow under the
    the current 32k max limitation.

    So even if the nla_len(attr) is larger than MAX_ACTIONS_BUFSIZE, we
    shouldn't report EINVAL and keep it move on, as the judgement can be
    done by the reserve_sfa_size.

Signed-off-by: zhangliping <zhangliping02@baidu.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: zhangliping <zhangliping02@baidu.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: fix data type in queue_gso_packets
Gustavo A. R. Silva [Wed, 7 Feb 2018 15:30:08 +0000 (07:30 -0800)]
datapath: fix data type in queue_gso_packets

Upstream commit:
    commit 2734166e89639c973c6e125ac8bcfc2d9db72b70
    Author: Gustavo A. R. Silva <garsilva@embeddedor.com>
    Date:   Sat Nov 25 13:14:40 2017 -0600

    net: openvswitch: datapath: fix data type in queue_gso_packets

    gso_type is being used in binary AND operations together with SKB_GSO_UDP.
    The issue is that variable gso_type is of type unsigned short and
    SKB_GSO_UDP expands to more than 16 bits:

    SKB_GSO_UDP = 1 << 16

    this makes any binary AND operation between gso_type and SKB_GSO_UDP to
    be always zero, hence making some code unreachable and likely causing
    undesired behavior.

    Fix this by changing the data type of variable gso_type to unsigned int.

    Addresses-Coverity-ID: 1462223
Fixes: 0c19f846d582 ("net: accept UFO datagrams from tuntap and packet")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
While backporting this I found another couple of instances of the
same issue so I fixed them up as well.

Cc: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Fix an error handling path in 'ovs_nla_init_match_and_action()
Christophe JAILLET [Wed, 7 Feb 2018 15:30:07 +0000 (07:30 -0800)]
datapath: Fix an error handling path in 'ovs_nla_init_match_and_action()

Upstream commit:
commit 5829e62ac17a40ab08c1b905565604a4b5fa7af6
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Mon Sep 11 21:56:20 2017 +0200

    openvswitch: Fix an error handling path in 'ovs_nla_init_match_and_action()'

    All other error handling paths in this function go through the 'error'
    label. This one should do the same.

Fixes: 9cc9a5cb176c ("datapath: Avoid using stack larger than 1024.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Fixes: 850c2a4d1a ("datapath: Avoid using stack larger than 1024.")
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agocompat: Fix compiler headers
Greg Rose [Wed, 7 Feb 2018 15:30:06 +0000 (07:30 -0800)]
compat: Fix compiler headers

Since Linux kernel upstream commit d15155824c50
("linux/compiler.h: Split into compiler.h and compiler_types.h") this
error check for the gcc compiler header is no longer valid.  Remove
so that openvswitch builds for linux kernels 4.14.8 and since.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Fix SKB_GSO_UDP usage
Greg Rose [Wed, 7 Feb 2018 15:30:05 +0000 (07:30 -0800)]
datapath: Fix SKB_GSO_UDP usage

Using SKB_GSO_UDP breaks the compilation on Linux 4.14. Check for
the HAVE_SKB_GSO_UDP compiler #define.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: conntrack: make protocol tracker pointers const
Florian Westphal [Wed, 7 Feb 2018 15:30:04 +0000 (07:30 -0800)]
datapath: conntrack: make protocol tracker pointers const

Upstream commit:
    commit b3480fe059ac9121b5714205b4ddae14b59ef4be
    Author: Florian Westphal <fw@strlen.de>
    Date:   Sat Aug 12 00:57:08 2017 +0200

    netfilter: conntrack: make protocol tracker pointers const

    Doesn't change generated code, but will make it easier to eventually
    make the actual trackers themselvers const.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agocompat:inet_frag.h: Check for frag_percpu_counter_batch
Greg Rose [Wed, 7 Feb 2018 15:30:03 +0000 (07:30 -0800)]
compat:inet_frag.h: Check for frag_percpu_counter_batch

Fix up the compat layer to check for frag_percpu_counter_batch and
if not present then use atomic_sub and atomic_add as per the
backport in the 3.16.50 LTS kernel.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agocompat: Do not include headers when not compiling
Greg Rose [Wed, 7 Feb 2018 15:30:02 +0000 (07:30 -0800)]
compat: Do not include headers when not compiling

If the entire file is not going to be compiled because OVS is using
upstream tunnel support then also don't bother pulling in the headers.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Fix netdev_master_upper_dev_link for 4.14
Greg Rose [Wed, 7 Feb 2018 15:30:01 +0000 (07:30 -0800)]
datapath: Fix netdev_master_upper_dev_link for 4.14

An extended netlink ack has been added for 4.14 - add compat layer
changes so that it compiles for all kernels up to and including
4.14.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agotests: Don't include a newline in ovs_fatal() calls.
Justin Pettit [Sat, 10 Feb 2018 01:02:09 +0000 (17:02 -0800)]
tests: Don't include a newline in ovs_fatal() calls.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Allow DNS lookups over IPv6
Mark Michelson [Fri, 9 Feb 2018 15:11:00 +0000 (09:11 -0600)]
ovn: Allow DNS lookups over IPv6

There was a bug in DNS request handling where the incoming packet was
assumed to be IPv4.

The result was that for the outgoing packet, we would attempt to write
the IPv4 checksum and total length into what was actually an IPv6
header. This resulted in the source IPv6 address getting corrupted.
Later, the source and destination IPv6 addresses would get swapped,
resulting in the DNS response being sent to a nonsense destination.

With this change, we check the ethertype of the packet to determine what
l3 information to write, and where to write it. A test is also included
that verifies that this works as expected.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1539608
Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath: enable NSH support
Yi Yang [Wed, 31 Jan 2018 13:53:06 +0000 (21:53 +0800)]
datapath: enable NSH support

Upstream commit:
  commit b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3
  Author: Yi Yang <yi.y.yang@intel.com>
  Date:   Tue Nov 7 21:07:02 2017 +0800

    openvswitch: enable NSH support

    OVS master and 2.8 branch has merged NSH userspace
    patch series, this patch is to enable NSH support
    in kernel data path in order that OVS can support
    NSH in compat mode by porting this.

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Acked-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Eric Garver <e@erig.me>
Acked-by: Pravin Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agodatapath: nsh: add GSO support
Yi Yang [Wed, 31 Jan 2018 13:53:05 +0000 (21:53 +0800)]
datapath: nsh: add GSO support

Upstream commit:
  commit c411ed854584a71b0e86ac3019b60e4789d88086
  Author: Jiri Benc <jbenc@redhat.com>
  Date:   Mon Aug 28 21:43:24 2017 +0200

    nsh: add GSO support

    Add a new nsh/ directory. It currently holds only GSO functions but more
    will come: in particular, code shared by openvswitch and tc to manipulate
    NSH headers.

    For now, assume there's no hardware support for NSH segmentation. We can
    always introduce netdev->nsh_features later.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agodatapath: net: add NSH header structures and helpers
Yi Yang [Wed, 31 Jan 2018 13:53:04 +0000 (21:53 +0800)]
datapath: net: add NSH header structures and helpers

Upstream commit:
  commit 1f0b7744c50573df464ca33d8e5275be509f852b
  Author: Yi Yang <yi.y.yang@intel.com>
  Date:   Mon Aug 28 21:43:23 2017 +0200

    net: add NSH header structures and helpers

    NSH (Network Service Header)[1] is a new protocol for service
    function chaining, it can be handled as a L3 protocol like
    IPv4 and IPv6, Eth + NSH + Inner packet or VxLAN-gpe + NSH +
    Inner packet are two typical use cases.

    This patch adds NSH header structures and helpers for NSH GSO
    support and Open vSwitch NSH support.

    [1] https://datatracker.ietf.org/doc/draft-ietf-sfc-nsh/

    [Jiri: added nsh_hdr() helper and renamed the header struct to "struct
    nshhdr" to match the usual pattern. Removed packet type defines, these are
    now shared with VXLAN-GPE.]

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agodatapath: vxlan: factor out VXLAN-GPE next protocol
Yi Yang [Wed, 31 Jan 2018 13:53:03 +0000 (21:53 +0800)]
datapath: vxlan: factor out VXLAN-GPE next protocol

Upstream commit:
  commit fa20e0e32cb3dfc1760b6254b64977f2fb5bd851
  Author: Jiri Benc <jbenc@redhat.com>
  Date:   Mon Aug 28 21:43:22 2017 +0200

    vxlan: factor out VXLAN-GPE next protocol

    The values are shared between VXLAN-GPE and NSH. Originally probably by
    coincidence but I notified both working groups about this last year and they
    seem to keep the values in sync since then.

    Hopefully they'll get a single IANA registry for the values, too. (I asked
    them for that.)

    Factor out the code to be shared by the NSH implementation.

    NSH and MPLS values are added in this patch, too. For MPLS, the drafts
    incorrectly assign only a single value, while we have two MPLS ethertypes.
    I raised the problem with both groups. For now, I assume the value is for
    unicast.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agodatapath: ether: add NSH ethertype
Yi Yang [Wed, 31 Jan 2018 13:53:02 +0000 (21:53 +0800)]
datapath: ether: add NSH ethertype

Upstream commit:
  commit 155e6f649757c902901e599c268f8b575ddac1f8
  Author: Jiri Benc <jbenc@redhat.com>
  Date:   Mon Aug 28 21:43:21 2017 +0200

    ether: add NSH ethertype

    The NSH draft says:

       An IEEE EtherType, 0x894F, has been allocated for NSH.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoexpr: Add additional invariant check in test.
Ben Pfaff [Tue, 6 Feb 2018 18:00:49 +0000 (10:00 -0800)]
expr: Add additional invariant check in test.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
6 years agoexpr: Make expr_sort() always yield an expr that satisfies invariants.
Ben Pfaff [Tue, 6 Feb 2018 18:00:48 +0000 (10:00 -0800)]
expr: Make expr_sort() always yield an expr that satisfies invariants.

Expressions of type EXPR_T_AND are supposed to follow an invariant that
they have at least 2 clauses, but expr_sort() did not always follow that;
for example, applying it to (x[0] == 1 && x[1] == 1) yielded the 1-child
EXPR_T_AND expression x[0..1] == 3.  This commit fixes the problem.

I don't know of any externally visible negative consequences for this
problem, but it made the code harder to reason about.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
6 years agoexpr: Fix some bad naming.
Ben Pfaff [Tue, 6 Feb 2018 18:00:47 +0000 (10:00 -0800)]
expr: Fix some bad naming.

expr_is_cmp() was badly named because it didn't just check for whether its
argument was an EXPR_T_CMP node.

struct expr_sort's 'relop' member was badly named because it wasn't a
relational operator, it was a symbol.

This commit improves both names.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
6 years agoovs-vsctl: Add commands "add-bond-iface" and "del-bond-iface".
Ben Pfaff [Fri, 2 Feb 2018 21:49:37 +0000 (13:49 -0800)]
ovs-vsctl: Add commands "add-bond-iface" and "del-bond-iface".

It was not too hard to build these commands using the database commands,
but a few people have asked for them over the years, so here they are.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoNEWS: Consolidate ovs-vswitchd sections and fix indentation.
Ben Pfaff [Fri, 2 Feb 2018 21:46:55 +0000 (13:46 -0800)]
NEWS: Consolidate ovs-vswitchd sections and fix indentation.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoovs-vsctl: Use default socket name in tests.
Ben Pfaff [Fri, 2 Feb 2018 21:09:03 +0000 (13:09 -0800)]
ovs-vsctl: Use default socket name in tests.

By using the default socket name "db.sock", instead of "socket", we can
avoid passing --db=unix:socket to all the ovs-vsctl invocations, which is
kind of nice.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoovs-vsctl: Remove superfluous OVS_VSCTL_CLEANUP from tests.
Ben Pfaff [Fri, 2 Feb 2018 18:23:37 +0000 (10:23 -0800)]
ovs-vsctl: Remove superfluous OVS_VSCTL_CLEANUP from tests.

Since on_exit was introduced a long, long time ago, it has no longer been
necessary to have individual calls to OVS_VSCTL_CLEANUP sprinkled
everywhere in the test code.  This change makes the tests easier to read.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoovsdb-client: Add --timeout option.
Ben Pfaff [Thu, 28 Dec 2017 16:58:05 +0000 (08:58 -0800)]
ovsdb-client: Add --timeout option.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Acked-by: Justin Pettit <jpettit@ovn.org>
6 years agojson: Make it safe to pass null pointers to json_equal().
Ben Pfaff [Sun, 31 Dec 2017 01:02:22 +0000 (17:02 -0800)]
json: Make it safe to pass null pointers to json_equal().

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Acked-by: Justin Pettit <jpettit@ovn.org>
6 years agojsonrpc: Add comment for jsonrpc_msg_to_json().
Ben Pfaff [Fri, 29 Dec 2017 13:44:35 +0000 (05:44 -0800)]
jsonrpc: Add comment for jsonrpc_msg_to_json().

From a glance at the prototype it wasn't obvious that it destroyed its
argument.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-util: Always report ODP_FIT_TOO_LITTLE for IGMP.
Ben Pfaff [Wed, 24 Jan 2018 19:40:20 +0000 (11:40 -0800)]
odp-util: Always report ODP_FIT_TOO_LITTLE for IGMP.

OVS datapaths don't understand or parse IGMP fields, but OVS userspace
does, so this commit updates odp_flow_key_to_flow() to report that properly
to the caller.

Reported-by: Huanle Han <hanxueluo@gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-January/343665.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif-upcall: Slow path flows that datapath can't fully match.
Ben Pfaff [Wed, 24 Jan 2018 19:40:19 +0000 (11:40 -0800)]
ofproto-dpif-upcall: Slow path flows that datapath can't fully match.

In the OVS architecture, when a datapath doesn't have a match for a packet,
it sends the packet and the flow that it extracted from it to userspace.
Userspace then examines the packet and the flow and compares them.
Commonly, the flow is the same as what userspace expects, given the packet,
but there are two other possibilities:

    - The flow lacks one or more fields that userspace expects to be there,
      that is, the datapath doesn't understand or parse them but userspace
      does.  This is, for example, what would happen if current OVS
      userspace, which understands and extracts TCP flags, were to be
      paired with an older OVS kernel module, which does not.  Internally
      OVS uses the name ODP_FIT_TOO_LITTLE for this situation.

    - The flow includes fields that userspace does not know about, that is,
      the datapath understands and parses them but userspace does not.
      This is, for example, what would happen if an old OVS userspace that
      does not understand or extract TCP flags, were to be paired with a
      recent OVS kernel module that does.  Internally, OVS uses the name
      ODP_FIT_TOO_MUCH for this situation.

The latter is not a big deal and OVS doesn't have to do much to cope with
it.

The former is more of a problem.  When the datapath can't match on all the
fields that OVS supports, it means that OVS can't safely install a flow at
all, other than one that directs packets to the slow path.  Otherwise, if
OVS did install a flow, it could match a packet that does not match the
flow that OVS intended to match and could cause the wrong behavior.

Somehow, this nuance was lost a long time.  From about 2013 until today,
it seems that OVS has ignored ODP_FIT_TOO_LITTLE.  Instead, it happily
installs a flow regardless of whether the datapath can actually fully match
it.  I imagine that this is rarely a problem because most of the time
the datapath and userspace are well matched, but it is still an important
problem to fix.  This commit fixes it, by forcing flows into the slow path
when the datapath cannot match specifically enough.

CC: Ethan Jackson <ejj@eecs.berkeley.edu>
Fixes: e79a6c833e0d ("ofproto: Handle flow installation and eviction in upcall.")
Reported-by: Huanle Han <hanxueluo@gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-January/343665.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoRemove last mentions of 'facet' from comments.
Ben Pfaff [Wed, 24 Jan 2018 19:40:18 +0000 (11:40 -0800)]
Remove last mentions of 'facet' from comments.

How did these survive so long?!  OVS hasn't had facets since 2013.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath-windows: Specify platform arch during compilation
Shashank Ram [Thu, 1 Feb 2018 02:58:56 +0000 (18:58 -0800)]
datapath-windows: Specify platform arch during compilation

Newer compilers expect the platorm architecture to be passed.

Signed-off-by: Shashank Ram <rams@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
6 years agodatapath-windows: Allow compiling all targets using SDK 10.0
Shashank Ram [Thu, 1 Feb 2018 02:58:55 +0000 (18:58 -0800)]
datapath-windows: Allow compiling all targets using SDK 10.0

Previously, Win8/8.1 targets would use SDK8.1. However, its
recommended to use the newer SDK as newer VS versions typically
drop support for older SDKs later on. This patch adds support
to compile all targets (Win8/8.1/10) using the 10.0 SDK.

Note that his patch does not drop support for older SDKs.

Signed-off-by: Shashank Ram <rams@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
6 years agonetdev-linux: Report netdev change events when mac changed.
Tonghao Zhang [Sun, 4 Feb 2018 14:45:38 +0000 (06:45 -0800)]
netdev-linux: Report netdev change events when mac changed.

When mac addr of ports on bridge has been changed, for example,

$ ip link set dev eth0 address 00:11:22:33:44:55

we should reconfigure the datapath id and mac addr of local port.
But now openvswitch dont do that as expected.

A simple example of how to reproduce it:

$ ovs-vsctl add-br br0
$ ifconfig br0  # for example, mac is c6:c6:d7:46:b4:4b
$ ip link set dev br0 address 00:11:22:33:44:55
$ ifconfig br0  # mac of br0 will be 00:11:22:33:44:55

then repeat:
$ ip link set dev br0 address 00:11:22:33:44:55
$ ifconfig br0  # mac of br0 will be c6:c6:d7:46:b4:4b

This patch reports the mac changed event when ports changed, then
openvswitch will reconfigure the datapath id and mac addr of local
port.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoMakefile.am: Use correct path separator for Windows
Shashank Ram [Fri, 2 Feb 2018 23:49:05 +0000 (15:49 -0800)]
Makefile.am: Use correct path separator for Windows

Signed-off-by: Shashank Ram <rams@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoutil: Use lookup table to optimize hexit_value().
Ben Pfaff [Fri, 2 Feb 2018 23:16:22 +0000 (15:16 -0800)]
util: Use lookup table to optimize hexit_value().

Daniel Alvarez Sanchez reported a significant overall speedup in ovn-northd
due to a similar patch.

Reported-by: Daniel Alvarez Sanchez <dalvarez@redhat.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-February/046120.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Daniel Alvarez <dalvarez@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath-windows: Add trace level logs in conntrack for invalid ct state.
Anand Kumar [Fri, 2 Feb 2018 22:43:16 +0000 (14:43 -0800)]
datapath-windows: Add trace level logs in conntrack for invalid ct state.

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>
6 years agoovn-controller: Process logical flow matches before actions.
Guoshuai Li [Fri, 2 Feb 2018 02:50:29 +0000 (10:50 +0800)]
ovn-controller: Process logical flow matches before actions.

Otherwise, when the match field has "is_chassis_resident", and the match is
not actually resident, and the action has meter or group, the group/meter
ID is assigned even though it will never be used.

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-controller: Document southbound database use and graceful termination.
Ben Pfaff [Fri, 2 Feb 2018 17:44:52 +0000 (09:44 -0800)]
ovn-controller: Document southbound database use and graceful termination.

A lot of people seem to think that "kill" gracefully terminates
ovn-controller, but it doesn't, so this documentation at least provides
something to point to.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Han Zhou <zhouhan@gmail.com>
6 years agodatapath-windows: Optimize conntrack lock implementation.
Anand Kumar [Mon, 29 Jan 2018 18:28:01 +0000 (10:28 -0800)]
datapath-windows: Optimize conntrack lock implementation.

Currently, there is one global lock for conntrack module, which protects
conntrack entries and conntrack table. All the NAT operations are
performed holding this lock.

This becomes inefficient, as the number of conntrack entries grow.
With new implementation, we will have two PNDIS_RW_LOCK_EX locks in
conntrack.

1. ovsCtBucketLock - one rw lock per bucket of the conntrack table,
which is shared by all the ct entries that belong to the same bucket.
2. lock -  a rw lock in OVS_CT_ENTRY structure that protects the members
of conntrack entry.

Also, OVS_CT_ENTRY structure will have a lock reference(bucketLockRef)
to the corresponding OvsCtBucketLock of conntrack table.
We need this reference to retrieve ovsCtBucketLock from ct entry
for delete operation.

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>
6 years agodatapath-windows: Add a global level RW lock for NAT
Anand Kumar [Mon, 29 Jan 2018 18:28:00 +0000 (10:28 -0800)]
datapath-windows: Add a global level RW lock for NAT

Currently NAT module relies on the existing conntrack lock.
This patch provides a basic lock implementation for NAT module
in conntrack.

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>
6 years agodatapath-windows: Refactor conntrack code.
Anand Kumar [Mon, 29 Jan 2018 18:27:59 +0000 (10:27 -0800)]
datapath-windows: Refactor conntrack code.

Some of the functions and  code are refactored
so that new conntrack lock can be implemented

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>
6 years agoAUTHORS: Add JunhanYan <juyan@redhat.com>.
Ben Pfaff [Thu, 1 Feb 2018 22:14:42 +0000 (14:14 -0800)]
AUTHORS: Add JunhanYan <juyan@redhat.com>.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: Delete system tunnel interface when remove ovs bridge
juyan@redhat.com [Wed, 25 Oct 2017 03:41:27 +0000 (11:41 +0800)]
ofproto-dpif: Delete system tunnel interface when remove ovs bridge

When a user adds the first tunnel of a given type (e.g. the first VXLAN
tunnel) to an OVS bridge, OVS adds a vport of the same type to the
kernel datapath that backs the bridge.  There is the corresponding
expectation that, when the last tunnel of that type is removed from the
OVS bridges, OVS would remove the vport that represents it from the
backing kernel datapath, but OVS was not doing that.  This commit fixes
the problem.

There is not any major concern about the lingering tunnel interface, but
it's cleaner to delete it.

Fixes: 921c370a9df5 ("dpif-netlink: Probe for out-of-tree tunnels, decides used interface")
Signed-off-by: JunhanYan <juyan@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoAUTHORS: Add Frode Nordahl <frode.nordahl@gmail.com>.
Ben Pfaff [Thu, 1 Feb 2018 21:48:48 +0000 (13:48 -0800)]
AUTHORS: Add Frode Nordahl <frode.nordahl@gmail.com>.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodebian: Do not modify pre-existing defaults file
Frode Nordahl [Tue, 17 Oct 2017 14:29:40 +0000 (16:29 +0200)]
debian: Do not modify pre-existing defaults file

Currently, on installation or upgrade the openvswitch-switch deb package
will in some circumstances modify a pre-existing
/etc/default/openvswitch-switch configuration file.

This does not play well with modeling and configuration management tools
and may lead to unnecessary restarts of the openvswitch-switch service
after the initial restart done as part of the package upgrade. As
restarting the openvswitch-switch affects the datapath this is
something we should try to avoid.

I also believe the current behaviour to be in conflict with best practices
set out in the config files section of the
[Debian Policy](https://www.debian.org/doc/debian-policy/#s-config-files).

This commit addresses this by removing the part of the postinst script
that attempts to append missing documentation parts of the template
and leaves the installed defaults file alone when it exists.

Fixes: 0aaa379d99f4 ("Debian packaging: Add several new settings to /etc/default/openflow-switch.")
Signed-off-by: Frode Nordahl <frode.nordahl@gmail.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/137
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-nbctl: Add QoS commands.
Guoshuai Li [Fri, 26 Jan 2018 08:34:39 +0000 (16:34 +0800)]
ovn-nbctl: Add QoS commands.

This patch provides the command line to add/delete/list QoS rule on the
logical switch.

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotests: Make OVS_WAIT_UNTIL and OVS_WAIT_WHILE failures easier to debug.
Ben Pfaff [Thu, 1 Feb 2018 18:08:05 +0000 (10:08 -0800)]
tests: Make OVS_WAIT_UNTIL and OVS_WAIT_WHILE failures easier to debug.

Until now, when OVS_WAIT_UNTIL or OVS_WAIT_WHILE ran, little information
was available: usually nothing at all in the log, unless the wait failed,
in which case there was a line number.  This commit adds a note saying
what is being waited for in any case, and a message saying that the wait
failed if it does.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoovs-router: fix router entry cast
William Tu [Wed, 31 Jan 2018 22:09:30 +0000 (14:09 -0800)]
ovs-router: fix router entry cast

The offsetof(struct ovs_router_entry, cr) should always be 0,
thus the else statement should never be reached.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodoc: Added OVS Conntrack tutorial
Ashish Varma [Mon, 29 Jan 2018 16:48:56 +0000 (08:48 -0800)]
doc: Added OVS Conntrack tutorial

OVS supports connection tracker related match fields and actions.
Added a tutorial to demonstrate the basic use cases for some of these
match fields and actions.

Signed-off-by: Ashish Varma <ashishvarma.ovs@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoAdd unixctl option for ovn-northd
Venkata Anil [Tue, 30 Jan 2018 09:42:32 +0000 (15:12 +0530)]
Add unixctl option for ovn-northd

Signed-off-by: Venkata Anil <vkommadi@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agolearn: improve test case
William Tu [Thu, 1 Feb 2018 02:32:29 +0000 (18:32 -0800)]
learn: improve test case

Current learn test cases use only ovs-ofctl add/del flows.
The patch add a new test case for learn with delete_learned and
limit option enabled.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoMerge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD
Ben Pfaff [Thu, 1 Feb 2018 20:52:12 +0000 (12:52 -0800)]
Merge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD

6 years agoxlate: fix packets loopback caused by duplicate read of xcfgp.
Huanle Han [Wed, 24 Jan 2018 19:40:16 +0000 (11:40 -0800)]
xlate: fix packets loopback caused by duplicate read of xcfgp.

Some functions, such as xlate_normal_mcast_send_mrouters, test xbundle
pointers equality to avoid sending packet back to in bundle. However,
xbundle pointers port from different xcfgp for same port are inequal.
This may lead to the packet loopback.

This commit stores xcfgp on ctx at first and always uses the same xcfgp
during one packet process period.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofctrl: Remove unused declaration.
Han Zhou [Mon, 29 Jan 2018 21:44:26 +0000 (13:44 -0800)]
ofctrl: Remove unused declaration.

Signed-off-by: Han Zhou <zhouhan@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-nbctl: update manpage for lsp-set-type.
Han Zhou [Mon, 29 Jan 2018 22:04:48 +0000 (14:04 -0800)]
ovn-nbctl: update manpage for lsp-set-type.

Signed-off-by: Han Zhou <zhouhan@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-vswitchd: Avoid or suppress memory leak warning for glibc aio.
Ben Pfaff [Thu, 25 Jan 2018 23:39:49 +0000 (15:39 -0800)]
ovs-vswitchd: Avoid or suppress memory leak warning for glibc aio.

The asynchronous IO library in glibc starts threads that show up as memory
leaks in valgrind.  This commit attempts to avoid the warnings by flushing
all the asynchronous I/O to the log file before exiting.  This only does
part of the job for glibc since it keeps the threads around for some
undefined idle time before killing them, so in addition this commit adds a
valgrind suppression to stop displaying these warnings in any case.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmai.com>
6 years agoovs-vswitchd: Fire RCU callbacks before exit to reduce memory leak warnings.
Ben Pfaff [Thu, 25 Jan 2018 23:39:48 +0000 (15:39 -0800)]
ovs-vswitchd: Fire RCU callbacks before exit to reduce memory leak warnings.

ovs-vswitchd makes extensive use of RCU to defer freeing memory past the
latest time that it could be in use by a thread.  Until now, ovs-vswitchd
has not waited for RCU callbacks to fire before exiting.  This meant that
in many cases, when ovs-vswitchd exits, many blocks of memory are stuck in
RCU callback queues, which valgrind often reports as "possible" memory
leaks.

This commit adds a new function ovsrcu_exit() that waits and fires as many
RCU callbacks as it reasonably can.  It can only do so for the thread that
calls it and the thread that calls the callbacks, but generally speaking
ovs-vswitchd shuts down other threads before it exits anyway, so this is
pretty good.

In my testing this eliminates most valgrind warnings for tests that run
ovs-vswitchd.  This ought to make it easier to distinguish new leaks that
are real from existing non-leaks.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmai.com>
6 years agoutil: Document and rely on ovs_assert() always evaluating its argument.
Ben Pfaff [Wed, 31 Jan 2018 19:23:24 +0000 (11:23 -0800)]
util: Document and rely on ovs_assert() always evaluating its argument.

The ovs_assert() macro always evaluates its argument, even when NDEBUG is
defined so that failure is ignored.  This behavior wasn't documented, and
thus a lot of code didn't rely on it.  This commit documents the behavior
and simplifies bits of code that heretofore didn't rely on it.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoSupport accepting and displaying table names in OVS tools.
Ben Pfaff [Sat, 6 Jan 2018 00:59:13 +0000 (16:59 -0800)]
Support accepting and displaying table names in OVS tools.

OpenFlow has little-known support for naming tables.  Open vSwitch has
supported table names for ages, but it has never used or displayed them
outside of commands dedicated to table manipulation.  This commit adds
support for table names in ovs-ofctl.  When a table has a name, it displays
that name in flows and actions, so that, for example, the following:
    table=1, arp, actions=resubmit(,2)
might become:
    table=ingress_acl, arp, actions=resubmit(,mac_learning)
given appropriately named tables.

For backward compatibility, only interactive ovs-ofctl commands by default
display table names; to display them in scripts, use the new --names
option.

This feature was inspired by a talk that Kei Nohguchi presented at Open
vSwitch 2017 Fall Conference.

CC: Kei Nohguchi <kei@nohguchi.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoofp-util: New data structure for mapping between table names and numbers.
Ben Pfaff [Mon, 1 Jan 2018 23:04:52 +0000 (15:04 -0800)]
ofp-util: New data structure for mapping between table names and numbers.

This shares the infrastructure for mapping port names and numbers.  It will
be used in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agoofp-actions: Make formatting and parsing functions take a struct argument.
Ben Pfaff [Fri, 12 Jan 2018 20:56:12 +0000 (12:56 -0800)]
ofp-actions: Make formatting and parsing functions take a struct argument.

An upcoming commit will add another parameter for parsing and formatting
actions.  It is much easier to add these parameters if they are
encapsulated in a struct, so this commit first makes that change.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agoclassifier: Refactor interface for classifier_remove().
Ben Pfaff [Tue, 30 Jan 2018 21:00:31 +0000 (13:00 -0800)]
classifier: Refactor interface for classifier_remove().

Until now, classifier_remove() returned either null or the classifier rule
passed to it, which is an unusual interface.  This commit changes it to
return true if it succeeds or false on failure.

In addition, most of classifier_remove()'s callers know ahead of time that
it must succeed, even though most of them didn't bother with an assertion,
so this commit adds a classifier_remove_assert() function as a helper.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agonetdev-dpdk: Add support for vHost dequeue zero copy (experimental)
Ciara Loftus [Wed, 31 Jan 2018 10:44:54 +0000 (10:44 +0000)]
netdev-dpdk: Add support for vHost dequeue zero copy (experimental)

Zero copy is disabled by default. To enable it, set the 'dq-zero-copy'
option to 'true' when configuring the Interface:

ovs-vsctl set Interface dpdkvhostuserclient0
options:vhost-server-path=/tmp/dpdkvhostuserclient0
options:dq-zero-copy=true

When packets from a vHost device with zero copy enabled are destined for
a single 'dpdk' port, the number of tx descriptors on that 'dpdk' port
must be set to a smaller value. 128 is recommended. This can be achieved
like so:

ovs-vsctl set Interface dpdkport options:n_txq_desc=128

Note: The sum of the tx descriptors of all 'dpdk' ports the VM will send
to should not exceed 128. Due to this requirement, the feature is
considered 'experimental'.

Testing of the patch showed a ~8% improvement when switching 512B
packets between vHost devices on different VMs on the same host when
zero copy was enabled on the transmitting device.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agoclassifier: Fix typo in comment.
Ben Pfaff [Tue, 30 Jan 2018 19:36:01 +0000 (11:36 -0800)]
classifier: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoMerge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD
Ben Pfaff [Sat, 27 Jan 2018 17:26:35 +0000 (09:26 -0800)]
Merge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD

6 years agoovs-ofctl: Fix typo in comment.
Ben Pfaff [Sat, 27 Jan 2018 17:18:41 +0000 (09:18 -0800)]
ovs-ofctl: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-ofctl: Add "compose-packet" command for testing flow_compose().
Ben Pfaff [Thu, 18 Jan 2018 22:39:50 +0000 (14:39 -0800)]
ovs-ofctl: Add "compose-packet" command for testing flow_compose().

I don't feel obligated to add a bunch of automatic tests for
flow_compose(), but this is handy for manual testing or for simple packet
generation.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoflow: Add some L7 payload data to most L4 protocols that accept it.
Ben Pfaff [Fri, 26 Jan 2018 22:36:05 +0000 (14:36 -0800)]
flow: Add some L7 payload data to most L4 protocols that accept it.

This makes traffic generated by flow_compose() look slightly more
realistic.  It requires lots of updates to tests, but at least the tests
themselves should be slightly more realistic too.

At the same time, add --l7 and --l7-len options to ofproto/trace to allow
users to specify the amount or contents of payloads that they want.

Suggested-by: Brad Cowie <brad@cowie.nz>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoflow: Simplify flow_compose_l4().
Ben Pfaff [Wed, 17 Jan 2018 21:57:28 +0000 (13:57 -0800)]
flow: Simplify flow_compose_l4().

Each of the cases in flow_compose_l4() separately tracked the number of
bytes of L4 data added to the packet.  This commit makes the function do
that in a single place without per-protocol bookkeeping.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoofproto-dpif-trace: Generalize syntax for ofproto/trace.
Ben Pfaff [Thu, 18 Jan 2018 21:13:15 +0000 (13:13 -0800)]
ofproto-dpif-trace: Generalize syntax for ofproto/trace.

ofproto/trace takes a bunch of options that have weird placement and
syntax.  This commit changes the syntax so that the options can be placed
anywhere and consistently use a double-dash option prefix.  For
compatibility, the previous syntax is also supported.

An upcoming commit will add new options and this change allows that
upcoming commit to be less confusing.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoovs-vsctl, vtep-ctl: Free 'args' string on exit.
Ben Pfaff [Thu, 25 Jan 2018 23:39:47 +0000 (15:39 -0800)]
ovs-vsctl, vtep-ctl: Free 'args' string on exit.

This avoids a memory leak warning from valgrind.

ovn-sbctl and ovn-nbctl already followed this pattern.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agoofproto: Avoid use-after-free on error path in ofproto_flow_mod_learn().
Ben Pfaff [Thu, 25 Jan 2018 23:39:46 +0000 (15:39 -0800)]
ofproto: Avoid use-after-free on error path in ofproto_flow_mod_learn().

In the case where the learned flow limit has been reached (below_limit ==
false), ofproto_flow_mod_uninit() would unref ofm->temp_rule (which is
also in the 'rule' local variable) before dereferencing rule->flow_cookie
for the log message.  This fixes the problem.

(The greatest likely consequence of this bug was logging the wrong cookie
value.)

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agocheckpatch.py: Fix Python style.
Ben Pfaff [Fri, 26 Jan 2018 19:45:52 +0000 (11:45 -0800)]
checkpatch.py: Fix Python style.

Fixes the following warnings:

../utilities/checkpatch.py:219:1: E302 expected 2 blank lines, found 1
../utilities/checkpatch.py:224:1: E302 expected 2 blank lines, found 1
../utilities/checkpatch.py:228:1: E302 expected 2 blank lines, found 1

CC: Justin Pettit <jpettit@ovn.org>
Fixes: 4e99b70dfae0 ("checkpatch.py: Add check for "xxx" in comments.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
6 years agonetdev-dpdk: Fix xstats leak on port destruction.
Ilya Maximets [Tue, 23 Jan 2018 07:51:31 +0000 (10:51 +0300)]
netdev-dpdk: Fix xstats leak on port destruction.

CC: Michal Weglicki <michalx.weglicki@intel.com>
Fixes: 971f4b394c6e ("netdev: Custom statistics.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Fix memory leak in netdev_dpdk_configure_xstats().
Ilya Maximets [Tue, 23 Jan 2018 07:51:14 +0000 (10:51 +0300)]
netdev-dpdk: Fix memory leak in netdev_dpdk_configure_xstats().

CC: Michal Weglicki <michalx.weglicki@intel.com>
Fixes: 971f4b394c6e ("netdev: Custom statistics.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Fix memory leak in netdev_dpdk_get_custom_stats().
Ilya Maximets [Mon, 22 Jan 2018 16:24:26 +0000 (19:24 +0300)]
netdev-dpdk: Fix memory leak in netdev_dpdk_get_custom_stats().

CC: Michal Weglicki <michalx.weglicki@intel.com>
Fixes: 971f4b394c6e ("netdev: Custom statistics.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agovswitchd: show DPDK version
Matteo Croce [Mon, 15 Jan 2018 18:21:12 +0000 (19:21 +0100)]
vswitchd: show DPDK version

Show DPDK version if Open vSwitch is compiled with DPDK support.
Version can be retrieved with `ovs-vswitchd --version` or from OVS logs.
Small change in ovs-ctl to avoid breakage on output change.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: fix port addition for ports sharing same PCI id
Yuanhan Liu [Wed, 10 Jan 2018 03:05:29 +0000 (11:05 +0800)]
netdev-dpdk: fix port addition for ports sharing same PCI id

Some NICs have only one PCI address associated with multiple ports. This
patch extends the dpdk-devargs option's format to cater for such devices.

To achieve that, this patch uses a new syntax that will be adapted and
implemented in future DPDK release (likely, v18.05):
    http://dpdk.org/ml/archives/dev/2017-December/084234.html

And since it's the DPDK duty to parse the (complete and full) syntax
and this patch is more likely to serve as an intermediate workaround,
here I take a simpler and shorter syntax from it (note it's allowed to
have only one category being provided):
    class=eth,mac=00:11:22:33:44:55:66

Also, old compatibility is kept. Users can still go on with using the
PCI id to add a port (if that's enough for them). Meaning, this patch
will not break anything.

This patch is basically based on the one from Ciara:
    https://mail.openvswitch.org/pipermail/ovs-dev/2017-October/339496.html

Cc: Loftus Ciara <ciara.loftus@intel.com>
Cc: Thomas Monjalon <thomas@monjalon.net>
Cc: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Fix requested MTU size validation.
Ian Stokes [Tue, 9 Jan 2018 16:09:28 +0000 (16:09 +0000)]
netdev-dpdk: Fix requested MTU size validation.

This commit replaces MTU_TO_FRAME_LEN(mtu) with MTU_TO_MAX_FRAME_LEN(mtu)
in netdev_dpdk_set_mtu(), in order to determine if the total length of
the L2 frame with an MTU of ’mtu’ exceeds NETDEV_DPDK_MAX_PKT_LEN.

When setting an MTU we first check if the requested total frame length
(which includes associated L2 overhead) will exceed the maximum
frame length supported in netdev_dpdk_set_mtu(). The frame length is
calculated by MTU_TO_FRAME_LEN  as MTU + ETHER_HEADER + ETHER_CRC. The MTU
for the device will be set at a later stage in dpdk_eth_dev_init() using
rte_eth_dev_set_mtu(mtu).

However when using rte_eth_dev_set_mtu(mtu) the calculation used to check
that the frame does not exceed the max frame length for that device varies
between DPDK device drivers. For example ixgbe driver calculates the
frame length for a given MTU as

mtu + ETHER_HDR_LEN + ETHER_CRC_LEN

i40e driver calculates it as

mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2

em driver calculates it as

mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE

Currently it is possible to set an MTU for a netdev_dpdk device that exceeds
the upper limit MTU for that devices DPDK driver. This leads to a segfault.
This is because the frame length comparison as is, does not take into account
the addition of the vlan tag overhead expected in the drivers. The
netdev_dpdk_set_mtu() call will incorrectly succeed but the subsequent
dpdk_eth_dev_init() will fail before the queues have been created for the
DPDK device. This coupled with assumptions regarding reconfiguration
requirements for the netdev will lead to a segfault when the rxq is polled
for this device.

A simple way to avoid this is by using MTU_TO_MAX_FRAME_LEN(mtu) when
validating a requested MTU in netdev_dpdk_set_mtu().
MTU_TO_MAX_FRAME_LEN(mtu) is equivalent to the following:

mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + (2 * VLAN_HEADER_LEN)

By using MTU_TO_MAX_FRAME_LEN at the netdev_dpdk_set_mtu() stage, OvS
now takes into account the maximum L2 overhead that a DPDK driver could
allow for in its frame size calculation. This allows OVS to flag an error
rather than the DPDK driver if the frame length exceeds the max DPDK frame
length. OVS can fail gracefully at this point and use the default MTU of
1500 to continue to configure the port.

Note: this fix is a work around, a better approach would be if DPDK devices
could report the maximum MTU value that can be requested on a per device
basis. This capability however is not currently available. A downside of
this patch is that the MTU upper limit will be reduced by 8 bytes for
DPDK devices that do not need to account for vlan tags in the frame length
driver calculations e.g. ixgbe devices upper MTU limit is reduced from
the OVS point of view from 9710 to 9702.

CC: Mark Kavanagh <mark.b.kavanagh@intel.com>
Fixes: 0072e931 ("netdev-dpdk: add support for jumbo frames")
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Co-authored-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
6 years agoofproto: Fix double-unref of temporary rule when learning.
Ben Pfaff [Fri, 26 Jan 2018 19:43:27 +0000 (11:43 -0800)]
ofproto: Fix double-unref of temporary rule when learning.

When ofproto_flow_mod_init() accepts a rule, it takes ownership of it and
either unrefs it on error or transfers ownership to the struct it
initializes on success, but ofproto_flow_mod_init_for_learn() was unref-ing
it a second time if it reported an error.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>