sliver-openvswitch.git
13 years agodatapath: Check vswitch_skb_checksum_setup() return code.
Jesse Gross [Thu, 17 Jun 2010 22:17:53 +0000 (15:17 -0700)]
datapath: Check vswitch_skb_checksum_setup() return code.

If vswitch_skb_checksum_setup() returns an error, the checksum
pointers probably haven't been set correctly which could cause
a crash later.  We should give up immediately on error.

13 years agodatapath: Call vswitch_skb_checksum_setup() before doing GSO.
Jesse Gross [Thu, 17 Jun 2010 22:15:11 +0000 (15:15 -0700)]
datapath: Call vswitch_skb_checksum_setup() before doing GSO.

Since GSO computes checksums as it does segmentation, we need to
setup the checksum pointers before calling skb_gso_segment().  Failing
to do so can potentially result in warnings, incorrect checksums,
crashes, or redundant checksum computation.  In general we don't
hit this case because the code path is run during the first packet
in a flow, which is generally not a large GSO packet.

This was found during the investigation of NIC-121 but has no impact
on it because vswitch_skb_checksum_setup() is a no-op on 2.6.27-based
XenServer kernels.

13 years agoofproto: Consistently make queue_id uint32_t.
Jesse Gross [Fri, 18 Jun 2010 17:24:28 +0000 (10:24 -0700)]
ofproto: Consistently make queue_id uint32_t.

In some places queue_id was a uint16_t which caused issues when
comparing to 32-bit constants and doing byte swaps.

13 years agoovsdb-idlc: Fix warning in generated code.
Ben Pfaff [Thu, 17 Jun 2010 22:24:54 +0000 (15:24 -0700)]
ovsdb-idlc: Fix warning in generated code.

Without this fix, ovsdb-idlc generates the following line of code:
    c->type.key.u.integer.max = 4294967295;
which causes GCC to issue this warning:
    this decimal constant is unsigned only in ISO C90

This commit changes the generated code to:
    c->type.key.u.integer.max = INT64_C(4294967295);
which eliminates the warning.

13 years agovswitchd: Attempt to further clarify Port "trunk" and "tag" documentation.
Ben Pfaff [Tue, 15 Jun 2010 19:14:43 +0000 (12:14 -0700)]
vswitchd: Attempt to further clarify Port "trunk" and "tag" documentation.

CC: Hao Zheng <hzheng@nicira.com>
13 years agoImplement QoS framework.
Ben Pfaff [Thu, 17 Jun 2010 22:04:12 +0000 (15:04 -0700)]
Implement QoS framework.

ovs-vswitchd doesn't declare its QoS capabilities in the database yet,
so the controller has to know what they are.  We can add that later.

The linux-htb QoS class has been tested to the extent that I can see that
it sets up the queues I expect when I run "tc qdisc show" and "tc class
show".  I haven't tested that the effects on flows are what we expect them
to be.  I am sure that there will be problems in that area that we will
have to fix.

13 years agoshash: New functions shash_destroy_free_data() and shash_clear_free_data().
Ben Pfaff [Mon, 7 Jun 2010 23:58:57 +0000 (16:58 -0700)]
shash: New functions shash_destroy_free_data() and shash_clear_free_data().

13 years agoport-array: Add port_array_delete() function.
Ben Pfaff [Thu, 3 Jun 2010 17:17:51 +0000 (10:17 -0700)]
port-array: Add port_array_delete() function.

port_array_delete(pa, idx) is equivalent to port_array_set(pa, idx, NULL),
but it never allocates memory and avoids conditionals.

13 years agonetdev-linux: Create rtnetlink socket up front instead of on demand.
Ben Pfaff [Fri, 28 May 2010 23:34:55 +0000 (16:34 -0700)]
netdev-linux: Create rtnetlink socket up front instead of on demand.

This simplifies a bit of existing code since it is known that an rtnetlink
socket will always be available.  It will simplify additional code in
upcoming commits.

13 years agonetlink: Improve support for nested Netlink attributes.
Ben Pfaff [Fri, 28 May 2010 23:16:23 +0000 (16:16 -0700)]
netlink: Improve support for nested Netlink attributes.

Fairly often it happens that nested Netlink attributes must themselves
contain Netlink attributes.  In such a case, nlmsg_put_nested() is not so
convenient, because it requires the contents to be pre-assembled and then
copied into place.  This commit introduces a new interface that instead
allows the nested attributes to be assembled in-place.  As a demonstration,
it updates nl_msg_put_nested() to use this new interface.

13 years agonetlink: Add support for Netlink table dumping.
Ben Pfaff [Fri, 21 May 2010 00:14:22 +0000 (17:14 -0700)]
netlink: Add support for Netlink table dumping.

13 years agonetlink: Add functions for handling nested attributes.
Ben Pfaff [Thu, 20 May 2010 22:57:56 +0000 (15:57 -0700)]
netlink: Add functions for handling nested attributes.

13 years agonetlink: Make nl_sock_transact() always return a reply on success.
Ben Pfaff [Thu, 20 May 2010 22:57:36 +0000 (15:57 -0700)]
netlink: Make nl_sock_transact() always return a reply on success.

Until now, if nl_sock_transact() received a reply that merely acknowledged
success, without providing any other payload, it would return success but
not provide the reply to its caller.  This is inconsistent and could easily
cause a segfault in a caller that expects to see the reply on success, if
kernel behavior changed, for whatever reason, so that a request that
previously returned data now just returns an acknowledgment.  In practice
this kind of change should never happen, but it is still better to handle
it properly.

13 years agonetlink: Fix bad assumption about nested Netlink attributes.
Ben Pfaff [Thu, 20 May 2010 22:53:17 +0000 (15:53 -0700)]
netlink: Fix bad assumption about nested Netlink attributes.

