sliver-openvswitch.git
12 years agoofproto: Fix use-after-free error when ports disappear. branch-1.3
Ben Pfaff [Mon, 23 Apr 2012 16:16:18 +0000 (09:16 -0700)]
ofproto: Fix use-after-free error when ports disappear.

update_port() can delete the port for which it is called, if the underlying
network device has been destroyed, so HMAP_FOR_EACH is unsafe in
ofproto_run().

Less obviously, update_port() can delete unrelated ports.  For example,
suppose that initially device A is port 1 and device B is port 2.  If
update_port("A") runs just after this, then it will ofport_remove() both
ports, then ofport_install() A as the new port 2.

So this commit first assembles a list of ports to update, then updates them
in a separate loop.

Without this commit, running "ovs-dpctl del-dp" while ovs-vswitchd is
running consistently causes a crash for me within a few seconds.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Fix log rotation.
Ben Pfaff [Thu, 22 Mar 2012 17:20:44 +0000 (10:20 -0700)]
debian: Fix log rotation.

Commit 24e81092a1 (debian: Bring Debian packaging in-line with new file
locations) introduced an ambiguous "--t" option invoking ovs-appctl, so
ovs-vswitchd and ovsdb-server were not reopening their log files following
log rotation.  This fixes the problem by correct the option name.

Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev-linux: Fix use-after-free when netdev_dump_queues() deletes queues.
Ben Pfaff [Mon, 19 Mar 2012 20:47:50 +0000 (13:47 -0700)]
netdev-linux: Fix use-after-free when netdev_dump_queues() deletes queues.

iface_configure_qos() passes a callback to netdev_dump_queues() that can
delete queues.  The netdev-linux implementation of this function was
unprepared for the callback to delete queues, so this could cause a
use-after-free.  This fixes the problem in netdev_linux_dump_queues() and
documents that netdev_dump_queues() implementations must support deletions
in the callback.

Found by valgrind:

==1593== Invalid read of size 8
==1593==    at 0x4A8C43: netdev_linux_dump_queues (hmap.h:326)
==1593==    by 0x4305F7: bridge_reconfigure (bridge.c:3084)
==1593==    by 0x431384: bridge_run (bridge.c:1892)
==1593==    by 0x432749: main (ovs-vswitchd.c:96)
==1593==  Address 0x632e078 is 8 bytes inside a block of size 32 free'd
==1593==    at 0x4C240FD: free (vg_replace_malloc.c:366)
==1593==    by 0x4A4D74: hfsc_class_delete (netdev-linux.c:3250)
==1593==    by 0x42AA59: iface_delete_queues (bridge.c:3055)
==1593==    by 0x4A8C8C: netdev_linux_dump_queues (netdev-linux.c:1881)
==1593==    by 0x4305F7: bridge_reconfigure (bridge.c:3084)
==1593==    by 0x431384: bridge_run (bridge.c:1892)

Bug #10164.
Reported-by: Ram Jothikumar <ram@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Fix code that keeps track of MTU.
Ben Pfaff [Mon, 12 Mar 2012 19:59:47 +0000 (12:59 -0700)]
ofproto: Fix code that keeps track of MTU.

ofport_install() should set the MTU that it finds into the ofport
before calling set_internal_devs_mtu(), because the latter function might
change the MTU and update ofport->mtu and the caller should not incorrectly
overwrite its changes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-monitor-ipsec: Detect correctly IPSEC configuration changes
Ansis Atteka [Fri, 9 Mar 2012 02:58:09 +0000 (18:58 -0800)]
ovs-monitor-ipsec: Detect correctly IPSEC configuration changes

If Open vSwitch has IPSEC tunnel (with certificates) and Interface
table was updated, then ovs-monitor-ipsec daemon would incorrectly
remove and readd all existing IPSEC tunnels.

The root cause for this issue was that "peer_cert_file" key was present in
interfaces dictionary, but it was missing in new_interfaces dictionary.

v2: Do not fail buildtests

Issue#10096

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
Reported-by: Niklas Andersson <nandersson@nicira.com>
12 years agobond: Incorrectly reported an error in appctl.
Ethan Jackson [Tue, 21 Feb 2012 05:57:20 +0000 (21:57 -0800)]
bond: Incorrectly reported an error in appctl.

The bond/enable-slave and bond/disable-slave ovs-appctl commands
incorrectly reported the 501 error code upon success.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoovs-xapi-sync: Rerun processing when a db update arrives during a commit.
Ben Pfaff [Thu, 8 Mar 2012 18:49:47 +0000 (10:49 -0800)]
ovs-xapi-sync: Rerun processing when a db update arrives during a commit.

The logic in ovs-xapi-sync didn't handle the case where ovsdb-server sends
a database update before it replies to a transaction that ovs-xapi-sync
sent, like this:

ovs-xapi-sync              ovsdb-server
-------------              ------------

                      .
                      .
                      .
transaction request  --->
                     <---  database contents update
                     <---  transaction reply
                      .
                      .
                      .

The update was not lost but ovs-xapi-sync would not process it until the
database changed again.

Bug #10082.
Reported-by: Krishna Miriyala <krishna@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agosocket-util: Unlink Unix domain sockets that bind but fail to connect.
Ben Pfaff [Mon, 27 Feb 2012 18:58:45 +0000 (10:58 -0800)]
socket-util: Unlink Unix domain sockets that bind but fail to connect.

The error handling path here failed to clean up bound sockets, by removing
them.  This fixes the problem.

It was easy to observe this bug by running "ovs-vsctl" without
"ovsdb-server" running.

Bug #9811.
Bug #9769.
Reported-by: Michael <mhu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agobridge: Remove unwanted ports at time of ofproto creation.
Ben Pfaff [Fri, 2 Mar 2012 21:26:35 +0000 (13:26 -0800)]
bridge: Remove unwanted ports at time of ofproto creation.

The reconfiguration code only deleted unwanted ports for bridges that had
been created in previous (re)configurations.  In fact, we should run this
step even for bridges that are newly added, e.g. to delete ports that
were added by a previous run of ovs-vswitchd and deleted from the database
between runs.

Before this commit, the following left "int" in datapath br0.  After this
commit, "int" is properly deleted:

1. With ovs-vswitchd running:
      # ovs-vsctl add-br br0
      # ovs-vsctl add-port br0 int -- set interface int type=internal
