cascardo/ovs.git
9 years agoRelease Open vSwitch 2.0.2. v2.0.2
Justin Pettit [Thu, 14 Aug 2014 17:50:10 +0000 (10:50 -0700)]
Release Open vSwitch 2.0.2.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoFix two memory leaks.
yinpeijun [Mon, 28 Jul 2014 07:21:17 +0000 (15:21 +0800)]
Fix two memory leaks.

Found by coverity.

Signed-off-by: yinpeijun <yinpeijun@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agostp: Make stp-disabled port forward stp bpdu packets.
Alex Wang [Wed, 16 Jul 2014 01:52:19 +0000 (18:52 -0700)]
stp: Make stp-disabled port forward stp bpdu packets.

Commit 0d1cee123a84 (stp: Fix bpdu tx problem in listening state)
makes ovs drop the stp bpdu packets if stp is not enabled on the
input port.  However, when pif bridge is used and stp is enabled
on the integration bridge.  The flow translation of stp bpdu
packets will go through a level of resubmission which changes
the input port to the corresponding peer port.  Since, the
patch port on the pif bridge does not have stp enabled, the
flow translation will drop the bpdu packets.

This commit fixes the issue by making ovs forward stp bpdu packets
on stp-disabled port.

VMware-BZ: #1284695

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agodpif-linux: Fix bad backport in previous commit.
Ben Pfaff [Tue, 15 Jul 2014 18:04:40 +0000 (11:04 -0700)]
dpif-linux: Fix bad backport in previous commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-linux: Avoid null dereference if all ports disappear.
Ben Pfaff [Mon, 14 Jul 2014 20:17:05 +0000 (13:17 -0700)]
dpif-linux: Avoid null dereference if all ports disappear.

When dpif_linux_refresh_channels() refreshes the set of channels when
the number of handlers changes, it destroys all the dpif's channels and
sets dpif->uc_array_size to 0.  If the port dump later in the function
turns up no ports (which generally indicates a bug), then no channels will
be allocated and thus dpif->uc_array_size will remain 0 and 'channels' will
be null in each handler.  This is self-consistent, at least, but
dpif_linux_port_get_pid__() was still willing in this situation to
try to access element 0 of the set of channels, dereferencing a null
pointer.

This fixes the problem.

I encountered this while looking at a bug that I had introduced during
development that caused the port dump to always be empty.  It would be
difficult to encounter in normal use.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agotests: Disable glibc memory checking under glibc <= 2.11.
Ben Pfaff [Fri, 11 Jul 2014 18:03:08 +0000 (11:03 -0700)]
tests: Disable glibc memory checking under glibc <= 2.11.

We noticed that the unit tests sometimes fail on XenServer inside glibc's
memory checker, in the free_check() function.  It turns out that the
glibc memory checker in glibc 2.11 and earlier had an internal race that
caused false positives in multithreaded programs.

This commit avoids the problem by disabling the glibc memory checker in
glibc 2.11 and earlier.

VMware-BZ: #1267127
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath/flow_netlink: Fix NDP flow mask validation
Daniele Di Proietto [Thu, 10 Jul 2014 19:39:39 +0000 (12:39 -0700)]
datapath/flow_netlink: Fix NDP flow mask validation

match_validate() enforce that a mask matching on NDP attributes has also an
exact match on ICMPv6 type.
The ICMPv6 type, which is 8-bit wide, is stored in the 'tp.src' field of
'struct sw_flow_key', which is 16-bit wide.
Therefore, an exact match on ICMPv6 type should only check the first 8 bits.

This commit fixes a bug that prevented flows with an exact match on NDP field
from being installed

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: Use exact lookup for flow_get and flow_del.
Alex Wang [Mon, 30 Jun 2014 20:48:07 +0000 (13:48 -0700)]
datapath: Use exact lookup for flow_get and flow_del.

Due to the race condition in userspace, there is chance that two
overlapping megaflows could be installed in datapath.  And this
causes userspace unable to delete the less inclusive megaflow flow
even after it timeout, since the flow_del logic will stop at the
first match of masked flow.

This commit fixes the bug by making the kernel flow_del and flow_get
logic check all masks in that case.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agojson: Fix parsing of strings that end with a backslash.
Ben Pfaff [Wed, 25 Jun 2014 18:39:25 +0000 (11:39 -0700)]
json: Fix parsing of strings that end with a backslash.

json_string_unescape() flagged a backslash at the end of a string as an
error, but of course "\\" is a valid string.  This fixes the problem.

VMware-BZ: #1275208
Reported-by: Michael Hu <mhu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agoofproto-dpif: Configure datapath max-idle through ovs-vsctl.
Alex Wang [Fri, 20 Jun 2014 00:53:58 +0000 (17:53 -0700)]
ofproto-dpif: Configure datapath max-idle through ovs-vsctl.

This patch adds a new configuration option, "max-idle" to the
Open_vSwitch "other-config" column. This sets how long datapath flows
are cached in the datapath before ovs-vswitchd thread expire them.

This commit is a backport of commit 72310b04 (upcall: Configure
datapath max-idle through ovs-vsctl.).

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agostream-ssl: Enable TLSv1.1 and TLSv1.2.
Ben Pfaff [Fri, 13 Jun 2014 23:24:49 +0000 (16:24 -0700)]
stream-ssl: Enable TLSv1.1 and TLSv1.2.

The Open vSwitch SSL code was inadvertently enabling only TLSv1, not
later versions.  This commit should fix it.

See https://www.openssl.org/docs/ssl/SSL_CTX_new.html
and http://www.postgresql.org/message-id/20131203213049.GA8259@gmail.com
for more information.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Abhinav Singhal <Abhinav.Singhal@spirent.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agoofproto: Fix memory leak in ofproto_destroy().
Ben Pfaff [Fri, 6 Jun 2014 00:43:46 +0000 (17:43 -0700)]
ofproto: Fix memory leak in ofproto_destroy().

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
9 years agoofproto: Send monitor updates if a flow mod changes a rules actions
Simon Horman [Thu, 5 Jun 2014 09:54:47 +0000 (18:54 +0900)]
ofproto: Send monitor updates if a flow mod changes a rules actions

Without this change a monitor update will be sent when a flow mod changes
a rules cookie but not if only the actions are updated. This appears
to be a logic error.

I noticed this while working on implementing OpenFlow1.4 flow monitor
as an OpenFlow1.4 flow mod does not update a rules cookie.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agobridge: Initialize dscp for mgmt connections.
Gurucharan Shetty [Fri, 16 May 2014 19:04:00 +0000 (12:04 -0700)]
bridge: Initialize dscp for mgmt connections.

Without it, garbage values make it to set_dscp function
in Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-ctl: Don't decrease max open fds if already set higher
Thomas Graf [Thu, 8 May 2014 18:45:25 +0000 (20:45 +0200)]
ovs-ctl: Don't decrease max open fds if already set higher

A user may set LimitNOFILE through systemd or other means to set
the maximum number of open file descriptors. Only modify the ulimit
if not already set to a higher value by the user.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Gospodarek <gospo@redhat.com>
9 years agotunnel: Fix bug where misconfiguration persists.
Joe Stringer [Sun, 4 May 2014 22:14:18 +0000 (10:14 +1200)]
tunnel: Fix bug where misconfiguration persists.

Previously, misconfiguring a tunnel port to use the exact same settings
would cause the corresponding netdev to never be destroyed. When
attempting to re-use the port as a different type, this would fail and
result in a discrepancy between reported port type and actual netdev in
use.

An example configuration that would previously give unexpected behaviour:

ovs-vsctl add-port br0 p0 -- set int p0 type=gre options:remote_ip=1.2.3.4
ovs-vsctl add-port br0 p1 -- set int p1 type=internal
ovs-vsctl set int p1 type=gre options:remote_ip=1.2.3.4
ovs-vsctl set int p1 type=internal