I had assumed that nested Netlink attributes contained an entire Netlink
message, including header.  This is wrong: they contain only a series of
attributes.

Nothing in the tree actually used nested attributes until now, so this
doesn't fix any existing bugs.

13 years agonetlink: Make nl_sock_transact() discard reply if 'replyp' is null.
Ben Pfaff [Wed, 19 May 2010 21:13:23 +0000 (14:13 -0700)]
netlink: Make nl_sock_transact() discard reply if 'replyp' is null.

Sometimes only the success or failure return value is interesting, not the
details of the reply, so this simplifies some callers.

13 years agonetlink: Drop sock parameter from nl_msg_put_(ge)nlmsghdr().
Ben Pfaff [Thu, 3 Jun 2010 17:22:31 +0000 (10:22 -0700)]
netlink: Drop sock parameter from nl_msg_put_(ge)nlmsghdr().

These two functions use their "sock" parameter only to figure out the
nlmsg_pid to put in the nlmsghdr.  But that field can be filled in just
as well right before sending the message.  Since our functions for sending
Netlink messages always modify the nlmsghdr anyhow (to fill in the length),
there is little benefit to filling in the nlmsg_pid in advance.  The cost,
on the other hand, is having to pass another argument to functions that
already have too many.  So this commit removes the argument.

13 years agovconn: Move OpenFlow utility functions into new file ofp-util.c.
Ben Pfaff [Thu, 27 May 2010 20:14:05 +0000 (13:14 -0700)]
vconn: Move OpenFlow utility functions into new file ofp-util.c.

The main purpose of the vconn code is to ship OpenFlow messages across
network connections.  Over time a large number of utility functions related
to OpenFlow messages have also crept into vconn.c, but that's really
logically separate.  This commit breaks those functions out into a new
file.

13 years agoovs-vsctl: Support references among records at creation time.
Ben Pfaff [Wed, 2 Jun 2010 18:08:03 +0000 (11:08 -0700)]
ovs-vsctl: Support references among records at creation time.

This makes it easy to create a bunch of records that are all related to
each other in a single ovs-vsctl invocation.  It adds an example to the
ovs-vsctl manpage.

13 years agoovs-vsctl: Add support for command options that accept arguments.
Ben Pfaff [Tue, 18 May 2010 19:46:56 +0000 (12:46 -0700)]
ovs-vsctl: Add support for command options that accept arguments.

13 years agoovs-vsctl: Update manpage. Use same order as ovs-vswitchd.conf.db.5.
Ben Pfaff [Tue, 18 May 2010 19:46:23 +0000 (12:46 -0700)]
ovs-vsctl: Update manpage.  Use same order as ovs-vswitchd.conf.db.5.

13 years agoovs-vsctl: Fix assert-fail when an error occurs and "create" command used.
Ben Pfaff [Tue, 18 May 2010 21:16:43 +0000 (14:16 -0700)]
ovs-vsctl: Fix assert-fail when an error occurs and "create" command used.

When the "create" command is used, post_create() calls
ovsdb_idl_txn_get_insert_uuid(), which asserts that the transaction
completed successfully.  This makes it clear that postprocess functions
should only run when the transaction completes successfully.  (Currently
post_create() is the only postprocess function.)

13 years agoofproto: Fix byte order for OFP_VLAN_NONE to dl_vlan in struct flow.
Ben Pfaff [Thu, 20 May 2010 22:43:13 +0000 (15:43 -0700)]
ofproto: Fix byte order for OFP_VLAN_NONE to dl_vlan in struct flow.

This is not a bug, since OFP_VLAN_NONE is all-1-bits, but it is still
best to get it correct.

13 years agovswitch: Improve documentation for datapath_id column.
Ben Pfaff [Wed, 16 Jun 2010 21:41:22 +0000 (14:41 -0700)]
vswitch: Improve documentation for datapath_id column.

It was insufficiently documented that the vswitch, not the user, sets the
datapath_id column, which confused people (including me).  This commit
fixes the problem.

13 years agovswitch: Datapath IDs are now 16 hex digits.
Ben Pfaff [Wed, 16 Jun 2010 23:01:41 +0000 (16:01 -0700)]
vswitch: Datapath IDs are now 16 hex digits.

OpenFlow 1.0 datapath IDs are 64 bits long, so the "datapath_id" column
should have 16 hex digits.  The documentation had this right, but the
code didn't implement it correctly.

Reported-by: Arthur van Kleef <arthur.vankleef@os3.nl>
13 years agoovs-vsctl: Fix spelling error in log message.
Ben Pfaff [Tue, 15 Jun 2010 23:09:34 +0000 (16:09 -0700)]
ovs-vsctl: Fix spelling error in log message.

13 years agoovsdbmonitor: Clean some more files.
Ben Pfaff [Tue, 15 Jun 2010 17:39:00 +0000 (10:39 -0700)]
ovsdbmonitor: Clean some more files.

Fixes "make distcheck" error.

13 years agoovsdbmonitor: Put temporary file in ovsdb/ovsdbmonitor directory.
Ben Pfaff [Tue, 15 Jun 2010 17:38:44 +0000 (10:38 -0700)]
ovsdbmonitor: Put temporary file in ovsdb/ovsdbmonitor directory.

The temporary file ovsdbmonitor.tmp was being put into the root of the
build directory, which seems unnecessary.

Also, delete the temporary file when we no longer need it.

13 years agoupdate-debian-changelog: Pass "-f" to "mv" to fix "make distcheck".
Ben Pfaff [Tue, 15 Jun 2010 17:37:27 +0000 (10:37 -0700)]
update-debian-changelog: Pass "-f" to "mv" to fix "make distcheck".

"make distcheck" unsets the "writable" bit of files as it installs them
on "make dist", so to avoid an error (or a user query) updating
debian/changelog in such a situation we must use the -f option.