2. Kill ovs-vswitchd, then:
      # ovs-vsctl --no-wait -- del-port br0 int
3. Restart ovs-vswitchd.

Bug #9957.
Reported-by: Hiroshi Tanaka <htanaka@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev: Fix typo in error message.
Ben Pfaff [Fri, 2 Mar 2012 22:18:21 +0000 (14:18 -0800)]
netdev: Fix typo in error message.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoINSTALL.Linux: minor typo
Chris Wright [Fri, 2 Mar 2012 05:14:56 +0000 (21:14 -0800)]
INSTALL.Linux: minor typo

s/ovsdmonitor/ovsdbmonitor/

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Prefer development Python files over installed ones.
Ethan Jackson [Fri, 2 Mar 2012 00:21:55 +0000 (16:21 -0800)]
tests: Prefer development Python files over installed ones.

A developer may have Open vSwitch installed, in which case many of
the Python files which are tested will be in both the development
tree and the system Python library.  When running unit tests, we
want to test the development tree, so it's better to prefer
importing those files.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoxenserver: Restart ovs-xapi-sync on kmod reload.
Ethan Jackson [Thu, 1 Mar 2012 02:54:05 +0000 (18:54 -0800)]
xenserver: Restart ovs-xapi-sync on kmod reload.

Some users never restart OVS, they just reload the kernel module on
each new version. Since ovs-xapi-sync is a daemon, a restart is
required to use the new code.  Therefore, without this patch, users
could unwittingly use stale versions of ovs-xapi-sync.

Bug #9919.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diagnosed-by: Ben Pfaff <blp@nicira.com>
12 years agoxenserver: Always update the bridge ID in ovs-xapi-sync.
Ethan Jackson [Thu, 1 Mar 2012 02:41:58 +0000 (18:41 -0800)]
xenserver: Always update the bridge ID in ovs-xapi-sync.

In some cases we were seeing this column get stale.

Bug #9929.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diagnosed-by: Justin Pettit <jpettit@nicira.com>
12 years agodebian: Fix exit status of openvswitch-switch init script "status" command.
Ben Pfaff [Wed, 29 Feb 2012 00:31:45 +0000 (16:31 -0800)]
debian: Fix exit status of openvswitch-switch init script "status" command.

The init script ends with an explicit "exit 0" so nonzero exit codes from
"ovs-ctl status" were being lost.

Bug #9714.
Reported-by: Paul Ingram <paul@nicira.com>
CC: Sujatha Shetty <sshetty@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodpif-linux: Make dpif_linux_port_query_by_name() query only one datapath.
Ben Pfaff [Tue, 28 Feb 2012 02:42:17 +0000 (18:42 -0800)]
dpif-linux: Make dpif_linux_port_query_by_name() query only one datapath.

The kernel will report a vport with the given name in any datapath, but
userspace only wants a vport with the given name in a specific datapath.
Receiving information on a vport in an unexpected datapath yields bizarre
and hard-to-debug problems.

Bug #9889.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Cleanup STP on ports when disabled on their bridge.
Ethan Jackson [Sun, 19 Feb 2012 08:34:28 +0000 (00:34 -0800)]
ofproto-dpif: Cleanup STP on ports when disabled on their bridge.

When STP is enabled on a bridge, the STP module puts its ports in
an STP_LISTENING state until STP converges.  This causes all
traffic destined for these ports to be dropped.  If STP is disabled
on the bridge, but not explicitly disabled on its ports, the bridge
fails to remove the STP state from these ports.  Therefore, if a
port is in an STP_LISTENING state, it will remain in that state and
continue to drop all traffic indefinitely.  This patch fixes the
issue.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Bug #9157.

12 years agoconfigure: Try to extract kernel source directory from build Makefile.
Ben Pfaff [Thu, 16 Feb 2012 18:34:55 +0000 (10:34 -0800)]
configure: Try to extract kernel source directory from build Makefile.

OVS needs to inspect the headers in the kernel source directory at build
time.  Debian keeps moving the source directory relative to the build
directory and doesn't provide an obvious way to find the source directory,
so in the past we've used some name-based heuristics to essentially guess
where it is.

This commit introduces a new heuristic that I hope will be more reliable:
extracting the source directory from the Makefile in the build directory.
In Debian's case, it looks like the Makefile generally contains a line of
the form "MAKEARGS := -C <srcdir> O=<outdir>".  This commit extracts the
source directory from that line.

To avoid regressions this commit retains the older heuristics as fallbacks.

CC: 659685@bugs.debian.org
Reported-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Always configure a default queue for QoS.
Ben Pfaff [Fri, 17 Feb 2012 00:33:14 +0000 (16:33 -0800)]
vswitchd: Always configure a default queue for QoS.

When an interface has QoS configured but no default queue (queue 0), OVS
has until now installed that QoS configuration literally, which causes all
packets destined for this default queue to be dropped.  This behavior is
usually both unexpected and undesirable.

This commit changes behavior so that, when no default queue is configured,
OVS uses a default "empty" configuration for the default queue.  This
behavior should be more acceptable when QoS is slightly misconfigured.

I tested that, without this patch, configuring only queue 1 causes "tc
class show" to show only queue 1 (handle 1:2) for linux-htb and linux-hfsc,
and that with this patch it shows configurations for both queue 0 (handle
1:1) and queue 1.

Bug #5583.
Feature #7413.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoxenserver: Fix iteration of dictionary.
Dominic Curran [Wed, 15 Feb 2012 17:17:25 +0000 (17:17 +0000)]
xenserver: Fix iteration of dictionary.

Fix bug in commit 3249bb907a1dab9b0, which incorrectly assumed that
get_all_records_where() returned a list.  It in fact returns a
dictionary and the list iteratory needs to change to account for this.

Thanks to Nicira for pointing this out.

NIC-454.

Reported-by: David Tsai <dtsai@nicira.com>
Acked-by: Rob Hoes <rob.hoes@citrix.com>
Signed-off-by: Dominic Curran <dominic.curran@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Use provided kernel source dir instead of host kernel version.
Ben Pfaff [Tue, 14 Feb 2012 17:17:13 +0000 (09:17 -0800)]
debian: Use provided kernel source dir instead of host kernel version.

