openvswitch
13 years agoovs-kill: Remove.
Ben Pfaff [Wed, 23 Feb 2011 20:56:31 +0000 (12:56 -0800)]
ovs-kill: Remove.

This utility isn't used anywhere (except INSTALL.Linux), so remove it.

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

13 years agoovs-vsctl: Simplify parse_column_key_value().
Ben Pfaff [Wed, 23 Feb 2011 20:20:38 +0000 (12:20 -0800)]
ovs-vsctl: Simplify parse_column_key_value().

Coverity pointed out some inconsistencies on tests for whether columnp and
keyp were nonnull.  These tests were, at best, confusing, but in fact every
caller always passed nonnull for both parameters, so this commit drops all
of those tests.

Coverity #10715, 10710.

13 years agoovs-brcompatd: Simplify code in brc_recv_update().
Ben Pfaff [Wed, 23 Feb 2011 18:27:04 +0000 (10:27 -0800)]
ovs-brcompatd: Simplify code in brc_recv_update().

This code was baffling and it confused Coverity, too.

Coverity #11070.

13 years agoovsdb-idl: JSONRPC_REPLY message always has nonnull 'id'.
Ben Pfaff [Wed, 23 Feb 2011 20:42:44 +0000 (12:42 -0800)]
ovsdb-idl: JSONRPC_REPLY message always has nonnull 'id'.

A JSONRPC_REPLY message always have a nonnull 'id' member, as ensured by
jsonrpc_msg_is_valid().  Checking for NULL here confused Coverity into
believing that the call to ovsdb_idl_txn_process_reply() just below could
cause a null pointer dereference, since ovsdb_idl_txn_process_reply() uses
the 'id' member without checking it for null.

Coverity #10713.

13 years agorconn: Clarify rconn_run_wait().
Ben Pfaff [Wed, 23 Feb 2011 20:35:32 +0000 (12:35 -0800)]
rconn: Clarify rconn_run_wait().

At first glance the vconn_wait() call looks risky because this function
checked whether rc->vconn is nonnull at the top.  In fact it's OK because
rc->state will be S_ACTIVE or S_IDLE only if rc->vconn is nonnull, but
there's no harm in putting that check inside the block that only runs if
rc->vconn is nonnull.

Coverity #10714.

13 years agoleak-checker: Avoid printing freed pointer.
Ben Pfaff [Wed, 23 Feb 2011 18:31:41 +0000 (10:31 -0800)]
leak-checker: Avoid printing freed pointer.

I think that this will work OK, and it should avoid complaints from static
checkers about using a freed pointer.

Coverity #11069.

13 years agostream: Make stream_report_content() tolerate negative size.
Ben Pfaff [Wed, 23 Feb 2011 19:29:37 +0000 (11:29 -0800)]
stream: Make stream_report_content() tolerate negative size.

A negative size probably means that a system call failed.  The caller could
set that to 0 but we might as well just tolerate it in
stream_report_content() by making the parameter type signed.

Coverity #10718.

13 years agoprocess: Avoid late failure if /dev/null cannot be opened.
Ben Pfaff [Wed, 23 Feb 2011 19:16:07 +0000 (11:16 -0800)]
process: Avoid late failure if /dev/null cannot be opened.

It is (very slightly) risky to open /dev/null every time that we need it,
because open can fail.  So this commit opens /dev/null in advance instead.

Coverity #10719.

13 years agobridge: Ethernet address is 6 bytes, not 4 or 8.
Ben Pfaff [Wed, 23 Feb 2011 19:21:52 +0000 (11:21 -0800)]
bridge: Ethernet address is 6 bytes, not 4 or 8.

'ea' here is a function parameter declared as an array, so "sizeof ea" is
sizeof(uint8_t *), which is either 4 or 8.

Coverity #10689, 10735.

13 years agoovsdb: Warn when result of ovsdb_txn_commit() is ignored and fix caller.
Justin Pettit [Wed, 23 Feb 2011 18:39:21 +0000 (10:39 -0800)]
ovsdb: Warn when result of ovsdb_txn_commit() is ignored and fix caller.

ovsdb_txn_commit() may return a ovsdb_error structure, which should be
freed by the caller.  The only remaining caller that discards the result
is in ovsdb_file_open__(), which this fixes.

Suggested-by: Ben Pfaff <blp@nicira.com>
13 years agoovsdb-idl: Remove deadcode related to "reply" in ovsdb_idl_run().
Justin Pettit [Wed, 23 Feb 2011 18:38:59 +0000 (10:38 -0800)]
ovsdb-idl: Remove deadcode related to "reply" in ovsdb_idl_run().

Coverity #10705

13 years agonx-match: Don't fall through case when handling dest mcast mac addresses.
Justin Pettit [Wed, 23 Feb 2011 03:07:05 +0000 (19:07 -0800)]
nx-match: Don't fall through case when handling dest mcast mac addresses.

When an NXM wildcard entry that includes a multicast address is parsed,
it would fall through to the next case statement, which would also set
an inappropriate source mac address match.

Coverity #10717

13 years agoovsdb-tool: Close "log" in do_show_log().
Justin Pettit [Wed, 23 Feb 2011 02:09:16 +0000 (18:09 -0800)]
ovsdb-tool: Close "log" in do_show_log().

Coverity #10726