13 years agoWHY-OVS: New file explaining the rationale for Open vSwitch.
Ben Pfaff [Thu, 17 Jun 2010 17:24:39 +0000 (10:24 -0700)]
WHY-OVS: New file explaining the rationale for Open vSwitch.

Signed-off-by: Martin Casado <casado@nicira.com>
Signed-off-by: Paul Fazzone <pfazzone@nicira.com>
Signed-off-by: Dan Wendlandt <dan@nicira.com>
13 years agoxenserver: Delete network.conf on package removal on XenServer 5.5.0.
Ben Pfaff [Wed, 9 Jun 2010 20:56:06 +0000 (13:56 -0700)]
xenserver: Delete network.conf on package removal on XenServer 5.5.0.

The previous commit "xenserver: Create network.conf before running
interface-reconfigure" fixed a problem that was not noticed earlier only
because we had not tested very often on pristine XenServer 5.5.0 systems,
instead mostly on systems that had had Open vSwitch installed before and
thus already had a network.conf file.  This commit should help to avoiding
future regressions in this area, by removing network.conf when the
openvswitch package is removed on XenServer 5.5.0.

13 years agoxenserver: Create network.conf before running interface-reconfigure.
Ben Pfaff [Wed, 9 Jun 2010 20:56:56 +0000 (13:56 -0700)]
xenserver: Create network.conf before running interface-reconfigure.

XenServer 5.5.0 doesn't have /etc/xensource/network.conf, but the
interface-reconfigure that OVS installs issues an error and aborts if it
does not exist, so create network.conf before trying to run it.

CC: Paul Ingram <paul@nicira.com>
13 years agobrcompatd: Remove commented-out code.
Ben Pfaff [Wed, 9 Jun 2010 20:17:51 +0000 (13:17 -0700)]
brcompatd: Remove commented-out code.

This code was never converted from the configuration database to OVSDB.
In the subsequent months the lack of it has not caused any problems, so
this commit deletes it.

13 years agobridge: Remove commented-out code for custom management and snoop listeners.
Ben Pfaff [Wed, 9 Jun 2010 20:16:09 +0000 (13:16 -0700)]
bridge: Remove commented-out code for custom management and snoop listeners.

Before the transition from configuration file to OVSDB, it was possible to
override the defaults for OpenFlow management listeners and for OpenFlow
controller connection snooping.  The former can now effectively be done by
configuring a controller through the database.  Overriding the latter is
not very useful (no one has complained that it cannot be done any longer).
So this commit deletes the commented-out code.

13 years agobridge: Remove commented-out code to set OpenFlow description strings.
Ben Pfaff [Wed, 9 Jun 2010 19:52:05 +0000 (12:52 -0700)]
bridge: Remove commented-out code to set OpenFlow description strings.

This code has been commented out since the end of January, so it cannot
be very important.

13 years agobridge: Remove unused and write-only members of 'struct bridge'.
Ben Pfaff [Wed, 9 Jun 2010 19:47:45 +0000 (12:47 -0700)]
bridge: Remove unused and write-only members of 'struct bridge'.

13 years agovlog: Check that all declared vlog modules are used, at "make" time.
Ben Pfaff [Tue, 15 Jun 2010 17:25:21 +0000 (10:25 -0700)]
vlog: Check that all declared vlog modules are used, at "make" time.

13 years agovlog: Remove modules that don't have any users.
Ben Pfaff [Wed, 9 Jun 2010 00:04:54 +0000 (17:04 -0700)]
vlog: Remove modules that don't have any users.

I am surprised that there are so many of these.

13 years agoovsdb-tool: Don't wait for lockfiles on "compact" or "convert".
Ben Pfaff [Wed, 9 Jun 2010 18:23:47 +0000 (11:23 -0700)]
ovsdb-tool: Don't wait for lockfiles on "compact" or "convert".

Until now, "ovsdb-tool convert" and "ovsdb-tool compact" were willing to
wait an arbitrarily long time to get a lock on the database or on a
temporary file.  In practice, though, the program most likely to have the
lock is ovsdb-server, which is not a transient process, and thus
ovsdb-tool will likely wait indefinitely if it waits at all.

This commit changes these ovsdb-tool commands so that they won't wait at
all if some other program has the lock.  (The other commands already had
this behavior.)

As a side effect, this change fixes the behavior of
"/etc/init.d/openvswitch start" when Open vSwitch was already running.
Previously, it would hang waiting for "ovsdb-tool convert" to finish.
Now, it completes quickly with an error.

CC: Reid Price <reid@nicira.com>
Bug #2864.

13 years agogre: Improve headroom calculation to reducing copying.
Jesse Gross [Fri, 11 Jun 2010 22:10:35 +0000 (15:10 -0700)]
gre: Improve headroom calculation to reducing copying.

The first change is use skb_header_cloned() instead of (skb_cloned()
 && skb_clone_writable()).  While these are effectively the same
checks, skb_clone_writable() does not exist until 2.6.23 and relies
on information not available in earlier kernels and therefore the
compat version always returns false.  Since GRE only adds data to
the front of the packet and this is on the transmit path (meaning
there is no important data in the SKB head) it is safe to use
skb_header_cloned().  This avoids a copy for locally generated
TCP packets on the affected kernels.

The second change is to always allocate 64 bytes of headroom when
a copy needs to be made.  There is no cost to allocating extra
space once we have decided to make a copy and can avoid another
copy later if we need to add a VLAN tag.

13 years agoINSTALL.Linux: Note the need for CONFIG_TUN and /dev/net/tun.
Ben Pfaff [Fri, 11 Jun 2010 17:52:02 +0000 (10:52 -0700)]
INSTALL.Linux: Note the need for CONFIG_TUN and /dev/net/tun.