DKMS passes in an explicit variable for the kernel source directory, so we
should use that instead of `uname -r`.

CC: 659685@bugs.debian.org
Reported-by: Thomas Goirand <thomas@goirand.fr>
Tested-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Do not run "make" if "configure" fails during DKMS build.
Ben Pfaff [Mon, 13 Feb 2012 18:09:09 +0000 (10:09 -0800)]
debian: Do not run "make" if "configure" fails during DKMS build.

There is no point in trying to run "make" if "configure" failed.  The
"make" will fail too and the log will be harder to read.

CC: Thomas Goirand <zigo@debian.org>
CC: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Look in /lib/modules instead of /usr/src for DKMS kernel sources.
Ben Pfaff [Tue, 10 Jan 2012 22:22:22 +0000 (14:22 -0800)]
debian: Look in /lib/modules instead of /usr/src for DKMS kernel sources.

DKMS packages usually look in /lib/modules for kernel sources, since that
is the "standard" location, but our packages was looking directly in
/usr/src.  This fixes the problem.

Reported-by: Alban Browaeys <prahal@yahoo.com>
Tested-by: Alban Browaeys <prahal@yahoo.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Fix dependencies for openvswitch-datapath-dkms package.
Ben Pfaff [Fri, 10 Feb 2012 19:00:54 +0000 (11:00 -0800)]
debian: Fix dependencies for openvswitch-datapath-dkms package.

The OVS kernel module, like other kernel modules, does not need a working
userspace build environment, but the OVS "configure" script and makefiles
don't support a kernel-only build, so "configure" fails if libc6-dev is
not installed.

It would be better to change the "configure" script and makefiles to handle
this special case, but that was more work than I initially expected it to
be.

Bug #8606.
Reported-by: Edwin Chiu <echiu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-xapi-sync: Always set iface-id, not just when xs-vif-uuid changes.
Ben Pfaff [Thu, 2 Feb 2012 01:18:52 +0000 (17:18 -0800)]
ovs-xapi-sync: Always set iface-id, not just when xs-vif-uuid changes.

When XAPI moves an interface from one bridge to another, the vif script
removes the vif from one bridge and adds it to (possibly) a different
bridge in a single transaction.  The new record does not have an iface-id
initially (because the vif script never adds the iface-id initially) but
it has the same name and xs-vif-uuid as the old one, so the caching logic
in ovs-xapi-sync failed to add a new iface-id.  This commit fixes the
caching logic.

Observed on XenServer 5.6.100.  It's possible that XAPI behavior changed in
later versions so the bug cannot be triggered there, but we have not
checked.

Bug #9414.
Reported-by: Duffie Cooley <dcooley@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Don't output to in_port even if in_port is OFPP_LOCAL.
Aaron Rosen [Wed, 8 Feb 2012 18:59:41 +0000 (10:59 -0800)]
ofproto-dpif: Don't output to in_port even if in_port is OFPP_LOCAL.

Signed-off-by: Aaron Rosen <arosen@clemson.edu>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agosflow_agent: Use snprintf() in place of sprintf().
Ben Pfaff [Tue, 31 Jan 2012 17:39:28 +0000 (09:39 -0800)]
sflow_agent: Use snprintf() in place of sprintf().

These functions use sprintf() into a 1000-byte buffer.  It appears to me
that the strings they format are either short, fixed-length strings or the
output of strerror(), neither of which should ordinarily overflow.
However, using snprintf() cannot hurt.

Launchpad bug #914160.
Reported-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotable: Avoid segmentation fault when printing an empty cell in JSON format.
Ben Pfaff [Fri, 27 Jan 2012 20:37:45 +0000 (12:37 -0800)]
table: Avoid segmentation fault when printing an empty cell in JSON format.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Delete log files correctly when packages are purged.
Ben Pfaff [Thu, 19 Jan 2012 18:07:38 +0000 (10:07 -0800)]
debian: Delete log files correctly when packages are purged.

Debian Policy 10.8 says "Log files should be removed when the package is
purged (but not when it is only removed)," but the Open vSwitch packages
didn't properly implement this:

   - The openvswitch-brcompat and openvswitch-pki packages didn't delete
     their log files at purge time.

   - The openvswitch-switch package deleted all of the log files at purge
     time, even those owned by openvswitch-brcompat or openvswitch-pki.

This commit fixes both problems.

CC: 656448@bugs.debian.org
Reported-by: Andreas Beckmann <debian@abeckmann.de>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Correct GRE checksum offset.
Jesse Gross [Fri, 20 Jan 2012 23:12:38 +0000 (15:12 -0800)]
datapath: Correct GRE checksum offset.

If a statically defined GRE key is used with checksums then the
checksum will overwrite the key.  This is because the key is set
at header caching time and the checksum is set at packet processing
time and we don't update the offset on packet processing because
we don't do anything with the key.

Reported-by: Christos Argyropoulos <cargious@netmode.ntua.gr>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Enforce mutual exclusion between bridge and brcompat_mod.
Ben Pfaff [Tue, 17 Jan 2012 19:15:49 +0000 (11:15 -0800)]
datapath: Enforce mutual exclusion between bridge and brcompat_mod.

In kernels 2.6.36, Open vSwitch can (and does) safely coexist with the
Linux bridge module, but it does not make sense to load both bridge and
brcompat_mod at the same time.  Until now, nothing has prevented both from
loading; when they both load, confusion (at best) results.  This fixes
the problem by enforcing mutual exclusion.

Bug #9226.
Launchpad bug #917309.
Reported-by: Rogério Vinhal Nunes
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agomultipath: Correctly calculate number of required destination bits.
Ben Pfaff [Tue, 27 Dec 2011 21:37:43 +0000 (13:37 -0800)]
multipath: Correctly calculate number of required destination bits.

The previous calculation was wrong when n_links was a power of 2.

Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Use correct ethernet addr len.
Pravin B Shelar [Sat, 12 Nov 2011 00:09:20 +0000 (16:09 -0800)]
datapath: Use correct ethernet addr len.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Fix multipart datapath dumps.
Ben Pfaff [Wed, 11 Jan 2012 17:58:17 +0000 (09:58 -0800)]
datapath: Fix multipart datapath dumps.

The logic to split up the list of datapaths into multiple Netlink messages
was simply wrong, causing the list to be terminated after the first part.
Only about the first 50 datapaths would be dumped.  This fixes the
problem.