13 years agotest-ovsdb: Don't leak return value from ovsdb_txn_commit().
Justin Pettit [Wed, 23 Feb 2011 02:02:20 +0000 (18:02 -0800)]
test-ovsdb: Don't leak return value from ovsdb_txn_commit().

Coverity #10727

13 years agoovs-vsctl: Free "columns" in cmd_find().
Justin Pettit [Wed, 23 Feb 2011 01:59:01 +0000 (17:59 -0800)]
ovs-vsctl: Free "columns" in cmd_find().

Coverity #10730

13 years agonetdev-linux: Zero-out "sin" in netdev_linux_arp_lookup().
Justin Pettit [Wed, 23 Feb 2011 01:50:19 +0000 (17:50 -0800)]
netdev-linux: Zero-out "sin" in netdev_linux_arp_lookup().

Coverity complains that we're copying the unitialized "sin_zero" member
from "sin" into "r".  I don't think this is an actual problem, but
there's no harm in zeroing out the structure, either.

Coverity #10916

13 years agotable: Free "error" in cell_to_text().
Justin Pettit [Tue, 22 Feb 2011 18:43:00 +0000 (10:43 -0800)]
table: Free "error" in cell_to_text().

Coverity #10722

13 years agomultipath: Validate multipath actions more thoroughly in multipath_parse().
Ben Pfaff [Wed, 23 Feb 2011 00:24:19 +0000 (16:24 -0800)]
multipath: Validate multipath actions more thoroughly in multipath_parse().

The stricter validation requires updates to the calls to test-multipath
to supply a valid n_links value.  test-multipath doesn't actually use
that value (it runs over different values in an internal "for" loop), so
this doesn't change any behavior.

Also adds a test to exercise each possible multipath_parse() error message.

Reported-by: Reid Price <reid@nicira.com>
Bug #4462.

13 years agoofp-parse: Don't segfault when an OpenFlow action's argument is missing.
Ben Pfaff [Tue, 22 Feb 2011 22:55:39 +0000 (14:55 -0800)]
ofp-parse: Don't segfault when an OpenFlow action's argument is missing.

Some actions checked that 'arg' was nonnull before attempting to parse it
but a lot of them didn't.  This commit avoids the segfault by substituting
an empty string when no argument is given.  It also updates a few of the
action implementations to correspond.

Reported-by: Reid Price <reid@nicira.com>
Bug #4462.
Coverity #10712.

13 years agonicira-ext: Fix comment.
Ben Pfaff [Wed, 23 Feb 2011 00:19:54 +0000 (16:19 -0800)]
nicira-ext: Fix comment.

Multipath actions only support registers as destinations, but this was
defined by reference in nicira-ext.h and the referenced text changed.

13 years agoovs-vsctl: --bootstrap only has an effect if the ca cert is missing.
Ben Pfaff [Wed, 23 Feb 2011 00:57:51 +0000 (16:57 -0800)]
ovs-vsctl: --bootstrap only has an effect if the ca cert is missing.

