sliver-openvswitch.git
13 years agodatapath: Change listing flows to use an iterator concept.
Ben Pfaff [Tue, 28 Dec 2010 18:39:52 +0000 (10:39 -0800)]
datapath: Change listing flows to use an iterator concept.

One of the goals for Open vSwitch is to decouple kernel and userspace
software, so that either one can be upgraded or rolled back independent of
the other.  To do this in full generality, it must be possible to change
the kernel's idea of the flow key separately from the userspace version.
In turn, that means that flow keys must become variable-length.  This does
not, however, fit in well with the ODP_FLOW_LIST ioctl in its current form,
because that would require userspace to know how much space to allocate
for each flow's key in advance, or to allocate as much space as could
possibly be needed.  Neither choice is very attractive.

This commit prepares for a different solution, by replacing ODP_FLOW_LIST
by a new ioctl ODP_FLOW_DUMP that retrieves a single flow from the datapath
on each call.  It is much cleaner to allocate the maximum amount of space
for a single flow key than to do so for possibly a very large number of
flow keys.

As a side effect, this patch also fixes a race condition that sometimes
made "ovs-dpctl dump-flows" print an error: previously, flows were listed
and then their actions were retrieved, which left a window in which
ovs-vswitchd could delete the flow.  Now dumping a flow and its actions is
a single step, closing that window.

Dumping all of the flows in a datapath is no longer an atomic step, so now
it is possible to miss some flows or see a single flow twice during
iteration, if the flow table is modified by another process.  It doesn't
look like this should be a problem for ovs-vswitchd.

It would be faster to retrieve a number of flows in batch instead of just
one at a time, but that will naturally happen later when the kernel
datapath interface is changed to use Netlink, so this patch does not bother
with it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agostream: Fix error message.
Ben Pfaff [Fri, 28 Jan 2011 00:25:07 +0000 (16:25 -0800)]
stream: Fix error message.

This message is supposed to be helpful but with the arguments in the wrong
order it was just confusing.

13 years agoovsdb-server: Correct Manager inactivity probe column name.
Andrew Evans [Fri, 28 Jan 2011 01:47:30 +0000 (17:47 -0800)]
ovsdb-server: Correct Manager inactivity probe column name.

ovsdb-server tries to read from a column named 'probe_interval' in the Manager
table, but the column is actually named 'inactivity_probe', so a
user-configured probe interval will never be used.

13 years agoDebian: Don't include ovs-vlan-test man page in "common" package.
Justin Pettit [Thu, 27 Jan 2011 21:09:23 +0000 (13:09 -0800)]
Debian: Don't include ovs-vlan-test man page in "common" package.

Commit f0d3bc (Debian: install man pages) added a few missing man pages
to the Debian "openvswitch-switch" package.  The ovs-vlan-test man page
was already part of the "openvswitch-common" package, so the duplicate
man page causes installation problems.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
13 years agotests: Tolerate different versions of tcpdump.
Ben Pfaff [Thu, 27 Jan 2011 17:50:19 +0000 (09:50 -0800)]
tests: Tolerate different versions of tcpdump.

The tcpdump output format differs slightly from one version to another, so
this test that runs tcpdump would fail depending on the system it was run
on.  This commit fixes the problem by using "sed" to trim off the part of
the line that can differ.

Reported-by: Justin Pettit <jpettit@nicira.com>
13 years agodatapath: Make VERIFY_NUL_STRING return a negative error code.
Ben Pfaff [Tue, 4 Jan 2011 23:32:39 +0000 (15:32 -0800)]
datapath: Make VERIFY_NUL_STRING return a negative error code.

This is the common kernel convention.  None of the callers currently do
anything with the return code except for test whether it is nonzero, so
they don't need any changes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoxenserver: Use "ovs-dpctl dump-dps" instead of parsing "ovs-dpctl show".
Ben Pfaff [Fri, 14 Jan 2011 01:14:07 +0000 (17:14 -0800)]
xenserver: Use "ovs-dpctl dump-dps" instead of parsing "ovs-dpctl show".

Might as well use the dump-dps command as intended.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoovs-dpctl: Use datapath enumeration functions instead of guessing names.
Ben Pfaff [Wed, 5 Jan 2011 23:33:09 +0000 (15:33 -0800)]
ovs-dpctl: Use datapath enumeration functions instead of guessing names.

I'm planning to get rid of userspace knowledge of ODP_MAX and this change
gets rid of one user of it.

Reviewed by Justin Pettit.

13 years agonetdev: Use shash and smap functions instead of inlined substitutes.
Ben Pfaff [Wed, 29 Dec 2010 07:03:58 +0000 (23:03 -0800)]
netdev: Use shash and smap functions instead of inlined substitutes.

This simplifies the code and makes it easier to extend in upcoming commits.

Reviewed by Justin Pettit.

13 years agoshash: New "smap" functions for working with string-to-string maps.
Ben Pfaff [Wed, 29 Dec 2010 23:06:16 +0000 (15:06 -0800)]
shash: New "smap" functions for working with string-to-string maps.

An shash always has string keys and sometimes it hash string values as
well.  Usually the general-purpose shash functions are fine for working
with string-to-string maps, but this commit introduces a few more
specialized functions that only work with string-to-string maps.  It's not
clear yet to me whether this should actually be a new data structure, so
for now the new functions just work on shashes.