Bug #9124.
Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agobundle: Fix returned error code in one bundle_check() corner case.
Ben Pfaff [Tue, 27 Dec 2011 23:44:41 +0000 (15:44 -0800)]
bundle: Fix returned error code in one bundle_check() corner case.

In C, the || operator yields 0 or 1, not (as in some other languages) the
value of its first nonzero operand.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agopacket: Match userspace and kernel definition of ICMP header.
Jesse Gross [Tue, 27 Dec 2011 01:33:03 +0000 (17:33 -0800)]
packet: Match userspace and kernel definition of ICMP header.

Current userspace considers an ICMP header to be 4 bytes consisting
of the type, code, and checksum.  The kernel considers it to be 8
bytes because it also counts the two data fields that contain
type-specific information (and are always present).  Since flow
extract will zero out headers that are not completely present this
means that an ICMP packet that has a header of 5-7 bytes will be
interpreted differently by userspace and kernel.  This fixes the
problem by adopting the kernel's version of the ICMP header in
userspace.

Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agoNEWS: Fix typo in entry for 1.3.0.
Ben Pfaff [Wed, 21 Dec 2011 19:01:45 +0000 (11:01 -0800)]
NEWS: Fix typo in entry for 1.3.0.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Fix use-after-free for OFPP_CONTROLLER flows.
Ben Pfaff [Fri, 16 Dec 2011 18:09:30 +0000 (10:09 -0800)]
ofproto-dpif: Fix use-after-free for OFPP_CONTROLLER flows.

When a flow consists solely of an output to OFPP_CONTROLLER, we avoid a
round trip to the kernel and back by calling execute_controller_action()
from handle_flow_miss().  However, execute_controller_action() frees the
packet passed in.  This is dangerous, because the packet and the upcall
key are in the same block of malloc()'d memory, as the comment on struct
dpif_upcall says:

/* A packet passed up from the datapath to userspace.
 *
 * If 'key' or 'actions' is nonnull, then it points into data owned by
 * 'packet', so their memory cannot be freed separately.  (This is hardly a
 * great way to do things but it works out OK for the dpif providers and
 * clients that exist so far.)
 */

Thus, we get a use-after-free later on in handle_flow_miss() and eventually
a double free.

This fixes the problem by making execute_controller_action() clone the
packet in this case.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agobridge: Enable support for access and native VLAN ports on bonds.
Ben Pfaff [Mon, 12 Dec 2011 22:44:23 +0000 (14:44 -0800)]
bridge: Enable support for access and native VLAN ports on bonds.

Since Open vSwitch's inception we've disabled the use of bonds as access
ports, for no particularly good reason.  This also unintentionally
prevented bonds from being used as native VLAN ports.

This commit removes the code that prevented using bonds these ways

Reported-and-tested-by: "Michael A. Collins" <mike.a.collins@ark-net.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Consistently use American spelling of "license" in copyright.in.
Ben Pfaff [Mon, 12 Dec 2011 18:32:44 +0000 (10:32 -0800)]
debian: Consistently use American spelling of "license" in copyright.in.

Consistent spelling may make searches easier.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Correct licensing information for user/kernel shared header files.
Ben Pfaff [Mon, 12 Dec 2011 17:37:34 +0000 (09:37 -0800)]
debian: Correct licensing information for user/kernel shared header files.

The intent is to license all shared user/kernel header files under both
GPLv2 and Apache v2.  The license statement here said GPLv3 instead of
GPLv2, so this commit fixes that problem.

Also, include/openvswitch used to be where all the shared user/kernel
header files were located, but this is no longer true, and now there is a
userspace-only header file also in include/openvswitch, so this commit now
lists all of the user/kernel header files explicitly.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Add sFlow license information and text to copyright.in.
Ben Pfaff [Mon, 12 Dec 2011 17:42:09 +0000 (09:42 -0800)]
debian: Add sFlow license information and text to copyright.in.

sFlow licensing information was omitted from debian/copyright due to an
oversight.  This commit adds it.

Reported-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agosFlow: add Sun Industry Standards Source License 1.1 as licensing option
Neil McKee [Sat, 10 Dec 2011 00:56:32 +0000 (16:56 -0800)]
sFlow: add Sun Industry Standards Source License 1.1 as licensing option

The sFlow License was not on the list for the Fedora Project,  but the
Sun Industry Standards Source License 1.1 was (and it has the right
properties).  So this patch includes it as a licensing option in the
relevant places (COPYING and the lib/sflow* sources).   Let me know
if this looks OK or not.

Signed-off-by: Neil McKee <neil.mckee@inmon.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Chris Wright <chrisw@sous-sol.org>
12 years agoFinal changes for 1.3.0 release. v1.3.0
Justin Pettit [Fri, 9 Dec 2011 18:51:09 +0000 (10:51 -0800)]
Final changes for 1.3.0 release.

12 years agosocket-util: Correctly return negative values for errors.
Ben Pfaff [Tue, 6 Dec 2011 23:55:22 +0000 (15:55 -0800)]
socket-util: Correctly return negative values for errors.

The comment on this function says that negative values indicate errors, and
the callers assume that too, but in fact it was returning positive errno
values, which are indistinguishable from valid fd numbers.

It really seems to me that this should have been found pretty quickly in
the field, since stream-tcp and stream-ssl both use inet_open_passive to
implement their passive listeners.  I'm surprised that no one has reported
it.

12 years agodatapath: small potential memory leak in ovs_vport_alloc()
Dan Carpenter [Tue, 6 Dec 2011 19:08:25 +0000 (11:08 -0800)]
datapath: small potential memory leak in ovs_vport_alloc()

We're unlikely to hit this leak, but the static checkers complain if we
don't take care of it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agoxenserver: Reduce number of xapi DB calls in plugin
Rob Hoes [Mon, 5 Dec 2011 14:43:12 +0000 (14:43 +0000)]
xenserver: Reduce number of xapi DB calls in plugin