13 years agoMention that /dev/urandom is needed.
Ben Pfaff [Fri, 11 Jun 2010 17:35:52 +0000 (10:35 -0700)]
Mention that /dev/urandom is needed.

13 years agotests: Allow some difference in rounding in timeval test.
Jesse Gross [Thu, 10 Jun 2010 23:35:34 +0000 (16:35 -0700)]
tests: Allow some difference in rounding in timeval test.

We now use a time source that provides nanosecond granularity.
However, our test uses gettimeofday() for comparision, which has
microsecond granularity.  In some cases this can lead to different
values depending on the rounding.  This allows us to be off by one
to prevent intermittent test failures.

13 years agonetdev-vport: Use vport set_stats instead of internal dev.
Jesse Gross [Wed, 9 Jun 2010 19:54:34 +0000 (12:54 -0700)]
netdev-vport: Use vport set_stats instead of internal dev.

In certain cases we require the ability to provide stats that are
added to the values collected by the kernel (currently only used
by bond fake devices).  Internal devices previously implemented
this directly but now that their stats are now handled by the vport
layer the functionality has been moved there.  This removes the
userspace code to set the stats and replaces it with a mechanism
to access the equivalent functionality in the vport layer.

13 years agonetdev-linux: Add capability to get stats from vport layer.
Jesse Gross [Tue, 8 Jun 2010 02:20:28 +0000 (19:20 -0700)]
netdev-linux: Add capability to get stats from vport layer.

The vport layer has the ability to track stats using 64-bit counters,
even if the kernel is only 32-bit.  This first attempts to collect
stats from these counters if they are available and otherwise falls
back to the normal Linux interfaces.

13 years agovport-internal: Convert internal devices to vport stats.
Jesse Gross [Thu, 20 May 2010 01:28:31 +0000 (18:28 -0700)]
vport-internal: Convert internal devices to vport stats.

Internal devices currently keep track of stats themselves.  However,
we now have stats tracking in the vport layer, so convert to use
that instead to avoid code duplication and take advantage of
additional features such as 64-bit counters.

13 years agovport-netdev: Use vport stats layer on 32-bit machines.
Jesse Gross [Wed, 19 May 2010 22:22:28 +0000 (15:22 -0700)]
vport-netdev: Use vport stats layer on 32-bit machines.

Linux devices store stats in counters the size of a machine word,
which are rapidly overflowed on a 32-bit machine.  In this
situation we now use the vport stats layer, which always uses 64-
bit stats.  On 64-bit machines we continue to use the normal
Linux stats to avoid the extra overhead of counting twice.

13 years agovport: Allow offsets to be set for stats.
Jesse Gross [Thu, 20 May 2010 00:18:08 +0000 (17:18 -0700)]
vport: Allow offsets to be set for stats.

Adds a method to set a group of stats to be added to the values
gathered normally.  This is needed for the fake bond device to
show the stats of its underlying slaves.  Also enables devices
that use the generic stats layer to define a get_stats() function
to provide additional error counts.

13 years agovport: Move 'extern' declarations of vports to header.
Jesse Gross [Thu, 10 Jun 2010 20:48:08 +0000 (13:48 -0700)]
vport: Move 'extern' declarations of vports to header.

Since vport implementations have no header files they needed to be
declared as extern before being used.  They are currently declared
in vport.c but this isn't safe because the compiler will silently
accept it if the type is incorrect.  This moves those declarations
into vport.h, which is included by all implementations and will
cause errors about conflicting types if there is a mismatch.

13 years agovport: Rename userspace functions.
Jesse Gross [Sat, 29 May 2010 01:09:27 +0000 (18:09 -0700)]
vport: Rename userspace functions.

The vport library can be accessed from both userspace and the
kernel using different sets of functions.  These functions were
named similarly, so add _user to the userspace variants to
distinguish them.

13 years agoxenserver: Remove some ovs-xenserverd support that I missed.
Ben Pfaff [Tue, 8 Jun 2010 23:33:39 +0000 (16:33 -0700)]
xenserver: Remove some ovs-xenserverd support that I missed.

Oops.  Must have been too giddy to look carefully the first time.

This time I'll test it before I push.

13 years agoFix EXTRA_DIST dependence on Automake conditionals.
Ben Pfaff [Wed, 26 May 2010 23:15:48 +0000 (16:15 -0700)]
Fix EXTRA_DIST dependence on Automake conditionals.

Automake respects conditionals around EXTRA_DIST assignments.  That is, if
COND is not true, then the following will not distribute 'myfile':
    if COND
    EXTRA_DIST += myfile
    endif

See http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
for more information.

This behavior is surprising, at least to me.  But we can work around it:
anything that can ever *potentially* be assigned to noinst_HEADERS is
always distributed.  So this commit eliminates the problem by adding
$(EXTRA_DIST) to noinst_HEADERS.

13 years agotimeval: Use monotonic time where appropriate.
Jesse Gross [Wed, 9 Jun 2010 00:18:48 +0000 (17:18 -0700)]
timeval: Use monotonic time where appropriate.

Most of the timekeeping needs of OVS are simply to measure intervals,
which means that it is sensitive to changes in the clock.  This commit
replaces the existing clocks with monotonic timers.  An additional set
of wall clock timers are added and used in locations that need absolute
time.

Bug #1858

13 years agoxenserver: Don't complain for "bridge" network.conf value
Justin Pettit [Tue, 8 Jun 2010 19:53:46 +0000 (12:53 -0700)]
xenserver: Don't complain for "bridge" network.conf value

Just silently don't start OVS daemons if /etc/xensource/network.conf
contains a value of "bridge".  This allows the init script to be called
regardless of whether OVS or bridge is configured.

