openvswitch
12 years agodebian: Avoid unit test failure when doing "unofficial" builds.
Ben Pfaff [Fri, 9 Mar 2012 22:20:54 +0000 (14:20 -0800)]
debian: Avoid unit test failure when doing "unofficial" builds.

The configure option --with-build-number=0 is interpreted differently in
different places.  The configure script itself accepts 0 as an actual
build number and puts '#define BUILDNR "+build0"' into config.h.  The
code in python/automake.mk treats 0 as "no build number" and puts
'BUILDNR = ""' into version.py.

This commit avoids the problem by not passing 0 as a build number.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodoc: Fix typo in manpage.
Thomas Goirand [Fri, 9 Mar 2012 22:44:41 +0000 (14:44 -0800)]
doc: Fix typo in manpage.

Found by lintian.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Bump standards-version to 3.9.3.
Thomas Goirand [Fri, 9 Mar 2012 21:53:12 +0000 (13:53 -0800)]
debian: Bump standards-version to 3.9.3.

No other changes necessary.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Remove some useless files from the dkms pacakge.
Thomas Goirand [Fri, 9 Mar 2012 21:49:36 +0000 (13:49 -0800)]
debian: Remove some useless files from the dkms pacakge.

This commit removes useless files from the dkms package that caused
lintian warnings.

(Many of the other files in the dkms package are also useless but do not
cause lintian warnings so they are less important.)

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Clean .pyc files in "clean" target.
Thomas Goirand [Fri, 9 Mar 2012 21:46:18 +0000 (13:46 -0800)]
debian: Clean .pyc files in "clean" target.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Remove po-debconf build dependency.
Thomas Goirand [Fri, 9 Mar 2012 21:45:02 +0000 (13:45 -0800)]
debian: Remove po-debconf build dependency.

Open vSwitch no longer uses Debconf at all, for some time now.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Build-depend on python-all to pull in all Python versions.
Thomas Goirand [Fri, 9 Mar 2012 21:44:10 +0000 (13:44 -0800)]
debian: Build-depend on python-all to pull in all Python versions.

Open vSwitch should support all Python versions in the distribution.  This
is the way to do it.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Add missing ${python:Depends} to openvswitch-test package.
Thomas Goirand [Fri, 9 Mar 2012 21:41:59 +0000 (13:41 -0800)]
debian: Add missing ${python:Depends} to openvswitch-test package.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Improve long descriptions so as to better describe the packages.
Thomas Goirand [Fri, 9 Mar 2012 21:39:59 +0000 (13:39 -0800)]
debian: Improve long descriptions so as to better describe the packages.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Bump debhelper compat level to 8 and make build-depends consistent.
Thomas Goirand [Fri, 9 Mar 2012 21:30:26 +0000 (13:30 -0800)]
debian: Bump debhelper compat level to 8 and make build-depends consistent.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Add long descriptions for init scripts.
Thomas Goirand [Fri, 9 Mar 2012 21:26:42 +0000 (13:26 -0800)]
debian: Add long descriptions for init scripts.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Fix "make check" as non-root.
Ben Pfaff [Mon, 12 Mar 2012 16:48:51 +0000 (09:48 -0700)]
tests: Fix "make check" as non-root.

Without this change, these tests try to write to /var/run, which fails
unless "make check" is run as root.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-pki: Implement --version option.
Ben Pfaff [Sat, 10 Mar 2012 00:22:12 +0000 (16:22 -0800)]
ovs-pki: Implement --version option.

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-monitor-ipsec: Use all caps for global constants.
Justin Pettit [Sat, 10 Mar 2012 19:04:42 +0000 (11:04 -0800)]
ovs-monitor-ipsec: Use all caps for global constants.

The convention in Python is to use all caps for global constants.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agonetdev: Consistently use 'enum netdev_features'.
Ethan Jackson [Fri, 9 Mar 2012 21:53:22 +0000 (13:53 -0800)]
netdev: Consistently use 'enum netdev_features'.

Without this patch sparse gives me warnings.  At any rate, it's
cleaner to be consistent.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agonicira-ext: Increase the number of NXM registers to 8.
Ethan Jackson [Thu, 8 Mar 2012 22:44:54 +0000 (14:44 -0800)]
nicira-ext: Increase the number of NXM registers to 8.