The final command would report in the ovs-vswitchd logs that it is
attempting to configure the port with the same gre settings as p0,
despite the command specifying the type as internal. Even after
deleting and re-adding the port, the message would reappear.

This patch fixes the bug by dereferencing the netdev in the failure
case of tnl_port_add__(), and ensures that the tnl_port structure is
freed in that case as well.

Bug #1198386.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ryan Wilson <wryan@vmware.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agonetdev: Safely increment refcount in netdev_open().
Joe Stringer [Thu, 1 May 2014 23:55:05 +0000 (11:55 +1200)]
netdev: Safely increment refcount in netdev_open().

netdev_open() would previously increment a netdev's refcount without
holding a lock for it. This commit shifts the locking to protect it.

Found by inspection.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
9 years agodatapath: Fix feature check for HAVE_RXHASH.
Jesse Gross [Fri, 2 May 2014 17:33:45 +0000 (10:33 -0700)]
datapath: Fix feature check for HAVE_RXHASH.

The check for HAVE_RXHASH use #if rather than #ifdef, which
provokes a warning when it isn't defined.

Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agodatapath: clear l4_rxhash in skb_clear_hash.
Pritesh Kothari [Thu, 1 May 2014 22:50:52 +0000 (15:50 -0700)]
datapath: clear l4_rxhash in skb_clear_hash.

Signed-off-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agoofproto-dpif-xlate: Fix in_port=controller case for NORMAL action
YAMAMOTO Takashi [Wed, 30 Apr 2014 01:10:12 +0000 (10:10 +0900)]
ofproto-dpif-xlate: Fix in_port=controller case for NORMAL action

The problem mentioned by Simon Horman in the following mail.
http://openvswitch.org/pipermail/dev/2014-April/039492.html

Cc: Simon Horman <horms@verge.net.au>
Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agonetflow: Correctly track flow creation time.
Ben Pfaff [Thu, 10 Apr 2014 17:18:42 +0000 (10:18 -0700)]
netflow: Correctly track flow creation time.

'created' is supposed to be the time the flow was created, but it was
getting reset to zero on every expiration, causing the flow start time to
be wonky after the first active expiration on a flow.

Reported-by: Lior Neudorfer <lior@guardicore.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agovlandev: Fix an obvious predicate logic crash bug.
ZhengLingyun [Thu, 10 Apr 2014 15:07:05 +0000 (08:07 -0700)]
vlandev: Fix an obvious predicate logic crash bug.

Signed-off-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Define old_cfm_fault as 'enum cfm_fault_reason'.
Alex Wang [Wed, 19 Mar 2014 23:19:28 +0000 (16:19 -0700)]
cfm: Define old_cfm_fault as 'enum cfm_fault_reason'.

CFM fault variable type has been changed to 'enum cfm_fault_reason' for
long time.  However, inside cfm_run(), the old_cfm_fault is still defined
as boolean.  This commit fixes the issue.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Use packet key to parse TCP flags.
Jarno Rajahalme [Wed, 19 Mar 2014 23:35:04 +0000 (16:35 -0700)]
dpif-netdev: Use packet key to parse TCP flags.

The flow that created the dp_netdev_flow might have wildcarded TCP
flags, or it may not be a TCP flow at all.  Fix this by using the
freshly extracted flow key to parse TCP flags.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agostp: Fix bpdu tx problem in listening state
kmindg [Sun, 9 Mar 2014 09:48:52 +0000 (17:48 +0800)]
stp: Fix bpdu tx problem in listening state

The restriction only allows to send bpdu in forwarding state in
compose_output_action__. But a port could send bpdu in listening
and learning state according to comments in lib/stp.h(State of
an STP port).

Until this commit, OVS did not send out BPDUs in listening and learning
states.  But those two states are temporary, the stp port will be in
forwarding state and send out BPDUs eventually (In the default
configuration listening and learning states last 15+15 second).  Therefore,
this bug increased convergence time but did not entirely break STP.

Signed-off-by: kmindg <kmindg@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-util: Include tun_id when nonzero even if "key" flag not set.
Ben Pfaff [Sun, 2 Mar 2014 01:11:02 +0000 (17:11 -0800)]
odp-util: Include tun_id when nonzero even if "key" flag not set.

When a flow_tnl is being translated to Netlink attributes, the tun_id field
was included only if the FLOW_TNL_F_KEY flag was set.  This meant that for
a mask, where one would not necessarily expect that flag to be set even if
there were a key, the tun_id could be omitted even if it were nonzero.
This led to kernel flows that did not match on a field that was required
to be matched (possibly causing incorrect treatment of packets) and
premature deletion of kernel flows due to mask mismatch.  This commit
fixes the problem.

Bug #1192516.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Discard any flow_miss_batches before destroy a ofproto
Andy Zhou [Fri, 28 Feb 2014 01:15:07 +0000 (17:15 -0800)]
ofproto-dpif: Discard any flow_miss_batches before destroy a ofproto

Commit dd2e44f835fac8 fixed a similar race conditions w.r.t.
removal of 'ofproto', but reintroduced this bug. While 'ofproto'
is being removed, the existing flow_miss_batches may still contain
references to the to be removed 'ofproto', causing access to freed
memory.

Bug #1202234

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agodpif-linux: Lookup netdev to get netdev type string.
Joe Stringer [Wed, 26 Feb 2014 21:22:35 +0000 (13:22 -0800)]
dpif-linux: Lookup netdev to get netdev type string.

When creating tap ports in dpif-linux, the "tap" type is treated the
same as "system", and the type is discarded. When dumping datapath
port types, this would cause "tap" type to be reported as a "system"
type.

Each time we see a port of the wrong type in bridge_reconfigure(), we
remove it and add a port with the correct configuration. This would
always occur for tap ports, causing deletion and re-creation of all tap
ports each time the bridge was reconfigured.

This patch makes dpif-linux use netdev to look up port types if the
datapath reports that they are of type OVS_VPORT_TYPE_NETDEV.

Bug #1196289.

Reported-by: James Schmidt <jschmidt@vmware.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Complete all packet translations before freeing an ofproto.
Ben Pfaff [Tue, 25 Feb 2014 16:01:01 +0000 (08:01 -0800)]
ofproto-dpif: Complete all packet translations before freeing an ofproto.

The following scenario can occur:

   1. Handler thread grabs a pointer to an ofproto in handle_upcalls().

   2. Main thread removes ofproto and destroys it in destruct().

   3. Handler thread uses pointer to ofproto and accesses freed memory.
      BOOM!

Each individual step above happens under the xlate_rwlock, but the ofproto
pointer is retained from step 1 to step 3, hence the problem.  This commit
fixes the problem by ensuring that after an ofproto is removed but before
it is destroyed, all packet translations get pushed all the way through
the upcall handler pipeline.  (No new packet translations can get a pointer
to the removed ofproto.)

Bug #1200351.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agoofproto-dpif: Fix segfault removing port when STP is enabled.
Ben Pfaff [Fri, 21 Feb 2014 20:40:00 +0000 (12:40 -0800)]
ofproto-dpif: Fix segfault removing port when STP is enabled.

Reported-by: Sridhar Samudrala <samudrala.sridhar@gmail.com>
Tested-by: Sridhar Samudrala <samudrala.sridhar@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Update only OFPUTIL_PS_LINK_DOWN (not STP) from netdev state.
Ben Pfaff [Thu, 20 Feb 2014 20:13:26 +0000 (12:13 -0800)]
ofproto: Update only OFPUTIL_PS_LINK_DOWN (not STP) from netdev state.