13 years agoxenserver: Don't start OVS if network.conf isn't "openvswitch"
Justin Pettit [Tue, 8 Jun 2010 06:17:26 +0000 (23:17 -0700)]
xenserver: Don't start OVS if network.conf isn't "openvswitch"

The OVS processes would start as long as "/etc/xensource/network.conf"
didn't contain "bridge".  The other OVS scripts, however, would complain
(and not run) if it wasn't "vswitch" or "openvswitch".  This commit will
only start the OVS processes if a value of "vswitch" or "openvswitch" is
present, so some consistency is provided.

(If "/etc/xensource/network.conf" is not "bridge", "vswitch", or
"openvswitch", then XAPI will refuse to run anyway, so not much is going
to happen on the system.)

13 years agodiscovery: Include datapath name in log messages.
Ben Pfaff [Fri, 4 Jun 2010 20:49:25 +0000 (13:49 -0700)]
discovery: Include datapath name in log messages.

This commit adds the datapath name to discovery and DHCP-related messages,
so that it is obvious to the user where discovery is taking place.

Previously, messages looked like:
    Jun 04 13:41:29|00010|dhcp_client|INFO|sending DHCPDISCOVER

With this commit, they look like this:
    Jun 04 13:41:29|00010|dhcp_client|INFO|br0: sending DHCPDISCOVER

I may be the only person in the world who regularly uses controller
discovery.

13 years agoofproto: Make OpenFlow connection log messages name the datapath.
Ben Pfaff [Tue, 8 Jun 2010 17:38:57 +0000 (10:38 -0700)]
ofproto: Make OpenFlow connection log messages name the datapath.

Until now, log messages about OpenFlow connections have named the target
of the connection, e.g. "tcp:1.2.3.4:5555", but they have not named the
datapath.  Most often, every datapath has the same target, so this can
make it difficult to tell which connection is going wrong.  Usually, that
isn't important, because all connections with the same target will have the
same problems, but it's probably better to be more informative.

This commit changes the log messages to include the datapath name, so that
"tcp:1.2.3.4:5555" becomes, e.g., "xenbr0<->tcp:1.2.3.4:5555".

Requested-by: Keith Amidon <keith@nicira.com>
13 years agorconn: Make rconn_connect() a 'void' function.
Ben Pfaff [Fri, 4 Jun 2010 00:15:53 +0000 (17:15 -0700)]
rconn: Make rconn_connect() a 'void' function.

The return value from rconn_connect() is essentially meaningless.
None of the current callers uses it.  Get rid of it.

13 years agorconn: Drop rconn_new(), rconn_new_from_vconn() functions.
Ben Pfaff [Thu, 3 Jun 2010 21:41:35 +0000 (14:41 -0700)]
rconn: Drop rconn_new(), rconn_new_from_vconn() functions.

There are enough rconn functions without these helpers, which weren't used
much in practice.

13 years agorconn: Drop 'name' arg to rconn_new_from_vconn(), rconn_connect_unreliably().
Ben Pfaff [Thu, 3 Jun 2010 21:19:33 +0000 (14:19 -0700)]
rconn: Drop 'name' arg to rconn_new_from_vconn(), rconn_connect_unreliably().

The 'name' argument to these functions is actively unhelpful, because none
of the callers provided a better name than the one provided by
vconn_get_name().  So drop it.

13 years agoxenserver: Get rid of ovs-xenserverd.
Ben Pfaff [Fri, 4 Jun 2010 18:25:19 +0000 (11:25 -0700)]
xenserver: Get rid of ovs-xenserverd.

This is no longer used.  Good riddance.

13 years agoxenserver: Ditch ovs-xenserverd even on XenServer 5.5.0.
Ben Pfaff [Fri, 4 Jun 2010 17:52:43 +0000 (10:52 -0700)]
xenserver: Ditch ovs-xenserverd even on XenServer 5.5.0.

Examining the XAPI source code shows that at startup it invokes a script
named /opt/xensource/libexec/xapi-startup-script, if one exists.  Testing
shows that this was also true in XenServer 5.5.0.  No such script is
installed by default.  Searching for "xapi-startup-script" on Google (with
the quotes) has only one hit, which is documentation on XAPI startup.  So
it seems that we're pretty safe in taking advantage of this hook ourselves.

This commit changes the RPM scripts to install refresh-network-uuids as
the XAPI startup hook on XenServer 5.5.0.

CC: Rob Hoes <rob.hoes@citrix.com>
13 years agoxenserver: Make refresh-network-uuids use "interface-reconfigure rewrite".
Ben Pfaff [Fri, 4 Jun 2010 17:55:32 +0000 (10:55 -0700)]
xenserver: Make refresh-network-uuids use "interface-reconfigure rewrite".

Commit 823c5699 "interface-reconfigure: callout to datapath backend class
method on rewrite" changed "interface-reconfigure write" to do what
refresh-network-uuids does.  We can't entirely get rid of
refresh-network-uuids, so this commit rewrites it as a trivial wrapper
around interface-reconfigure.

13 years agoPORTING: Fix some typos.
Ben Pfaff [Tue, 8 Jun 2010 16:51:41 +0000 (09:51 -0700)]
PORTING: Fix some typos.

Reported-by: Justin Pettit <jpettit@nicira.com>
13 years agoOpen vSwitch: Be more definitive about fixing wdp issues in PORTING
Justin Pettit [Tue, 8 Jun 2010 05:51:56 +0000 (22:51 -0700)]
Open vSwitch: Be more definitive about fixing wdp issues in PORTING

13 years agoAdd guide to porting Open vSwitch.
Ben Pfaff [Mon, 7 Jun 2010 21:05:56 +0000 (14:05 -0700)]
Add guide to porting Open vSwitch.