This commit also converts one user of shash_destroy() to use smap_destroy().
This is the only existing user of these functions that I spotted as a
trivial conversion candidate while grepping.

These new functions will see more use in the following commit.

Reviewed by Justin Pettit.

13 years agoodp-util: Improve formatting of bogus empty action attributes.
Ben Pfaff [Tue, 11 Jan 2011 23:35:56 +0000 (15:35 -0800)]
odp-util: Improve formatting of bogus empty action attributes.

Before this change, these were formatted as:
,***%u leftover bytes***
After this change, they are formatted as:
<empty>,***%u leftover bytes***

Reviewed by Ethan Jackson <ethan@nicira.com>.

13 years agonetlink-socket: Log Generic Netlink family names.
Ben Pfaff [Tue, 11 Jan 2011 19:02:32 +0000 (11:02 -0800)]
netlink-socket: Log Generic Netlink family names.

The ids for Generic Netlink family names aren't very helpful because they
can vary from machine to machine and even from one boot to the next.  So
this change logs their names too.

This only affects logging at DBG level.

Reviewed by Ethan Jackson <ethan@nicira.com>.

13 years agonetlink-socket: Consistently log sequence numbers in hexadecimal.
Ben Pfaff [Tue, 11 Jan 2011 19:01:08 +0000 (11:01 -0800)]
netlink-socket: Consistently log sequence numbers in hexadecimal.

nlmsghdr_to_string() wrote sequence numbers in hex, but nl_sock_transact()
wrote them in decimal.  This consistently switches to hexadecimal.

Reviewed by Ethan Jackson <ethan@nicira.com>.

13 years agonetlink-socket: Make dumping and doing transactions on same nl_sock safe.
Ben Pfaff [Sat, 22 Jan 2011 23:23:10 +0000 (15:23 -0800)]
netlink-socket: Make dumping and doing transactions on same nl_sock safe.

It's not safe to use a single Netlink fd to do multiple operations in an
synchronous way.  Some of the limitations are fundamental; for example, the
kernel only supports a single "dump" operation at a time.  Others are
limitations imposed by the OVS coding style; for example, our Netlink
library is not callback based, so nothing can be done about incoming
messages that can't be handled immediately.  Regardless, in OVS multicast
groups, transactions, and dumps cannot coexist on a single nl_sock.

This is only mildly irritating at the moment, but it will become much worse
later on, when dpif-linux shifts to using Netlink dumps for listing various
kinds of datapath entities.  When that happens, a dump will be in progress
in situations where the dpif-linux client might want to do other
operations.  For example, it is reasonable for the client to list flows
and, in the middle, look up information on vports mentioned in those flows.
It might be possible to simply ban and avoid such nested operations--I have
not even audited the source tree to find out whether we do anything like
that already--but that seems like an unnecessary cramp on our coding style.
Furthermore, it's difficult to explain and justify without understanding
the implementation.

This patch takes another approach, by improving the Netlink socket library
to avoid artificial constraints.  When an operation, or a dump, or joining
a multicast group would cause a problem, this patch makes the library
transparently create a separate Netlink socket.  This solves the problem
without putting any onerous restrictions on use.

This commit also slightly simplifies netdev_vport_reset_names().  It had
been written to destroy the dump object before the Netlink socket that it
used, but this is no longer necessary and doing it in the opposite order
saved a few lines of code.

Reviewed by Ethan Jackson <ethan@nicira.com>.

13 years agonetlink-socket: Slightly improve logging of Generic Netlink messages.
Ben Pfaff [Tue, 18 Jan 2011 22:07:52 +0000 (14:07 -0800)]
netlink-socket: Slightly improve logging of Generic Netlink messages.

This makes the stream of requests and replies very slightly easier to
understand.

Reviewed by Justin Pettit.

13 years agonetlink-socket: New function for draining the receive buffer.
Ben Pfaff [Wed, 12 Jan 2011 00:05:37 +0000 (16:05 -0800)]
netlink-socket: New function for draining the receive buffer.

This will be used in an upcoming patch.

Reviewed by Justin Pettit.

13 years agonetlink-socket: Add functions for joining and leaving multicast groups.
Ben Pfaff [Mon, 10 Jan 2011 00:57:45 +0000 (16:57 -0800)]
netlink-socket: Add functions for joining and leaving multicast groups.

When this library was originally implemented, support for Linux 2.4 was
important.  The Netlink implementation in Linux only added support for
joining and leaving multicast groups after a socket is bound as of Linux
2.6.14, so the library did not support it either.  But the current version
of Open vSwitch targets Linux 2.6.18 and over, so it's fine to add this
support now, and this commit does so.

This will be used more extensively in upcoming commits.

Reviewed by Justin Pettit.

13 years agonetlink: Add nl_attr_type constants for big-endian values.
Ben Pfaff [Wed, 19 Jan 2011 21:17:22 +0000 (13:17 -0800)]
netlink: Add nl_attr_type constants for big-endian values.

These are semantically identical, so they might as well share existing
values, but they help to document the endianness of attributes in Netlink
attribute policies.