When a netdev indicates that its state or configuration has changed,
update_port() updates the OpenFlow port to match the changes.  However,
this was being taken too far: a netdev does not have an STP state, and a
state change was resetting the STP state of the port.  This fixes the
problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Vasu Dasari <vdasari@gmail.com>
Tested-by: Vasu Dasari <vdasari@gmail.com>
10 years agoipfix: fix upcall cookie size checks to support 8 byte cookies
Romain Lenglet [Tue, 11 Feb 2014 23:21:08 +0000 (15:21 -0800)]
ipfix: fix upcall cookie size checks to support 8 byte cookies

Commit 96ed775f resizes all userspace metadata to be 8 bytes minimum.
Fix the upcall size checks accordingly.

Signed-off-by: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix race.
Jarno Rajahalme [Tue, 11 Feb 2014 23:34:39 +0000 (15:34 -0800)]
datapath: Fix race.

ovs_vport_cmd_dump() did rcu_read_lock() only after getting the
datapath, which could have been deleted in between.  Resolved by
taking rcu_read_lock() before the get_dp() call.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agometa-flow: Fix setting MFF_IP_FRAG.
Jarno Rajahalme [Fri, 7 Feb 2014 19:34:02 +0000 (11:34 -0800)]
meta-flow: Fix setting MFF_IP_FRAG.

mf_set_flow_value() was not setting 'flow->nw_frag' properly.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agotests: Fix up tests to match changes from previous commit.
Ben Pfaff [Tue, 11 Feb 2014 20:58:36 +0000 (12:58 -0800)]
tests: Fix up tests to match changes from previous commit.

Commit d2bf1bf62e8 (ofproto-dpif-xlate: Make flows that match ICMP fields
revalidate correctly.) changed the result of a couple of tests.  This
commit updates the test results to match.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Make flows that match ICMP fields revalidate correctly.
Ben Pfaff [Tue, 11 Feb 2014 16:24:16 +0000 (08:24 -0800)]
ofproto-dpif-xlate: Make flows that match ICMP fields revalidate correctly.

ICMPv4 and ICMPv6 have 8-bit "type" and "code" fields.  struct flow
uses the low 8 bits of the 16-bit tp_src and tp_dst members to
represent these fields.  The datapath interface, on the other hand,
represents them with just 8 bits each.  This means that if the high 8
bits of the masks for these fields somehow become set (meaning to
match on the nonexistent "high bits" of these fields) during
translation, then they will get chopped off by a round trip through
the datapath, and revalidation will spot that as an inconsistency and
delete the flow.  This commit avoids the problem by making sure that
only the low 8 bits of either field can be unwildcarded for ICMP.

This seems like the minimal fix for this problem, appropriate for
backporting to earlier branches.  The root of the issue is that these high
bits can get set in the match at all.  I have some leads on that, but they
require more invasive changes elsewhere.

Bug #23320.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agopackets: Fix userland implementation of set-field ipv6 addresses
YAMAMOTO Takashi [Fri, 24 Jan 2014 06:50:41 +0000 (15:50 +0900)]
packets: Fix userland implementation of set-field ipv6 addresses

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vsctl: Update will be discarded when multiple ovs-vsctl are executed
Ken Ajiro [Tue, 28 Jan 2014 01:20:43 +0000 (01:20 +0000)]
ovs-vsctl: Update will be discarded when multiple ovs-vsctl are executed

When two ovs-vsctl update map type column at same time, one ovs-vsctl's
update will be discarded although all ovs-vsctl succeeded. This patch
fixes this issue.

Signed-off-by: Ken Ajiro <ajiro@mxw.nes.nec.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Do not free in use mask list, fixes a kernel crash bug
Andy Zhou [Wed, 29 Jan 2014 16:36:05 +0000 (08:36 -0800)]
datapath: Do not free in use mask list, fixes a kernel crash bug

Last commit 738a2445c0 introduced a bug where the mask list of
a flow table was freed even when the table's flows and mask list is
reused by another table.

Bug #32932

Reported-by: Len Gao <leng@vmware.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif: Fix rule delete deadlock.
Ethan Jackson [Tue, 28 Jan 2014 22:43:56 +0000 (14:43 -0800)]
ofproto-dpif: Fix rule delete deadlock.

When doing rule expiration, ofproto_rule_delete__() take the
ofproto_mutex and calls rule_get_stats().  rule_get_stats() can do an
xlate_actions() which may take the ofproto_mutex, causing a deadlock.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix kernel panic on ovs_flow_free
Andy Zhou [Wed, 22 Jan 2014 21:15:24 +0000 (13:15 -0800)]
datapath: Fix kernel panic on ovs_flow_free

Both mega flow mask's reference counter and per flow table mask list
should only be accessed when holding ovs_mutex() lock.  However
this is not true with ovs_flow_table_flush(). The patch fixes this bug.

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agoipsec: install iptables rules that set IPsec bit in skb mark
Ansis Atteka [Tue, 21 Jan 2014 01:16:39 +0000 (17:16 -0800)]
ipsec: install iptables rules that set IPsec bit in skb mark

Without these two iptables rules (one for UDP encapsulated IPsec and
another for direct IPsec), ovs-vswitchd would incorrectly conclude
that GRE packet belonged to a plain GRE tunnel instead of IPsec GRE
tunnel.

Reported-by: Aryan TaheriMonfared <aryan.taherimonfared@uis.no>
Reported-by: Daniel Hiltgen <daniel@netkine.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
10 years agoAdd check for -latomic
James Page [Thu, 5 Dec 2013 17:29:05 +0000 (17:29 +0000)]
Add check for -latomic

Later versions of gcc on some architectures push atomic functions
out into a separate atomic library; add a check to see when this
is required and add it to LIBS if need be.

Specifically the problem was observed on GCC 4.8.2 on powerpc
architecture for Ubuntu 14.04:

https://launchpadlibrarian.net/155235096/buildlog_ubuntu-trusty-powerpc.openvswitch_2.0.0-0ubuntu1_FAILEDTOBUILD.txt.gz

Signed-off-by: James Page <james.page@ubuntu.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Avoid segfault modifying flow with invalid meter.
Ben Pfaff [Tue, 14 Jan 2014 21:41:14 +0000 (13:41 -0800)]
ofproto: Avoid segfault modifying flow with invalid meter.

ofproto_check_ofpacts() checks for a valid meter ID but ofpacts_check()
does not.

Reported-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agosFlow: clear the padding
Francesco Fusco [Thu, 19 Dec 2013 17:16:24 +0000 (18:16 +0100)]
sFlow: clear the padding

putString pads the string to the 4-byte boundary without
clearing the "padded" memory. This patch simply set the
padding to zero.

Signed-off-by: Francesco Fusco <ffusco@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Fix cpath_down set failure.
Alex Wang [Thu, 9 Jan 2014 02:51:43 +0000 (18:51 -0800)]
bfd: Fix cpath_down set failure.

Commit ccc09689 (bfd: Implement Bidirectional Forwarding Detection.)
set the bfd local diagnostic to "Concatenated Path Down" in response
to the set of cpath_down only when the current local diagnostic is
"None".  However, since the bfd local diagnostic is not reset when
the bfd state is restored from last erroneous state, the set of
cpath_down will not update the local diagnostic in that case.

This commit fixes the bug by always checking for local diagnostic
change when cpath_down is set or reset.

Bug #22625
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Fix a vlan-splinter megaflow bug
Andy Zhou [Wed, 8 Jan 2014 22:20:26 +0000 (14:20 -0800)]
ofproto-dpif: Fix a vlan-splinter megaflow bug

When vlan-splinter is enabled, ovs receives non-vlan flows from the
kernel vlan ports, vlan tag is then added to the incoming flow before
xlating, so that they look like those received from a trunk port.