Requested-by: Amar Padmanabhan <amar@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoidl: Convert python daemons to utilize SchemaHelper.
Ethan Jackson [Sat, 3 Mar 2012 01:50:59 +0000 (17:50 -0800)]
idl: Convert python daemons to utilize SchemaHelper.

The recently added SchemaHelper class significantly simplifies IDL
instantiation in Python.  This commit converts all users of the old
method to the new method, and removes support for the old method.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoovs-monitor-ipsec: Add unixctl support.
Ethan Jackson [Sat, 3 Mar 2012 02:33:48 +0000 (18:33 -0800)]
ovs-monitor-ipsec: Add unixctl support.

With this patch, users can query a running ovs-monitor-ipsec
daemon's version, or ask it to exit using ovs-appctl.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoovs-xapi-sync: Use unixctl to trigger cache flushes.
Ethan Jackson [Tue, 6 Mar 2012 19:12:19 +0000 (11:12 -0800)]
ovs-xapi-sync: Use unixctl to trigger cache flushes.

Typically Open vSwitch communicates with running processes using
unixctl.  This patch converts ovs-xapi-sync to the strategy for
consistency.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoovs-xapi-sync: Add unixctl support.
Ethan Jackson [Sat, 3 Mar 2012 01:18:35 +0000 (17:18 -0800)]
ovs-xapi-sync: Add unixctl support.

With this patch, users can query a running ovs-xapi-sync's version
or ask it to exit using ovs-appctl.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoovs-xapi-sync: Cache nicira-bridge-id in ovs-xapi-sync.
Ethan Jackson [Fri, 2 Mar 2012 23:24:32 +0000 (15:24 -0800)]
ovs-xapi-sync: Cache nicira-bridge-id in ovs-xapi-sync.

Communicating with xapi from Python can be quite expensive so it
makes sense to cache this data if convenient.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoovs-xapi-sync: Remove useless root_prefix global.
Ethan Jackson [Tue, 6 Mar 2012 19:16:38 +0000 (11:16 -0800)]
ovs-xapi-sync: Remove useless root_prefix global.

There's no reason for this variable to be global, or to exist at
all for that matter.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agodebian: Fix Debian build of modules via module-assistant.
Ben Pfaff [Fri, 9 Mar 2012 21:31:41 +0000 (13:31 -0800)]
debian: Fix Debian build of modules via module-assistant.