When there are lots of PIFs in a XenServer/XCP pool, for example when
there are many VLANs configured on the pool, operations such as
PIF.get_all and loops over all PIFs which include database operations,
are very inefficient when executed on a pool slave, and should be
avoided as much as possible. This patch reduces the number of database
calls in the update function of the openvswitch-cfg-update xapi plugin.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Acked-by: Dominic Curran <Dominic.curran@citrix.com>
12 years agoovs-vlan-bugs: Document driver bug with priority tagged packets.
Ben Pfaff [Mon, 28 Nov 2011 21:49:12 +0000 (13:49 -0800)]
ovs-vlan-bugs: Document driver bug with priority tagged packets.

Reported-by: Jesse Gross <jesse@nicira.com>
12 years agoINSTALL.XenServer: Update instructions.
Ben Pfaff [Wed, 30 Nov 2011 20:54:03 +0000 (12:54 -0800)]
INSTALL.XenServer: Update instructions.

The instructions hadn't been properly updated to match current XenServer
releases.

Reported-by: Ramana Reddy <gtvrreddy@gmail.com>
12 years agolearn: Avoid 1-byte buffer underrun in learn_format().
Ben Pfaff [Thu, 1 Dec 2011 16:33:55 +0000 (08:33 -0800)]
learn: Avoid 1-byte buffer underrun in learn_format().

Reported-and-tested-by: Jari Sundell <sundell.software@gmail.com>
12 years agobridge: Honor lacp-system-id other_config setting.
Ethan Jackson [Wed, 30 Nov 2011 03:03:52 +0000 (19:03 -0800)]
bridge: Honor lacp-system-id other_config setting.

The bridge code was completely ignoring the lacp-system-id setting.

Future patches will add tests which would have caught this issue.

Bug #8516.

12 years agobridge: Configure datapath ID earlier.
Ben Pfaff [Wed, 30 Nov 2011 20:09:35 +0000 (12:09 -0800)]
bridge: Configure datapath ID earlier.

The design intent is for LACP ports to use the datapath ID as the default
system ID when none is specifically configured.  However, the datapath ID
is not available that early.  This commit makes it available earlier.

This commit does not fix another bug that prevents the LACP system ID from
being set properly (nothing sets it at all, in fact, so it always uses 0).

Build and unit tested only.

12 years agomirroring: Use more generic terms for mirroring.
Justin Pettit [Wed, 23 Nov 2011 07:50:59 +0000 (23:50 -0800)]
mirroring: Use more generic terms for mirroring.

12 years agodaemon: Better log when fork child dies early from signals.
Ben Pfaff [Wed, 23 Nov 2011 20:15:42 +0000 (12:15 -0800)]
daemon: Better log when fork child dies early from signals.

On one machine, "/etc/init.d/openvswitch-switch start" failed to start
with:

   ovs-vswitchd: fork child failed to signal startup (Success)
   Starting ovs-vswitchd ... failed!

"strace" revealed that the fork child was actually segfaulting, but the
message output didn't indicate that in any way.  This commit fixes the
log message (but not the segfault itself).

Reported-by: Michael Hu <mhu@nicira.com>
Bug #8457.

12 years agoofproto: Add "fast path".
Ben Pfaff [Mon, 28 Nov 2011 18:35:15 +0000 (10:35 -0800)]
ofproto: Add "fast path".

The key to getting good performance on the netperf CRR test seems to be to
handle the first packet of each new flow as quickly as possible.  Until
now, we've only had one opportunity to do that on each trip through the
main poll loop.  One way to improve would be to make that poll loop
circulate more quickly.  My experiments show, however, that even just
commenting out the slower parts of the poll loop yield minimal improvement.

This commit takes another approach.  Instead of making the poll loop
overall faster, it invokes the performance-critical parts of it more than
once during each poll loop.

My measurements show that this commit improves netperf CRR performance by
24% versus the previous commit, for an overall improvement of 87% versus
the baseline just before the commit that removed the poll_fd_woke().  With
this commit, ovs-benchmark performance has also improved by 13% overall
since that baseline.

12 years agoofproto-dpif: Process multiple batches of upcalls in a single poll loop.
Ben Pfaff [Fri, 11 Nov 2011 00:42:51 +0000 (16:42 -0800)]
ofproto-dpif: Process multiple batches of upcalls in a single poll loop.

This yields a 27% improvement in netperf CRR results in my tests
versus the previous commit, which is a 52% improvement versus
the baseline from just before the poll_fd_woke() optimization was
removed.

12 years agodpif-linux: Use "epoll" instead of poll().
Ben Pfaff [Tue, 22 Nov 2011 17:25:32 +0000 (09:25 -0800)]
dpif-linux: Use "epoll" instead of poll().

epoll appears to be much more efficient than poll() at least for
static file descriptor sets.  I can't otherwise explain why this
patch increases netperf CRR performance by 20% above the previous
commit, which is also about a 19% overall improvement versus
the baseline from before the poll_fd_woke() optimization was
removed.

12 years agodpif-linux: Use poll() internally in dpif_linux_recv().
Ben Pfaff [Mon, 28 Nov 2011 17:29:18 +0000 (09:29 -0800)]
dpif-linux: Use poll() internally in dpif_linux_recv().

Using poll() internally in dpif_linux_recv(), instead of relying
on the results of the main loop poll() call, brings netperf CRR
performance back within 1% of par versus the code base before the
poll_fd_woke() optimizations were introduced.  It also increases
the ovs-benchmark results by about 5% versus that baseline, too.

My theory is that this is because the main loop takes long enough
that a significant number of packets can arrive during the main
loop itself, so this reduces the time before OVS gets to those
packets.

12 years agoRevert "poll-loop: Enable checking whether a FD caused a wakeup."
Ben Pfaff [Tue, 22 Nov 2011 19:05:53 +0000 (11:05 -0800)]
Revert "poll-loop: Enable checking whether a FD caused a wakeup."

This reverts commit 1e276d1a10539a8cd97d2ad63c073a9a43f0f1ef.
The poll_fd_woke() and nl_sock_woke() function added in that commit are
no longer used, so there is no reason to keep them in the tree.

12 years agodpif-linux: Remove poll_fd_woke() optimization from dpif_linux_recv().
Ben Pfaff [Thu, 10 Nov 2011 23:39:39 +0000 (15:39 -0800)]
dpif-linux: Remove poll_fd_woke() optimization from dpif_linux_recv().

This optimization on its own provided about 37% benefit against a
load of a single netperf CRR test, but at the same time it penalized
ovs-benchmark by about 11%.  We can get back the CRR performance
loss, and more, other ways, so the first step is to revert this
patch, temporarily accepting the performance loss.