13 years agoxenserver: call "interface-reconfigure rewrite" instead of refresh-network-uuids
Ian Campbell [Fri, 4 Jun 2010 15:47:20 +0000 (16:47 +0100)]
xenserver: call "interface-reconfigure rewrite" instead of refresh-network-uuids

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
13 years agointerface-reconfigure: callout to datapath backend class method on rewrite
Ian Campbell [Fri, 4 Jun 2010 15:39:10 +0000 (16:39 +0100)]
interface-reconfigure: callout to datapath backend class method on rewrite

Use this mechanism to allow the vswitch backend to update the vswitch
configuration's mapping from datapath to XenAPI datamodel Network
UUIDs. The vswitch needs a mechanism to update these when they change
(i.e. on pool join and eject).

Refactor the DatapathFactory method to return the class which the
caller can instantiate or not as the require.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
13 years agoovs-xenserverd: Fix time-delay logic.
Ben Pfaff [Thu, 3 Jun 2010 18:41:43 +0000 (11:41 -0700)]
ovs-xenserverd: Fix time-delay logic.

network_uuid_refresh_run() needs to update pool_conf_mtime as soon as it
notices a change.  Otherwise it thinks that the mtime has changed every
time it is called and therefore never actually runs the refresh script.

Bug #2097.

13 years agoxenserver: Update network UUIDs whenever XAPI restarts.
Ben Pfaff [Fri, 4 Jun 2010 17:02:15 +0000 (10:02 -0700)]
xenserver: Update network UUIDs whenever XAPI restarts.

XAPI calls the "update" method of the vswitch-cfg-update plugin whenever it
starts or restarts.  Thus, this is a good place to trigger updating network
UUIDs.  This commit implements that behavior.  This should fix the problem
of network UUIDs not being updated on pool join, since XAPI restarts when
it joins a pool.

When XenServer 5.5 support is no longer interesting, we should integrate
the refresh-network-uuids script into the XAPI plugin.

Lightly tested, works for me on 5.6.810-31078p.

See-also: http://openvswitch.org/pipermail/dev_openvswitch.org/2010-June/002216.html
Suggested-by: Rob Hoes <rob.hoes@citrix.com>
Bug #2097.

13 years agobridge: Filter some gratuitous ARPs on bond slaves.
Jesse Gross [Wed, 2 Jun 2010 23:26:46 +0000 (16:26 -0700)]
bridge: Filter some gratuitous ARPs on bond slaves.

Normally we filter out packets received on a bond if we have
learned the source MAC as belonging to another port to avoid packets
sent on one slave and reflected back on another.  The exception to
this is gratuitous ARPs because they indicate that the host
has moved to another port.  However, this can result in an additional
problem on the switch that the host moved to if the gratuitous ARP is
reflected back on a bond slave.  In this case, we incorrectly relearn
the slave as the source of the MAC address.  To solve this, we lock the
learning entry for 5 seconds after receiving a gratuitous ARP against
further updates caused by gratuitous ARPs on bond slaves.

Bug #2516

Reported-by: Ian Campbell <ian.campbell@citrix.com>
13 years agoxenserver: make ovs-xenserverd startup configurable and disable it for 5.6.0 onwards.
Ian Campbell [Thu, 3 Jun 2010 14:35:51 +0000 (15:35 +0100)]
xenserver: make ovs-xenserverd startup configurable and disable it for 5.6.0 onwards.

In my testing with XenServer 5.6.810 without ovs-xenserverd the
vswitch bridge external-id network-uuid field was always kept up to
date over both pool join and pool eject. I believe this is because
xapi is restarted on both pool join and pool eject and on restart all
PIFs are plugged again. This causes the vswitch field to be updated,
either via a call to interface reconfigure or via an explicit
ovs-vsctl call in the case of internal networks.

I think the only reason this daemon would still be required with
XenServer 5.5 is that the explicit call to ovs-vsctl for internl
networks is not present there.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
13 years agodatapath: Fix mutual exclusion with bridge module.
Ben Pfaff [Wed, 2 Jun 2010 22:35:15 +0000 (15:35 -0700)]
datapath: Fix mutual exclusion with bridge module.

Mutual exclusion with the Linux bridge module has always been a problem.
But I think that this new approach should work reliably.  It is also
simpler.

13 years agonetdev: Remove may_create/may_open flags.
Jesse Gross [Tue, 1 Jun 2010 21:20:59 +0000 (14:20 -0700)]
netdev: Remove may_create/may_open flags.

The most recent revision of the netdev library added may_create
and may_open flags to explicitly state the intent of the caller as
to whether the device should already be in use.  This was simply
a sanity check for users of the netdev library and the configuration.
At this point the netdev library and its users are well behaved and
should no longer need to be checked.  Additional checks have also
been added for incorrect configuration that mean the netdev library
is no longer the primary line of defense.

These flags themselves create problems because it is not always
easy for a library to know what the state of devices should be.
This is particularly a problem for ovs-openflowd, which expects
ports to be added by ovs-dpctl.  Fixing this either requires that
the checks are so permissive to be useless or ugly hacks to get
around them.  Since they are no longer needed, just remove the
checks.

This commit restores the previous behavior of ovs-openflowd to
not require that ports be specified on the command line or
cleaned up after use.

Bug #2652

CC: Natasha Gude <natasha@nicira.com>
CC: Jean Tourrilhes <jt@hpl.hp.com>
CC: 蒲彦 <yan.p.bjtu@gmail.com>
13 years agonetdev-linux: Give tap FD to first opener.
Jesse Gross [Tue, 1 Jun 2010 22:27:26 +0000 (15:27 -0700)]
netdev-linux: Give tap FD to first opener.

Tap devices can have two FDs that allow transmit and receive from
different perspectives.  We previously would always share one of
the FDs among all openers.  However, this is confusing to some
users (primarily the DHCP client) which expect tap devices to behave
like any other device.  Now we give the tap FD to the first opener,
which knows that it has opened a tap device, and a normal system FD
to everyone else for consistency.