Acked-by: Jesse Gross <jesse@nicira.com>
13 years agonetlink: Log duplicate attributes in nl_policy_parse().
Ben Pfaff [Tue, 11 Jan 2011 22:12:03 +0000 (14:12 -0800)]
netlink: Log duplicate attributes in nl_policy_parse().

This made finding one particular bug slightly easier for me.

Reviewed by Justin Pettit.

13 years agonetlink: New functions for finding a specific attribute.
Ben Pfaff [Thu, 13 Jan 2011 20:36:06 +0000 (12:36 -0800)]
netlink: New functions for finding a specific attribute.

These functions are useful in the occasional case where a piece of code
only cares about one or a few attributes, probably knows that the format
is correct, and doesn't want to go to the trouble of doing a full parse.
Upcoming commits will add a user.

Reviewed by Justin Pettit.

13 years agohmap: New function hmap_at_position().
Ben Pfaff [Tue, 28 Dec 2010 18:05:05 +0000 (10:05 -0800)]
hmap: New function hmap_at_position().

This function offers a way to iterate through an hmap in situations where
it is not safe to retain a node pointer.

Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoofpbuf: New function ofpbuf_clone_data_with_headroom().
Ben Pfaff [Mon, 27 Dec 2010 22:36:16 +0000 (14:36 -0800)]
ofpbuf: New function ofpbuf_clone_data_with_headroom().

This new function is a simple helper that creates a new ofpbuf with some
initial contents plus a caller-specified amount of headroom.

This will be used in upcoming commits.

Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoofpbuf: Enable ofpbuf_push() to expand headroom.
Ben Pfaff [Mon, 27 Dec 2010 22:32:45 +0000 (14:32 -0800)]
ofpbuf: Enable ofpbuf_push() to expand headroom.

Until now, ofpbuf_put() has been able to reallocate an ofpbuf to
expand the tailroom, but ofpbuf_push() has not been able to expand
the headroom in an analogous way.  This omission is simply because
it has never been useful to do this.  However, an upcoming change
will make the amount of headroom in an ofpbuf passed up from a
dpif to ofproto harder to predict.  It seems that we might as well
simply implement expanding headroom, so this commit does that.

Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoofpbuf: New function ofpbuf_use_stack().
Ben Pfaff [Thu, 23 Dec 2010 22:23:41 +0000 (14:23 -0800)]
ofpbuf: New function ofpbuf_use_stack().

This new function is useful in a situation where a small stack-allocated
buffer is usually appropriate but occasionally it must be expanded.

Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoDebian: install man pages
Simon Horman [Thu, 27 Jan 2011 06:29:25 +0000 (16:29 +1000)]
Debian: install man pages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agoxenserver: Support fail_mode override at network level.
Ethan Jackson [Thu, 27 Jan 2011 01:20:41 +0000 (17:20 -0800)]
xenserver: Support fail_mode override at network level.

This patch allows the Pool object's vswitch-controller-fail-mode
setting to be overridden on by Network object.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
13 years agotests: Skip frequently hanging "closes standard fds" tests
Justin Pettit [Wed, 26 Jan 2011 21:37:44 +0000 (13:37 -0800)]
tests: Skip frequently hanging "closes standard fds" tests

The "closes standard fds" test frequently hangs, which causes builds to
not complete.  Skip these tests until we have time to debug the cause.

13 years agovswitchd: Initialize SSL keys before making SSL connections.
Ben Pfaff [Tue, 25 Jan 2011 23:27:54 +0000 (15:27 -0800)]
vswitchd: Initialize SSL keys before making SSL connections.

Otherwise, if SSL is configured at startup then the first connection
attempt fails with warnings about keys not be configured.

Bug #4448.

13 years agostream-ssl: Only cache SSL sessions after they shut down.
Ben Pfaff [Tue, 25 Jan 2011 23:23:31 +0000 (15:23 -0800)]
stream-ssl: Only cache SSL sessions after they shut down.

A cached SSL session may only be used for new connections after the initial
connection has shut down.  As far as I can tell, nothing in the OpenSSL
documentation actually comes out and says this, but it is implied by
various examples found around the web and doing it this way makes caching
work much more reliably in my testing.

Bug #4448.

13 years agostream-ssl: Set a session context ID string on our SSL_CTX.
Ben Pfaff [Tue, 25 Jan 2011 23:17:32 +0000 (15:17 -0800)]
stream-ssl: Set a session context ID string on our SSL_CTX.

In the finest OpenSSL tradition of putting important documentation only in
code comments, ssl/ssl_sess.c in the OpenSSL tree has the following comment
inside ssl_get_prev_session():

   /* We can't be sure if this session is being used out of
    * context, which is especially important for SSL_VERIFY_PEER.
    * The application should have used SSL[_CTX]_set_session_id_context.
    *
    * For this error case, we generate an error instead of treating
    * the event like a cache miss (otherwise it would be easy for
    * applications to effectively disable the session cache by
    * accident without anyone noticing).
    */

This meant that ovs-controller couldn't effectively cache SSL server
sessions and we got a weird error whenever ovs-vswitchd tried.

Bug #4448.
CC: David Tsai <dtsai@nicira.com>
CC: Jeremy Stribling <strib@nicira.com>
13 years agoovs-bugtool: Indiscriminately capture all openvswitch log files.
Ethan Jackson [Tue, 25 Jan 2011 18:58:47 +0000 (10:58 -0800)]
ovs-bugtool: Indiscriminately capture all openvswitch log files.