12 years agoovsdb: Correctly implement conditions that include multiple clauses.
Ben Pfaff [Wed, 16 Nov 2011 22:38:52 +0000 (14:38 -0800)]
ovsdb: Correctly implement conditions that include multiple clauses.

Multiple-clause conditions in OVSDB operations with "where" clauses are
supposed to be conjunctions, that is, the condition is true only if every
clause is true.  In fact, the implementation only checked a single clause
(not necessarily the first one) and ignored the rest.  This fixes the
problem and adds test coverage for multiple-clause conditions.

Reported-by: Shih-Hao Li <shli@nicira.com>
12 years agodocs: Always build ovs-vswitchd.conf.db.5 in srcdir.
Ben Pfaff [Fri, 11 Nov 2011 23:10:55 +0000 (15:10 -0800)]
docs: Always build ovs-vswitchd.conf.db.5 in srcdir.

Otherwise we build it in the build directory by default, which breaks the
Debian package build (unless we're working from a "make dist" created
tarball since that has ovs-vswitchd.conf.db.5 in the srcdir as part of
the distribution).

Reported-by: Ansis Atteka <aatteka@nicira.com>
Tested-by: Ansis Atteka <aatteka@nicira.com>
12 years agodebian: Fix build failure installing ovs-vswitchd.conf.db(5) manpage.
Ben Pfaff [Fri, 4 Nov 2011 20:53:44 +0000 (13:53 -0700)]
debian: Fix build failure installing ovs-vswitchd.conf.db(5) manpage.

ovs-vswitchd.conf.db is distributed so it's in the source directory not
the build directory.

This fixes a Debian package build failure introduced by commit 9840bdbd
"debian: Install ovs-vswitchd.conf.db(5) manpage."  I did test that commit
but the build failure didn't show up in my environment (probably I had a
stray file left over from development).

12 years agodebian: Install ovs-vswitchd.conf.db(5) manpage.
Ben Pfaff [Fri, 4 Nov 2011 16:57:50 +0000 (09:57 -0700)]
debian: Install ovs-vswitchd.conf.db(5) manpage.

This manpage wasn't getting installed.  This fixes it.