Someone (I can't remember who) asked me about this a while ago.  I hope
this clarifies.

13 years agoconfigure: Reject incompatible XenServer version.
Ben Pfaff [Tue, 22 Feb 2011 22:47:19 +0000 (14:47 -0800)]
configure: Reject incompatible XenServer version.

Suggested-by: Andrew Evans <aevans@nicira.com>
13 years agoutil: New function ovs_strzcpy().
Ben Pfaff [Tue, 22 Feb 2011 18:58:36 +0000 (10:58 -0800)]
util: New function ovs_strzcpy().

Static analyzers hate strncpy().  This new function shares its property of
initializing an entire buffer, without its nasty habit of failing to
null-terminate long strings.

Coverity #10697,10696,10695,10694,10693,10692,10691,10690.

13 years agoutil: Don't read over 'size - 1' bytes of source string in ovs_strlcpy().
Ben Pfaff [Tue, 22 Feb 2011 18:41:15 +0000 (10:41 -0800)]
util: Don't read over 'size - 1' bytes of source string in ovs_strlcpy().

The blind replacement of strncpy() by ovs_strlcpy() is risky because
strncpy() never reads more bytes from its source string than necessary to
write its destination string, but ovs_strlcpy() and the OpenBSD function
that inspired it both read the entire source string.  This avoids that
problem.

Given that change, we can use ovs_strlcpy() in a few more places, and
this commit does that too.

Coverity #10697,10696,10695,10694,10693,10692,10691,10690.

13 years agostring: Implement strnlen() if it is missing.
Ben Pfaff [Tue, 22 Feb 2011 18:36:13 +0000 (10:36 -0800)]
string: Implement strnlen() if it is missing.

13 years agovconn: Fix comparison that should be assignment in vconn_open_block().
Justin Pettit [Tue, 22 Feb 2011 01:21:20 +0000 (17:21 -0800)]
vconn: Fix comparison that should be assignment in vconn_open_block().

Coverity #10702

13 years agoovs-vsctl: Check "key" is valid before dereferencing in get_external_id().
Justin Pettit [Tue, 22 Feb 2011 01:19:18 +0000 (17:19 -0800)]
ovs-vsctl: Check "key" is valid before dereferencing in get_external_id().

Coverity #10716

13 years agoovsdb: Don't check "date" before assignment in ovsdb_file_txn_from_json().
Justin Pettit [Tue, 22 Feb 2011 01:02:35 +0000 (17:02 -0800)]
ovsdb: Don't check "date" before assignment in ovsdb_file_txn_from_json().

There's no indication that "date" is optional in the description of
ovsdb_file_txn_from_json(), and the one caller always passes it in, so
don't bother checking whether it exists.

Coverity #10732

13 years agosocket-util: Free strings in make_sockaddr_un() error handling.
Justin Pettit [Tue, 22 Feb 2011 00:38:39 +0000 (16:38 -0800)]
socket-util: Free strings in make_sockaddr_un() error handling.

Coverity #10721,10720

13 years agoovsdb: Free "error" string in ovsdb_execute_insert().
Justin Pettit [Tue, 22 Feb 2011 00:30:01 +0000 (16:30 -0800)]
ovsdb: Free "error" string in ovsdb_execute_insert().

Coverity #10723

13 years agodaemon: Fix leak of string in make_pidfile().
Justin Pettit [Tue, 22 Feb 2011 00:27:22 +0000 (16:27 -0800)]
daemon: Fix leak of string in make_pidfile().

Coverity #10724

13 years agoovsdb-data: Free string leaked in ovsdb_datum_from_string().
Justin Pettit [Tue, 22 Feb 2011 00:23:50 +0000 (16:23 -0800)]
ovsdb-data: Free string leaked in ovsdb_datum_from_string().

Coverity #10725

13 years agodiscovery: Free "buffer" in discovery_set_accept_controller_re().
Justin Pettit [Tue, 22 Feb 2011 00:06:28 +0000 (16:06 -0800)]
discovery: Free "buffer" in discovery_set_accept_controller_re().

Coverity #10728

13 years agoofproto: Free "controller_name" in ofconn_run().
Justin Pettit [Tue, 22 Feb 2011 00:04:55 +0000 (16:04 -0800)]
ofproto: Free "controller_name" in ofconn_run().

Coverity #10729

13 years agoovs-brcompatd: Fix memory leak in handle_fdb_query_cmd().
Justin Pettit [Mon, 21 Feb 2011 23:58:19 +0000 (15:58 -0800)]
ovs-brcompatd: Fix memory leak in handle_fdb_query_cmd().

Coverity #10731

13 years agoovsdb: Fix double free in ovsdb_file_open_log().
Justin Pettit [Mon, 21 Feb 2011 23:33:19 +0000 (15:33 -0800)]
ovsdb: Fix double free in ovsdb_file_open_log().

Coverity #11066

13 years agojsonrpc.py: Import "ovs.json".
Justin Pettit [Tue, 22 Feb 2011 07:56:07 +0000 (23:56 -0800)]
jsonrpc.py: Import "ovs.json".

Reported-by: Giuseppe de Candia <giuseppe.decandia@gmail.com>
13 years agoxenserver: Split kernel/userspace into separate RPMs for supplemental packs.
Andrew Evans [Thu, 17 Feb 2011 06:40:46 +0000 (22:40 -0800)]
xenserver: Split kernel/userspace into separate RPMs for supplemental packs.

XenServer has the concept of a "supplemental pack", which is just a collection
of RPMs rolled into an ISO image for installation as a unit, either during
XenServer installation or later as an update.

The script used to build supplemental packs requires that a single RPM not mix
kernel and userspace components. It also enforces a particular naming scheme
for kernel module RPMs. This commit modifies the OVS RPM spec file to create
separate RPMs in accordance with these conventions.

In an attempt to ensure that the userspace and kernel module packages are both
present and compatible, the kernel package provides a fictitious capability,
openvswitch_mod.ko.0, and the userspace package requires that capability. If a
future change breaks backward compatibility between userspace and kernel, we'll
increment the numeric suffix, preventing mismatched installs.

Reviewed by Ben Pfaff.

13 years agodatapath: Properly initialize ovs_skb_cb of packet from userspace.
Ben Pfaff [Sat, 19 Feb 2011 04:53:51 +0000 (20:53 -0800)]
datapath: Properly initialize ovs_skb_cb of packet from userspace.

The ovs_skb_cb in 'packet' in this function is initially a clone of the
corresponding area in 'skb', which came from the Netlink layer and thus
isn't necessarily all-zeros.  This commit initializes it properly before
passing it along to execute_actions().

The most common problem caused by failing to initialize the ovs_skb_cb
properly was that on Linux 2.6.26 and earlier, where Open vSwitch keeps
its own vlan_tci field inside ovs_skb_cb, the first packet of a flow would
get sent out tagged with a random VLAN (usually 0x0001 or 0xffff in our
testing).  This commit should fix that problem.

Another likely problem would be for turning on sFlow to randomly panic the
kernel.  That problem would not be kernel version dependent.  We haven't
been testing sFlow so we haven't noticed this problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Reported-by: Pankaj Thakkar <thakkar@nicira.com>
13 years agoxenserver: Revert only the XenServer scripts no longer replaced by OVS.
Andrew Evans [Thu, 17 Feb 2011 20:51:34 +0000 (12:51 -0800)]
xenserver: Revert only the XenServer scripts no longer replaced by OVS.

Commit d66880ee (xenserver: Clean up /usr/sbin/brctl dangling symlink.)
attempted to revert the original XenServer-shipped versions of scripts replaced
by OVS during an RPM upgrade, but the logic was incorrect. It assumed that
%postun of the package being replaced was run before the %post of the new
version replacing it. The reverse is actually true.

Make upgrade and erase cases both work correctly by simply checking whether any
of the files ever replaced in any OVS version are dangling symlinks, and if so,
attempt to copy the saved XenServer original back to its rightful place. In the
upgrade case, if the newly-installed version of OVS lacks any of the scripts in
the previous version, those will be reverted. In the erase case, none of the
OVS replacements will exist, so they will all be dangling symlinks and will all
be reverted.

Furthermore, replace any dangling symlink from /usr/sbin/xen-bugtool to the
now-nonexistent OVS replacement (caused by commit 92dbd5c9 (xenserver: Replace
customized xen-bugtool with plugin to collect qdisc info.)).

Lastly, prevent accidental reversion of files replaced by OVS during rpm -U
(also caused by commit 92dbd5c9).

Bug #4696.

13 years agoofproto: Resubmit Statistics.
Ethan Jackson [Fri, 11 Feb 2011 00:35:48 +0000 (16:35 -0800)]
ofproto: Resubmit Statistics.

This patch causes statistics to be updated for rules which are
resubmitted into. Once per second statistics are queried from the
datapath and pushed along the resubmit graph (calculated on demand
from the action list).  This approach is simple, easy to understand,
and in most cases accurate.  However, when the resubmit graph
changes, it is possible that some statistics will be accounted to
the wrong rule for a short period of time.

Bug #3730.

13 years agoofproto: Batch statistics updates.
Ethan Jackson [Wed, 9 Feb 2011 21:18:51 +0000 (13:18 -0800)]
ofproto: Batch statistics updates.

Facet statistics are updated once per second during
ofproto_expire() instead of upon request.  This will greatly
simplify implementation of future patches. This commit also changes
each facet's packet and byte counters to include the statistics
stored in the datapath.

13 years agoofproto: Display idle time in bridge/dump-flows.
Ethan Jackson [Sat, 12 Feb 2011 00:03:26 +0000 (16:03 -0800)]
ofproto: Display idle time in bridge/dump-flows.

13 years agoofproto: flow_stats_ds() print flows properly.
Ethan Jackson [Mon, 14 Feb 2011 20:10:52 +0000 (12:10 -0800)]
ofproto: flow_stats_ds() print flows properly.

13 years agoovsdb: Remove 'managers' column from 'Open vSwitch' table.
Andrew Evans [Fri, 18 Feb 2011 17:50:12 +0000 (09:50 -0800)]
ovsdb: Remove 'managers' column from 'Open vSwitch' table.

We had retained but deprecated the use of the older 'managers' column in the
'Open vSwitch' table for compatibility with applications that might still use
it, but that created more problems than it solved. This commit removes the
'managers' column from the schema, and removes all references to it from the
code, init scripts, documentation, and tests.

13 years agoofproto: Fix behavior when special_cb not present (as with ovs-openflowd).
Ben Pfaff [Thu, 17 Feb 2011 23:04:44 +0000 (15:04 -0800)]
ofproto: Fix behavior when special_cb not present (as with ovs-openflowd).

The special_cb hook allows ofproto's client to intercept packets.  When
it is not present (as in ovs-openflowd), no packets need to be intercepted,
but ofproto implemented the opposite behavior.  This fixes the problem.

Reported-by: kk yap <yapkke@stanford.edu>
13 years agoovsdb-server: Fix memory leak.
Ethan Jackson [Thu, 17 Feb 2011 20:52:48 +0000 (12:52 -0800)]
ovsdb-server: Fix memory leak.

Reported-by: Peter Balland <peter@nicira.com>
Bug #4698.

13 years agovconn-stream: Make definitions of tcp_vconn_class, etc., easier to find.
Ben Pfaff [Fri, 4 Feb 2011 23:10:27 +0000 (15:10 -0800)]
vconn-stream: Make definitions of tcp_vconn_class, etc., easier to find.

When object definitions are entirely hidden inside macros with token
pasting tricks, tools like "tags" and even "grep" cannot find them.  This
change makes the definitions of tcp_vconn_class and other stream-based
vconns easier to find, by exposing their definitions to these tools.

Reported-by: Yongqiang Liu <liuyq7809@gmail.com>
13 years agoAvoid unneeded database compaction at startup, and improve backups.
Ben Pfaff [Tue, 15 Feb 2011 18:17:44 +0000 (10:17 -0800)]
Avoid unneeded database compaction at startup, and improve backups.

Until now, Open vSwitch "start" has always converted the database to the
current database schema.  This compacts the database, which as a side
effect throws away useful information about the transactions that were
executed to bring the database into its current state.  This can make
debugging database-related problems more difficult.

This commit changes the "start" command to only convert the database if
the database schema has changed.  It also adds the database checksum to
the backup file name, to avoid overwriting backups in the case where the
checksum changed but the developer neglected to update the version number.

I tested an earlier version of the xenserver changes but not any version
of the Debian changes.

13 years agoovsdb-tool: New command "needs-conversion".
Ben Pfaff [Tue, 8 Feb 2011 23:57:14 +0000 (15:57 -0800)]
ovsdb-tool: New command "needs-conversion".

13 years agoovsdb-tool: Add commands for printing the database checksum.
Ben Pfaff [Tue, 8 Feb 2011 23:23:33 +0000 (15:23 -0800)]
ovsdb-tool: Add commands for printing the database checksum.

13 years agoovsdb: New function ovsdb_file_read_schema() for reading schema from db.
Ben Pfaff [Tue, 8 Feb 2011 23:36:21 +0000 (15:36 -0800)]
ovsdb: New function ovsdb_file_read_schema() for reading schema from db.

This new function saves reading the whole database when only the schema is
of interest.  This commit adapts ovsdb-tool to use it for the "db-version"
command.  Upcoming commits will introduce another caller.

13 years agoovs-vsctl: Improve documentation and --help output.
Ben Pfaff [Thu, 10 Feb 2011 17:34:42 +0000 (09:34 -0800)]
ovs-vsctl: Improve documentation and --help output.

13 years agoovs-bugtool: Ignore deprecation warnings.
Ethan Jackson [Tue, 15 Feb 2011 01:28:56 +0000 (17:28 -0800)]
ovs-bugtool: Ignore deprecation warnings.

Since we have to support many versions of Python, this commit
forces ovs-bugtool to ignore deprecation warnings.  They were
complaining about use of the md5 module whose replacement does not
appear until Python 2.5.  In Python 2.7 deprecation warnings are
ignored by default.

Bug #4373

13 years agodebian: Add license information for new xen-bugtool plugin to copyright.in.
Andrew Evans [Tue, 15 Feb 2011 18:36:38 +0000 (10:36 -0800)]
debian: Add license information for new xen-bugtool plugin to copyright.in.

13 years agodpif-netdev: Fix segfault handling packets.
Ben Pfaff [Tue, 15 Feb 2011 18:07:20 +0000 (10:07 -0800)]
dpif-netdev: Fix segfault handling packets.

Reported-by: Hassan Khan <hassan.khan@seecs.edu.pk>
13 years agoxenserver: Replace customized xen-bugtool with plugin to collect qdisc info.
Andrew Evans [Fri, 11 Feb 2011 19:29:33 +0000 (11:29 -0800)]
xenserver: Replace customized xen-bugtool with plugin to collect qdisc info.

XenServer RPMs have installed a modified /usr/sbin/xen-bugtool that is
identical to upstream except for an additional command to collect tc qdisc
class configuration for each network interface. Since xen-bugtool has an
extension mechanism, use that instead of maintaining a parallel patched
xen-bugtool.

This does change the content of the bug report slightly. Instead of one file
per network interface, qdisc class info for all interfaces is written to one
file. This is an artifact of the xen-bugtool extension mechanism: a single
extension command's output must go to one file, and it is impractical to create
individual <command> tags for each interface dynamically.

Reviewed by Ben Pfaff.

13 years agoxenserver: Clean up /usr/sbin/brctl dangling symlink.
Andrew Evans [Mon, 14 Feb 2011 21:02:43 +0000 (13:02 -0800)]
xenserver: Clean up /usr/sbin/brctl dangling symlink.

Commit 54f16a10 removed Open vSwitch's /usr/sbin/brctl replacement for
XenServer, but because the RPM doesn't restore the original files on upgrade,
an upgrade leaves /usr/sbin/brctl a broken symlink to the removed
/usr/share/openvswitch/scripts/brctl.

This commit adds a one-time cleanup to restore the original XenServer-supplied
/usr/sbin/brctl. It also changes the RPM to restore all the replaced files with
their XenServer originals at post-uninstall time during an upgrade transaction,
just as uninstall has done up to now. This should prevent the same problem in
the future.

Bug #4667.

13 years agoRemove /proc/net compatibility support.
Ben Pfaff [Fri, 11 Feb 2011 21:16:28 +0000 (13:16 -0800)]
Remove /proc/net compatibility support.

This feature was included only to allow Citrix QA to run some tests that
interacted directly with the bridge.  This feature hasn't been turned on
for some time, so it should not be necessary any longer.

Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agoxenserver: Remove usr_share_openvswitch_scripts_refresh-xs-network-uuids.
Ben Pfaff [Fri, 11 Feb 2011 21:48:23 +0000 (13:48 -0800)]
xenserver: Remove usr_share_openvswitch_scripts_refresh-xs-network-uuids.

This file is not distributed, which breaks the build with the message:

    The distribution is missing the following files:
    xenserver/usr_share_openvswitch_scripts_refresh-xs-network-uuids

Removing it from the repository fixes the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agoxenserver: Don't create XAPI cache at install.
Bob Ball [Fri, 11 Feb 2011 20:35:38 +0000 (12:35 -0800)]
xenserver: Don't create XAPI cache at install.

There are two mechanisms of installing a supplemental pack – one is
after installation (using the xe-install-supplemental-pack command) and
one is during installation by either creating a new install ISO with the
supplemental pack bundled or creating an HTTP directory which serves the
install files and the new supplemental pack contents.

The RPM should support both methods, but currently attempts to backup
data that doesn't exist yet.  With this commit, the XAPI cache is not
created at install.

Signed-off-by: Bob Ball <bob.ball@citrix.com>
[removed sourcing /etc/xensource-inventory since it is no longer needed]
Signed-off-by: Justin Pettit <jpettit@nicira.com>
13 years agoxenserver: Rename ovs-external-ids to ovs-xapi-sync.
Justin Pettit [Fri, 11 Feb 2011 20:35:37 +0000 (12:35 -0800)]
xenserver: Rename ovs-external-ids to ovs-xapi-sync.

With commit 5692e3 (xenserver: Set fail_mode on internal bridges.), the
responsibilities of ovs-external-ids got expanded beyond just monitoring
external-ids.  This commit renames the script to more accurately
describe its job.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
13 years agoxenserver: Remove support for XenServer versions older than 5.6 FP1.
Justin Pettit [Fri, 11 Feb 2011 20:35:35 +0000 (12:35 -0800)]
xenserver: Remove support for XenServer versions older than 5.6 FP1.

Commit 404c169247b1c3ac2ebad887f0421478a6cef924 breaks compatibility with
XenServers older than 5.6 FP1.  This commit removes the last vestiges of
support for those older XenServer versions.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
13 years agoxenserver: Remove brctl wrapper script.
Justin Pettit [Fri, 11 Feb 2011 20:35:36 +0000 (12:35 -0800)]
xenserver: Remove brctl wrapper script.

The OVS "brctl" wrapper script was added to aid Citrix's QA and help
XenCenter display link status and statistics of bridges.  Since the Citrix
integrated OVS ships without this wrapper script, it's clearly no longer
needed in the versions of XenServer we now support.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
13 years agoxenserver: Merge upstream changes and drop pre-5.6.100 support.
Andrew Evans [Fri, 11 Feb 2011 00:50:49 +0000 (16:50 -0800)]
xenserver: Merge upstream changes and drop pre-5.6.100 support.

Citrix have made modifications to the various interface configuration scripts
that OVS replaces, so at present those modifications are lost when OVS is
installed on e.g. XenServer 5.6.100. This commit applies those changes while
preserving OVS-specific modifications that have been made in the interim.

One major change introduced by these updates is the removal of support for
XenServer releases prior to 5.6.100.

This commit also updates the OVS-supplied xen-bugtool in similar fashion. We
will soon remove xen-bugtool from OVS altogether and move the added OVS
functionality to an XML extension as described in the Supplemental Pack DDK
guide.

13 years agovswitchd: Fix broken load rebalancing with balance-tcp.
Ethan Jackson [Fri, 11 Feb 2011 00:47:45 +0000 (16:47 -0800)]
vswitchd: Fix broken load rebalancing with balance-tcp.

Load rebalancing was not working in balance-tcp mode due to
mistaken balance-slb only assumptions leftover in the bridge code.

13 years agodocs: Consistently suggest /etc/openvswitch/conf.db as location for db.
Ben Pfaff [Thu, 10 Feb 2011 21:20:27 +0000 (13:20 -0800)]
docs: Consistently suggest /etc/openvswitch/conf.db as location for db.

Our Debian and XenServer packages use /etc/openvswitch/conf.db as the
location for the database but some of the docs suggested
/etc/ovs-vswitchd.conf.db.  This settles on the former consistently.
The manpage is still ovs-vswitchd.conf.db but I don't know what to do
about that.

13 years agoxenserver: Set fail_mode on internal bridges.
Ethan Jackson [Wed, 9 Feb 2011 02:55:17 +0000 (18:55 -0800)]
xenserver: Set fail_mode on internal bridges.

The fail_mode was not getting set on internal bridges.  This commit
forces ovs-external-ids to automatically set fail_mode on all new
bridges.

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

13 years agoxenserver: Introduce "force-reload-kmod" to reload kernel module.
Ben Pfaff [Wed, 9 Feb 2011 00:43:40 +0000 (16:43 -0800)]
xenserver: Introduce "force-reload-kmod" to reload kernel module.

Running "service openvswitch force-reload-kmod" will now save the kernel
configuration state of Open vSwitch interfaces, stop the vswitch, unload
the kernel module, reload the kernel module, restart the vswitch, and
restore kernel configuration state.  It is a reasonably safe way to upgrade
or downgrade the Open vSwitch kernel module on a running system.

Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agoovs-vsctl: Add formatting options for the "list" and "find" commands.
Ben Pfaff [Wed, 9 Feb 2011 00:10:34 +0000 (16:10 -0800)]
ovs-vsctl: Add formatting options for the "list" and "find" commands.

The default format is the same as before (which the testsuite verifies).
The most important use for the new formatting options is --bare, which
outputs a format that is easy to parse from a shell script.  An upcoming
patch will start using that.

13 years agotable: Add new "bare" output formatting options.
Ben Pfaff [Wed, 2 Feb 2011 19:24:35 +0000 (11:24 -0800)]
table: Add new "bare" output formatting options.

--format=list corresponds to the output format that "ovs-vsctl list" has
always used.

--bare is easier for scripts to parse.

13 years agoovsdb-client: Break table formatting into new library.
Ben Pfaff [Wed, 9 Feb 2011 00:09:45 +0000 (16:09 -0800)]
ovsdb-client: Break table formatting into new library.

This makes the table formatting functions available to other programs.
ovs-vsctl will start using it soon on the "list" and "find" commands.

13 years agoovs-vsctl: Add new "find" command.
Ben Pfaff [Tue, 8 Feb 2011 18:21:59 +0000 (10:21 -0800)]
ovs-vsctl: Add new "find" command.

This allows listing records that match specified criteria, instead
of just records that have specific names.

This will be used in an upcoming patch, along with --columns, to
list all of the interfaces whose type is 'internal'.

13 years agoovs-vsctl: Add --columns options to "list" command.
Ben Pfaff [Tue, 8 Feb 2011 18:27:35 +0000 (10:27 -0800)]
ovs-vsctl: Add --columns options to "list" command.

This allows the user to list just selected columns from a table,
for example just the "name" column.

This will become more useful as additional formatting options
are added in upcoming commits.

13 years agoovs-vsctl: Fix spelling of "satisfied" in function name.
Ben Pfaff [Tue, 8 Feb 2011 18:21:10 +0000 (10:21 -0800)]
ovs-vsctl: Fix spelling of "satisfied" in function name.

Suggested-by: Ethan Jackson <ethan@nicira.com>
13 years agoovsdb: Fix unused warning.
Ethan Jackson [Tue, 8 Feb 2011 19:50:15 +0000 (11:50 -0800)]
ovsdb: Fix unused warning.

"warning: 'parse_db_string_column' defined but not used"
This commit fixes the above warning when compiling on systems which
do not have SSL support.  It also causes query_db_string() to
always be compiled on these systems as it is not SSL specific and
may be useful in the future.

13 years agoxenserver: Make openvswitch-cfg-update reset 'manager_options' column.
Andrew Evans [Mon, 7 Feb 2011 22:41:09 +0000 (14:41 -0800)]
xenserver: Make openvswitch-cfg-update reset 'manager_options' column.

13 years agoxenserver: Display managers referenced by 'manager_options' in xsconsole.
Andrew Evans [Mon, 7 Feb 2011 20:40:01 +0000 (12:40 -0800)]
xenserver: Display managers referenced by 'manager_options' in xsconsole.

13 years agoovs-vsctl: Add commands to get/delete/set manager connections.
Andrew Evans [Fri, 4 Feb 2011 21:30:02 +0000 (13:30 -0800)]
ovs-vsctl: Add commands to get/delete/set manager connections.

13 years agodatapath: Check for backported rcu_read_lock_held.
Jesse Gross [Tue, 8 Feb 2011 01:22:58 +0000 (17:22 -0800)]
datapath: Check for backported rcu_read_lock_held.

New versions of Xen backport this function.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Use vlan deacceleration function in upcall.
Jesse Gross [Mon, 7 Feb 2011 23:57:09 +0000 (15:57 -0800)]
datapath: Use vlan deacceleration function in upcall.

vlan_deaccel_tag() was introduced to move a vlan tag from skb->vlan_tci
to the packet but there was still an open coded variant when doing
an upcall.  vlan_deaccel_tag() also clears skb->vlan_tci which is not
currently done but it makes no difference.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Don't use vlan_features before 2.6.26.
Jesse Gross [Mon, 7 Feb 2011 23:50:04 +0000 (15:50 -0800)]
datapath: Don't use vlan_features before 2.6.26.

Support for offloading over vlans wasn't introduced until 2.6.26,
so do full software emulation on kernels before that when dealing
with vlan packets.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Better calculate max nlattr-formatted flow size.
Justin Pettit [Mon, 7 Feb 2011 06:46:27 +0000 (22:46 -0800)]
datapath: Better calculate max nlattr-formatted flow size.

Both userspace and the kernel allocate space based on the max size of a
nlattr-formatted flow.  It was easy to change the max size of a flow
definition and cause crashes by forgetting to update one or both of
those definitions.  This commit attempts to make that harder by
providing a better description of how the max size is calculated and a
build check to look for a common indication that it may have changed.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: Increase size of max nlattr-formatted flow to 132.
Justin Pettit [Mon, 7 Feb 2011 06:39:09 +0000 (22:39 -0800)]
datapath: Increase size of max nlattr-formatted flow to 132.

The addition of IPv6 matching increased the maximum size of a
nlattr-formatted flow.  This was not properly reflected in the userspace
and kernel #defines that reserve space for the flows and could lead to
crashes.  This commit increases the size uniformly to 132 bytes.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: Clear rxhash when using an action that may affect it
Simon Horman [Mon, 7 Feb 2011 02:07:14 +0000 (11:07 +0900)]
datapath: Clear rxhash when using an action that may affect it

Signed-off-by: Simon Horman <horms@verge.net.au>
[Jesse: Change version check from 2.6.37 to 2.6.35]
Signed-off-by: Jesse Gross <jesse@nicira.com>
13 years agovswitchd: Incoming LACP packets should un-default links.
Ethan Jackson [Mon, 7 Feb 2011 22:53:39 +0000 (14:53 -0800)]
vswitchd: Incoming LACP packets should un-default links.

13 years agovswitchd: LACP attached status flapped.
Ethan Jackson [Mon, 7 Feb 2011 22:34:44 +0000 (14:34 -0800)]
vswitchd: LACP attached status flapped.

A bug introduced in the switch to bit mask LACP status caused the
attached status of interfaces in a LACP bond to slowly flap.

13 years agovswitchd: Process special packets more aggressively.
Ethan Jackson [Fri, 4 Feb 2011 02:33:53 +0000 (18:33 -0800)]
vswitchd: Process special packets more aggressively.

Before this patch, special packets such as LACP and CFM messages
were only processed if they had NORMAL open flow actions.  With
this patch these messages are always processed unless originated in
ofproto_send_packet().

13 years agodatapath: Add module parameter to allow TSO with vlans.
Jesse Gross [Thu, 30 Dec 2010 20:28:10 +0000 (12:28 -0800)]
datapath: Add module parameter to allow TSO with vlans.

We currently perform GSO on packets before adding a vlan tag,
which is reliable but hurts performance.  Even NICs that support
TSO on vlan tagged packets typically expect vlan acceleration to
be used.  Before 2.6.37 we can't use vlan acceleration and must
place the tag in the packet itself, which is risky when used with
TSO.  However, if the driver is known to work with internally
tagged packets and TSO this exposes a module parameter to enable it.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Add definition for FCoE offload.
Jesse Gross [Thu, 30 Dec 2010 21:13:04 +0000 (13:13 -0800)]
datapath: Add definition for FCoE offload.

FCoE offload was introduced in 2.6.30, so this introduces a null
definition for it on earlier kernels.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Use vlan acceleration for vlan operations.
Jesse Gross [Thu, 30 Dec 2010 06:13:15 +0000 (22:13 -0800)]
datapath: Use vlan acceleration for vlan operations.

Using the kernel vlan acceleration has a number of benefits:
it enables hardware tagging, allows usage of TSO and checksum
offloading, and is generally easier to manipulate.  This switches
the vlan actions to use skb->vlan_tci field for any necessary
changes.  In places that do not support vlan acceleration in a way
that we can use (in particular kernels before 2.6.37) we perform
any necessary conversions, such as tagging and GSO before the
packet leaves Open vSwitch.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Add vlan acceleration field for older kernels.
Jesse Gross [Fri, 31 Dec 2010 04:48:38 +0000 (20:48 -0800)]
datapath: Add vlan acceleration field for older kernels.

Kernels prior to 2.6.27 did not have a vlan_tci field in struct
sk_buff for vlan acceleration.  It's very convenient to use this
field for manipulating vlan tags, so we would like to use it as
the primary mechanism.  To enable this, this commit adds similar
infrastructure to the OVS_CB on the kernels that need it and a
set of functions to use the correct location.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agotunneling: Check refcount of each page in frags.
Jesse Gross [Mon, 7 Feb 2011 21:05:34 +0000 (13:05 -0800)]
tunneling: Check refcount of each page in frags.

We check the refcount of each page in a fragmented skb
to see if we need to do a linearize before computing the
checksum.  However, although we iterate over the list of
pages, we always check the first one.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodebian: Store more system information in OVSDB.
Justin Pettit [Mon, 7 Feb 2011 19:44:54 +0000 (11:44 -0800)]
debian: Store more system information in OVSDB.

Store the OVS version in OVSDB.  Additionally, if the "lsb_release"
command is available, store information about the system type and
version.

Bug #4576

13 years agoxenserver: Consistently use spaces instead of tabs in init script.
Justin Pettit [Mon, 7 Feb 2011 18:43:15 +0000 (10:43 -0800)]
xenserver: Consistently use spaces instead of tabs in init script.

13 years agoovs-vswitchd: Complete daemonization only after initial configuration.
Ben Pfaff [Fri, 28 Jan 2011 20:44:00 +0000 (12:44 -0800)]
ovs-vswitchd: Complete daemonization only after initial configuration.

Otherwise when we add support for saving and restoring configuration
of internal devices around kernel module unload and reload, there's
no easy way for the "restore" code to tell when all the interfaces
should be set up and ready for configuration.

13 years agodaemon: Define daemon options enums the same way as other option enums.
Ben Pfaff [Fri, 28 Jan 2011 20:39:15 +0000 (12:39 -0800)]
daemon: Define daemon options enums the same way as other option enums.

Other modules that accept options use this style and I don't see a reason
for the daemon code to be different.  The style used by the daemon code
until now runs the risk of ending up with conflicting values accidentally,
which would be confusing.

13 years agoofproto: Clear out entire 'name' field of ofp_phy_port when initializing.
Ben Pfaff [Mon, 7 Feb 2011 20:46:25 +0000 (12:46 -0800)]
ofproto: Clear out entire 'name' field of ofp_phy_port when initializing.

Sometimes garbage could appear in the name field following the port name,
since it wasn't completely zeroed.

Reported-by: kk yap <yapkke@openvswitch.org>
Tested-by: kk yap <yapkke@openvswitch.org>
13 years agovswitchd: LACP switch lacp_status to bit mask.
Ethan Jackson [Fri, 4 Feb 2011 00:19:52 +0000 (16:19 -0800)]
vswitchd: LACP switch lacp_status to bit mask.

Much of the LACP status information attached to an interface is
moved from an enum to a bit mask in this commit.  The main reason
to do this is to allow a link to be concurrently expired and
defaulted.  With this commit, if a link enters an expired state,
but has never had its partner information update, it will properly
set the defaulted flag in its LACP messages.

13 years agovswitchd: Instrument lacp_update_ifaces().
Ethan Jackson [Sat, 5 Feb 2011 02:26:22 +0000 (18:26 -0800)]
vswitchd: Instrument lacp_update_ifaces().