ovs-bugtool was only capturing openvswitch core files.  This commit
causes it to capture all files under /var/log/openvswitch and
/var/log/core.  It also moves the ovs-bugtool output to
/var/log/ovs-bugtool.

Reported-by: Ben Pfaff <blp@nicira.com>
Bug #4481.

13 years agovswitchd: Write build error message to stderr.
Ben Pfaff [Tue, 25 Jan 2011 20:33:56 +0000 (12:33 -0800)]
vswitchd: Write build error message to stderr.

Suggested-by: Andrew Evans <aevans@nicira.com>
13 years agovswitchd: Fail the build when the schema checksum does not match.
Ben Pfaff [Mon, 24 Jan 2011 20:05:23 +0000 (12:05 -0800)]
vswitchd: Fail the build when the schema checksum does not match.

Before, a bad checksum was easy to miss because the build still succeeded.
With this change, a bad checksum makes the build fail.

This is what I thought the existing code already did, but I was wrong.

Suggested-by: Andrew Evans <aevans@nicira.com>
13 years agobridge: Check for null ofproto_controller_info pointer.
Andrew Evans [Tue, 25 Jan 2011 01:01:53 +0000 (17:01 -0800)]
bridge: Check for null ofproto_controller_info pointer.

This fixes a bug I introduced in commit bffc0589.

Reported-by: Bryan Fulton <bryan@nicira.com>
Bug #4474.

13 years agodatapath: Move rcu_read_lock_held(), rcu_dereference_*() to rcupdate.h.
Ben Pfaff [Mon, 24 Jan 2011 22:03:57 +0000 (14:03 -0800)]
datapath: Move rcu_read_lock_held(), rcu_dereference_*() to rcupdate.h.

<linux/rcupdate.h> is the normal location of these functions, so we should
not put compat code for them in <linux/rtnetlink.h>.

This caused build failures for datapath/table.c, which in later commits
uses rcu_dereference_check() and rcu_dereference_protected() but does not
need RTNL.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: Avoid sparse warning in compat header.
Ben Pfaff [Mon, 24 Jan 2011 21:55:59 +0000 (13:55 -0800)]
datapath: Avoid sparse warning in compat header.

Without this change, sparse complains:

datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h:12:9: warning:
Using plain integer as NULL pointer

at least on kernels old enough to need this compat code anyway.  Might as
well suppress it, since it is easy.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agodpif-netdev: Allow for Ethernet and VLAN header in buffer size calculation.
Ben Pfaff [Mon, 24 Jan 2011 17:41:29 +0000 (09:41 -0800)]
dpif-netdev: Allow for Ethernet and VLAN header in buffer size calculation.

This is a long-standing bug--it was present in version 1.0 too.

Reported-by: Gaetano Catalli <gaetano.catalli@gmail.com>
Solution by Jesse Gross <jesse@nicira.com>

13 years agoxenserver: Change all bridge's fail_mode when updating.
Ethan Jackson [Mon, 24 Jan 2011 18:54:17 +0000 (10:54 -0800)]
xenserver: Change all bridge's fail_mode when updating.

The ovs plugin's update command was only setting fail_mode for
bridges attached to pifs.  This patch applies the fail_mode
setting to all bridges on the XenServer system.

Reported-by: David Tsai <dtsai@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
13 years agovswitch: Fix schema version number.
Andrew Evans [Mon, 24 Jan 2011 17:53:14 +0000 (09:53 -0800)]
vswitch: Fix schema version number.

I accidentally committed with a bogus schema version number that I had intended
to change prior to checkin.

13 years agobridge: Add controller status to Controller table.
Andrew Evans [Fri, 21 Jan 2011 19:01:45 +0000 (11:01 -0800)]
bridge: Add controller status to Controller table.

Get status information for controller(s) attached to each bridge and store in
Controller table every 5 seconds.

13 years agodatapath: Remove unused ->set_stats() function from vport_ops.
Ben Pfaff [Sun, 23 Jan 2011 04:07:20 +0000 (20:07 -0800)]
datapath: Remove unused ->set_stats() function from vport_ops.

No vport implements this function and, as far as I can tell, no vport has
ever implemented it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agomultipath: Fix off-by-one in hash_threshold multipath calculation.
Ben Pfaff [Sat, 22 Jan 2011 01:09:21 +0000 (17:09 -0800)]
multipath: Fix off-by-one in hash_threshold multipath calculation.

0xffffffff / (0xffffffff / n) can have a value as large as n (consider the
n == 1 case), but we need a value no bigger than n-1.  So add 1 before
dividing to fix the problem.

This caused a test failure on Debian "lenny" amd64 when apparently
unrelated code changed.

Reported-by: Justin Pettit <jpettit@nicira.com>
13 years agoofproto: Correctly compute length of flow stats in multipart flow stats.
Ben Pfaff [Fri, 21 Jan 2011 22:49:01 +0000 (14:49 -0800)]
ofproto: Correctly compute length of flow stats in multipart flow stats.

In a flow table dump, the length of the first nx_flow_stats in the second
and subsequent OpenFlow messages was being miscalculated, because
append_nxstats_reply() changed the length of the message in such cases.
So we need to load the starting length after calling append_nxstats_reply()
instead of before.

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

