sliver-openvswitch.git
14 years agoinitscript: pass complete path to pidfile to status command xs5.7
Ian Campbell [Thu, 17 Dec 2009 14:46:52 +0000 (14:46 +0000)]
initscript: pass complete path to pidfile to status command

Older versions of RHEL/CentOS used pifof in preference to the pidfile
and hence we got away with passing just the basename instead of
including the full path. Using pidof first doesn't make much sense and
this was fixed in RHEL 5 update 4 (see https://bugzilla.redhat.com/show_bug.cgi?id=440658)

This means that on RHEL 5.4 "service vswitch status" always returned
"ovs-vswitchd is stopped" even if it was running. Fix this issue by
passing in the correct pidfile name.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agoMerge master branch into xs5.7.
Ben Pfaff [Wed, 18 Nov 2009 22:26:55 +0000 (14:26 -0800)]
Merge master branch into xs5.7.

Conflicts:
xenserver/README
xenserver/automake.mk
xenserver/etc_xensource_scripts_vif
xenserver/usr_share_vswitch_scripts_dump-vif-details
xenserver/vswitch-xen.spec

14 years agoMerge citrix branch into master.
Ben Pfaff [Wed, 18 Nov 2009 22:14:29 +0000 (14:14 -0800)]
Merge citrix branch into master.

14 years agodatapath: Allow minimum headroom to be set when copying buffers.
Jesse Gross [Wed, 18 Nov 2009 03:03:27 +0000 (19:03 -0800)]
datapath: Allow minimum headroom to be set when copying buffers.

If we need to copy an sk_buff in order to make it writable, allow
the minimum headroom to be specified.  This ensures that if we
need to add additional data, such as a VLAN tag, we will not have
to make a second copy.

Solves bug #2197 in certain situations.

14 years agodatapath: Copy Xen's checksumming fields when doing skb_copy.
Jesse Gross [Wed, 18 Nov 2009 01:28:00 +0000 (17:28 -0800)]
datapath: Copy Xen's checksumming fields when doing skb_copy.

Two fields that control checksumming were added to sk_buff in
Xen: proto_data_valid and proto_csum_blank.  These fields are copied
when doing a skb_clone but not in other functions such as skb_copy,
which can lead to checksum errors in TCP and UDP when offloading is
enabled in the guest.  To fix this we manually copy these fields,
though ideally this should be fixed upstream in Xen.

Bug #2299

14 years agodatapath: Fix build with kernel header layout recently adopted by Debian.
Ben Pfaff [Wed, 18 Nov 2009 19:05:00 +0000 (11:05 -0800)]
datapath: Fix build with kernel header layout recently adopted by Debian.

Recent Debian kernel-header packages divide kernel headers into two
directories: the "common" headers that are not architecture-specific,
which go in a directory named like
    /usr/src/kernel-headers-2.6.31-1-common,
and architecture-specific headers in a directory named, e.g.
    /usr/src/kernel-headers-2.6.31-1-686.
OVS needs to look at the ones in the "common" directory as part of its
configuration process, but the build directory provided on --with-l26 is
the architecture-specific directory.  We also need the
architecture-specific directory, since it is the one that we use as part
of the "make", so we can't simply make the user specify the common
directory on --with-l26.  Furthermore, there is no easy-to-see link
between the two directories, except as part of the text in a Makefile,
which is not the easiest language to parse.

This commit attempts to kluge around the problem by using the Debian
directory naming.  If the build directory does not contain the headers,
then we replace the last component of its name by "-common" and check
for the headers there.  This is not ideal, but it does solve the actual
problem at hand.

Tested with Debian's linux-headers-2.6.31-1-686 and with a few older
sets of headers that do not use this scheme.

14 years agoDocument userspace switch.
Ben Pfaff [Wed, 18 Nov 2009 20:57:18 +0000 (12:57 -0800)]
Document userspace switch.

14 years agoUpdate documentation to mention correct Autoconf version prerequisite.
Ben Pfaff [Wed, 18 Nov 2009 18:03:34 +0000 (10:03 -0800)]
Update documentation to mention correct Autoconf version prerequisite.

14 years agodatapath: Remove unused print_flow() function
Justin Pettit [Tue, 17 Nov 2009 17:51:34 +0000 (09:51 -0800)]
datapath: Remove unused print_flow() function

14 years agodatapath: Cleanup tab/space issues in datapath
Justin Pettit [Mon, 16 Nov 2009 23:24:35 +0000 (15:24 -0800)]
datapath: Cleanup tab/space issues in datapath

14 years agovconn: Fix endian issue in unknown action type error message
Justin Pettit [Mon, 16 Nov 2009 23:26:31 +0000 (15:26 -0800)]
vconn: Fix endian issue in unknown action type error message

14 years agoovs-ofctl: Add support for transport and network modification actions
Justin Pettit [Tue, 17 Nov 2009 01:58:26 +0000 (17:58 -0800)]
ovs-ofctl: Add support for transport and network modification actions

Add support to ovs-ofctl for modifying the network source and destination
IP address with the "mod_nw_src" and "mod_nw_dst" actions, respectively.
And support modifying the TCP/UDP source and destination ports with the
"mod_tp_src" and "mod_tp_dst" actions, respectively.

14 years agoofproto: Support missing set_nw_dst and set_tp_dst translations
Justin Pettit [Tue, 17 Nov 2009 02:08:12 +0000 (18:08 -0800)]
ofproto: Support missing set_nw_dst and set_tp_dst translations

The function that translates OpenFlow actions into datapath actions was
missing definitions for OFPAT_SET_NW_DST and OFPAT_SET_TP_DST.  This
meant those actions would not occur in the datapath.

14 years agodatapath: Calculate proper checksum for set_tp_src/dst action
Justin Pettit [Tue, 17 Nov 2009 01:51:31 +0000 (17:51 -0800)]
datapath: Calculate proper checksum for set_tp_src/dst action

When the set_tp_src or set_tp_dst action is used, the calculation for
where the checksum is located was wrong.  This caused the checksum to
not be updated and packet corruption in the bad offset.

14 years agoovs-appctl: Fix shadow variable that could cause segfault
Justin Pettit [Tue, 17 Nov 2009 00:36:21 +0000 (16:36 -0800)]
ovs-appctl: Fix shadow variable that could cause segfault

The variable "socket_name" contains the name of the unix domain socket
to be used for communicating with the OVS process.  If the target does
not begin with a "/", the socket name is determined based on a pidfile.
A shadow copy of "socket_name" was kept in the block that looks at the
pidfile, which would cause the function-level one to not be set.  This
removes that shadow copy.

14 years agoofproto: Update time of super-rule to match sub-rule
Justin Pettit [Sat, 14 Nov 2009 02:53:28 +0000 (18:53 -0800)]
ofproto: Update time of super-rule to match sub-rule

Rules keep track of their creation and last used time.  When a sub-rule
is updated, it wasn't updating the time of its super-rule.  This commit
fixes that behavior.

Thanks to Jesse Gross for the help tracking this down.

14 years agoovs-openflowd: Setup default listener
Justin Pettit [Fri, 13 Nov 2009 23:51:44 +0000 (15:51 -0800)]
ovs-openflowd: Setup default listener

By default, ovs-openflowd was not listening for any management
connections.  Tools such as ovs-ofctl attempt to use a default location
based on the datapath name.  This change creates that default listener.

14 years agoofproto: Don't send OpenFlow flow expirations hidden rules.
Jesse Gross [Fri, 13 Nov 2009 01:41:58 +0000 (17:41 -0800)]
ofproto: Don't send OpenFlow flow expirations hidden rules.

We were reporting flow expirations for the hidden exact match flows
with the stats set to zero.  These are an implementation detail and
can confuse controllers, so don't report them.

CC: David Erickson <derickso@stanford.edu>
14 years agoofproto: Distinguish stats from before and after action changes.
Jesse Gross [Thu, 12 Nov 2009 23:58:18 +0000 (15:58 -0800)]
ofproto: Distinguish stats from before and after action changes.

When a rule is revalidated and the actions change don't lump all
the stats together.  This will clear the stats in the datapath
and send a NetFlow expiration message.  This could already happen
before in certain circumstances so this change makes it more
consistent.

14 years agoofproto: Correct structure length assertion for ofp_action_vlan_pcp
Justin Pettit [Fri, 13 Nov 2009 19:15:35 +0000 (11:15 -0800)]
ofproto: Correct structure length assertion for ofp_action_vlan_pcp

14 years agoxenserver: interface-reconfigure and vif hotplug relicensing.
Ian Campbell [Tue, 10 Nov 2009 09:23:51 +0000 (09:23 +0000)]
xenserver: interface-reconfigure and vif hotplug relicensing.

As part of the Open Sourcing of xapi (the XenServer toolstack) via the
XenCloud project (announcement in [0]). The upstream versions of
interface-reconfigure and the vif hotplug script have been re-licensed
under an LGPL v2.1 + exception license. The exception applies to other
files in the upstream repository and doesn't particularly make sense for
these scripts but it is included to maintain the uniformity of the
license for the upstream repository.

This patch synchronises the licenses headers on those scripts with the
upstream version. Since those headers refer to a file called LICENSE in
the upstream repository I have included a copy here, slightly modified
to indicate precisely which files it applies to.

Git shows[1] that only myself and Nicira employees have made
modifications to these scripts in the openvswitch repository. The
licensing change has been okayed by Keith Amidon on behalf of Nicira.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
[0]
http://lists.xensource.com/archives/html/xen-devel/2009-11/msg00117.html

14 years agoofp-print: Add missing error types
Justin Pettit [Thu, 12 Nov 2009 23:46:35 +0000 (15:46 -0800)]
ofp-print: Add missing error types

14 years agoofproto: Correctly credit stats for displaced rules.
Jesse Gross [Thu, 12 Nov 2009 20:44:44 +0000 (12:44 -0800)]
ofproto: Correctly credit stats for displaced rules.

When a rule displaces another, we are supposed to credit the stats
for packets that have already been processed to the displaced rule
before we eject it from the datapath.  However, we were instead
crediting the new rule.

14 years agobridge: Fix segfault when updating learning table for deleted port.
Jesse Gross [Thu, 12 Nov 2009 01:05:22 +0000 (17:05 -0800)]
bridge: Fix segfault when updating learning table for deleted port.

A function call using in_port was accidentally moved before the check
to see if it is null.  in_port can be null if a port was deleted but
an update is still pending.  This moves the call after the check.

Bug #2313

14 years agomirroring: Preserve key for disabling learning.
Jesse Gross [Wed, 11 Nov 2009 22:48:48 +0000 (14:48 -0800)]
mirroring: Preserve key for disabling learning.

Don't delete the key for disabling MAC learning on a given VLAN
after a reboot.  Also logs when learning is disabled.

14 years agobridge: Feed flow stats into learning table.
Jesse Gross [Wed, 11 Nov 2009 21:06:16 +0000 (13:06 -0800)]
bridge: Feed flow stats into learning table.

Update the learning table to keep it current with flows actually
going through the datapath.  This ensures that entries do not age
out when they are actively being used.

Feature #2209

14 years agoofproto: Update stats for exact match flows before expiration.
Jesse Gross [Wed, 11 Nov 2009 19:13:37 +0000 (11:13 -0800)]
ofproto: Update stats for exact match flows before expiration.

When a wildcarded flow is expired we remove all of the subrules to
collect their stats before sending a flow expiration message.  However,
we were only removing exact match flows after the expiration message
is composed.  This uninstalls it first.

CC: David Erickson <derickso@stanford.edu>
14 years agoMerge citrix branch into master.
Jesse Gross [Tue, 10 Nov 2009 23:12:01 +0000 (15:12 -0800)]
Merge citrix branch into master.

14 years agomirroring: Allow learning to be disabled on a VLAN.
Jesse Gross [Sat, 7 Nov 2009 01:13:51 +0000 (17:13 -0800)]
mirroring: Allow learning to be disabled on a VLAN.

RSPAN does not work properly unless MAC learning for the VLAN is
disabled on all switches between the origin and monitoring point.
This allows learning to be disabled on a given VLAN so vSwitch can
acts as an intermediate switch.

Feature #2136

14 years agobridge: Require learning table at all times.
Jesse Gross [Mon, 9 Nov 2009 23:26:51 +0000 (15:26 -0800)]
bridge: Require learning table at all times.

The bridge nominally allowed the MAC learning module to not be enabled
though in reality it was always used.  Tracking active MAC addresses
in the bridge is useful for other reasons besides deciding the output
port - primarily for bonding.  In addition there were several bugs
that would have been triggered had learning actually been disabled since
that code path is never tested.  This makes it explicit that the learning
table should be maintained at all times.

14 years agovconn: Clean-up "match" typo in comments
Justin Pettit [Tue, 10 Nov 2009 00:06:52 +0000 (16:06 -0800)]
vconn: Clean-up "match" typo in comments

A few comments referenced "m", when "match" was clearly meant.  This was
likely due to a quick search and replace that scooped up these comments
along with the intended code.  This cleans that up.

14 years agoovs-vsctl: Capitalize names of global constants but not variables.
Ben Pfaff [Mon, 9 Nov 2009 23:02:05 +0000 (15:02 -0800)]
ovs-vsctl: Capitalize names of global constants but not variables.

Conforms to the Google style guide for Python.

Reported by Justin.

14 years agoMake ovs-appctl easier to use and synchronize its interface with ovs-vsctl.
Ben Pfaff [Mon, 9 Nov 2009 22:46:38 +0000 (14:46 -0800)]
Make ovs-appctl easier to use and synchronize its interface with ovs-vsctl.

It is inconvenient to type the whole path to the Unix daemon socket when
using ovs-appctl.  Allow the name of the daemon to be used instead when
a pidfile exists in the default location, and contact ovs-vswitchd by
default.

Also, the various options for manipulating vlog were invented before the
general-purpose command mechanism existed.  Get rid of all of the action
options in favor of just specifying the command to be executed as
non-option arguments.

Finally, there simply wasn't much value in allowing multiple targets or
options to be specified; these variations were never used in practice.  So
simplify the interface by making it one target, one action per invocation.

Also, make ovs-vsctl use the same syntax for its --target option.

Based on work by Justin Pettit.

14 years agobonding: Ignore updelay if there is no active slave.
Jesse Gross [Wed, 4 Nov 2009 21:48:41 +0000 (13:48 -0800)]
bonding: Ignore updelay if there is no active slave.

If all slaves on a bond are down but some are waiting for an updelay,
enable the slave with the shortest amount of delay remaining.  This
would already occur if all other slaves were disabled at the time the
delay was to begin but not if a delay was already in progress.  This
also immediately sends learning packets out in both situations, which
prevents incoming packets to disabled slaves from being blackholed.

CC: Danny Wannagat <Danny.Wannagat@eu.citrix.com>
14 years agoFix incorrect printf format specifiers.
Ben Pfaff [Fri, 6 Nov 2009 18:43:50 +0000 (10:43 -0800)]
Fix incorrect printf format specifiers.

GCC reported these during a 64-bit build.

14 years agobacktrace: Avoid GCC warning on x86-64.
Ben Pfaff [Fri, 6 Nov 2009 18:25:50 +0000 (10:25 -0800)]
backtrace: Avoid GCC warning on x86-64.

The portable implementation of stack_low(), which before this commit is
used on x86-64, provokes a warning from GCC that cannot be disabled.  We
already have an i386-specific implementation that does not warn; this
commit adds a corresponding implementation for x86-64 to avoid the warning
there too.

14 years agobacktrace: Suppress dumb GCC warning on x86-64.
Ben Pfaff [Fri, 6 Nov 2009 18:22:55 +0000 (10:22 -0800)]
backtrace: Suppress dumb GCC warning on x86-64.

Without this change GCC warns "use of assignment suppression and length
modifier together in scanf format", which doesn't actually point out any
real problem (and why would it?  Google turns up nothing interesting).

14 years agoudatapath: Implement ZERO_TCP_FLAGS option.
Jesse Gross [Fri, 6 Nov 2009 22:18:58 +0000 (14:18 -0800)]
udatapath: Implement ZERO_TCP_FLAGS option.

An option to zero the TCP flags when querying flow stats was added
to the kernel datapath to support NetFlow active timeouts.  This
adds that same support to the user datapath.

14 years agonetflow: Only query stats of installed flows.
Jesse Gross [Fri, 6 Nov 2009 21:26:42 +0000 (13:26 -0800)]
netflow: Only query stats of installed flows.

NetFlow active timeouts was querying the stats of all exact match
flows that had reached a certain age including those that could
not be installed.  This was not harmful but it was wasteful and
produced log spew.  This changes it to only query the flows that
are actually installed.

Bug #2252

14 years agodatapath: Allow TCP flags to be cleared.
Jesse Gross [Wed, 28 Oct 2009 21:36:52 +0000 (14:36 -0700)]
datapath: Allow TCP flags to be cleared.

When querying flow stats allow the TCP flags to be reset.  Since
the datapath ORs together all flags that have previously been
seen it is otherwise impossible to determine the set of flags from
after a particular time.

14 years agoRevert "ovs-ofctl: Fix use-after-free error in del-flows command."
Jean Tourrilhes [Thu, 5 Nov 2009 07:40:18 +0000 (23:40 -0800)]
Revert "ovs-ofctl: Fix use-after-free error in del-flows command."

This reverts commit cae7a4b90a55cbfd4cfd23c06f9f09cd429ab4c0.

This commit forced the user to specify an action when deleting a flow,
which is not desirable.  The change was not actually needed, as the
buffer is never passed to str_to_flow() in the original code.

14 years agoovs-ofctl: Fix use-after-free error in del-flows command.
Jean Tourrilhes [Wed, 4 Nov 2009 21:21:07 +0000 (13:21 -0800)]
ovs-ofctl: Fix use-after-free error in del-flows command.

14 years agoxenserver: Fix issue with deleting network UUID on VLAN destruction
Justin Pettit [Wed, 4 Nov 2009 05:19:47 +0000 (21:19 -0800)]
xenserver: Fix issue with deleting network UUID on VLAN destruction

In XenServer, a VLAN is considered an additional network with its own
UUID.  The interface-reconfigure script properly adds this network UUID
to the configuration script, but commit 774428 removed the code that
would remove this information on VLAN destruction.  Ian Campbell was the
author of that commit and felt that reverting this part was safe.

Bug #1973

14 years agoMention running boot.sh when pulling sources from Git
Justin Pettit [Tue, 3 Nov 2009 21:56:46 +0000 (13:56 -0800)]
Mention running boot.sh when pulling sources from Git

When the sources are pulled directly from Git, it is necessary to run
"./boot.sh" before "./configure" can be run.  This commit documents that
useful bit of information.

14 years agonetflow: Implement NetFlow active timeouts.
Jesse Gross [Tue, 3 Nov 2009 20:25:29 +0000 (12:25 -0800)]
netflow: Implement NetFlow active timeouts.

Provides a NetFlow expiration message at regular intervals if the
key netflow.<br>.active-timeout is set.

Feature #1317

14 years agodatapath: Allow TCP flags to be cleared.
Jesse Gross [Wed, 28 Oct 2009 21:36:52 +0000 (14:36 -0700)]
datapath: Allow TCP flags to be cleared.

When querying flow stats allow the TCP flags to be reset.  Since
the datapath ORs together all flags that have previously been
seen it is otherwise impossible to determine the set of flags from
after a particular time.

14 years agoofproto: Only zero stats for non exact-match sub-rules.
Jesse Gross [Wed, 28 Oct 2009 23:05:57 +0000 (16:05 -0700)]
ofproto: Only zero stats for non exact-match sub-rules.

We zero the stats on sub-rules after they expire to prevent them
from being counted twice in their super-rule if they are reinstalled.
However, for exact-match sub-rules this means that the OpenFlow stats
are always zero.  This changes that to only zero the stats for
non exact match rules.

Bug #1911

14 years agodump-vif-details: Safeguard 'finally' code
Reid Price [Fri, 30 Oct 2009 19:39:14 +0000 (12:39 -0700)]
dump-vif-details:  Safeguard 'finally' code

This makes several minor streamlining changes to dump-vif-details,
and moves the try statement in dump_vif_info to exclude session
initialization, so that finally will not obscure the original exception
with a new exception related to the session variable when logins fail.

14 years agoopenflow: Fix endian issues in flow expiration messages
Justin Pettit [Thu, 29 Oct 2009 00:15:57 +0000 (17:15 -0700)]
openflow: Fix endian issues in flow expiration messages

A few of the fields in the OpenFlow flow expiration message were being
sent in host-byte order.  This properly converts them to network.

Thanks to David Erickson for catching this!

14 years agoxenserver: Print program name on error in dump-vif-details
Justin Pettit [Wed, 28 Oct 2009 19:01:36 +0000 (12:01 -0700)]
xenserver: Print program name on error in dump-vif-details

14 years agoxenserver: Set network-uuid for internal bridges
Justin Pettit [Wed, 28 Oct 2009 01:38:33 +0000 (18:38 -0700)]
xenserver: Set network-uuid for internal bridges

The "citrix" branch contains a script called dump-vif-details that would
write detailed information about the vifs into ovs-vswitchd.conf.
Additionally, it would add the network-uuid information for internal
bridges, since the interface-reconfigure script that normally takes care
of this is not called on internal bridges.  The Midnight Ride release
no longer needs to call dump-vif-details, but the functionality to write
the network-uuid for internal bridges was not put elsewhere.  This
commit addresses that.

It introduces the vif-on-internal-bridge script, which is a hack until a
more appropriate method, such XAPI writing out the information to
xenstore, becomes available.

Bug #2208

14 years agonetflow: Populate NetFlow output interface field.
Jesse Gross [Fri, 23 Oct 2009 00:51:05 +0000 (17:51 -0700)]
netflow: Populate NetFlow output interface field.

Previously NetFlow expiration messages always contained 0 as the
output interface index.  This changes that to report the OpenFlow
interface instead.

Feature #1202

14 years agoSpell verb form of "set up" correctly throughout the tree.
Ben Pfaff [Mon, 26 Oct 2009 21:41:32 +0000 (14:41 -0700)]
Spell verb form of "set up" correctly throughout the tree.

14 years agoflow: Differentiate between "port" when printing flows
Justin Pettit [Mon, 26 Oct 2009 19:02:02 +0000 (12:02 -0700)]
flow: Differentiate between "port" when printing flows

When printing a flow, there were two references to "port": one the
interface the packet arrived on and the other the L4 ports.  This could
be a bit confusing to new users looking at the output of a command such
as "ovs-ofctl dump-flows".  This commit changes the incoming interface
field from "port" to "in_port".

14 years agoovs-vswitchd: Document "bridge/dump-flows" management command
Justin Pettit [Sat, 24 Oct 2009 22:51:31 +0000 (15:51 -0700)]
ovs-vswitchd: Document "bridge/dump-flows" management command

14 years agobridge: Allow flows based on ARP opcode to be installed.
Jesse Gross [Fri, 14 Aug 2009 21:23:44 +0000 (14:23 -0700)]
bridge: Allow flows based on ARP opcode to be installed.

Since we can now distinguish between flows with different ARP opcodes
in the kernel, allow these flows to be installed.

14 years agoMerge "citrix" into "master".
Ben Pfaff [Fri, 23 Oct 2009 00:43:28 +0000 (17:43 -0700)]
Merge "citrix" into "master".

This merge took a little bit of care due to two issues:

    - Crossport of "interface-reconfigure" fixes from master back to
      citrix that had happened and needed to be canceled out of the merge.

    - New script "refresh-xs-network-uuids" added on citrix branch that
      needed to be moved from /root/vswitch/scripts to
      /usr/share/vswitch/scripts.

14 years agobridge: Eject NORMAL flows without a learning entry from datapath.
Jesse Gross [Thu, 22 Oct 2009 18:40:04 +0000 (11:40 -0700)]
bridge: Eject NORMAL flows without a learning entry from datapath.

When revalidating NORMAL flows we consult the learning table, which
could be empty if a packet hasn't come to userspace in a while or we
just did a bridge flush.  If there is no learning entry then existing
flows will begin flooding packets until a new flow is setup.  The
problem is worse with bonding because we can receive one of the flooded
packets back on a bond slave and learn that port, causing us to send
traffic to the wrong location.

14 years agobonding: Balance bond slaves based on ratio.
Jesse Gross [Wed, 21 Oct 2009 02:26:55 +0000 (19:26 -0700)]
bonding: Balance bond slaves based on ratio.

Previously when deciding whether to migrate a hash between slaves
we would never move it if it would cause more load on the new slave
than the old.  This could lead to a situation where the slaves would
be imbalanced but no migration would occur since it would flip the
load.  This will do the migration if it will decrease the ratio.

Bug NIC-49

14 years agobonding: Drop unicast packets which have a different learned port.
Jesse Gross [Mon, 12 Oct 2009 20:09:51 +0000 (13:09 -0700)]
bonding: Drop unicast packets which have a different learned port.

Drop packets received on a bond port if we have learned a different
source port for that MAC.  We were already doing this for multicast
packets but extend the logic to unicast packets as well since the
same situation can occur if the connected switch has not learned the
MAC address and is flooding.  Otherwise vSwitch will learn the bond
port as the source of that MAC.

Bug #2167

14 years agoxen: Restore state files for VIF VLANs
Jesse Gross [Tue, 20 Oct 2009 03:14:31 +0000 (20:14 -0700)]
xen: Restore state files for VIF VLANs

A change on master to use ovs-vsctl instead of state files for VLANs
was ported to the citrix branch, which does not have ovs-vsctl.  The
interface reconfigure portion, which does not store the state files
was ported but the vif-hotput script portion was not.  This restores
interface reconfigure to again save the state files.

Bug #2187

14 years agoxen: Correctly write VLAN key in config file.
Jesse Gross [Tue, 20 Oct 2009 01:40:11 +0000 (18:40 -0700)]
xen: Correctly write VLAN key in config file.

When adding the VLAN key the name of the vif was from a variable in
use on only the xs5.7 branch.  This uses the correct variable name
for the master branch

14 years agoovs-vsctl: Add tests that adding duplicate bridges or ports fails.
Ben Pfaff [Fri, 16 Oct 2009 16:49:59 +0000 (09:49 -0700)]
ovs-vsctl: Add tests that adding duplicate bridges or ports fails.

Suggested-by: Reid Price <reid@nicira.com>
14 years agoovs-vsctl: Add the ability to perform multiple operations in a single run.
Ben Pfaff [Fri, 16 Oct 2009 16:42:21 +0000 (09:42 -0700)]
ovs-vsctl: Add the ability to perform multiple operations in a single run.

CC: Ian Campbell <Ian.Campbell@citrix.com>
14 years agoovs-vsctl: Refactor internals to increase flexibility.
Ben Pfaff [Fri, 16 Oct 2009 16:36:25 +0000 (09:36 -0700)]
ovs-vsctl: Refactor internals to increase flexibility.

This changes the interface of each of the command implementations, making
them take the configuration as an argument and return the output.  This
will make it easier to support alternate output formats and to execute more
than one command per invocation (both happening in upcoming commits).

14 years agoovs-vsctl: Allow bridge name to be omitted from del-port command.
Ben Pfaff [Thu, 15 Oct 2009 19:47:05 +0000 (12:47 -0700)]
ovs-vsctl: Allow bridge name to be omitted from del-port command.

The 'bridge' argument to ovs-vsctl's del-port command is only supplied as
a form of error checking.  Sometimes the name of the bridge isn't readily
available, so for such situations this commit allows the user to omit the
name of the bridge entirely.

CC: Ian Campbell <Ian.Campbell@citrix.com>
14 years agoovs-vsctl: Log changes to configuration file to syslog.
Ben Pfaff [Fri, 16 Oct 2009 16:26:20 +0000 (09:26 -0700)]
ovs-vsctl: Log changes to configuration file to syslog.

This feature, which has been in ovs-cfg-mod for some time as the "-c"
option, makes it much easier to see what changes ovs-vsctl actually makes
to ovs-vswitchd.conf.

CC: <Ian.Campbell@citrix.com>
14 years agoMake sure that time advances in a daemon between calls to time_refresh().
Ben Pfaff [Thu, 15 Oct 2009 17:39:10 +0000 (10:39 -0700)]
Make sure that time advances in a daemon between calls to time_refresh().

Open vSwitch uses an interval timer signal to tell it that its cached idea
of the current time has expired.  However, this didn't work in a daemon
detached from the foreground session (invoked with --detach) because a
child created with fork() does not inherit the parent's interval timer and
we did not re-set it after calling fork().

This commit fixes the problem by setting the interval timer back up after
calling fork() from daemonize().

This fix is based on code inspection (which was then verified to be correct
through testing).  It may not fix any actual problems in practice, because
time_refresh() is called every time through the poll loop, and the poll
loop typically runs more quickly than the periodic timer fires (1 ms or so
average in ovs-vswitchd, vs. 100 ms timer interval).

14 years agodatapath: Fix build with Linux 2.6.31.
Ben Pfaff [Mon, 12 Oct 2009 18:13:55 +0000 (11:13 -0700)]
datapath: Fix build with Linux 2.6.31.

Linux 2.6.31 breaks the network device functions pointers into a separate
"netdev_ops" structure, so we need to handle this case now too.

14 years agodatapath: Ignore return value from rtnl_notify().
Ben Pfaff [Wed, 24 Jun 2009 21:58:57 +0000 (14:58 -0700)]
datapath: Ignore return value from rtnl_notify().

In Linux 2.6.30, the rtnl_notify() return type was changed from int to
void along with the following commit message:

    This patch also modifies the rtnetlink code to ignore the return
    value of rtnl_notify() in all callers. The function rtnl_notify()
    (before this patch) returned the error of the unicast notification
    which makes rtnl_set_sk_err() reports errors to all listeners. This
    is not of any help since the origin of the change (the socket that
    requested the echoing) notices the ENOBUFS error if the notification
    fails and should resync itself.

Thus there's no point in checking the return value, even in older versions
of the kernel, and so this commit changes our code to ignore it, even
on older kernel versions.  We also update the rtnl_notify() wrapper macros
to make the return type void on older kernel versions.

This has not been tested, just built.

Thanks to Mikio for spurring me to try building with Linux 2.6.29 and
2.6.30.

14 years agodatapath: Fix warning on 64-bit builds.
Ben Pfaff [Mon, 12 Oct 2009 17:34:38 +0000 (10:34 -0700)]
datapath: Fix warning on 64-bit builds.

14 years agodatapath: Factor out code for getting and setting listen mask.
Ben Pfaff [Mon, 12 Oct 2009 17:34:10 +0000 (10:34 -0700)]
datapath: Factor out code for getting and setting listen mask.

This fixes GCC warnings on 64-bit architectures caused by storing an "int"
in the "void *" f->private_data field.

14 years agologrotate: Allow logs to be missing
Ian Campbell [Wed, 14 Oct 2009 10:38:40 +0000 (11:38 +0100)]
logrotate: Allow logs to be missing

In particular ovs-brcompatd.log is not present if compatibility mode is
disabled. Without this logrotate attempts to send email to the
administrator.

14 years agoEnsure "service vswitch status" returns appropriate error code
Ian Campbell [Wed, 14 Oct 2009 10:37:19 +0000 (11:37 +0100)]
Ensure "service vswitch status" returns appropriate error code

This command was returning success when vswitchd was not running.
Our automated test relies on this command to decide if the host uses
vswitch or not.

If vswitchd is not OK then brcompatd is not checked at all. Since the
return codes apparently have specific meanings I couldn't see a sensible
way to combine multiple failure results.

14 years agovlan: Compare vlan tags before implicit tagging when RSPANing.
Jesse Gross [Thu, 8 Oct 2009 19:31:03 +0000 (12:31 -0700)]
vlan: Compare vlan tags before implicit tagging when RSPANing.

We check that a packet is not sent out the on the in port on the
same VLAN when performing RSPAN.  However, we were comparing the
vlan tag from a packet after implicit tagging with a tag from
before implicit tagging.  This ensures that we always compare them
before such tagging.

14 years agodatapath: Fix build with Centos 5.3 kernel.
Ben Pfaff [Fri, 9 Oct 2009 16:41:29 +0000 (09:41 -0700)]
datapath: Fix build with Centos 5.3 kernel.

Centos 5.3 backports more functions from later kernel versions to 2.6.18,
so the kernel version number is no longer a reliable way to check for these
functions.  Thus, add a "configure" test for them.

Reported-by: Paulo Cravero <pcravero@as2594.net>
14 years agodatapath: Add cpumask.h header wrapper to distribution.
Ben Pfaff [Fri, 9 Oct 2009 16:44:47 +0000 (09:44 -0700)]
datapath: Add cpumask.h header wrapper to distribution.

This header was included in the Git tree but we failed to distribute it
as part of the tarball.

This problem was found by inspection.  I am not aware of an actual problem
this fixes.

14 years agoxenserver: Crossport "master" interface-reconfigure to "citrix".
Ben Pfaff [Wed, 7 Oct 2009 19:07:27 +0000 (12:07 -0700)]
xenserver: Crossport "master" interface-reconfigure to "citrix".

This commit copies the interface-reconfigure script from "master" into
"citrix" and fixes up a few incompatibilities: the location of ovs-cfg-mod,
which in master is in /usr/bin and in citrix is in /root/vswitch/bin, and
the RPM spec file fragments needed to initialize the database cache.

The purpose of this commit is to obtain the bug fixes that have been
applied (mainly by Ian Campbell) to "master" but which are not in "citrix".

It's difficult to understand the changes from this commit alone.  It is
more meaningful to compare the resulting files against those currently
on the master branch.

14 years agoofproto: Make current packet counts more accurate.
Jesse Gross [Fri, 14 Aug 2009 20:47:28 +0000 (13:47 -0700)]
ofproto: Make current packet counts more accurate.

When the stats for a currently active flow are requested this
ensures that the packets not handled by the kernel are counted
immediately.  Before, these packets would only be counted once
the kernel flow expired and the counts were combined.

14 years agobonding: Compare ports, not interfaces, for loop checks.
Jesse Gross [Thu, 8 Oct 2009 19:20:10 +0000 (12:20 -0700)]
bonding: Compare ports, not interfaces, for loop checks.

In order to avoid loops we check that the input and output ports
are not equal.  When selecting mirror outputs for RSPAN we were
checking interfaces instead of ports.  This lead to loops when
using RSPAN with bonded ports.

Bug #2118

14 years agoovs-ofctl: Fix use-after-free error in mod-flows command.
Jean Tourrilhes [Thu, 8 Oct 2009 17:39:49 +0000 (10:39 -0700)]
ovs-ofctl: Fix use-after-free error in mod-flows command.

14 years agodatapath: Fix validation of ODPAT_SET_VLAN_PCP actions.
Jean Tourrilhes [Thu, 8 Oct 2009 17:37:43 +0000 (10:37 -0700)]
datapath: Fix validation of ODPAT_SET_VLAN_PCP actions.

The VLAN PCP mask is in the rightmost bits of the vlan_pcp member but we
were checking for it in its position in the VLAN tag field instead.

Slightly modified from Jean's original patch by adding and using the
VLAN_PCP_SHIFT macro.

14 years agoMerge "master" into "xs5.7".
Ben Pfaff [Wed, 7 Oct 2009 17:21:49 +0000 (10:21 -0700)]
Merge "master" into "xs5.7".

This makes ovs-vsctl work and thus should make it possible to start VMs
See commit 417a8cb6a "xenserver: Fix ovs-vsctl in built RPM by defining
/etc as sysconfdir" for more details.

14 years agoxenserver: Fix ovs-vsctl in built RPM by defining /etc as sysconfdir.
Ben Pfaff [Wed, 7 Oct 2009 17:19:31 +0000 (10:19 -0700)]
xenserver: Fix ovs-vsctl in built RPM by defining /etc as sysconfdir.

By default, the "configure" script picks a sysconfdir of $prefix/etc,
which works out to /usr/etc in our case.  That's wrong, of course--it
should be /etc--but we didn't notice until now because sysconfdir was
only used in ovs-vsctl, which in turn wasn't used at all on a XenServer
system until recently.

This bug is present on all branches, but it is only potentially visible
on "master" and "xs5.7", since only those have ovs-vsctl.  It is only
actually visible on "xs5.7", since that is the only branch where the
system uses ovs-vsctl itself (from /etc/xensource/scripts/vif), but this
is being committed to master in case we start using ovs-vsctl there too.

Reported-by: Henrik Amren <henrik@nicira.com>
14 years agoMerge commit 'v0.90.6' into citrix
Justin Pettit [Tue, 6 Oct 2009 21:33:31 +0000 (14:33 -0700)]
Merge commit 'v0.90.6' into citrix

14 years agoPrepare for v0.90.6 release. v0.90.6
Justin Pettit [Tue, 6 Oct 2009 21:25:36 +0000 (14:25 -0700)]
Prepare for v0.90.6 release.

14 years agoxenserver: Fix dbcache location for xen-bugtool
Justin Pettit [Tue, 6 Oct 2009 18:38:57 +0000 (11:38 -0700)]
xenserver: Fix dbcache location for xen-bugtool

I forgot to add my local changes to xen-bugtool that reflected the new
location for dbcache.

14 years agoMerge commit 'origin/citrix'
Justin Pettit [Tue, 6 Oct 2009 18:08:31 +0000 (11:08 -0700)]
Merge commit 'origin/citrix'

14 years agoxenserver: Include dbcache in xen-bugtool output
Justin Pettit [Tue, 6 Oct 2009 00:32:36 +0000 (17:32 -0700)]
xenserver: Include dbcache in xen-bugtool output

It has been pointed out that it would be useful to have a copy of the
dbcache file in the bug report.  This adds that.

Bug #2106

14 years agonetflow: Increase maximum number of NetFlow records to 30.
Jesse Gross [Mon, 5 Oct 2009 20:25:19 +0000 (13:25 -0700)]
netflow: Increase maximum number of NetFlow records to 30.

NetFlow v5 allows up to 30 records per packet but we were incorrectly
limiting to 29.  This corrects that and also uses the count of the
number of records in the header rather than the packet size since
it is easier to reason about.

Bug #2103

14 years agoMerge "master" into xs5.7.
Ben Pfaff [Mon, 5 Oct 2009 17:32:38 +0000 (10:32 -0700)]
Merge "master" into xs5.7.

14 years agoMerge "citrix" branch into "master.
Ben Pfaff [Mon, 5 Oct 2009 17:29:07 +0000 (10:29 -0700)]
Merge "citrix" branch into "master.

14 years agobonding: Update the link status on the bond fake interface.
Jesse Gross [Sat, 3 Oct 2009 01:08:05 +0000 (18:08 -0700)]
bonding: Update the link status on the bond fake interface.

Brings the fake bond interface up and down to match our notion of
whether the bond is currently active.  This solves an issue where
XenCenter would always show the bond as disconnected.

Bug #1703

14 years agoxenserver: use ovs-vsctl for VIF VLANs instead of separate state files
Ian Campbell [Mon, 5 Oct 2009 15:32:53 +0000 (16:32 +0100)]
xenserver: use ovs-vsctl for VIF VLANs instead of separate state files

ovs-vsctl did not exist when this code was originally written, but it
provides exactly what is needed to get rid of those separate state
files.

The vif hotplug script diff is against the xs5.7 branch but I think is
applicable to master and/or citrix with just context changes.

I was thinking of using ovs-vsctl exclusively for configuration
modifications from the vif hotplug script but that would need a
mechanism to pass the additional vif details to ovs-vsctl add-port as
well as perhaps making the bridge optional to del-port. The other option
would be to use the --no-reload option and split the config mods into
two parts, but I don't like that idea much.

14 years agoxenserver: Include bridge.*.xs-network-uuids for all networks
Ian Campbell [Mon, 5 Oct 2009 15:27:01 +0000 (16:27 +0100)]
xenserver: Include bridge.*.xs-network-uuids for all networks

Previously I advised that only networks which were currently attached to
the host be listed in /etc/ovs-vswitchd.conf. However I've just realised
that this interacts badly with the slightly ugly special case used for
PIF.currently-attached when reading from dbcache instead of talking to
Xapi. This bites on boot when /etc/init.d/management-interface tries to
plug a selection of PIFs which are deemed to be somehow required by
xapi. (not helped by a bug in XenServer 5.7.0 which can cause this list
to be larger than it should be and not internally consistent).

For now I think it prudent to simply list all networks which could
potentially be attached to a given datapath, until I can figure out what
the sane fix is on the XenServer end.

(I think there are two options for a proper fix, either inspect the
current state of the network devices or assume dbcache represents the
desired final state after devices are plugged on boot. I'm leaning
towards the later since the dbcache should indicate the set of PIFs
which were attached on shutdown, which xapi will likely be trying to
replug on boot... Needs more thought though).

14 years agovswitch: Allow user to set Ethernet address of any internal interface.
Ben Pfaff [Fri, 2 Oct 2009 20:29:01 +0000 (13:29 -0700)]
vswitch: Allow user to set Ethernet address of any internal interface.

Until now the vswitch configuration file has allowed the user to configure
the MAC address on bridge local ports only.  This commit adds the ability
to configure them on any internal interface.

It would be logical to extend this to any bridge port, period, but many
network devices must be brought down before their Ethernet addresses may be
changed.  Bringing a network interface down and then back up can reset a
lot of state, so as we don't actually need the ability to change any bridge
port's MAC address yet this commit does not implement it.

CC: Ian Campbell <Ian.Campbell@citrix.com>
14 years agovswitch: Factor out detection of internal interfaces into a new function.
Ben Pfaff [Fri, 2 Oct 2009 17:41:05 +0000 (10:41 -0700)]
vswitch: Factor out detection of internal interfaces into a new function.

The following commit needs to use this same logic, so break it out into
a function to avoid redundancy.

14 years agosecchan: Clarify logic in add_output_action().
Ben Pfaff [Fri, 2 Oct 2009 23:01:36 +0000 (16:01 -0700)]
secchan: Clarify logic in add_output_action().

The code and the logic here was too terse for anyone to reasonably
understand it.  Add some comments.

This should not cause any behavioral change.

CC: Jean Tourrilhes <jt@hpl.hp.com>
14 years agodpif-linux: Clarify bad device warning message
Justin Pettit [Fri, 2 Oct 2009 23:59:28 +0000 (16:59 -0700)]
dpif-linux: Clarify bad device warning message

The message warning that the device number is wrong for the Open vSwitch
devices could have been clearer.

Thanks to Ben Pfaff for the suggested wording.

14 years agodpif-linux: Fail earlier if OVS kernel module isn't loaded
Justin Pettit [Fri, 2 Oct 2009 22:20:12 +0000 (15:20 -0700)]
dpif-linux: Fail earlier if OVS kernel module isn't loaded

When the kernel module isn't loaded, the bridge tries to open all the
possible minor devices, regardless.  This change first checks that there
is a major device number for Open vSwitch and only then tries to open the
minor devices.

This change also removes the assumption that there's a default Open vSwitch
major device number, since the kernel module always attempts to get a
dynamic one.  Maybe one day we'll have one...

Bug #1179