13 years agonetdev-linux: Fix tap device stats.
Jesse Gross [Tue, 1 Jun 2010 21:20:46 +0000 (14:20 -0700)]
netdev-linux: Fix tap device stats.

For tap and internal devices we swap the transmit and receive stats
to appear consistent with other devices.  However, the check whether
to store the stats in a temporary location before the swap did not
include tap devices, which lead to the use of uninitialized memory
when the swap occured.

14 years agoRelease Open vSwitch 1.0.1 v1.0.1
Justin Pettit [Tue, 1 Jun 2010 05:31:07 +0000 (22:31 -0700)]
Release Open vSwitch 1.0.1

14 years agodebian: Fix version number check for changelog.
Jesse Gross [Thu, 27 May 2010 23:35:45 +0000 (16:35 -0700)]
debian: Fix version number check for changelog.

The test to see if the current version is present in the Debian
changelog wasn't properly quoted so we would add a new entry every
time configure was run.

14 years agodatapath: Check for skb_cow_head(), not skb_cow().
Ben Pfaff [Thu, 27 May 2010 22:29:29 +0000 (15:29 -0700)]
datapath: Check for skb_cow_head(), not skb_cow().

skb_cow() has been present since 2.6.12 or earlier, but skb_cow_head() was
added only in 2.6.23, so we were checking for the wrong identifier here.

14 years agodatapath: <linux/if_vlan.h> needs <linux/skbuff.h> on some kernels.
Ben Pfaff [Thu, 27 May 2010 21:11:01 +0000 (14:11 -0700)]
datapath: <linux/if_vlan.h> needs <linux/skbuff.h> on some kernels.

Otherwise this fails to build on 2.6.18.

14 years agoconfigure: Deep-six "5".
Ben Pfaff [Thu, 27 May 2010 21:40:25 +0000 (14:40 -0700)]
configure: Deep-six "5".

Perhaps you've noticed that whenever you run "configure" you end up with
a file named "5" in your current directory.  This commit fixes that
problem.

14 years agodatapath: Fix VLAN insertion behavior on Linux 2.6.27 and 2.6.28.
Ben Pfaff [Thu, 27 May 2010 20:03:45 +0000 (13:03 -0700)]
datapath: Fix VLAN insertion behavior on Linux 2.6.27 and 2.6.28.