13 years agodatapath: Remove vport_del_all() because it is now a no-op.
Ben Pfaff [Fri, 21 Jan 2011 00:34:15 +0000 (16:34 -0800)]
datapath: Remove vport_del_all() because it is now a no-op.

vport_del_all() was created when vports could exist without being attached
to any datapath.  Now, a vport is always attached to a datapath.  This
function was only called on module unload, but the module can't be unloaded
if any datapath exists, so it won't ever have any work to do, and we might
as well delete it entirely.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Suggested-by: Jesse Gross <jesse@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoImplement arbitrary bitwise masks for tun_id field.
Ben Pfaff [Thu, 20 Jan 2011 23:29:00 +0000 (15:29 -0800)]
Implement arbitrary bitwise masks for tun_id field.

This was documented to work, but not implemented.

Requested-by: Pankaj Thakkar <thakkar@nicira.com>
13 years agoofproto: Fix bug in "trace" command.
Ben Pfaff [Thu, 20 Jan 2011 20:27:34 +0000 (12:27 -0800)]
ofproto: Fix bug in "trace" command.

tun_id is a 64-bit field but it was being treated here as a 32-bit field.

13 years agonetdev-vport: Report carrier state of tunnel egress interfaces.
Andrew Evans [Wed, 19 Jan 2011 22:50:01 +0000 (14:50 -0800)]
netdev-vport: Report carrier state of tunnel egress interfaces.

Record carrier state of tunnel egress interface in
"tunnel_egress_iface_carrier" key in "status" map of Interface table.

13 years agoxenserver: Fix interface reconfigure crash when setting fail_mode.
Ethan Jackson [Thu, 20 Jan 2011 01:57:08 +0000 (17:57 -0800)]
xenserver: Fix interface reconfigure crash when setting fail_mode.

Interface reconfigure can crash when setting fail_mode if an
expected other_config setting is not set.

13 years agoovs-monitor-ipsec: Create cert directory if it doesn't exist.
Justin Pettit [Tue, 18 Jan 2011 08:09:15 +0000 (00:09 -0800)]
ovs-monitor-ipsec: Create cert directory if it doesn't exist.

13 years agoovs-monitor-ipsec: Use "require" when adding SPD entries.
Justin Pettit [Tue, 18 Jan 2011 08:01:24 +0000 (00:01 -0800)]
ovs-monitor-ipsec: Use "require" when adding SPD entries.

Previously, SPD entries were added with a level of "default".  This uses
the system-wide default for the protocol when processing a matching
packet.  Switch the level to "require" so that a SA is always used when
sending the packet.

13 years agoxenserver: Allow NULL pool in configuration cache.
Ethan Jackson [Wed, 19 Jan 2011 22:46:57 +0000 (14:46 -0800)]
xenserver: Allow NULL pool in configuration cache.

InterfaceReconfigure assumes the pool is in the configuration
cache.  This is always true except when upgrading from an older
version of openvswitch which does record the pool.  This can cause
upgrades to lock up.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
13 years agonx-match: Allow NXM_NX_TUN_ID and NXM_OF_VLAN_TCI on NXAST_REG_LOAD.
Ben Pfaff [Wed, 19 Jan 2011 22:51:26 +0000 (14:51 -0800)]
nx-match: Allow NXM_NX_TUN_ID and NXM_OF_VLAN_TCI on NXAST_REG_LOAD.

NXM_NX_TUN_ID and NXM_OF_VLAN_TCI were already allowed on NXAST_REG_MOVE,
but not on NXAST_REG_LOAD.  This makes them valid on both.

Requested-by: Pankaj Thakkar <thakkar@nicira.com>
13 years agoofproto: Fix NXAST_REG_MOVE with NXM_NX_TUN_ID as destination.
Ben Pfaff [Wed, 19 Jan 2011 22:53:16 +0000 (14:53 -0800)]
ofproto: Fix NXAST_REG_MOVE with NXM_NX_TUN_ID as destination.

The documentation claimed this worked but it wasn't actually implemented.

13 years agodatapath: Avoid backported csum_replace4() on RHEL 5.
Jesse Gross [Wed, 19 Jan 2011 17:29:06 +0000 (09:29 -0800)]
datapath: Avoid backported csum_replace4() on RHEL 5.

Reported-by: Koichi Yagishita <yagishita.koichi@jrc.co.jp>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agotests: Update interface-reconfigure tests.
Ethan Jackson [Wed, 19 Jan 2011 03:05:15 +0000 (19:05 -0800)]
tests: Update interface-reconfigure tests.

The interface-reconfigure tests currently fail because they were
not updated when fail_mode was added to XenServer configuration.

13 years agoCommit e210037e has an incorrect database checksum. This commit fixes that.
Andrew Evans [Wed, 19 Jan 2011 05:27:41 +0000 (21:27 -0800)]
Commit e210037e has an incorrect database checksum. This commit fixes that.

13 years agobridge: Store status of physical network interfaces in Interface table.
Andrew Evans [Mon, 17 Jan 2011 23:37:13 +0000 (15:37 -0800)]
bridge: Store status of physical network interfaces in Interface table.

New columns in Interface table: admin_state, link_state, link_speed, duplex,
mtu.

New keys in status map in Interface table: driver_name, driver_version,
firmware_version.