In case megaflow is enabled, xlating may set vlan masks during rule
processing as usual. If those vlan masks were serialized and downloaded
to the kernel (this bug), those mega flows will be rejected due to
unexpected vlan mask encapsulation, since the original kernel flows do
not have vlan tags. This bug does not break connectivity, but impacts
performance since all traffic received on vlan splinter ports will now
be handled by vswitchd, as no datapath flows can be successfully
installed.

This fix is to make sure no vlan mask encapsulation is generated for
the datapath flow if its in_port was re-written by vlan-splinter
receiving logic.

Bug #22567

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-util: Avoid null dereference in parse_8021q_onward().
Ben Pfaff [Tue, 31 Dec 2013 19:32:16 +0000 (11:32 -0800)]
odp-util: Avoid null dereference in parse_8021q_onward().

For parsing a mask, this code in parse_8021q_onward() always read out
the OVS_KEY_ATTR_VLAN attribute without first checking whether it existed.
The correct behavior, implemented by this commit, appears to be treating
the VLAN as wildcarded and to continue parsing the flow.

Bug #22312.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agobridge: Fix reversed string parsing in bridge_configure_flow_miss_model().
Alex Wang [Mon, 30 Dec 2013 22:21:40 +0000 (14:21 -0800)]
bridge: Fix reversed string parsing in bridge_configure_flow_miss_model().

This commit fixes a command matching error introduced by commit
7155fa52f (ofproto-dpif: Add 'force-miss-model' configuration).

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-parse: Check port number only after parsing it in parse_output().
Daisuke Kotani [Mon, 23 Dec 2013 09:19:48 +0000 (18:19 +0900)]
ofp-parse: Check port number only after parsing it in parse_output().

This patch allows to set max_len to UINT16_MAX in parse_output
if output port is OFPP_CONTROLLER.

Signed-off-by: Daisuke Kotani <kotani@net.ist.i.kyoto-u.ac.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Check for backported netdev_features_t.
Jesse Gross [Tue, 17 Dec 2013 18:22:40 +0000 (10:22 -0800)]
datapath: Check for backported netdev_features_t.

This is apparently used by CentOS 6.5.

Reported-by: Phil Daws <uxbod@splatnix.net>
Reported-by: Edouard Bourguignon <madko@linuxed.net>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoconnmgr: Fix attempt to take mutex recursively when exiting fail-open.
Ben Pfaff [Mon, 16 Dec 2013 18:58:29 +0000 (10:58 -0800)]
connmgr: Fix attempt to take mutex recursively when exiting fail-open.

If one configured a controller which does not exist, waited for the switch
to enter fail-open mode, and then deleted the controller, then
ofproto_set_controllers() would take ofproto_mutex and call
update_fail_open(), which would call fail_open_destroy(), which would call
fail_open_recover(), which would call ofproto_delete_flow(), which requires
ofproto_mutex not to be held since it eventually try to take it.  This
caused OVS to abort.

This fixes the problem by releasing ofproto_mutex earlier, since nothing
seems to require it being held so long (a comment in
connmgr_set_controllers() says that this is likely to be the case).

Better annotations would have found this problem at compile time.  A later
patch adds them.

Reported-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoRelease Open vSwitch 2.0.1. v2.0.1
Justin Pettit [Sat, 14 Dec 2013 00:16:19 +0000 (16:16 -0800)]
Release Open vSwitch 2.0.1.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Ignore non-packet field masks during flow revalidation
Andy Zhou [Wed, 11 Dec 2013 07:32:51 +0000 (23:32 -0800)]
ofproto-dpif: Ignore non-packet field masks during flow revalidation

Commit bcd2633a5be(ofproto-dpif: Store relevant fields for wildcarding
in facet) implements flow revalidation by comparing the newly looked
up flow mask with that of the existing facet.

The non-packet fields, such as register masks, are always cleared
by xlate_actions in the masks stored within facets, but they are not
cleared in the newly looked up flow masks, causing otherwise valid
flows to be declared as invalid flows and be removed from the datapath.

This patch provides a fix. I was able to verify the fix on a system set
up by Ying Chen where the bug can be reproduced.

Bug #21680
Reported by: Ying Chen <yingchen@vmware.com>

Acked-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agodatapath: Fix compat skb_get_rxhash()
Pravin B Shelar [Thu, 5 Dec 2013 05:24:49 +0000 (21:24 -0800)]
datapath: Fix compat skb_get_rxhash()

Add missing return statement.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: fix vport-netdev unregister
Alexei Starovoitov [Wed, 16 Oct 2013 22:28:23 +0000 (15:28 -0700)]
datapath: fix vport-netdev unregister

The combination of two commits:
commit 8e4e1713e4
("openvswitch: Simplify datapath locking.")
commit 2537b4dd0a
("openvswitch:: link upper device for port devices")

introduced a bug where upper_dev wasn't unlinked upon
netdev_unregister notification

The following steps:

  modprobe openvswitch
  ovs-dpctl add-dp test
  ip tuntap add dev tap1 mode tap
  ovs-dpctl add-if test tap1
  ip tuntap del dev tap1 mode tap

are causing multiple warnings:

[   62.747557] gre: GRE over IPv4 demultiplexor driver
[   62.749579] openvswitch: Open vSwitch switching datapath
[   62.755087] device test entered promiscuous mode
[   62.765911] device tap1 entered promiscuous mode
[   62.766033] IPv6: ADDRCONF(NETDEV_UP): tap1: link is not ready
[   62.769017] ------------[ cut here ]------------
[   62.769022] WARNING: CPU: 1 PID: 3267 at net/core/dev.c:5501 rollback_registered_many+0x20f/0x240()
[   62.769023] Modules linked in: openvswitch gre vxlan ip_tunnel libcrc32c ip6table_filter ip6_tables ebtable_nat ebtables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_CHECKSUM iptable_mangle ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc vhost_net macvtap macvlan vhost kvm_intel kvm dm_crypt iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi hid_generic mxm_wmi eeepc_wmi asus_wmi sparse_keymap dm_multipath psmouse serio_raw usbhid hid parport_pc ppdev firewire_ohci lpc_ich firewire_core e1000e crc_itu_t binfmt_misc igb dca ptp pps_core mac_hid wmi lp parport i2o_config i2o_block video
[   62.769051] CPU: 1 PID: 3267 Comm: ip Not tainted 3.12.0-rc3+ #60
[   62.769052] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012
[   62.769053]  0000000000000009 ffff8807f25cbd28 ffffffff8175e575 0000000000000006
[   62.769055]  0000000000000000 ffff8807f25cbd68 ffffffff8105314c ffff8807f25cbd58
[   62.769057]  ffff8807f2634000 ffff8807f25cbdc8 ffff8807f25cbd88 ffff8807f25cbdc8
[   62.769059] Call Trace:
[   62.769062]  [<ffffffff8175e575>] dump_stack+0x55/0x76
[   62.769065]  [<ffffffff8105314c>] warn_slowpath_common+0x8c/0xc0
[   62.769067]  [<ffffffff8105319a>] warn_slowpath_null+0x1a/0x20
[   62.769069]  [<ffffffff8162a04f>] rollback_registered_many+0x20f/0x240
[   62.769071]  [<ffffffff8162a101>] rollback_registered+0x31/0x40
[   62.769073]  [<ffffffff8162a488>] unregister_netdevice_queue+0x58/0x90
[   62.769075]  [<ffffffff8154f900>] __tun_detach+0x140/0x340
[   62.769077]  [<ffffffff8154fb36>] tun_chr_close+0x36/0x60
[   62.769080]  [<ffffffff811bddaf>] __fput+0xff/0x260
[   62.769082]  [<ffffffff811bdf5e>] ____fput+0xe/0x10
[   62.769084]  [<ffffffff8107b515>] task_work_run+0xb5/0xe0
[   62.769087]  [<ffffffff810029b9>] do_notify_resume+0x59/0x80
[   62.769089]  [<ffffffff813a41fe>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[   62.769091]  [<ffffffff81770f5a>] int_signal+0x12/0x17
[   62.769093] ---[ end trace 838756c62e156ffb ]---
[   62.769481] ------------[ cut here ]------------
[   62.769485] WARNING: CPU: 1 PID: 92 at fs/sysfs/inode.c:325 sysfs_hash_and_remove+0xa9/0xb0()
[   62.769486] sysfs: can not remove 'master', no directory
[   62.769486] Modules linked in: openvswitch gre vxlan ip_tunnel libcrc32c ip6table_filter ip6_tables ebtable_nat ebtables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_CHECKSUM iptable_mangle ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc vhost_net macvtap macvlan vhost kvm_intel kvm dm_crypt iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi hid_generic mxm_wmi eeepc_wmi asus_wmi sparse_keymap dm_multipath psmouse serio_raw usbhid hid parport_pc ppdev firewire_ohci lpc_ich firewire_core e1000e crc_itu_t binfmt_misc igb dca ptp pps_core mac_hid wmi lp parport i2o_config i2o_block video
[   62.769514] CPU: 1 PID: 92 Comm: kworker/1:2 Tainted: G        W    3.12.0-rc3+ #60
[   62.769515] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012
[   62.769518] Workqueue: events ovs_dp_notify_wq [openvswitch]
[   62.769519]  0000000000000009 ffff880807ad3ac8 ffffffff8175e575 0000000000000006
[   62.769521]  ffff880807ad3b18 ffff880807ad3b08 ffffffff8105314c ffff880807ad3b28
[   62.769523]  0000000000000000 ffffffff81a87a1f ffff8807f2634000 ffff880037038500
[   62.769525] Call Trace:
[   62.769528]  [<ffffffff8175e575>] dump_stack+0x55/0x76
[   62.769529]  [<ffffffff8105314c>] warn_slowpath_common+0x8c/0xc0
[   62.769531]  [<ffffffff81053236>] warn_slowpath_fmt+0x46/0x50
[   62.769533]  [<ffffffff8123e7e9>] sysfs_hash_and_remove+0xa9/0xb0
[   62.769535]  [<ffffffff81240e96>] sysfs_remove_link+0x26/0x30
[   62.769538]  [<ffffffff81631ef7>] __netdev_adjacent_dev_remove+0xf7/0x150
[   62.769540]  [<ffffffff81632037>] __netdev_adjacent_dev_unlink_lists+0x27/0x50
[   62.769542]  [<ffffffff8163213a>] __netdev_adjacent_dev_unlink_neighbour+0x3a/0x50
[   62.769544]  [<ffffffff8163218d>] netdev_upper_dev_unlink+0x3d/0x140
[   62.769548]  [<ffffffffa033c2db>] netdev_destroy+0x4b/0x80 [openvswitch]
[   62.769550]  [<ffffffffa033b696>] ovs_vport_del+0x46/0x60 [openvswitch]
[   62.769552]  [<ffffffffa0335314>] ovs_dp_detach_port+0x44/0x60 [openvswitch]
[   62.769555]  [<ffffffffa0336574>] ovs_dp_notify_wq+0xb4/0x150 [openvswitch]
[   62.769557]  [<ffffffff81075c28>] process_one_work+0x1d8/0x6a0
[   62.769559]  [<ffffffff81075bc8>] ? process_one_work+0x178/0x6a0
[   62.769562]  [<ffffffff8107659b>] worker_thread+0x11b/0x370
[   62.769564]  [<ffffffff81076480>] ? rescuer_thread+0x350/0x350
[   62.769566]  [<ffffffff8107f44a>] kthread+0xea/0xf0
[   62.769568]  [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150
[   62.769570]  [<ffffffff81770bac>] ret_from_fork+0x7c/0xb0
[   62.769572]  [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150
[   62.769573] ---[ end trace 838756c62e156ffc ]---
[   62.769574] ------------[ cut here ]------------
[   62.769576] WARNING: CPU: 1 PID: 92 at fs/sysfs/inode.c:325 sysfs_hash_and_remove+0xa9/0xb0()
[   62.769577] sysfs: can not remove 'upper_test', no directory
[   62.769577] Modules linked in: openvswitch gre vxlan ip_tunnel libcrc32c ip6table_filter ip6_tables ebtable_nat ebtables nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_CHECKSUM iptable_mangle ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc vhost_net macvtap macvlan vhost kvm_intel kvm dm_crypt iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi hid_generic mxm_wmi eeepc_wmi asus_wmi sparse_keymap dm_multipath psmouse serio_raw usbhid hid parport_pc ppdev firewire_ohci lpc_ich firewire_core e1000e crc_itu_t binfmt_misc igb dca ptp pps_core mac_hid wmi lp parport i2o_config i2o_block video
[   62.769603] CPU: 1 PID: 92 Comm: kworker/1:2 Tainted: G        W    3.12.0-rc3+ #60
[   62.769604] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012
[   62.769606] Workqueue: events ovs_dp_notify_wq [openvswitch]
[   62.769607]  0000000000000009 ffff880807ad3ac8 ffffffff8175e575 0000000000000006
[   62.769609]  ffff880807ad3b18 ffff880807ad3b08 ffffffff8105314c ffff880807ad3b58
[   62.769611]  0000000000000000 ffff880807ad3bd9 ffff8807f2634000 ffff880037038500
[   62.769613] Call Trace:
[   62.769615]  [<ffffffff8175e575>] dump_stack+0x55/0x76
[   62.769617]  [<ffffffff8105314c>] warn_slowpath_common+0x8c/0xc0
[   62.769619]  [<ffffffff81053236>] warn_slowpath_fmt+0x46/0x50
[   62.769621]  [<ffffffff8123e7e9>] sysfs_hash_and_remove+0xa9/0xb0
[   62.769622]  [<ffffffff81240e96>] sysfs_remove_link+0x26/0x30
[   62.769624]  [<ffffffff81631f22>] __netdev_adjacent_dev_remove+0x122/0x150
[   62.769627]  [<ffffffff81632037>] __netdev_adjacent_dev_unlink_lists+0x27/0x50
[   62.769629]  [<ffffffff8163213a>] __netdev_adjacent_dev_unlink_neighbour+0x3a/0x50
[   62.769631]  [<ffffffff8163218d>] netdev_upper_dev_unlink+0x3d/0x140
[   62.769633]  [<ffffffffa033c2db>] netdev_destroy+0x4b/0x80 [openvswitch]
[   62.769636]  [<ffffffffa033b696>] ovs_vport_del+0x46/0x60 [openvswitch]
[   62.769638]  [<ffffffffa0335314>] ovs_dp_detach_port+0x44/0x60 [openvswitch]
[   62.769640]  [<ffffffffa0336574>] ovs_dp_notify_wq+0xb4/0x150 [openvswitch]
[   62.769642]  [<ffffffff81075c28>] process_one_work+0x1d8/0x6a0
[   62.769644]  [<ffffffff81075bc8>] ? process_one_work+0x178/0x6a0
[   62.769646]  [<ffffffff8107659b>] worker_thread+0x11b/0x370
[   62.769648]  [<ffffffff81076480>] ? rescuer_thread+0x350/0x350
[   62.769650]  [<ffffffff8107f44a>] kthread+0xea/0xf0
[   62.769652]  [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150
[   62.769654]  [<ffffffff81770bac>] ret_from_fork+0x7c/0xb0
[   62.769656]  [<ffffffff8107f360>] ? flush_kthread_worker+0x150/0x150
[   62.769657] ---[ end trace 838756c62e156ffd ]---
[   62.769724] device tap1 left promiscuous mode

This patch also affects moving devices between net namespaces.

OVS used to ignore netns move notifications which caused problems.
Like:
  ovs-dpctl add-if test tap1
  ip link set tap1 netns 3512
and then removing tap1 inside the namespace will cause hang on missing dev_put.

With this patch OVS will detach dev upon receiving netns move event.

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Conflicts:
AUTHORS

10 years agovxlan: Optimize vxlan rcv
Pravin B Shelar [Fri, 11 Oct 2013 19:40:13 +0000 (12:40 -0700)]
vxlan: Optimize vxlan rcv

vxlan-udp-recv function lookup vxlan_sock struct on every packet
recv by using udp-port number. we can use sk->sk_user_data to
store vxlan_sock and avoid lookup.

This commit also allows us to get rid of socket hash table.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agoipfix: fix segfault for Flow_Sample_Collector_Set without ipfix
Romain Lenglet [Wed, 20 Nov 2013 18:57:52 +0000 (10:57 -0800)]
ipfix: fix segfault for Flow_Sample_Collector_Set without ipfix

Guard any access to an IPFIX row referenced from
Flow_Sample_Collector_Set by a test that the reference is not NULL.

Signed-off-by: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodebian: Avoid logrotate error if /var/run/openvswitch does not exist.
Alfredo Finelli [Tue, 12 Nov 2013 16:03:41 +0000 (08:03 -0800)]
debian: Avoid logrotate error if /var/run/openvswitch does not exist.

Signed-off-by: Alfredo Finelli <alf@computationes.de>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-util: Fix formatting of ipfix action cookies, to fix a testsuite failure
Ben Pfaff [Mon, 11 Nov 2013 21:32:23 +0000 (13:32 -0800)]
odp-util: Fix formatting of ipfix action cookies, to fix a testsuite failure

Problem introduced by previous commit 96ed775f19 (odp-util: Fix IPFIX
breakage with old kernel modules.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-util: Fix IPFIX breakage with old kernel modules.
Ben Pfaff [Mon, 7 Oct 2013 21:26:28 +0000 (14:26 -0700)]
odp-util: Fix IPFIX breakage with old kernel modules.

Before commit e995e3df57ea (Allow OVS_USERSPACE_ATTR_USERDATA to be
variable length.) userdata attributes in userspace actions were expected
to be exactly 64 bits long.  The kernel only actually enforced that they
were at least 64 bits long (the previously referenced commit's log message
contains misinformation on this account).

Initially this was no problem, because all of the userdata that userspace
actually used was exactly 8 bytes long.  Commit 29089a540c (Implement IPFIX
export), however, exposed a problem by reducing the length of userdata for
IPFIX support to just 4 bytes.  This meant that IPFIX no longer worked on
older datapaths, because the userdata was no longer at least 8 bytes long.

This commit fixes the problem by padding out userdata attributes less than
8 bytes long to 8 bytes.

CC: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Romain Lenglet <rlenglet at vmware.com>
10 years agonetlink: New function nl_msg_put_unspec_zero().
Ben Pfaff [Mon, 7 Oct 2013 21:11:40 +0000 (14:11 -0700)]
netlink: New function nl_msg_put_unspec_zero().

An upcoming commit adds a user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdb: Do not leak error in ovsdb_server_compact()
Thomas Graf [Fri, 1 Nov 2013 16:44:52 +0000 (17:44 +0100)]
ovsdb: Do not leak error in ovsdb_server_compact()

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-util: Parse SCTP correctly.
Gurucharan Shetty [Wed, 30 Oct 2013 07:44:32 +0000 (00:44 -0700)]
odp-util: Parse SCTP correctly.

We should be looking at 'src_flow' instead of 'flow'. Otherwise,
parsing SCTP through odp_flow_key_to_mask will fail.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agofedora: Add ovs-dpctl-top to the spec file.
Gurucharan Shetty [Tue, 29 Oct 2013 15:53:58 +0000 (08:53 -0700)]
fedora: Add ovs-dpctl-top to the spec file.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
10 years agoofproto: Send only one OFPT_FLOW_REMOVED message when a flow expires.
Ben Pfaff [Fri, 18 Oct 2013 23:32:40 +0000 (16:32 -0700)]
ofproto: Send only one OFPT_FLOW_REMOVED message when a flow expires.

Commit 15aaf59932a3 (ofproto: Add global locking around flow table
changes.) introduced doubled messages for expirations.

Reported-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agoovs-lib: Return the correct exit status of the command 'status'
Gurucharan Shetty [Mon, 7 Oct 2013 21:28:48 +0000 (14:28 -0700)]
ovs-lib: Return the correct exit status of the command 'status'

commit 46528f78e5c(debian, rhel, xenserver: Ability to collect ovs-ctl logs)
made changes in the startup scripts such that the o/p of ovs-ctl is logged
into ovs-ctl.log. But it had an unintended consequence that the exit status
of ovs-ctl was no longer returned. We would always return success(the exit
status of tee).

With this commit, we return the exit status of ovs-ctl instead of tee.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoAnnounce that ovs-vswitchd is now multi-threaded. v2.0
Justin Pettit [Tue, 15 Oct 2013 22:36:40 +0000 (15:36 -0700)]
Announce that ovs-vswitchd is now multi-threaded.

Might be worth mentioning the biggest change in 2.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoSet release date for 2.0.0.
Justin Pettit [Tue, 15 Oct 2013 22:04:20 +0000 (15:04 -0700)]
Set release date for 2.0.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agolib/meta-flow: Include util.h for ovs_assert().
Jarno Rajahalme [Tue, 15 Oct 2013 17:30:44 +0000 (10:30 -0700)]
lib/meta-flow: Include util.h for ovs_assert().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: fix failure when $PKIDIR contains uuid-like string
YAMAMOTO Takashi [Tue, 15 Oct 2013 14:38:06 +0000 (23:38 +0900)]
tests: fix failure when $PKIDIR contains uuid-like string

this fixes a test failure with my working directory:
    /disks/ea6a5743-ad5f-11e2-9410-08606e7f74e7/git/openvswitch

stop filtering uuid as it's unnecessary for this specific test case.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/meta-flow: Enforce mf_fields array order.
Jarno Rajahalme [Tue, 15 Oct 2013 15:35:39 +0000 (08:35 -0700)]
lib/meta-flow: Enforce mf_fields array order.

The elements of the array must be in the enum order.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Make ovsdb-server add/remove remote test faster and more reliable.
Alex Wang [Tue, 15 Oct 2013 05:12:59 +0000 (22:12 -0700)]
tests: Make ovsdb-server add/remove remote test faster and more reliable.

Until now, the "ovsdb-server/add-remote and remove-remote with --monitor"
test killed ovsdb-server with SIGSEGV twice.  Each time, the "--monitor"
option caused the supervisor process to restart the child, but the second
time it incurred a 10-second delay intended to prevent the daemon from
wasting CPU time by restarting itself and dying again very quickly in a
loop.  This made the test take over 10 seconds to execute.  It also made
it occasionally fail because the OVS_WAIT_UNTIL check waits at most
approximately 10 seconds before it decides that the condition that it is
testing for will never occur.

This commit fixes the problem by breaking the test into two tests, each of
which kills ovsdb-server with SIGSEGV only once.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agorconn: Make thread-safe.
Ben Pfaff [Fri, 11 Oct 2013 17:08:32 +0000 (10:08 -0700)]
rconn: Make thread-safe.

This should make sending OFPT_FLOW_REMOVED and NXST_FLOW_MONITOR safe from
miss handler threads.

Bug #20271.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoconnmgr: Formalize 'ofproto_mutex' as protecting ofconn monitor data.
Ben Pfaff [Fri, 11 Oct 2013 06:11:09 +0000 (23:11 -0700)]
connmgr: Formalize 'ofproto_mutex' as protecting ofconn monitor data.

'ofproto_mutex' has effectively protected the monitor-related members of
struct ofconn since its introduction, but this was not written down or
systematically annotated.  This commit makes it more systematic and fixes
a few issues found using the annotations.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoconnmgr: Use 'ofproto_mutex' to protect ofconns from being destroyed.
Ben Pfaff [Fri, 11 Oct 2013 17:04:32 +0000 (10:04 -0700)]
connmgr: Use 'ofproto_mutex' to protect ofconns from being destroyed.

Code in the ofproto-dpif miss handler threads can currently access
ofconns, sending flow_removed and flow monitor messages due to NXAST_LEARN
actions.  Nothing currently protects those threads from accessing ofconns
that are in the process of being destroyed.  This commit adds protection
'ofproto_mutex', which NXAST_LEARN already takes.

Later patches will address other races that remain.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agorconn: Make rconn_packet_counter thread-safe.
Ben Pfaff [Fri, 13 Sep 2013 22:07:35 +0000 (15:07 -0700)]
rconn: Make rconn_packet_counter thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif-xlate: Do initial rule lookup for callers.
Ethan Jackson [Wed, 9 Oct 2013 20:23:31 +0000 (13:23 -0700)]
ofproto-dpif-xlate: Do initial rule lookup for callers.

None of the functions available in ofproto-dpif.h are thread safe
unless holding the xlate_rwlock because one can't know that an ofproto
or ofport used as argument will survive during the function call.  For
this reason, ofproto-dpif-upcall's invocation of rule_dpif_lookup()
is unsafe because the ofproto could be destroyed during the call.

This patch fixes the problem by optionally doing the initial rule
lookup in xlate_actions() so that it can be done while holding the
xlate_rwlock.  This has the nice side benefit of removing a bunch of
boilerplate.

Note that this only partially solves the problem, there's still
vsp_realdev_to_vlandev() and ofproto_dpif_send_packet_in() which
aren't thread safe for the same reason.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoovs-controller: Avoid dereferencing NULL pointer when the switch acts as a hub
ZhengLingyun [Tue, 8 Oct 2013 15:52:40 +0000 (23:52 +0800)]
ovs-controller: Avoid dereferencing NULL pointer when the switch acts as a hub

Starting ovs-controller with '-H' option will lead to a segment fault problem.
Add a check, and adjust the indentation of the following code.

Signed-off-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-lib: Revert "Return the exit status of ovs-ctl in ovs_ctl()."
Gurucharan Shetty [Fri, 4 Oct 2013 21:52:34 +0000 (14:52 -0700)]
ovs-lib: Revert "Return the exit status of ovs-ctl in ovs_ctl()."

This reverts commit 0e37488562d1 which had a side-effect that
ssh executing start/restart command on a remote machine would
hang as one of the file descriptors created in that commit
was getting passed along to the daemons. The daemons weren't closing
it and hence ssh would just wait for them to close and hang.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-lib: Return the exit status of ovs-ctl in ovs_ctl().
Duffie Cooley [Wed, 2 Oct 2013 14:07:43 +0000 (07:07 -0700)]
ovs-lib: Return the exit status of ovs-ctl in ovs_ctl().

commit 46528f78e5c(debian, rhel, xenserver: Ability to collect ovs-ctl logs)
made changes in the startup scripts such that the o/p of ovs-ctl is logged
into ovs-ctl.log. But it had an unintended consequence that the exit status
of ovs-ctl was no longer returned. We would always return success(the exit
status of tee).

With this commit, we return the exit status of ovs-ctl instead of tee.
Code referenced from: (line wrapped).
http://unix.stackexchange.com/questions/14270/\
get-exit-status-of-process-thats-piped-to-another/70675#70675)

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Duffie Cooley <dcooley@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix vxlan gso with vlan.
Pravin B Shelar [Tue, 1 Oct 2013 15:24:55 +0000 (08:24 -0700)]
datapath: Fix vxlan gso with vlan.

To use ovs-gso-compatibility we need to record inner skb offset.
In case of vxlan it is done before vlan header is pushed which
gives wrong inner packet to ovs-gso.
Following patch reset skb offsets after inner skb is completely built.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agorhel: fix the exit status of the openvswitch init script.
Duffie Cooley [Tue, 1 Oct 2013 02:27:07 +0000 (19:27 -0700)]
rhel: fix the exit status of the openvswitch init script.

This is a fix for a request to make sure that the openvswitch status command
in rhel based distros gives a useful exit status. That was fixed in

commit 5e0c05bc058c78a11be6747f62e6ad88e5d06b70
debian: Fix exit status of openvswitch-switch init script "status" command

Signed-off-by: Duffie Cooley <dcooley@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agohmap: Make bad hash functions easier to find.
Ben Pfaff [Tue, 24 Sep 2013 21:42:35 +0000 (14:42 -0700)]
hmap: Make bad hash functions easier to find.

The hmap code has for a long time incremented a counter when a hash bucket
grew to have many entries.  This can let a developer know that some hash
function is performing poorly, but doesn't give any hint as to which one.
This commit improves the situation by adding rate-limited debug logging
that points out a particular line of code as the source of the poor hash
behavior.  It should make issues easier to track down.

Bug #19926.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Lauded-by: Keith Amidon <keith@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agoofproto: Fix memory leak in rule_actions_unref().
Ben Pfaff [Tue, 24 Sep 2013 21:22:14 +0000 (14:22 -0700)]
ofproto: Fix memory leak in rule_actions_unref().

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agoofproto: Allow ofproto_delete_flow() to delete hidden rules.
Ben Pfaff [Tue, 24 Sep 2013 04:34:37 +0000 (21:34 -0700)]
ofproto: Allow ofproto_delete_flow() to delete hidden rules.

Commit 97f63e57a8 (ofproto: Remove soon-to-be-invalid optimizations.)
changed ofproto_delete_flow() to use the general-purpose flow_mod
implementation.  However, the general-purpose flow_mod never matches hidden
flows, which are exactly the flows that ofproto_delete_flow()'s callers
want to delete.

This commit fixes the problem by allowing flow_mods that specify a priority
that can only be for a hidden flow to delete a hidden flow.  (This doesn't
allow OpenFlow clients to meddle with hidden flows because OpenFlow uses
only a 16-bit field to specify priority.)

I verified that, without this commit, if I change from one controller to
another with "ovs-vsctl set-controller", then the in-band rules for the
old controller remain.  With this commit, the old rules are removed.

Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Bug #19821.
Reported-by: Luca Giraudo <lgiraudo@vmware.com>
Bug #19888.
Reported-by: Ying Chen <yingchen@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agocfm: Don't enforce CFM_FAULT_INTERVAL.
Ethan Jackson [Fri, 20 Sep 2013 22:32:08 +0000 (15:32 -0700)]
cfm: Don't enforce CFM_FAULT_INTERVAL.

While upgrading a deployment, it's possible that transient
configuration changes could cause the cfm interval on two ends of a
link to be different.  If these two configured values are close to
each other, this condition could have no impact on traffic.  Therefore
it's better to let this slide than force a tunnel down guaranteeing an
impact

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Prevent interval fault when demand mode is enabled on one end.
alex wang [Fri, 20 Sep 2013 06:13:33 +0000 (06:13 +0000)]
cfm: Prevent interval fault when demand mode is enabled on one end.

This commit prevents cfm from raising 'interval' fault when demand
mode is only enabled on one end of link.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodatapath: Remove net_device_ops compatibility code.
Jesse Gross [Fri, 13 Sep 2013 21:16:35 +0000 (14:16 -0700)]
datapath: Remove net_device_ops compatibility code.

The symbol HAVE_NET_DEVICE_OPS was changed in 3.1 but code the that
it was protecting dates back to before 2.6.32. Therefore, we can
just assume that net_device_ops exists in all cases and drop the
compat code.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
10 years agoutilities: a top like tool for ovs-dpctl dump-flows.
Mark Hamilton [Fri, 13 Sep 2013 22:50:48 +0000 (15:50 -0700)]
utilities: a top like tool for ovs-dpctl dump-flows.

This python script summarizes ovs-dpctl dump-flows content by aggregating
the number of packets, total bytes and occurrence of the following fields:
  - Datapath in_port
  - Ethernet type
  - Source and destination MAC addresses
  - IP protocol
  - Source and destination IPv4 addresses
  - Source and destination IPv6 addresses
  - UDP and TCP destination port
  - Tunnel source and destination addresses

Testing included confirming both mega-flows and non-megaflows are
properly parsed. Bit masks are applied in the case of mega-flows
prior to aggregation.  Test --script parameter which runs in
non-interactive mode. Tested syntax against python 2.4.3, 2.6 and 2.7.
Confirmed script passes pep8 and pylint run as:

pylint --disable=I0011 --include-id=y --reports=n

This tool has been added to these distribution:
  - add ovs-dpctl-top to debian distribution
  - add ovs-dpctl-top to rpm distribution.
  - add ovs-dpctl-top to XenServer RPM.

Signed-off-by: Mark Hamilton <mhamilton@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agovlog: Fix formatting of milliseconds in Python log messages.
Ben Pfaff [Mon, 16 Sep 2013 22:15:01 +0000 (15:15 -0700)]
vlog: Fix formatting of milliseconds in Python log messages.

Commit 2b31d8e713de7 (vlog: Report timestamps in millisecond resolution in
log messages.) introduced milliseconds to log messages by default, but the
Python version did not ensure that milliseconds were always formatted with
3 digits, so 3.001 was formatted as "3.1" and 3.012 as "3.12", and so on.
This commit fixes the problem.

CC: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdb: write commit timestamps to millisecond resolution.
Paul Ingram [Sat, 14 Sep 2013 01:52:54 +0000 (18:52 -0700)]
ovsdb: write commit timestamps to millisecond resolution.

This is expected to make system debugging easier.

This raises two compatibility issues:
1. When a new ovsdb-tool reads an old database, it will multiply by 1000 any
  timestamp it reads which is less than 1<<31. Since this date corresponds to
  Jan 16 1970 this is unlikely to cause a problem.
2. When an old ovsdb-tool reads a new database, it will interpret the
  millisecond timestamps as seconds and report dates in the far future; the
  time of this commit is reported as the year 45672 (each second since the
  epoch is interpreted as 16 minutes).

Signed-off-by: Paul Ingram <pingram@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdb: Use DB load time, not on-disk commit times, for compaction.
Paul Ingram [Sat, 14 Sep 2013 01:52:53 +0000 (18:52 -0700)]
ovsdb: Use DB load time, not on-disk commit times, for compaction.

The ovsdb-server compaction timing logic is written assuming monotonic
time at milliscond resolution but it calculated the next compaction time
based on the oldest commit in the database. This was a problem because
commit timestamps are written in wall-clock time to second resolution.

This commit calculates the next compaction time based on the time when
the database was first loaded or the last compaction was done, both in
monotonic time at millisecond resolution.

Signed-off-by: Paul Ingram <pingram@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovlog: Report timestamps in millisecond resolution in log messages.
Paul Ingram [Fri, 13 Sep 2013 01:19:04 +0000 (18:19 -0700)]
vlog: Report timestamps in millisecond resolution in log messages.

To make debugging easier.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Paul Ingram <pingram@nicira.com>
10 years agoofproto-dpif: Fix use-after-free error deleting last bridge.
Ben Pfaff [Mon, 16 Sep 2013 21:53:27 +0000 (14:53 -0700)]
ofproto-dpif: Fix use-after-free error deleting last bridge.

valgrind reported:

    Invalid read of size 4
       at 0x806ADC1: odp_port_to_ofport (hmap.h:267)
       by 0x8077C05: xlate_receive (ofproto-dpif-xlate.c:523)
       by 0x8073994: handle_miss_upcalls (ofproto-dpif-upcall.c:642)
       by 0x80741AA: udpif_miss_handler (ofproto-dpif-upcall.c:412)
       by 0x56FCC38: start_thread (pthread_create.c:304)
       by 0x735378D: clone (clone.S:130)
     Address 0x786c084 is 4 bytes inside a block of size 16 free'd
       at 0x4D8350C: free (vg_replace_malloc.c:427)
       by 0x8065EDA: close_dpif_backer (ofproto-dpif.c:1094)

The problem is that close_dpif_backer() destroys odp_to_ofport_map and the
associated mutex before it calls udpif_destroy() to stop the forwarding
threads.  This gives the forwarding threads a window in which to try to
use odp_to_ofport_map.

This commit moves the udpif_destroy() call much earlier, solving the
problem.  (The call to udpif_destroy() must follow the call to
drop_key_clear() because drop_key_clear() uses the udpif.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agotests: Make ovsdb-server add-db/remove-db test faster and more reliable.
Ben Pfaff [Mon, 16 Sep 2013 22:03:55 +0000 (15:03 -0700)]
tests: Make ovsdb-server add-db/remove-db test faster and more reliable.

Until now, the "ovsdb-server/add-db and remove-db with --monitor" test
killed ovsdb-server with SIGSEGV twice.  Each time, the "--monitor" option
caused the supervisor process to restart the child, but the second time it
incurred a 10-second delay intended to prevent the daemon from wasting CPU
time by restarting itself and dying again very quickly in a loop.  This
made the test take over 10 seconds to execute.  It also made it
occasionally fail because the OVS_WAIT_UNTIL check waits at most
approximately 10 seconds before it decides that the condition that it is
testing for will never occur.

This commit fixes the problem by breaking the test into two tests, each of
which kills ovsdb-server with SIGSEGV only once.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoFAQ: Fix version number for 2.0.
Jesse Gross [Fri, 13 Sep 2013 21:40:39 +0000 (14:40 -0700)]
FAQ: Fix version number for 2.0.

Presumably we will have minor version releases in the 2.x series
as well.

Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif: Move "learn" actions into individual threads.
Ben Pfaff [Fri, 13 Sep 2013 03:45:31 +0000 (20:45 -0700)]
ofproto-dpif: Move "learn" actions into individual threads.

Before OVS introduced threading, any given ``learn'' action took effect in
the flow table before the next incoming flow was set up.  This meant that
if a packet came in, used ``learn'' to set up a flow to handle replies, and
then a reply came in, the reply would always hit the flow set up by the
``learn'' action.  Until now, with the threading implementation, though,
the effects of ``learn'' actions happen asynchronously via a queue, which
means that the reply can arrive before the flow to handle it is set up.
This introduced an unacceptable regression in important use cases.

This commit fixes the problem by switching back to executing learn actions
before forwarding the packet that triggered it.

I imagine that there is considerable opportunity for optimization here.

Bug #19147.
Bug #19244.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Remove redundant cls parameter from a few functions.
Ben Pfaff [Tue, 10 Sep 2013 05:36:19 +0000 (22:36 -0700)]
ofproto: Remove redundant cls parameter from a few functions.

Previously this parameter was useful for Clang locking annotations
but it isn't actually a locking requirement anymore, so remove
the parameter.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Add global locking around flow table changes.
Ben Pfaff [Fri, 13 Sep 2013 03:45:15 +0000 (20:45 -0700)]
ofproto: Add global locking around flow table changes.

This makes 'ofproto_mutex' protect the flow table well enough that threads
other than the main one can realistically modify flows.

I need to look at the interface between ofproto and connmgr: I think that
there might need to be some locking there too.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>