The behavior of __vlan_put_tag() has changed over time:

     - In 2.6.26 and earlier, it adjusted both MAC and network header
       pointers.  (The latter didn't make any sense.)

     - In 2.6.27 and 2.6.28, it did not adjust any header pointers at all.

     - In 2.6.29 and later, it adjusts the MAC header pointer only.

The behavior in 2.6.26 and earlier, and in 2.2.29 and later, works OK for
Open vSwitch.  The 2.6.27 and 2.6.28 behavior *almost* works OK, with a few
subtle problems.  If an action that sets a VLAN tag is followed by an
action that strips a VLAN tag, the "strip" action silently fails.  This is
because vlan_pull_tag() in datapath/actions.c sees the encapsulated
protocol, not the 802.1Q protocol, because the MAC header was not adjusted
and does not point to the 802.1Q header.  If multiple set-VLAN actions
occur in a single flow, the second and later actions will fail for the same
reason.

This commit fixes the problem by ensuring that __vlan_put_tag() always
behaves as in 2.6.29 and later.

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

14 years agoAdd dist-hook to ensure that every file gets distributed.
Ben Pfaff [Thu, 27 May 2010 17:00:03 +0000 (10:00 -0700)]
Add dist-hook to ensure that every file gets distributed.

It's easy to add a file to the repository and forget to make sure that it
is distributed.  This commit adds a hook target to the main Makefile that
causes "make dist" to fail if the tree is being built from a Git repository
and some files are not distributed.

14 years agoDistribute files that had been overlooked.
Ben Pfaff [Wed, 26 May 2010 21:05:23 +0000 (14:05 -0700)]
Distribute files that had been overlooked.

In general, every file in the Git repository should be distributed, except
for files that are specific to Git, such as the .gitignore files.  But we
had overlooked several of them.  This commit makes sure that they get
distributed.

14 years agoRemove unused files from source tree.
Ben Pfaff [Wed, 26 May 2010 21:03:38 +0000 (14:03 -0700)]
Remove unused files from source tree.

config-linux-2.6.23-rc9-kvm is an antique that I doubt anyone cares about.
I'd forgotten it was there.

ovsdbmonitor.py.in is an oversight.  It isn't used.  The file that is used,
which is also in the source tree, is ovsdbmonitor.in.

14 years agovswitchd: Treat gratuitous ARP requests like gratuitous ARP replies.
Ben Pfaff [Thu, 27 May 2010 17:06:36 +0000 (10:06 -0700)]
vswitchd: Treat gratuitous ARP requests like gratuitous ARP replies.

vswitchd has long used a gratuitous ARP reply as an indication that a VM
has migrated, because traditional xen.org Linux DomUs send such packets out
when they complete migration.  Relatively recently, however, we realized
that upstream Linux does not do this.  Ian Campbell tracked this down to
two separate issues:

        1. A bug prevented gratuitous ARPs from being sent.

        2. When this was fixed, the gratuitous ARPs that were sent were
           requests, not replies, although kernel documentation sent that
           replies were to be sent.

Ian submitted patches to fix both bugs.  #1 is in process of revision for
acceptance.  #2 was rejected: according to Dave Miller, the documentation
is wrong, not the implementation, because ARP replies would unnecessarily
fill up the ARP tables of devices on the network.

OVS has not until now treated gratuitous ARP requests specially, only
replies.  Now that Linux will be using ARP requests to indicate migration,
OVS should also treat them as such.!  This commit does so.

See http://marc.info/?l=linux-netdev&m=127367215620212&w=2 for Ian's
original patch and http://marc.info/?l=linux-netdev&m=127468303701361&w=2
for Dave Miller's response.

CC: Ian Campbell <Ian.Campbell@citrix.com>
NIC-74.

14 years agodebian: Attempt to keep debian/changelog up-to-date.
Ben Pfaff [Wed, 26 May 2010 22:53:57 +0000 (15:53 -0700)]
debian: Attempt to keep debian/changelog up-to-date.

Invariably we forget to update the version number in debian/changelog as
we change OVS's own version number.  This is embarrassing.

This commit introduces two different times to automatically update the
debian/changelog version number: whenever boot.sh runs and whenever
"make dist" runs.  In the latter case, only the version number in the
distributed tarball is updated, but that seems OK.

Reported by Joan Cirer <joan@ev0.net> most recently, and by others over
the last year or so too.

14 years agodebian: Update changelog to reflect current OVS version.
Ben Pfaff [Wed, 26 May 2010 22:40:15 +0000 (15:40 -0700)]
debian: Update changelog to reflect current OVS version.

14 years agoofproto: Avoid null pointer dereference if in_band_create() fails.
Ben Pfaff [Wed, 26 May 2010 20:37:57 +0000 (13:37 -0700)]
ofproto: Avoid null pointer dereference if in_band_create() fails.

in_band_create() can fail if something goes wrong with the network device
that represents the local port.  In that case update_in_band_remotes()
should not call in_band_set_remotes(), but it did anyway.  This commit fixes
it.

Reported-by: Tom Everman <teverman@google.com>
14 years agoofproto: Fix treatment of out-of-band controllers.
Ben Pfaff [Thu, 27 May 2010 16:34:23 +0000 (09:34 -0700)]
ofproto: Fix treatment of out-of-band controllers.

This code was treated every controller as in-band, but obviously that's not
correct.

Reported-by: Jan Medved <jmedved@juniper.net>
14 years agodatapath: Add missing #include to datapath/flow.h.
Ben Pfaff [Thu, 27 May 2010 16:24:11 +0000 (09:24 -0700)]
datapath: Add missing #include to datapath/flow.h.

This caused a problem on builds under 2.6.26 (and possibly other versions).

14 years agovswitchd: Build ovs-brcompatd only on Linux systems.
Ben Pfaff [Wed, 26 May 2010 17:35:20 +0000 (10:35 -0700)]
vswitchd: Build ovs-brcompatd only on Linux systems.

This feature is Linux-specific.

14 years agoproc-net-compat: Stub out on non-Linux.
Ben Pfaff [Wed, 26 May 2010 17:34:51 +0000 (10:34 -0700)]
proc-net-compat: Stub out on non-Linux.

/proc/net is Linux-specific, so there is no need to implement it on
non-Linux systems.

14 years agoBuild ovs-wdt or nlmon utilities only on Linux.
Ben Pfaff [Wed, 26 May 2010 17:25:19 +0000 (10:25 -0700)]
Build ovs-wdt or nlmon utilities only on Linux.

These utilities are Linux-specific.

14 years agolib: Disable Linux-specific libraries on non-Linux systems.
Ben Pfaff [Wed, 26 May 2010 17:38:52 +0000 (10:38 -0700)]
lib: Disable Linux-specific libraries on non-Linux systems.

14 years agodatapath: Make datapath-protocol.h portable to non-Linux systems.
Ben Pfaff [Wed, 26 May 2010 22:32:34 +0000 (15:32 -0700)]
datapath: Make datapath-protocol.h portable to non-Linux systems.

datapath-protocol.h is not a very clean interface.  I originally intended
it to be solely a Linux-kernel specific interface.  Over time it became
a general-purpose interface to dpifs.  This is not a good situation,
because clearly the header is still Linux-specific.

In the long run, the correct solution is to separate the generic and
Linux-specific bits.  This is not that patch.  Instead, this patch modifies
datapath-protocol.h enough that it can be used on non-Linux hosts.  In
particular I tested that it works OK with FreeBSD 8.0.

14 years agodatapath: Make gre.h safe to include by itself.
Ben Pfaff [Wed, 26 May 2010 17:09:56 +0000 (10:09 -0700)]
datapath: Make gre.h safe to include by itself.

gre.h is Linux-specific, and it uses Linux-specific types, so it has to
#include <linux/types.h>.  We probably got away with it until now because
it was always included after some other header that had already included
that one.

14 years agosocket-util: Tolerate missing RLIM_SAVED_CUR and RLIM_SAVED_MAX.
Ben Pfaff [Wed, 26 May 2010 17:07:22 +0000 (10:07 -0700)]
socket-util: Tolerate missing RLIM_SAVED_CUR and RLIM_SAVED_MAX.

POSIX requires these macros, but FreeBSD 8.0 doesn't have them.

14 years agoAdd some missing "#include"s.
Ben Pfaff [Wed, 26 May 2010 17:37:39 +0000 (10:37 -0700)]
Add some missing "#include"s.

These are required to build on FreeBSD 8.0.

14 years agoAlways #include <sys/socket.h> before <net/if.h>.
Ben Pfaff [Wed, 26 May 2010 17:05:19 +0000 (10:05 -0700)]
Always #include <sys/socket.h> before <net/if.h>.

FreeBSD 8.0's <net/if.h> requires <sys/socket.h> to be included first,
even though I don't see any such requirement in POSIX.

14 years agotests: Remove incorrect OVS_UNUSED from declaration.
Ben Pfaff [Wed, 26 May 2010 19:52:06 +0000 (12:52 -0700)]
tests: Remove incorrect OVS_UNUSED from declaration.