Requested-by: Peter Balland <pballand@nicira.com>
Bug #4299.

13 years agovswitchd: Display miimon interval.
Ethan Jackson [Wed, 19 Jan 2011 00:01:45 +0000 (16:01 -0800)]
vswitchd: Display miimon interval.

Causes bond/show to display the miimon interval for bonded ports
when configured to use miimon instead of carrier.

Requested-by: Michael Mao <mmao@nicira.com>
Bug #4418.

13 years agoxenserver: Allow fail_mode to be set from xapi.
Ethan Jackson [Sat, 15 Jan 2011 01:10:55 +0000 (17:10 -0800)]
xenserver: Allow fail_mode to be set from xapi.

This commit allows xapi to set the fail mode through the
vswitch-controller-fail-mode other-config setting in the Pool
object.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
13 years agoxenserver: Allow unknown other-config attributes.
Ethan Jackson [Mon, 17 Jan 2011 19:31:46 +0000 (11:31 -0800)]
xenserver: Allow unknown other-config attributes.

When saving the database cache, InterfaceReconfigure can crash if
unexpected attributes are in an object's other-config column.  This
commit causes it to skip that attribute and log a warning.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Dominic Curran <Dominic.Curran@citrix.com>
13 years agoovs-vsctl: emer-reset should clear the fail_mode.
Ethan Jackson [Tue, 18 Jan 2011 00:52:16 +0000 (16:52 -0800)]
ovs-vsctl: emer-reset should clear the fail_mode.

13 years agonetdev: Make 'netdev' parameter of 'get_features()' const.
Andrew Evans [Mon, 17 Jan 2011 23:18:38 +0000 (15:18 -0800)]
netdev: Make 'netdev' parameter of 'get_features()' const.

Implementations shouldn't need to modify it.

13 years agodatapath: Tabify indentation.
Ben Pfaff [Tue, 18 Jan 2011 00:59:18 +0000 (16:59 -0800)]
datapath: Tabify indentation.

Somehow this function was indented with spaces instead of tabs.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jess@nicira.com>
13 years agodatapath: Fix validation of ODPAT_OUTPUT actions.
Ben Pfaff [Tue, 18 Jan 2011 00:58:35 +0000 (16:58 -0800)]
datapath: Fix validation of ODPAT_OUTPUT actions.

The missing "break" here meant that an attempt to output to any port
number that happened to include the wrong bit would fail.