The --language=C option to dh_installman is necessary to keep that script
from thinking that the ".db" suffix indicates a translation into the "db"
language (which doesn't actually exist) and therefore installing it into
the wrong directory with the .db suffix stripped.

Bug #8138.
Reported-by: Ethan Jackson <ethan@nicira.com>
12 years agoDo not output priority tagged frames.
Ben Pfaff [Fri, 18 Nov 2011 00:00:20 +0000 (16:00 -0800)]
Do not output priority tagged frames.

Linux hosts (and probably others) tend to ignore priority-tagged frames, so
it's safest not to output them at all.

On "master" we've added a per-port setting for whether priority-tagged
frames may be output, but "master" and "branch-1.3" have diverged
significantly in how they handle port output, so it's much simpler to
port this simpler policy to "branch-1.3".

Reported-by: Michael Mao <mmao@nicira.com>
Bug #8320.

12 years agoflow: flow_extract() improperly parses IPv6 TOS bits.
Ethan Jackson [Wed, 16 Nov 2011 02:35:26 +0000 (18:35 -0800)]
flow: flow_extract() improperly parses IPv6 TOS bits.

This problem could cause userspace to automatically evict IPv6
flows from the datapath which had TOS bits set.

Bug #8323.

12 years agoofproto: Disable STP when unregistering a port.
Justin Pettit [Tue, 15 Nov 2011 09:33:08 +0000 (01:33 -0800)]
ofproto: Disable STP when unregistering a port.

If a port is removed when spanning tree was configured on it, then the
system may crash, since the STP library will try to send packets out a
now non-existent port.  This commit disables STP on ports when they are
destroyed.

12 years agostp: Fix tick remainder calculation.
Justin Pettit [Tue, 15 Nov 2011 08:20:09 +0000 (00:20 -0800)]
stp: Fix tick remainder calculation.

The spanning tree library keeps track of time to know how often it
should update its state and send out BPDUs.  OVS is able to track time
in milliseconds, but STP uses a coarser-grained count (256 ticks per
second).  To prevent losing milliseconds that didn't account for an
entire tick, the library keeps track of these remaining milliseconds.  A
bug miscalculated the remainder and made it too high, which caused the
library to think time was passing more quickly than it was.

This bug wasn't noticeable on a quiet system, since STP only asks to be
woken every second.  However, a system with a lot of activity would wake
OVS more frequently and have it call the subsystems' "run" functions.

Bug #8283

12 years agostp: Track BPDU tx and rx counts.
Justin Pettit [Mon, 14 Nov 2011 23:04:14 +0000 (15:04 -0800)]
stp: Track BPDU tx and rx counts.

When debugging spanning tree, it's useful to have counters about how
many BPDUs have been sent and received.  This commit keeps track of
these counters and stores them in a new "statistics" column of the Port
table.

Feature #8103

12 years agoofproto-dpif: Actually disable STP on port when disabling STP on port.
Justin Pettit [Wed, 9 Nov 2011 01:31:04 +0000 (17:31 -0800)]
ofproto-dpif: Actually disable STP on port when disabling STP on port.

When disabling STP on a port that has it enabled on the bridge, STP was
not actually being disabled on the port.  This commit directly calls the
update function in this situation.

Reported-by: Paul Ingram <paul@nicira.com>
12 years agobond: Only drop packets that indicate moves on SLB bonds.
Ben Pfaff [Fri, 28 Oct 2011 20:27:27 +0000 (13:27 -0700)]
bond: Only drop packets that indicate moves on SLB bonds.

SLB bonds, for important reasons, drop most incoming packets that indicate
that a MAC has moved to the bond from another port.  These reasons do not
apply to other types of bonds, but until now OVS has still dropped them.

This fixes the problem.  It changes behavior of active-backup bonds and
stable bonds, neither of which has the same problem as SLB.  Behavior of
SLB bonds and TCP bonds in SLB fallback mode is unaffected.

Bug #7928.

12 years agostream: Fix uninitialized values in stream_init().
Ben Pfaff [Wed, 2 Nov 2011 19:59:06 +0000 (12:59 -0700)]
stream: Fix uninitialized values in stream_init().

stream_init() didn't initialize the remote_ip, remote_port, local_ip, or
local_port members of the stream, so "unix" streams that don't have any of
those would get random values instead.

Reported-by: "Voravit T." <voravit@kth.se>
Reported-by: Jari Sundell <sundell.software@gmail.com>
12 years agonetdev-vport: Again allow "tap" devices to be added to bridges.
Ben Pfaff [Mon, 31 Oct 2011 17:54:30 +0000 (10:54 -0700)]
netdev-vport: Again allow "tap" devices to be added to bridges.

I did not check that tap devices otherwise work.  This at least allows
them to be part of a bridge again.

Reported-by: Janis Hamme <janis.hamme@student.kit.edu>
12 years agoovsdb-idl: Prevent occasional hang when multiple database clients race.
Ben Pfaff [Mon, 31 Oct 2011 16:15:14 +0000 (09:15 -0700)]
ovsdb-idl: Prevent occasional hang when multiple database clients race.

When a client of the IDL tries to commit a read-modify-write transaction
but the database has changed in the meantime, the IDL tells its client to
wait for the IDL to change and then try the transaction again by returning
TXN_TRY_AGAIN.  The "wait for the IDL to change" part is important because
there's no point in retrying the transaction before the IDL has received
the database updates (the transaction would fail in the same way all over
again).

However, the logic was incomplete: the database update can be received
*before* the reply to the transaction RPC (I think that in the current
ovsdb-server implementation this will always happen, in fact).  When this
happens, the right thing to do is to retry the transaction immediately;
if we wait, then we're waiting for an additional change to the database
that may never come, causing an indefinite hang.

This commit therefore breaks the "try again" IDL commit status code
into two, one that means "try again immediately" and another that means
"wait for a change then try again".  When an update is processed after a
transaction is committed but before the reply is received, the "try again
now" tells the IDL client not to wait for another database change before
retrying its transaction.

Bug #5980.
Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
Reproduced-by: Alex Yip <alex@nicira.com>
12 years agoofproto: Add OFPC_QUEUE_STATS to switch feature reply.
Ben Pfaff [Sat, 29 Oct 2011 17:08:42 +0000 (10:08 -0700)]
ofproto: Add OFPC_QUEUE_STATS to switch feature reply.

Open vSwitch has supported queue stats for a long time, but we forgot to
set the OFPC_QUEUE_STATS bit in the switch features reply to show that they
are supported.  This fixes it.

12 years agobundle: Parsing bug when using bracketed syntax.
Ethan Jackson [Thu, 27 Oct 2011 23:58:20 +0000 (16:58 -0700)]
bundle: Parsing bug when using bracketed syntax.

This patch fixes the issue and adds a test which would have caught
it.

Reported-by: Michael Mao <mmao@nicira.com>
Bug #8045.

12 years agotests: Fix intermittent failure in ovs-monitor-ipsec test.
Jesse Gross [Thu, 27 Oct 2011 04:14:46 +0000 (21:14 -0700)]
tests: Fix intermittent failure in ovs-monitor-ipsec test.

The ovs-monitor-ipsec test waits for a specific number of lines
of output before doing a comparison to the correct values.  However,
some copy and pasted code did not update the number of lines to
look for resulting in a race condition where the comparison could
happen before the script finished running.

12 years agovswitch: Don't update STP on synthetic ports.
Ethan Jackson [Wed, 26 Oct 2011 18:39:46 +0000 (11:39 -0700)]
vswitch: Don't update STP on synthetic ports.

This can cause ovs-vswitchd to crash.

Bug #8007.
Reported-by: Krishna Miriyala <krishna@nicira.com>
12 years agoDeclare the version as "1.3.0".
Justin Pettit [Tue, 25 Oct 2011 06:37:11 +0000 (23:37 -0700)]
Declare the version as "1.3.0".

12 years agodebian: Start ovs-monitor-ipsec after ovsdb running.
Justin Pettit [Mon, 24 Oct 2011 21:40:58 +0000 (14:40 -0700)]
debian: Start ovs-monitor-ipsec after ovsdb running.

ovs-monitor-ipsec uses the OVS database to get configuration, so don't
bother starting the daemon until it's up.

Debian recently switched to using the LSB fields in the header of init
scripts to allow dependency-based boots.  This is described in the
following page:

    http://wiki.debian.org/LSBInitScripts/DependencyBasedBoot

This commit makes use of those fields to get the ordering we want.

12 years agoofproto-dpif: Fix uninitialized struct member in xlate_actions().
Ben Pfaff [Mon, 24 Oct 2011 16:58:35 +0000 (09:58 -0700)]
ofproto-dpif: Fix uninitialized struct member in xlate_actions().

Commit 7257b535ab "Implement new fragment handling policy." moved around
a bunch of initialization code in xlate_actions() so that the assignment
to ctx->flow.tp_src and .tp_dst would not have to also assign to
ctx->base_flow.tp_src and .tp_dst.  However, this meant that the early-exit
"return" in the new switch statement exited without initializing a lot of
the context.  In particular 'may_set_up_flow' didn't get initialized, so
something the early-exit would produce a flow that couldn't be installed,
which wasn't the intent.

It seems that this optimization was a bad tradeoff, so this commit puts
all of the initialization up front and just assigns to both copies of the
tp_src and tp_dst members.

Fixes a nondeterministic "make check" failure in the VLAN handling test.

12 years agotest-openflowd: Remove.
Ben Pfaff [Mon, 24 Oct 2011 17:36:01 +0000 (10:36 -0700)]
test-openflowd: Remove.

Some users were still confused by its presence.

12 years agoofproto: Check for overlapping flows only in the target table.
Ben Pfaff [Wed, 19 Oct 2011 23:03:31 +0000 (16:03 -0700)]
ofproto: Check for overlapping flows only in the target table.

There's no reason to check for overlapping flows in table A if the flow
is going to be inserted into table B.

(I doubt anyone actually uses OFPFF_CHECK_OVERLAP though.)

12 years agoofproto-dpif: Fix htons() that should be ntohs().
Ben Pfaff [Mon, 24 Oct 2011 16:23:18 +0000 (09:23 -0700)]
ofproto-dpif: Fix htons() that should be ntohs().

Not a real bug since htons() and ntohs() do the same thing on all
interesting target platforms.

Found by sparse.

12 years agoovsdb-tool: Make "show-log" convert raw JSON to easier-to-read syntax.
Ben Pfaff [Thu, 6 Oct 2011 18:25:25 +0000 (11:25 -0700)]
ovsdb-tool: Make "show-log" convert raw JSON to easier-to-read syntax.

Now output that formerly looked like ["map", [["key1", "value1"], ["key2",
"value2"]]] is printed like {key1=value1, key2=value2}, which I find easier
to read.

12 years agoovsdb-tool: Add abbreviated UUIDs to "show-log" even when we have a name.
Ben Pfaff [Thu, 6 Oct 2011 18:23:54 +0000 (11:23 -0700)]
ovsdb-tool: Add abbreviated UUIDs to "show-log" even when we have a name.

The "show-log" command tries to give names to the rows to make it easier to
understand what's going on, but it's still important to see at least
partial UUIDs so that one can search the output for references to the rows
by UUID.

12 years agoDESIGN: Document multiple table support.
Ben Pfaff [Thu, 29 Sep 2011 18:34:03 +0000 (11:34 -0700)]
DESIGN: Document multiple table support.

Suggested-by: Justin Pettit <jpettit@nicira.com>
Suggested-by: Michael Mao <mmao@nicira.com>
12 years agoovs-bugtool: Improve how Open vSwitch log files are saved.
Ben Pfaff [Mon, 24 Oct 2011 16:14:12 +0000 (09:14 -0700)]
ovs-bugtool: Improve how Open vSwitch log files are saved.

This moves the OVS log files from the "network-status" capability, which
has a very small maximum size, to the "system-logs" capability, which is
much larger.  It ensures that the newest OVS log files are prioritized over
old versions of system log files (if we just added the OVS log files after
the existing file_output, then new OVS log files would only be included
*after* all archived system log files were added).

Bug #5443.

12 years agodatapath: Cleanup openvswitch.h formatting.
Jesse Gross [Sun, 23 Oct 2011 01:50:44 +0000 (18:50 -0700)]
datapath: Cleanup openvswitch.h formatting.

The userspace/kernel interface file had acquired a mixture of userspace
and kernel style, so this makes it use kernel style consistently.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Define constants for versions of GENL families.
Jesse Gross [Sun, 23 Oct 2011 01:22:18 +0000 (18:22 -0700)]
datapath: Define constants for versions of GENL families.

Currently we hard code the versions of our GENL families to 1 but it's
nicer to have symbolic constants.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-vswitchd: Add support for 802.1D STP.
Justin Pettit [Fri, 14 Oct 2011 16:48:17 +0000 (09:48 -0700)]
ovs-vswitchd: Add support for 802.1D STP.

Still alpha quality, since only tested for interoperability with Linux
bridge's STP implementation.

12 years agoofproto: Add function to set OpenFlow state and update controller.
Justin Pettit [Fri, 14 Oct 2011 22:45:14 +0000 (15:45 -0700)]
ofproto: Add function to set OpenFlow state and update controller.

This will be used in an upcoming commit.

12 years agoofproto: Mark 'ofproto' arg in is_mirror_output_bundle() as const.
Justin Pettit [Mon, 10 Oct 2011 23:44:28 +0000 (16:44 -0700)]
ofproto: Mark 'ofproto' arg in is_mirror_output_bundle() as const.

No changes are made to 'ofproto', so it's safe to mark the argument as
const.  This will be useful in a later commit.

12 years agoVarious bug fixes and cleanups to STP library.
Justin Pettit [Fri, 14 Oct 2011 16:48:43 +0000 (09:48 -0700)]
Various bug fixes and cleanups to STP library.

    - Don't apply endian conversions to flags, which are 8 bits.
    - Use #defines for default times for use outside library.
    - Clarify our behavior when in STP_DISABLED state.
    - Add "aux" member to STP port struct to be able to refer back to
      the owning port.
    - Define macros to print STP bridge and port ids.
    - New helper function to get port id.
    - New helper function to convert speed to cost.
    - New functions to describe current role of port.

12 years agoAdd back 802.1D Spanning Tree Protocol (STP) library code.
Justin Pettit [Tue, 20 Sep 2011 22:08:05 +0000 (15:08 -0700)]
Add back 802.1D Spanning Tree Protocol (STP) library code.

At one point, the OVS distribution contained an IEEE 802.1D Spanning
Tree Protocol (STP) library written by Ben Pfaff and based on the
802.1D-1998 reference code.  It was never integrated into ovs-vswitchd,
so it was removed as part of commit ba18611 (Remove vestigial support
for Spanning Tree Protocol.)

This commit reintroduces the library, cleans up a few spots, and makes
it build cleanly against new code.  A future commit will have
ovs-vswitchd use this library.

12 years agopackets.h: Fix STP destination MAC address.
Justin Pettit [Sat, 8 Oct 2011 01:24:12 +0000 (18:24 -0700)]
packets.h: Fix STP destination MAC address.

12 years agoofproto: Fix comment describing ofport_modified().
Justin Pettit [Fri, 14 Oct 2011 22:48:05 +0000 (15:48 -0700)]
ofproto: Fix comment describing ofport_modified().

12 years agoovs-vsctl: Fix small formatting error in man page.
Justin Pettit [Wed, 5 Oct 2011 07:13:56 +0000 (00:13 -0700)]
ovs-vsctl: Fix small formatting error in man page.

12 years agoofproto-dpif: Update bundle when OFPPC_NO_FLOOD changed.
Justin Pettit [Mon, 17 Oct 2011 17:27:35 +0000 (10:27 -0700)]
ofproto-dpif: Update bundle when OFPPC_NO_FLOOD changed.

When the OFPPC_NO_FLOOD flag is toggled on the port, the "floodable"
member of the bundle was not updated.  This would cause OFPP_NORMAL to
not include the proper ports when flooding.  With this commit,
OFPPC_NO_FLOOD changes will cause the floodable members to be
recalculated.

Found by inspection.

12 years agodatapath: Use kfree_skb() only on error paths.
Ben Pfaff [Fri, 21 Oct 2011 23:38:35 +0000 (16:38 -0700)]
datapath: Use kfree_skb() only on error paths.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>