Fixes an error during module-assistant build step:

    install: cannot stat `openvswitch/datapath/linux/*_mod.ko': No such
    file or directory

This was (understandably) overlooked as part of commit 9b80f761be
(datapath: omit _mod from module names).

Acked-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev-linux: Cache error code from do_get_ifindex().
Pravin B Shelar [Fri, 9 Mar 2012 21:00:29 +0000 (13:00 -0800)]
netdev-linux: Cache error code from do_get_ifindex().

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agonetdev-linux: Cache error code from get-features.
Pravin B Shelar [Fri, 9 Mar 2012 20:59:58 +0000 (12:59 -0800)]
netdev-linux: Cache error code from get-features.

Following patch adds support for caching error code from ETHTOOL_GSET
call. Since internal device is virtual device device feature does not
make much sense, so netdev_get_features op is removed for internal
devices.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agonetdev-linux: Cache error code from set-policing.
Pravin B Shelar [Fri, 9 Mar 2012 20:59:27 +0000 (12:59 -0800)]
netdev-linux: Cache error code from set-policing.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agonetdev-linux: Cache error code from ether-addr ioctl.
Pravin B Shelar [Fri, 9 Mar 2012 20:58:10 +0000 (12:58 -0800)]
netdev-linux: Cache error code from ether-addr ioctl.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agonetdev-linux: Cache error code from mtu ioctl.
Pravin B Shelar [Fri, 9 Mar 2012 20:57:48 +0000 (12:57 -0800)]
netdev-linux: Cache error code from mtu ioctl.

netdev linux devices uses mtu ioctl to get and set MTU for a device.
By caching error code from ioctl we can reduce number of ioctl calls
for device which is unregistered from system.
netdev notification is used to update mtu which saves get-mtu-ioctl.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agonetdev-linux: Cache drv-info for net device.
Pravin B Shelar [Fri, 9 Mar 2012 20:57:13 +0000 (12:57 -0800)]
netdev-linux: Cache drv-info for net device.

Netdev-linux calls ETHTOOL_GDRVINFO on every netdev_linux_get_status()
which is not optimal as drv-info does not change for given device.
So following patch changes netdev_linux_get_status() to read drv-info at
device initialization and cache it.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agodatapath: omit _mod from module names
Chris Wright [Fri, 9 Mar 2012 17:55:45 +0000 (09:55 -0800)]
datapath: omit _mod from module names

This renames the datapath modules:

  openvswitch_mod -> openvswitch
  brcompat_mod -> brcompat

The first makes the module name consistent with upstream, and the latter
is just for internal consistency.  This makes tools, and documentation
refer to a common module name regardless if it's coming from upstream
linux or built from datapath/ as part of a local build.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Jesse Gross <jesse@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 agoRevert "ovs-monitor-ipsec: Detect correctly IPSEC configuration changes"
Ansis Atteka [Fri, 9 Mar 2012 02:34:15 +0000 (18:34 -0800)]
Revert "ovs-monitor-ipsec: Detect correctly IPSEC configuration changes"

This reverts commit e1870e82f5ea35d45d7358c2454e876122a02bfb.

Reverting due to a failing build test.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
12 years agoovs-monitor-ipsec: Detect correctly IPSEC configuration changes
Ansis Atteka [Fri, 9 Mar 2012 00:19:59 +0000 (16:19 -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 not present in new_interfaces dictionary.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
Reported-by: Niklas Andersson <nandersson@nicira.com>
12 years agoauthors: Fix text alignment.
Ethan Jackson [Thu, 8 Mar 2012 23:57:45 +0000 (15:57 -0800)]
authors: Fix text alignment.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agonetdev-linux: Use "read", not "recv", for tap devices.
Ben Pfaff [Thu, 8 Mar 2012 22:27:35 +0000 (14:27 -0800)]
netdev-linux: Use "read", not "recv", for tap devices.

"recv" only works for sockets, but tap devices aren't sockets.

Makes the userspace switch work again.

Reported-by: Ravi Kerur <Ravi.Kerur@telekom.com>
Reported-by: 胡靖飞 <hujingfei914@msn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: update linux/.gitignore
Chris Wright [Wed, 7 Mar 2012 20:19:04 +0000 (12:19 -0800)]
datapath: update linux/.gitignore

Remove a couple stale entries:
  brc_sysfs_* was renamed to dp_sysfs_* a few years ago

Add some new entries to ignore:
 # Untracked file:
 #   (use "git add <file>..." to include in what will be committed)
 # datapath/linux/exthdrs_core.c
 # datapath/linux/genl_exec.c
 #  datapath/linux/net_namespace.c
 #  datapath/linux/workqueue.c

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: rename brcompat.c to brcompat_main.c
Chris Wright [Wed, 7 Mar 2012 18:28:02 +0000 (10:28 -0800)]
datapath: rename brcompat.c to brcompat_main.c

This just makes it easier to subsequently rename the brcompat_mod module
to brcompat without introducing circular dependencies.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Jesse Gross <jesse@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 agoofproto-dpif: Log traces when resubmit depth is exceeded.
Ethan Jackson [Wed, 7 Mar 2012 00:51:44 +0000 (16:51 -0800)]
ofproto-dpif: Log traces when resubmit depth is exceeded.

It can be very difficult to debug xlate_actions() failures due to
excessive resubmit recursion.  In an attempt to make it easier,
this patch adds a (severely rate-limited) full ofproto/trace to the
logs.

Suggested-by: Alan Shieh <ashieh@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agogit: Update gitignore to include new hstamp suffix.
Ethan Jackson [Thu, 8 Mar 2012 01:12:58 +0000 (17:12 -0800)]
git: Update gitignore to include new hstamp suffix.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agotests: Suppress "role reply" that can appear in async message test.
Ben Pfaff [Thu, 8 Mar 2012 00:38:28 +0000 (16:38 -0800)]
tests: Suppress "role reply" that can appear in async message test.

Another race condition in this test, *sigh*.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agopython: Make build number format consistent with C.
Ethan Jackson [Wed, 7 Mar 2012 23:48:32 +0000 (15:48 -0800)]
python: Make build number format consistent with C.

The C code displays the build number as the empty string when 0,
and as +build<num> otherwise.  This commit updates version.py to be
consistent and tests that it is in the unit tests.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agostream-unix: Do not bind a name for client sockets.
Ben Pfaff [Mon, 27 Feb 2012 19:13:00 +0000 (11:13 -0800)]
stream-unix: Do not bind a name for client sockets.

There's no reason for a Unix domain client socket to bind a name.  I don't
know why we've always done that.  Stevens's "Unix Network Programming"
Unix domain socket client example doesn't do a bind.

Removes the 'unlink_path' parameter from new_fd_stream() since it is now
always passed as NULL.

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 agopython socket_util: Use correct fatal_signal function on error path.
Ben Pfaff [Wed, 7 Mar 2012 23:41:30 +0000 (15:41 -0800)]
python socket_util: Use correct fatal_signal function on error path.

The correct function to call here is "remove_file_to_unlink".  That is,
since the file has already been unlinked there is no need to keep it on
the list of files to unlink.

However, "unlink_file_now" simplifies the code, so we might as well use
that.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agopython socket_util: Don't try to unbind None bind_path.
Ben Pfaff [Wed, 7 Mar 2012 23:38:27 +0000 (15:38 -0800)]
python socket_util: Don't try to unbind None bind_path.

This bug is not exposed in the current tree, because no existing caller
passes None as bind_path.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev-linux: Fix build failure with old kernel headers.
Ben Pfaff [Wed, 7 Mar 2012 23:27:52 +0000 (15:27 -0800)]
netdev-linux: Fix build failure with old kernel headers.

The "speed_hi" member was only introduced in 2.6.27, so builds against
older kernel headers failed.

speed_hi is fully backward compatible with older kernels, because older
kernels always set it to 0, so we could easily introduce a compatibility
layer here, but in fact I don't know of any OVS users who have interfaces
faster than 65.5 Gb/s, so it's hardly urgent.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolacp: Notify LACP module when carrier changes.
Ethan Jackson [Fri, 2 Mar 2012 20:24:55 +0000 (12:24 -0800)]
lacp: Notify LACP module when carrier changes.

Without this patch, when a slave's carrier goes down, the LACP
module (as evidenced by ovs-appctl lacp/show) would consider the
slave current until it hadn't received LACP PDUs for the requisite
amount of time.  It should instead, immediately mark the slave
expired.  This shouldn't actually affect the behavior of LACP bonds
because the bond module won't choose to send traffic out a slave
whose carrier is down.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoovs-ofctl: Make "barrier" output reproducible for testing.
Ben Pfaff [Wed, 7 Mar 2012 22:46:14 +0000 (14:46 -0800)]
ovs-ofctl: Make "barrier" output reproducible for testing.

The "ofproto - asynchronous message control" test had a race in which
the "send: OFPT_BARRIER_REQUEST" message could get printed in different
places because there was nothing to ensure that messages from the switch
were printed before messages sent to the switch, even though the actual
ordering of the messages was predictable.  This fixes the problem by not
printing a message at all when the barrier request is sent.

Bug #10049.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Fix checksum update for actions on UDP packets.
Jesse Gross [Tue, 6 Mar 2012 21:09:13 +0000 (13:09 -0800)]
datapath: Fix checksum update for actions on UDP packets.

When modifying IP addresses or ports on a UDP packet we don't
correctly follow the rules for unchecksummed packets.  This meant
that packets without a checksum can be given a incorrect new checksum
and packets with a checksum can become marked as being unchecksummed.
This fixes it to handle those requirements.

Bug #8937

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Convert *_SCHEMA macros to shell functions.
Ben Pfaff [Wed, 7 Mar 2012 22:17:45 +0000 (14:17 -0800)]
tests: Convert *_SCHEMA macros to shell functions.

This reduces tests/testsuite by about 70 kB, by collapsing a number of
macro expansions into just one copy in a shell function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Convert OVS_WAIT_* macros to shell functions.
Ben Pfaff [Mon, 13 Feb 2012 22:47:53 +0000 (14:47 -0800)]
tests: Convert OVS_WAIT_* macros to shell functions.

This reduces tests/testsuite by about 35 kB, by collapsing a number of
macro expansions into just one copy in a shell function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Convert interface-reconfigure macros to shell functions.
Ben Pfaff [Mon, 13 Feb 2012 22:30:27 +0000 (14:30 -0800)]
tests: Convert interface-reconfigure macros to shell functions.

This reduces tests/testsuite by about 50 kB, by collapsing a number of
macro expansions into just one copy in a shell function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Honor dp_ifindex, when specified, for vport lookup by name.
Ben Pfaff [Wed, 7 Mar 2012 22:11:09 +0000 (14:11 -0800)]
datapath: Honor dp_ifindex, when specified, for vport lookup by name.

When OVS_VPORT_ATTR_NAME is specified and dp_ifindex is nonzero, the
logical behavior would be for the vport name lookup scope to be limited
to the specified datapath, but in fact the dp_ifindex value was ignored.
This commit causes the search scope to be honored.

Bug #9889.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoAbstract everything that uses ofp_phy_port, add OF1.1 support.
Ben Pfaff [Thu, 16 Feb 2012 00:33:04 +0000 (16:33 -0800)]
Abstract everything that uses ofp_phy_port, add OF1.1 support.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoopenflow: Split OFPAT_* into OFPAT10_* and OFPAT11_*.
Ben Pfaff [Thu, 16 Feb 2012 00:22:18 +0000 (16:22 -0800)]
openflow: Split OFPAT_* into OFPAT10_* and OFPAT11_*.

An upcoming commit will start referring to OpenFlow 1.1 actions, which are
renumbered relative to OpenFlow 1.0 actions, so this commit prepares by
changing all the existing uses of OFPAT_* to instead use OFPAT10_*.

This commit also introduces the OFPAT11_* constants.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev: Abstract "features" interface away from OpenFlow 1.0.
Ben Pfaff [Wed, 15 Feb 2012 22:23:38 +0000 (14:23 -0800)]
netdev: Abstract "features" interface away from OpenFlow 1.0.

netdev_get_features() and other functions have always used OpenFlow 1.0
"enum ofp_port_features" bits as part of their interface.  This commit
switches over to using an internally defined interface that is not tied
directly to any OpenFlow version, making evolution of each side of the
interface easier in the future.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: Don't decode some OF1.1 messages as OF1.0 stats messages.
Ben Pfaff [Wed, 15 Feb 2012 23:39:41 +0000 (15:39 -0800)]
ofp-util: Don't decode some OF1.1 messages as OF1.0 stats messages.

This bug was not yet visible because none of the messages that would be
misinterpreted were yet implemented.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoBreak OFPT_* constants into common value and 1.0- and 1.1-specific values.
Ben Pfaff [Wed, 15 Feb 2012 00:58:39 +0000 (16:58 -0800)]
Break OFPT_* constants into common value and 1.0- and 1.1-specific values.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: Add functions for working with OpenFlow 1.1 port numbers.
Ben Pfaff [Wed, 15 Feb 2012 01:08:03 +0000 (17:08 -0800)]
ofp-util: Add functions for working with OpenFlow 1.1 port numbers.

OpenFlow 1.1 extends port numbers to 32 bits.  Initially we plan to support
only port numbers in the 16-bit range in Open vSwitch.  However the OF1.1
reserved ports have high-valued fixed numbers that require translation to
high fixed values in the 16-bit range for OF1.0.  These new functions
provide this translation.

Nothing uses these functions yet.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-print: Print OpenFlow version number of message, unless it's 1.0.
Ben Pfaff [Wed, 15 Feb 2012 23:28:25 +0000 (15:28 -0800)]
ofp-print: Print OpenFlow version number of message, unless it's 1.0.

The version number is an important part of the OpenFlow message's
meaning, so include it.  Version 1.0 is grandfathered in so existing output
parsers don't have to change.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoBegin breaking openflow-1.0.h into common and version-specific definitions.
Ben Pfaff [Wed, 7 Dec 2011 06:33:49 +0000 (22:33 -0800)]
Begin breaking openflow-1.0.h into common and version-specific definitions.

The intention is that, as each OpenFlow 1.1 and 1.2 feature is added to Open
vSwitch, the corresponding protocol definitions will be broken up this way:

  - Definitions that are the same in OF1.0 and OF1.1 will retain the "OFP"
    or "ofp" prefix and move to openflow-common.h.

  - Definitions that are specific to OF1.0 will be renamed with an "OFP10"
    or "ofp10" prefix and stay in openflow-1.0.h.

  - Definitions that are specific to OF1.1 or to OF1.1 and OF1.2 will be
    renamed with an "OFP11" or "ofp11" prefix and move to openflow-1.1.h.

  - Definitions that are specific to OF1.2 will be renamed with an "OFP12"
    or "ofp12" prefix and move to openflow-1.2.h.

This commit starts this process with some basic OpenFlow definitions.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoMove content of openflow.h into openflow-1.0.h.
Ben Pfaff [Mon, 24 Oct 2011 01:16:03 +0000 (18:16 -0700)]
Move content of openflow.h into openflow-1.0.h.

This prepares for a gradual introduction of definitions from OpenFlow
1.1 and later, by making it clearer that the current definitions are
specific to OpenFlow 1.0.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoIntroduce ofputil_protocol, to abstract the protocol in use on a connection.
Ben Pfaff [Fri, 10 Feb 2012 21:30:23 +0000 (13:30 -0800)]
Introduce ofputil_protocol, to abstract the protocol in use on a connection.

Open vSwitch already handles a few different protocol variations, but it
does so in a nonuniform manner:

  - OpenFlow 1.0 and NXM flow formats are distinguished using the NXFF_*
    constant values from nicira-ext.h.

  - The "flow_mod_table_id" feature setting is maintained in ofproto as
    part of an OpenFlow connection's (ofconn's) state.

There's no way to easily communicate this state among components.  It's
not much of a problem yet, but as more protocol support is added it seems
better to have an abstract, uniform way to represent protocol versions and
variants.  This commit implements that by introducing a new type
"enum ofputil_protocol".  Each ofputil_protocol value represents a variant
of a protocol version.  Each value is a separate bit, so a single enum
can also represent a set of protocols, which is often useful as well.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-print: Remove unused function ofp_message_type_to_string().
Ben Pfaff [Wed, 15 Feb 2012 23:13:41 +0000 (15:13 -0800)]
ofp-print: Remove unused function ofp_message_type_to_string().

ofputil_msg_type_name() is a better interface.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ofctl: Avoid segfault upon receive error for "monitor", "snoop".
Ben Pfaff [Wed, 7 Mar 2012 21:52:55 +0000 (13:52 -0800)]
ovs-ofctl: Avoid segfault upon receive error for "monitor", "snoop".

Bug #10062.
Reported-by: James Schmidt <jschmidt@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agounixctl: Timeout unit tests instead of hanging.
Ethan Jackson [Wed, 7 Mar 2012 00:10:46 +0000 (16:10 -0800)]
unixctl: Timeout unit tests instead of hanging.

We've seen some unixctl tests hang indefinitely which makes them
difficult to debug.  ovs-appctl and appctl.py calls to timeout
instead.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agounixctl: Re-enable unit tests.
Ethan Jackson [Tue, 6 Mar 2012 21:20:06 +0000 (13:20 -0800)]
unixctl: Re-enable unit tests.

The transient failure in the unixctl unit tests likely still
exists, but we've added additional instrumentation to our build
tools to help us debug it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoxenserver: Add vm-id to the external_ids.
Gurucharan Shetty [Mon, 5 Mar 2012 18:20:00 +0000 (10:20 -0800)]
xenserver: Add vm-id to the external_ids.

The vm-id external id in the interface table will uniquely identify a VM
that is connected to a bridge through that interface.

In xenserver, this will have the same value as the external id - xs-vm-uuid
and can be overridden by setting the nicira-vm-id key in the other_config
field of VM record of XAPI.

Bug #10020.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
12 years agonetdev-linux: Make netdev_set_policing coverage counter consistent with other counters.
Pravin B Shelar [Mon, 5 Mar 2012 23:42:41 +0000 (15:42 -0800)]
netdev-linux: Make netdev_set_policing coverage counter consistent with other counters.

Most of coverage counters in netdev-linux are counting actual system
calls rather than reads from cached data.
Following patch fixes it by incrementing it after cache check.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agovswitchd: Document behavior of 802.1p priorities with VLAN splinters.
Ben Pfaff [Mon, 5 Mar 2012 17:52:36 +0000 (09:52 -0800)]
vswitchd: Document behavior of 802.1p priorities with VLAN splinters.

Reported-by: likunyun <kunyunli@hotmail.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 agounixctl: Skip Python unixctl tests.
Ethan Jackson [Sat, 3 Mar 2012 03:05:29 +0000 (19:05 -0800)]
unixctl: Skip Python unixctl tests.

The Python unixctl tests introduced a transient build failure that
can't be debugged until more information is collected.  Skipping
these tests for now until it's possible to debug them.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoconnmgr: Make "enable-async-messages" work for primary controllers too.
Ben Pfaff [Fri, 2 Mar 2012 22:09:58 +0000 (14:09 -0800)]
connmgr: Make "enable-async-messages" work for primary controllers too.

I only tested this feature with service controllers.

Bug #9964.
Reported-by: James Schmidt <jschmidt@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 agopython: Implement new SchemaHelper class.
Ethan Jackson [Thu, 1 Mar 2012 02:24:07 +0000 (18:24 -0800)]
python: Implement new SchemaHelper class.

The new SchemaHelper class makes it easier to prune database
schemas intended for the Python IDL.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agopython: Port unixctl to Python.
Ethan Jackson [Fri, 17 Feb 2012 03:15:01 +0000 (19:15 -0800)]
python: Port unixctl to Python.

Many of the currently implemented Python daemons, and likely many
daemons to be implemented in the future, could benefit from unixctl
support even if only to implement "exit" and "version" commands.
This patch implements unixctl in Python.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agopython: Add ovs_error() helper function to Python.
Ethan Jackson [Thu, 1 Mar 2012 01:20:14 +0000 (17:20 -0800)]
python: Add ovs_error() helper function to Python.

The ovs_error() and ovs_fatal() helper functions are useful enough
to be ported to Python.  A user will be added in a future commit.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agopython: New method to retrieve OVS version at runtime.
Ethan Jackson [Thu, 1 Mar 2012 01:20:03 +0000 (17:20 -0800)]
python: New method to retrieve OVS version at runtime.

Version information is typically fairly useful when debugging Open
vSwitch.  This patch adds a new version.py module which python code
can use to report its version to callers.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agotests: Add code coverage for Python.
Ethan Jackson [Wed, 29 Feb 2012 00:28:08 +0000 (16:28 -0800)]
tests: Add code coverage for Python.

Adds support for Ned Batchelder's code coverage tool to the
test suite. http://nedbatchelder.com/code/coverage/

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agojsonrpc.py: Don't swallow errors in transact_block().
Ethan Jackson [Fri, 17 Feb 2012 04:26:35 +0000 (20:26 -0800)]
jsonrpc.py: Don't swallow errors in transact_block().

If a server returned an error in response to a request,
transact_block() would ignore it.

Signed-off-by: Ethan Jackson <ethan@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 agoovsdbmonitor: add .desktop file
Chris Wright [Fri, 2 Mar 2012 05:13:36 +0000 (21:13 -0800)]
ovsdbmonitor: add .desktop file

Needed for Fedora builds, might as well share it.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoxenserver: Fix rule for generating xenserver/openvswitch-xen.spec.
Ben Pfaff [Fri, 2 Mar 2012 17:19:21 +0000 (09:19 -0800)]
xenserver: Fix rule for generating xenserver/openvswitch-xen.spec.

Commands in Makefiles have to begin with a hard tab, otherwise they are
ignored, which is what happened here.

Fixes "make distcheck".

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 agodebian: Move PKI directory to FHS-compliant location.
Ben Pfaff [Fri, 2 Mar 2012 00:38:27 +0000 (16:38 -0800)]
debian: Move PKI directory to FHS-compliant location.

The PKI directory is mutable state, so it should be in /var, not in /usr.
This commit changes its location and, on systems upgraded from earlier
versions, moves the existing PKI and leaves behind a symlink.

CC: 661090@bugs.debian.org
Reported-by: Andreas Beckmann <debian@abeckmann.de>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovsdbmonitor: move to its own data directory
Chris Wright [Thu, 1 Mar 2012 23:25:14 +0000 (15:25 -0800)]
ovsdbmonitor: move to its own data directory

It doesn't have dependencies on any packages that would install into
pkgdatadir, and for Fedora it makes directory ownership work better.
So move ovsdbmonitor python internals to its own data directory.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Ben Pfaff <blp@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 agonetdev-linux: Fix stats for ovs internal device.
Pravin B Shelar [Wed, 29 Feb 2012 22:09:05 +0000 (14:09 -0800)]
netdev-linux: Fix stats for ovs internal device.

There is no need to retrieve linux system stats for internal devices
as all relevant stats for virtual device like internal device are
already reported by OVS over vport-stats. As a result it also fixes
error stats for internal-devices as they are not counted twice.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agobridge: Drop log message when a QoS record lacks a default queue.
Ben Pfaff [Tue, 28 Feb 2012 20:53:13 +0000 (12:53 -0800)]
bridge: Drop log message when a QoS record lacks a default queue.

Apparently we're planning to use this configuration regularly at Nicira.

Bug #7413.
Requested-by: Bryan Fulton <bryan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotimeval: Add "time/stop" unixctl command, for use in unit tests.
Ben Pfaff [Tue, 28 Feb 2012 22:57:13 +0000 (14:57 -0800)]
timeval: Add "time/stop" unixctl command, for use in unit tests.

Although we try to avoid it, some unit tests are necessarily
timing-sensitive.  The new "time/stop" command that this commit adds should
help with that, by preventing time from advancing from the viewpoint of
the OVS "timeval" functions except when "time/warp" explicitly advances
the current time.  This should allow the unit tests that need it to become
reproducible regardless of the speed at which the tests run.

This commit adds one unit of "time/stop" to the unit test suite, in the one
timing-sensitive test of which I am currently aware.

Bug #9782.
Reported-by: Tim Chen <tchen@nicira.com>
Signed-off-by: Ben Pfaff <blp@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 agoUse struct nicira_header nxh in struct nx_set_flow_format
Simon Horman [Tue, 28 Feb 2012 00:08:43 +0000 (09:08 +0900)]
Use struct nicira_header nxh in struct nx_set_flow_format

This makes struct nx_set_flow_format consistent with
other similar structures.

Acked-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agounixctl: New JSON RPC back-end.
Ethan Jackson [Wed, 15 Feb 2012 04:53:59 +0000 (20:53 -0800)]
unixctl: New JSON RPC back-end.

The unixctl library had used the vde2 management protocol since the
early days of Open vSwitch.  As Open vSwitch has matured, several
Python daemons have been added to the code base which would benefit
from a unixctl implementations.  Instead of implementing the old
unixctl protocol in Python, this patch changes unixctl to use JSON
RPC for which we already have an implementation in both Python and
C.  Future patches will need to implement a unixctl library in
Python on top of JSON RPC.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agojsonrpc: Don't swallow errors in jsonrpc_transact_block().
Ethan Jackson [Thu, 16 Feb 2012 03:38:27 +0000 (19:38 -0800)]
jsonrpc: Don't swallow errors in jsonrpc_transact_block().

If a server returned an error in response to a request,
jsonrpc_transact_block() would ignore it.  This patch changes the
behavior and updates its callers to gracefully handle the
possibility.

Signed-off-by: Ethan Jackson <ethan@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 agoAdd ability to direct "packet-in"s to particular controllers.
Ben Pfaff [Thu, 9 Feb 2012 22:17:33 +0000 (14:17 -0800)]
Add ability to direct "packet-in"s to particular controllers.

Nicira's controllers are somewhat heterogeneous, so that particular
"packet-in" messages should be directed to particular controllers.  This
new Nicira extension action allows designating a controller or controllers
to receive the "packet-in" using a 16-bit integer ID.

The new NXAST_CONTROLLER action also specifies the "reason" code to include
in the "packet-in" message.  This is particularly useful for simulating a
"no-match" "packet-in" using a rule.

Feature #8946.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: New functions for string versions of ofp_packet_in_reason.
Ben Pfaff [Tue, 7 Feb 2012 22:46:34 +0000 (14:46 -0800)]
ofp-util: New functions for string versions of ofp_packet_in_reason.

Upcoming commits add a user for ofputil_packet_in_reason_from_string()
and more users for ofputil_packet_in_reason_to_string().

Signed-off-by: Ben Pfaff <blp@nicira.com>