Problem introduced by commit cdee00fd635 (datapath: Replace "struct
odp_action" by Netlink attributes.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jess@nicira.com>
Reported-by: Michael Mao <mmao@nicira.com>
Bug #4385.

13 years agodatapath: Consistently parenthesize the operand of 'sizeof'.
Ben Pfaff [Mon, 17 Jan 2011 22:34:55 +0000 (14:34 -0800)]
datapath: Consistently parenthesize the operand of 'sizeof'.

This is proper kernel style.

Kernel style also encourages using a type name instead of an expression as
sizeof's operand, but this patch doesn't make any of those changes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agonetdev-linux: Fix strict aliasing warnings.
Ethan Jackson [Fri, 14 Jan 2011 20:41:39 +0000 (12:41 -0800)]
netdev-linux: Fix strict aliasing warnings.

This commit fixes warnings caused by the miimon code's breakage of
strict aliasing rules.

Reported-by: Jesse Gross <jesse@nicira.com>
Implemented-by: Ben Pfaff <blp@nicira.com>
13 years agoroute-table: Handle route updates more robustly.
Ethan Jackson [Fri, 14 Jan 2011 00:29:31 +0000 (16:29 -0800)]
route-table: Handle route updates more robustly.

The kernel does not broadcast rtnetlink route messages in all cases
one would expect.  This can cause stale entires to end up in the
route table which may cause incorrect results for
route_table_get_ifindex() queries.  This commit causes rtnetlink
route messages to dump the entire route table on the next
route_table_get_ifindex() query.

13 years agoroute-table: Process route messages more selectively.
Ethan Jackson [Fri, 14 Jan 2011 00:40:42 +0000 (16:40 -0800)]
route-table: Process route messages more selectively.

This commit cleans up the routing table by preventing it from
processing messages which are not relevant for our purposes.

13 years agolib: Simplify rtnetlink routing functionality.
Ethan Jackson [Wed, 12 Jan 2011 22:55:18 +0000 (14:55 -0800)]
lib: Simplify rtnetlink routing functionality.

This commit removes the rtnetlink-route module and replaces it with
a much simpler to use route-table module.  The route-table uses
rtnetlink to maintain a routing table which may be used to query
the egress interface of particular addresses.

This commit also converts netdev-vport to use the new route-table
module.

13 years agoretnetlink: Add rtnetlink_destroy function.
Ethan Jackson [Thu, 13 Jan 2011 19:54:33 +0000 (11:54 -0800)]
retnetlink: Add rtnetlink_destroy function.

This commit adds a function to rtnetlink which may be used to
destroy struct rtnetlink handles.  This function will be used in a
future commit.

13 years agodatapath: Get rid of compat.h, compat26.h in favor of modern approach.
Ben Pfaff [Wed, 12 Jan 2011 18:44:43 +0000 (10:44 -0800)]
datapath: Get rid of compat.h, compat26.h in favor of modern approach.

I had completely forgotten that we had a top-level compat.h and compat26.h.
It's better to distribute their contents to individual compat headers, so
this commit does so and deletes them.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: Use NULL for null pointer in compat code.
Ben Pfaff [Wed, 12 Jan 2011 17:49:44 +0000 (09:49 -0800)]
datapath: Use NULL for null pointer in compat code.

Fixes a sparse warning on 2.6.18:

datapath/linux-2.6/compat-2.6/include/net/dst.h:12:20: warning: Using plain
integer as NULL pointer

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoovsdb-data: Fix warnings.
Ethan Jackson [Thu, 13 Jan 2011 01:26:00 +0000 (17:26 -0800)]
ovsdb-data: Fix warnings.

This commit fixes "may be used uninitialized" warnings in
ovsdb-data.c

13 years agodebian: Modify ovs-bugtool to include collectd rrd logs
Sajjad Lateef [Thu, 13 Jan 2011 01:07:58 +0000 (17:07 -0800)]
debian: Modify ovs-bugtool to include collectd rrd logs

collectd is a utility that stores rrd logs in the directory
/var/lib/collectd/rrd/ by default. rrd logs are created when
collectd is configured to output logs in Round Robin Database
format.

With this change, ovs-bugtool will include collectd logs in the
output bundle from /var/lib/collectd/rrd.  The output bundle will
include all sub-directories of the specified collectd directory.

ovs-bugtool checks if a directory exists before it attempts to
include the directory contents in the output bundle. So, running
ovs-bugtool on a system that does not have collectd logs should
not negatively affect the behavior of ovs-bugtool.

13 years agoxenserver: Add miimon configuration support for xenserver.
Ethan Jackson [Wed, 12 Jan 2011 03:10:28 +0000 (19:10 -0800)]
xenserver: Add miimon configuration support for xenserver.

This commit makes necessary changes to Interface Reconfigure to
allow miimon bond-detect-mode and bond-miimon-interval to be
changed using xapi.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
13 years agovswitchd: Add miimon support.
Ethan Jackson [Sat, 8 Jan 2011 00:22:34 +0000 (16:22 -0800)]
vswitchd: Add miimon support.

This commit allows users to check link status in bonded ports using
MII instead of carrier.

13 years agonx-match: Print register values in hex in "load" action also.
Ben Pfaff [Wed, 12 Jan 2011 21:38:19 +0000 (13:38 -0800)]
nx-match: Print register values in hex in "load" action also.

cls_rule_format() prints register values are printed in hex, but the "load"
action was printing them in decimal.  This makes it consistent.

Requested-by: Paul Ingram <paul@nicira.com>
Bug #4249.

13 years agoofp-print: Add tests for OpenFlow message formatting.
Ben Pfaff [Wed, 12 Jan 2011 21:57:53 +0000 (13:57 -0800)]
ofp-print: Add tests for OpenFlow message formatting.

It's become clear over the past few weeks that some people really depend
on the formatting of ofp-print output.  It has also become clear that OVS
doesn't have anything that actually checks or enforces the formatting of
the output.  The former is not something I want to encourage, but the
latter is somewhat worrisome because the formatting does change from time
to time and I want to make sure that that is intentional.

So this commit adds at least one test for each supported OpenFlow and
Nicira extension message, so that we can better keep track of changes.

13 years agoofp-print: Insert missing whitespace.
Ben Pfaff [Tue, 14 Dec 2010 00:19:19 +0000 (16:19 -0800)]
ofp-print: Insert missing whitespace.

13 years agoofp-print: Print fragment handling in OpenFlow switch config messages.
Ben Pfaff [Tue, 14 Dec 2010 20:08:10 +0000 (12:08 -0800)]
ofp-print: Print fragment handling in OpenFlow switch config messages.

13 years agoAutomatically extract error types and codes for formatting.
Ben Pfaff [Wed, 12 Jan 2011 21:42:50 +0000 (13:42 -0800)]
Automatically extract error types and codes for formatting.

13 years agopython: Use os.path.basename instead of open-coding it.
Ben Pfaff [Wed, 12 Jan 2011 21:43:22 +0000 (13:43 -0800)]
python: Use os.path.basename instead of open-coding it.

Reported-by: Justin Pettit <jpettit@nicira.com>
13 years agonicira-ext: Fix typo in comment.
Ben Pfaff [Wed, 12 Jan 2011 21:50:18 +0000 (13:50 -0800)]
nicira-ext: Fix typo in comment.

Reported-by: Justin Pettit <jpettit@nicira.com>
13 years agotests: Fix bonding related test failures.
Ethan Jackson [Wed, 12 Jan 2011 18:39:52 +0000 (10:39 -0800)]
tests: Fix bonding related test failures.

The tests did not get updated with recent interface reconfigure
changes.  This fixes the problem.

13 years agoFix non-static instances of "struct vlog_rate_limit" and add check.
Ben Pfaff [Wed, 12 Jan 2011 17:22:12 +0000 (09:22 -0800)]
Fix non-static instances of "struct vlog_rate_limit" and add check.

A non-static vlog_rate_limit is not actually going to rate-limit anything.

13 years agoAdd some new generated files to .gitignore.
Justin Pettit [Wed, 12 Jan 2011 03:05:09 +0000 (19:05 -0800)]
Add some new generated files to .gitignore.

A few generated files have snuck in that should be ignored by git.

13 years agouuid: Correct name of header file in comment.
Justin Pettit [Wed, 12 Jan 2011 02:57:01 +0000 (18:57 -0800)]
uuid: Correct name of header file in comment.

13 years agoxenserver: Allow bond_mode configuration in xen.
Ethan Jackson [Mon, 10 Jan 2011 20:18:50 +0000 (12:18 -0800)]
xenserver: Allow bond_mode configuration in xen.

This commit adds bond_mode configuration to Interface Reconfigure
so that it may be changed using standard XenServer commands.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
13 years agovswitchd: Rename bond_mode configuration.
Ethan Jackson [Mon, 10 Jan 2011 19:23:13 +0000 (11:23 -0800)]
vswitchd: Rename bond_mode configuration.

This commit renames bond_type to bond_mode to be more consistent
with XenServer configuration.  It also renames the "slb" bond_mode
to "balance-slb".

13 years agoDebian: Update change log for 1.1.0~pre2.g2.ea763e0e-1 upload
Simon Horman [Tue, 11 Jan 2011 23:45:25 +0000 (08:45 +0900)]
Debian: Update change log for 1.1.0~pre2.g2.ea763e0e-1 upload

13 years agobridge: Move tunnel_egress_iface to status column.
Ethan Jackson [Wed, 5 Jan 2011 19:51:15 +0000 (11:51 -0800)]
bridge: Move tunnel_egress_iface to status column.

This commit removes the tunnel_egress_iface column from the
interface table and moves it's data to the status column.  In the
process it reverts the database to version 1.0.0.

13 years agoxenserver: Remove "Required-" parameters from "openvswitch" init script.
Justin Pettit [Tue, 11 Jan 2011 05:32:09 +0000 (21:32 -0800)]
xenserver: Remove "Required-" parameters from "openvswitch" init script.

Commit 72dfb3b (xenserver: Add LSB init info to scripts.) added LSB init
info to the XenServer scripts.  This was verified to work on XenServer
5.5, but newer versions of XenServer interpret these values and alter
when "openvswitch" gets called.  This causes XenServer to not come up
with its networking configuration properly.

By removing the "Required-" parameters, OVS will properly come up.  This
is just a temporary fix, and a more proper one will be forthcoming.

13 years agotests: Fix Y2011 bug in testsuite.
Ben Pfaff [Mon, 10 Jan 2011 20:54:26 +0000 (12:54 -0800)]
tests: Fix Y2011 bug in testsuite.

The tests have been failing for a few days now, because the PKI expired a
few days into 2011.  This commit instead generates the PKI at "make check"
time, which has the additional benefit of getting some test exposure for
the ovs-pki program.

Reported-by: Aaron M. Ucko <ucko@debian.org>
CC: 609506@bugs.debian.org
13 years agovswitchd: Fix "make distcheck" by cleaning up stray "stamp" file.
Ben Pfaff [Mon, 10 Jan 2011 20:46:26 +0000 (12:46 -0800)]
vswitchd: Fix "make distcheck" by cleaning up stray "stamp" file.

13 years agoovs-pki: Fix handling of relative log file name on --log option.
Ben Pfaff [Mon, 10 Jan 2011 20:44:46 +0000 (12:44 -0800)]
ovs-pki: Fix handling of relative log file name on --log option.

"$var=value" is not valid shell syntax, but "var=value" is.

13 years agovswitchd: Active backup bonding.
Ethan Jackson [Thu, 6 Jan 2011 20:14:23 +0000 (12:14 -0800)]
vswitchd: Active backup bonding.

This commit adds active backup bonding support to vswitchd.

Bug #4210.

13 years agovswitchd: Fix segmentation fault with bonded ports.
Ethan Jackson [Fri, 7 Jan 2011 00:17:23 +0000 (16:17 -0800)]
vswitchd: Fix segmentation fault with bonded ports.

This commit fixes a segmentation fault which could occur when a
bonded port was destroyed.

13 years agovswitchd: Whitespace fixups.
Ethan Jackson [Thu, 6 Jan 2011 20:09:05 +0000 (12:09 -0800)]
vswitchd: Whitespace fixups.

Removed tabs from vswitch.xml.  Removed trailing whitespace from
the bridge.

13 years agoxenserver: Remove Linux bridge on startup if no bridges exist.
Patrick Mullaney [Wed, 15 Dec 2010 19:07:10 +0000 (11:07 -0800)]
xenserver: Remove Linux bridge on startup if no bridges exist.

Otherwise, if the bridge module is loaded but no bridges exist, on all
but the most recent Linux kernels this prevents the Open vSwitch kernel
module from loading.

Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agoxenserver: Add defaults for ENABLE_BRCOMPAT, ENABLE_FAKE_PROC_NET.
Patrick Mullaney [Wed, 15 Dec 2010 18:41:13 +0000 (10:41 -0800)]
xenserver: Add defaults for ENABLE_BRCOMPAT, ENABLE_FAKE_PROC_NET.

On non-XenServer systems there is no $PRODUCT_VERSION to test for default
behavior, so use reasonable defaults in that case.

Signed-off-by: Patrick Mullaney <pm.mullaney@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>