openvswitch
14 years agoofproto: Don't leak struct ofproto's port array.
Ben Pfaff [Thu, 11 Feb 2010 23:04:00 +0000 (15:04 -0800)]
ofproto: Don't leak struct ofproto's port array.

From Jean Tourrilhes <jt@hpl.hp.com>.

14 years agodpif-netdev: Fix validation of VLAN PCP value in userspace datapath.
Ben Pfaff [Thu, 11 Feb 2010 21:51:56 +0000 (13:51 -0800)]
dpif-netdev: Fix validation of VLAN PCP value in userspace datapath.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
14 years agoAllow sFlowCpInterval=0 to disable counter samples, and fix bug in sampler removal.
Neil McKee [Thu, 11 Feb 2010 23:06:11 +0000 (15:06 -0800)]
Allow sFlowCpInterval=0 to disable counter samples, and fix bug in sampler removal.

14 years agoRename UNUSED macro to OVS_UNUSED to avoid naming conflict.
Ben Pfaff [Thu, 11 Feb 2010 18:59:47 +0000 (10:59 -0800)]
Rename UNUSED macro to OVS_UNUSED to avoid naming conflict.

Requested by Jean Tourrilhes <jt@hpl.hp.com>.

14 years agoovs-wdt: Mark variable static and use NULL for a null pointer.
Ben Pfaff [Thu, 11 Feb 2010 00:54:30 +0000 (16:54 -0800)]
ovs-wdt: Mark variable static and use NULL for a null pointer.

Neither is really a bug but it's cleaner this way.

Found by sparse (http://sparse.wiki.kernel.org/).

14 years agodatapath: Mark functions "static".
Ben Pfaff [Thu, 11 Feb 2010 00:50:51 +0000 (16:50 -0800)]
datapath: Mark functions "static".

Found by sparse (http://sparse.wiki.kernel.org/).

14 years agodatapath: When adding a port, return the new port number to userspace.
Ben Pfaff [Thu, 11 Feb 2010 00:53:40 +0000 (16:53 -0800)]
datapath: When adding a port, return the new port number to userspace.

'port' is a kernel-space copy of the odp_port and modifying it is useless.
'portp' is the userspace copy; modifying it is useful.

None of our current userspace users care about the port number and so we
never noticed.

Found by sparse (http://sparse.wiki.kernel.org/).

14 years agodhcp: Add missing * to use of sizeof.
Ben Pfaff [Tue, 9 Feb 2010 18:19:14 +0000 (10:19 -0800)]
dhcp: Add missing * to use of sizeof.

Found with coccinelle and coccicheck (http://coccinelle.lip6.fr/).

14 years agoAdd extern "C" { ... } to some header files to support usage from C++.
Ben Pfaff [Thu, 4 Feb 2010 17:37:30 +0000 (09:37 -0800)]
Add extern "C" { ... } to some header files to support usage from C++.

From partner.

14 years agoovs-pki: Avoid using local variables, which are non-POSIX.
Ben Pfaff [Mon, 1 Feb 2010 18:09:56 +0000 (10:09 -0800)]
ovs-pki: Avoid using local variables, which are non-POSIX.

Reported-by: Srini Seetharaman <seethara@stanford.edu>
14 years agoCA-37154: vswitch: Use MAC address of tagged PIF for VLAN fake-bridge
Ian Campbell [Mon, 1 Feb 2010 17:50:14 +0000 (09:50 -0800)]
CA-37154: vswitch: Use MAC address of tagged PIF for VLAN fake-bridge

This is because PIF.MAC for a VLAN is FE:FF:FF:FF:FF:FF. In bridge
mode the VLAN and the bridge naturally pick up the underlying MAC
address from the physical device but under vswitch we must explicitly
specify it and we are currently specifying
FE:FF:FF:FF:FF. interface-reconfigure needs to use the MAC address of
the tagged PIF not the untagged PIF.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1265020755 0
# Node ID d7fc59d6a274334377fdbb09dcaf80a76431bcdb
# Parent  a6f27b5a3096ce627b5003c7be19ca59f7dd9606

14 years agoofpbuf: Rename ofpbuf "private" member for C++ header compatibility.
Ben Pfaff [Mon, 1 Feb 2010 17:46:31 +0000 (09:46 -0800)]
ofpbuf: Rename ofpbuf "private" member for C++ header compatibility.

From partner.

14 years agonetdev: Correctly maintain netdev refcounts even if errors occur.
Jesse Gross [Fri, 29 Jan 2010 00:56:05 +0000 (19:56 -0500)]
netdev: Correctly maintain netdev refcounts even if errors occur.

If an error occured while opening a netdev it would decrement the
refcount, even though it was never incremented.  Depending on
the timing this could result in either an error message or an
assertion failure.  This workaround simply always increments
the refcount before openning a device.  A more complete fix
already exists in the netdev overhaul in the 'next' branch.

NIC-59

14 years agoconfigure: Silence check for broken strtok_r().
Ben Pfaff [Mon, 25 Jan 2010 18:32:39 +0000 (10:32 -0800)]
configure: Silence check for broken strtok_r().

The check for strtok_r() prints a line of text on stdout as part of its
run.  This is noticeable when running "configure", especially with -q.
This commit fixes it.

(The apparent alternative of not printing anything at all seems like a bad
idea because this might encourage the compiler to completely optimize
everything out of main().)

14 years agoxenserver: Update to use upstream XenServer location for dbcache.
Ben Pfaff [Tue, 26 Jan 2010 18:35:11 +0000 (10:35 -0800)]
xenserver: Update to use upstream XenServer location for dbcache.

I thought that this was going to be more difficult (see this email thread:
http://openvswitch.org/pipermail/dev_openvswitch.org/2010-January/001023.html
) but it turned out to be trivial.

14 years agoRelease Open vSwitch 0.99.1
Justin Pettit [Tue, 26 Jan 2010 07:09:58 +0000 (23:09 -0800)]
Release Open vSwitch 0.99.1

This is an "unstable" release.

14 years agoMerge "sflow" into "master".
Ben Pfaff [Mon, 25 Jan 2010 18:52:28 +0000 (10:52 -0800)]
Merge "sflow" into "master".

No conflicts, but lib/dpif.c needed a few changes since struct dpif's
member "class" was renamed to "dpif_class" in master since sflow was
branched off.

14 years agoxenserver: Update interface-reconfigure and vif integration scripts.
Ian Campbell [Fri, 22 Jan 2010 20:55:37 +0000 (12:55 -0800)]
xenserver: Update interface-reconfigure and vif integration scripts.

This patch updates the versions of the host integration scripts to
what is present in the recent XCP update and the next release of
XenServer (5.6). I think it probably works on 5.5 as well but I
haven't verified that.

These new versions support runtime selection of the Linux bridging vs
vswitch through the toolstack. The patch includes the necessary
reconfiguration (rewriting /etc/xensource/network.conf) to enable
vswitch in the RPM %post stage.

The RPM spec file integration is only lightly tested, seems to work
for me.

This commit is as provided by Ian Campbell, with a few minor tweaks:

    - Updated xenserver/automake.mk to distribute the added files.

    - Updated RPM spec file not to complain if the added files do
      not already exist (since they do not exist on XenServer 5.5.0).

    - Change location of dbcache back to /var/lib/openvswitch/dbcache
      so that this can coexist with our other internal builds.
      (Undoubtedly we will have to adopt the new location chosen by Ian
      eventually, however.)

14 years agodatapath: Clean up vswitch_skb_checksum_setup().
Ben Pfaff [Wed, 20 Jan 2010 21:07:47 +0000 (13:07 -0800)]
datapath: Clean up vswitch_skb_checksum_setup().

vswitch_skb_checksum_setup() can be defined in datapath.h as a no-op
when defined(CONFIG_XEN) && defined(HAVE_PROTO_DATA_VALID) is false.

Also, skb_checksum_setup(), which was defined similarly, can be dropped
now, since it was unused.

14 years agonetdev: Rename "class" members to "netdev_class" for C++ compatibility.
Ben Pfaff [Fri, 22 Jan 2010 23:13:26 +0000 (15:13 -0800)]
netdev: Rename "class" members to "netdev_class" for C++ compatibility.

From partner.

14 years agohmap: Rename "new" to "new_node" for C++ header compatibility.
Ben Pfaff [Fri, 22 Jan 2010 23:10:07 +0000 (15:10 -0800)]
hmap: Rename "new" to "new_node" for C++ header compatibility.

From partner.

14 years agodpif: Rename "class" member to "dpif_class" for C++ compatibility.
Ben Pfaff [Fri, 22 Jan 2010 23:14:01 +0000 (15:14 -0800)]
dpif: Rename "class" member to "dpif_class" for C++ compatibility.

From partner.

14 years agosflow: Fix sFlow sampling structure.
Ben Pfaff [Wed, 20 Jan 2010 21:52:42 +0000 (13:52 -0800)]
sflow: Fix sFlow sampling structure.

According to Neil McKee, in an email archived at
http://openvswitch.org/pipermail/dev_openvswitch.org/2010-January/000934.html:

    The containment rule is that a given sflow-datasource (sampler or
    poller) should be scoped within only one sflow-agent (or
    sub-agent).  So the issue arrises when you have two
    switches/datapaths defined on the same host being managed with
    the same IP address: each switch is a separate sub-agent, so they
    can run independently (e.g. with their own sequence numbers) but
    they can't both claim to speak for the same sflow-datasource.
    Specifically, they can't both represent the <ifindex>:0
    data-source.  This containment rule is necessary so that the
    sFlow collector can scale and combine the results accurately.

    One option would be to stick with the <ifindex>:0 data-source but
    elevate it to be global across all bridges, with a global
    sample_pool and a global sflow_agent.  Not tempting.  Better to
    go the other way and allow each interface to have it's own
    sampler, just as it already has it's own poller.  The ifIndex
    numbers are globally unique across all switches/datapaths on the
    host, so the containment is now clean.  Datasource <ifindex>:5
    might be on one switch, whille <ifindex>:7 can be on another.
    Other benefits are that 1) you can support the option of
    overriding the default sampling-rate on an interface-by-interface
    basis, and 2) this is how most sFlow implementations are coded,
    so there will be no surprises or interoperability issues with any
    sFlow collectors out there.

This commit implements the approach suggested by Neil.

This commit uses an atomic_t to represent the sampling pool.  This is
because we do want access to it to be atomic, but we expect that it will
"mostly" be accessed from a single CPU at a time.  Perhaps this is a bad
assumption; we can always switch to another form of synchronization later.

CC: Neil McKee <neil.mckee@inmon.com>
14 years agosflow: Fix printf format specifier in log message.
Ben Pfaff [Tue, 19 Jan 2010 18:12:05 +0000 (10:12 -0800)]
sflow: Fix printf format specifier in log message.

"65536 / sizeof *actions" has type size_t, so use %zu.

Reported-by: Neil McKee <neil.mckee@inmon.com>
14 years agodpif-linux: Always set *fnp in make_openvswitch_device().
Ben Pfaff [Tue, 19 Jan 2010 18:10:52 +0000 (10:10 -0800)]
dpif-linux: Always set *fnp in make_openvswitch_device().

Some versions of GCC warn about this.  Always initializing it seems like
the right thing to do, since we "almost always" initialized it before.

Reported-by: Neil McKee <neil.mckee@inmon.com>
14 years agoRelease Open vSwitch 0.99.0.
Justin Pettit [Fri, 15 Jan 2010 07:24:09 +0000 (23:24 -0800)]
Release Open vSwitch 0.99.0.

This is an "unstable" release.

14 years agodatapath: Disable preemption updating per-CPU data in dp_dev_recv().
Ben Pfaff [Wed, 13 Jan 2010 18:43:31 +0000 (10:43 -0800)]
datapath: Disable preemption updating per-CPU data in dp_dev_recv().

dp_dev_recv() is called from do_output(), which can be called from
execute_actions(), which can be called from process context with
preemption enabled, so it needs to disabled preemption before it can
access per-CPU data.

Build tested on a few different kernels.

Bug #2316.

Reported-by: John Galgay <john@galgay.net>
CC: Dan Wendlandt <dan@nicira.com>
14 years agosflow: Improve documentation phrasing.
Ben Pfaff [Mon, 11 Jan 2010 19:13:49 +0000 (11:13 -0800)]
sflow: Improve documentation phrasing.

Suggested by Justin Pettit.

14 years agosflow: Document how the agent address is determined.
Ben Pfaff [Mon, 11 Jan 2010 19:11:03 +0000 (11:11 -0800)]
sflow: Document how the agent address is determined.

14 years agosflow: Fix byte order problem.
Ben Pfaff [Mon, 11 Jan 2010 19:10:24 +0000 (11:10 -0800)]
sflow: Fix byte order problem.

Reported by Justin Pettit.

14 years agosflow: Improve user-visible string.
Ben Pfaff [Mon, 11 Jan 2010 19:10:01 +0000 (11:10 -0800)]
sflow: Improve user-visible string.

Suggested by Justin Pettit.

14 years agosflow: Improve comments.
Ben Pfaff [Mon, 11 Jan 2010 19:09:43 +0000 (11:09 -0800)]
sflow: Improve comments.

Pointed out by Justin Pettit.

14 years agosflow: Avoid division by zero if sampling rate is 0.
Ben Pfaff [Mon, 11 Jan 2010 19:09:14 +0000 (11:09 -0800)]
sflow: Avoid division by zero if sampling rate is 0.

Reported by Justin Pettit.

14 years agosflow: Fix ifDirection setting if duplex unknown.
Ben Pfaff [Mon, 11 Jan 2010 19:08:29 +0000 (11:08 -0800)]
sflow: Fix ifDirection setting if duplex unknown.

Reported by Justin Pettit.

14 years agosflow: Fix handling of struct ofproto_sflow_options members.
Ben Pfaff [Mon, 11 Jan 2010 19:07:59 +0000 (11:07 -0800)]
sflow: Fix handling of struct ofproto_sflow_options members.

Reported by Justin Pettit.

14 years agodatapath: Improve comments.
Ben Pfaff [Mon, 11 Jan 2010 19:06:56 +0000 (11:06 -0800)]
datapath: Improve comments.

14 years agodpif: Remove stray new-line.
Ben Pfaff [Mon, 11 Jan 2010 19:06:36 +0000 (11:06 -0800)]
dpif: Remove stray new-line.

Suggested by Justin Pettit.

14 years agodatapath: Renumber ioctls to avoid gaps.
Ben Pfaff [Sat, 9 Jan 2010 00:46:03 +0000 (16:46 -0800)]
datapath: Renumber ioctls to avoid gaps.

Suggested by Justin Pettit.

14 years agoImprove comments on interpretation of sFlow sampling probabilities.
Ben Pfaff [Sat, 9 Jan 2010 00:44:43 +0000 (16:44 -0800)]
Improve comments on interpretation of sFlow sampling probabilities.

Suggested by Justin Pettit.

14 years agodatapath: Improve comments on struct dp_stats_percpu.
Ben Pfaff [Sat, 9 Jan 2010 00:45:14 +0000 (16:45 -0800)]
datapath: Improve comments on struct dp_stats_percpu.

Suggested by Justin Pettit.

14 years agosflow: Write "sFlow" as "sFlow(R)" in documentation.
Ben Pfaff [Sat, 9 Jan 2010 00:45:02 +0000 (16:45 -0800)]
sflow: Write "sFlow" as "sFlow(R)" in documentation.

The sFlow license requires sFlow to be written as sFlow(R) for the first
reference in user documentation, so this commit implements that.

Suggested by Justin Pettit.

14 years agosflow: Set proper output port number for dropped packets.
Ben Pfaff [Sat, 9 Jan 2010 00:10:01 +0000 (16:10 -0800)]
sflow: Set proper output port number for dropped packets.

Based on advice from Neil McKee.

14 years agosflow: Report port ifIndexes instead of datapath port numbers.
Ben Pfaff [Wed, 6 Jan 2010 18:24:52 +0000 (10:24 -0800)]
sflow: Report port ifIndexes instead of datapath port numbers.

Reported-by: Neil McKee <neil.mckee@inmon.com>
14 years agoAdd runtime test that strtok_r() bug fix works.
Ben Pfaff [Wed, 6 Jan 2010 18:00:56 +0000 (10:00 -0800)]
Add runtime test that strtok_r() bug fix works.

Our bug fix for glibc's strtok_r() bug was not effective in distribution
tarballs.  This new test should catch that problem earlier in case it
recurs.

14 years agoInclude lib/string.h in "make dist"-generated tarballs.
Ben Pfaff [Wed, 6 Jan 2010 17:53:32 +0000 (09:53 -0800)]
Include lib/string.h in "make dist"-generated tarballs.

This file was missing from distributions.  Its lack prevented the
strtok_r() fix from working on systems that need it.

Reported-by: Tetsuo NAKAGAWA <nakagawa@mxc.nes.nec.co.jp>
14 years agovconn: Add comment describing usage of VCONN_SSL_LONG_OPTIONS
Justin Pettit [Tue, 5 Jan 2010 08:08:34 +0000 (00:08 -0800)]
vconn: Add comment describing usage of VCONN_SSL_LONG_OPTIONS

14 years agoAdd extended vlog options to utilities
Justin Pettit [Tue, 5 Jan 2010 02:55:00 +0000 (18:55 -0800)]
Add extended vlog options to utilities

The ovs-discover, ovs-dpctl, and ovs-ofctl man pages indicated that they
supported extended vlog options (e.g., --log-file), but they actually
did not.  This commit adds them.

Reported by Tetsuo NAKAGAWA <nakagawa@mxc.nes.nec.co.jp>

14 years agoofproto: Fix segfault when changing command execution settings
Tetsuo NAKAGAWA [Tue, 5 Jan 2010 02:19:47 +0000 (18:19 -0800)]
ofproto: Fix segfault when changing command execution settings

If the remote command execution settings are changed and a NULL argument
is given for the directory, a crash would occur.  With this change, the
default directory is used.

14 years agoxenserver: Fix small typo in vswitch-xapi-update
Justin Pettit [Tue, 5 Jan 2010 00:33:49 +0000 (16:33 -0800)]
xenserver: Fix small typo in vswitch-xapi-update

14 years agoFix documented name of key used to disable MAC learning on a VLAN.
Ben Pfaff [Mon, 4 Jan 2010 23:01:41 +0000 (15:01 -0800)]
Fix documented name of key used to disable MAC learning on a VLAN.

The code uses "disable-learning" but the documentation claimed that it
was "learning-disable".

14 years agoInitial implementation of sFlow.
Ben Pfaff [Mon, 4 Jan 2010 21:08:37 +0000 (13:08 -0800)]
Initial implementation of sFlow.

Tested very slightly with "ping" and "sflowtool -t | tcpdump -r -".

14 years agonetdev: New functions for interpreting "enum ofp_port_features" bitmaps.
Ben Pfaff [Tue, 22 Dec 2009 00:27:55 +0000 (16:27 -0800)]
netdev: New functions for interpreting "enum ofp_port_features" bitmaps.

14 years agoAdd InMon's sFlow Agent library to the build system.
Ben Pfaff [Fri, 20 Nov 2009 17:45:26 +0000 (09:45 -0800)]
Add InMon's sFlow Agent library to the build system.

The C source and header files added in this commit is covered under the
InMon sFlow license at http://www.inmon.com/technology/sflowlicense.txt

The library requires -Wno-unused to compile without warnings, so this
commit adds that for building the sFlow code only.  Automake can only
change compiler flags on a per-library or per-program basis, so sFlow
is built as a separate library.

The library will be used in upcoming commits.

14 years agoinitscript: pass complete path to pidfile to status command
Ben Pfaff [Thu, 17 Dec 2009 18:00:36 +0000 (10:00 -0800)]
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.

Cross-port of Ian Campbell's commit d1c8c9e4 on xs5.7 branch.

14 years agoovs-vsctl: Fix traceback when telling target to reload
Justin Pettit [Fri, 4 Dec 2009 22:11:53 +0000 (14:11 -0800)]
ovs-vsctl: Fix traceback when telling target to reload

The code to tell the target to reload was referencing a non-existent
global variable to determine the target.  This change uses the correct
one.

14 years agonetdev: Allow explicit creation of netdev objects
Justin Pettit [Tue, 1 Dec 2009 09:14:33 +0000 (01:14 -0800)]
netdev: Allow explicit creation of netdev objects

This change adds netdev_create() and netdev_destroy() functions to allow
the creation of network devices through the netdev library.  Previously,
network devices had to already exist or be created on demand through
netdev_open().  This caused problems such as not being able to specify
TAP devices as ports in ovs-vswitchd, which this patch fixes.

This also lays the groundwork for adding GRE and VDE support.

14 years agodpif: Minor provider comment cleanups.
Justin Pettit [Tue, 1 Dec 2009 07:20:57 +0000 (23:20 -0800)]
dpif: Minor provider comment cleanups.

15 years agoclassifier: Improve comments.
Ben Pfaff [Tue, 24 Nov 2009 17:59:54 +0000 (09:59 -0800)]
classifier: Improve comments.

15 years agoovs-openflowd: Add support for userspace-only switching.
Ben Pfaff [Mon, 23 Nov 2009 19:32:08 +0000 (11:32 -0800)]
ovs-openflowd: Add support for userspace-only switching.

15 years agosvec: New function svec_split().
Ben Pfaff [Mon, 23 Nov 2009 19:09:38 +0000 (11:09 -0800)]
svec: New function svec_split().

This is useful in an upcoming commit.

15 years agodpif: New function dpif_create_and_open().
Ben Pfaff [Mon, 23 Nov 2009 19:09:19 +0000 (11:09 -0800)]
dpif: New function dpif_create_and_open().

This function combines what dpif_create() and dpif_open() do.  It allows
us to factor a tiny amount of code out of the vswitch, but more importantly
this function is also useful in the following commit.

15 years agonetflow: Break out code for sending packets into a new "collectors" module.
Ben Pfaff [Mon, 23 Nov 2009 21:59:20 +0000 (13:59 -0800)]
netflow: Break out code for sending packets into a new "collectors" module.

sFlow uses a similar UDP structure so this will allow use to reuse the
NetFlow code for it.

15 years agonetflow: Use inet_open_active() to factor out some code.
Ben Pfaff [Mon, 23 Nov 2009 20:22:03 +0000 (12:22 -0800)]
netflow: Use inet_open_active() to factor out some code.

15 years agosocket-util: Generalize tcp_open_*() to UDP, as inet_open_*().
Ben Pfaff [Mon, 23 Nov 2009 20:18:59 +0000 (12:18 -0800)]
socket-util: Generalize tcp_open_*() to UDP, as inet_open_*().

The tcp_open_active() and tcp_open_passive() functions don't really have
any strong dependencies on TCP.  With a couple of simple changes they
can be used for UDP also.  Since this is useful for Netflow, this commit
does so.

15 years agosocket-util: Make TCP open function support no default port.
Ben Pfaff [Thu, 19 Nov 2009 21:44:49 +0000 (13:44 -0800)]
socket-util: Make TCP open function support no default port.

Until now, tcp_open_active() and tcp_open_passive() have only been used
in situations where there is a reasonable default port, e.g. OFP_TCP_PORT.
But for NetFlow there is no universal default, so enhance these functions
so that they can require the user to specify a port explicitly.

Crossported from the 'db' branch, where this is useful for JSON-RPC, which
also has no widely known port.

15 years agonetdev: New function netdev_get_ifindex().
Ben Pfaff [Mon, 23 Nov 2009 20:25:08 +0000 (12:25 -0800)]
netdev: New function netdev_get_ifindex().

sFlow needs the ifindex of an interface, so this commit adds a function
to retrieve it.

15 years agoMove C compiler warning (-W) flags from CFLAGS to AM_CFLAGS.
Ben Pfaff [Thu, 19 Nov 2009 21:25:42 +0000 (13:25 -0800)]
Move C compiler warning (-W) flags from CFLAGS to AM_CFLAGS.

C compiler warning options added by the "configure" script have until
now been put into CFLAGS.  However that option is supposed to be reserved
for the user under Automake rules, so move them to AM_CFLAGS.

Besides increased adherence to Automake rules, this is useful because
AM_CFLAGS can be overridden on a per-target (e.g. program or library)
basis, whereas CFLAGS cannot.  In turn, building the sFlow library (which
will be added in an upcoming commit) requires overriding the compiler
flags to avoid some warning messages.  (By modifying the warning flags, we
avoid the need to modify the sFlow library in any way.)

15 years agoacinclude.m4: Fix inconsistency.
Ben Pfaff [Thu, 19 Nov 2009 00:27:55 +0000 (16:27 -0800)]
acinclude.m4: Fix inconsistency.

Both ; and : are valid shell commands here, but one branch of the "if"
uses one and the other branch uses the other.  Use the same one, for
consistency's sake.

15 years agoCorrect dameon options in INSTALL.bridge
Justin Pettit [Thu, 19 Nov 2009 23:45:20 +0000 (15:45 -0800)]
Correct dameon options in INSTALL.bridge

A while back, we retired the short options for daemons.  The
INSTALL.bridge file was never updated to reflect this.

CC: Jeongkeun Lee <jklee@hp.com>
15 years agonetdev: Really set output values to 0 on failure in netdev_get_features().
Ben Pfaff [Thu, 19 Nov 2009 19:06:14 +0000 (11:06 -0800)]
netdev: Really set output values to 0 on failure in netdev_get_features().

The comment on netdev_get_features() claimed that all of the passed-in
values were set to 0 on failure, but the implementation didn't live up
to the promise.

CC: Paul Ingram <paul@nicira.com>
15 years agoovs-controller: Add --wildcard and --normal features.
Jean Tourrilhes [Thu, 19 Nov 2009 20:48:32 +0000 (12:48 -0800)]
ovs-controller: Add --wildcard and --normal features.

This adds two command line switches to ovs-controller to:
1) Use wildcards instead of exact matches.
2) Use "normal" action instead of explicit port.

15 years agodatapath: Use HAVE_PROTO_DATA_VALID when defining vswitch_skb_checksum_setup
Ian Campbell [Thu, 19 Nov 2009 18:20:49 +0000 (10:20 -0800)]
datapath: Use HAVE_PROTO_DATA_VALID when defining vswitch_skb_checksum_setup

The purpose of the non-empty variant of vswitch_skb_checksum_setup is to
synchronise the proto_data_valid and proto_csum_blank fields into the
standard skb csum/ip_summed fields, therefore it is more correct to key
off of HAVE_PROTO_DATA_VALID.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
15 years agodatapath: Fix warning building datapath on pre-2.6.24 kernels.
Ben Pfaff [Wed, 18 Nov 2009 23:56:57 +0000 (15:56 -0800)]
datapath: Fix warning building datapath on pre-2.6.24 kernels.

The Linux 'min' macro checks that its arguments have the same type, and
if not the compiler reports a message about incompatible pointer types.
On pre-2.6.24 kernels skb_headroom() returns int, so this code was
firing a warning:
       unsigned headroom = max(min_headroom, skb_headroom(skb));

This commit makes skb_headroom() return an unsigned int regardless of
kernel version.

15 years agodatapath: Check for proto_data_valid member instead of kernel version.
Ben Pfaff [Wed, 18 Nov 2009 23:19:50 +0000 (15:19 -0800)]
datapath: Check for proto_data_valid member instead of kernel version.

Commit 5ef800a69 "datapath: Copy Xen's checksumming fields when doing
skb_copy" should copy proto_data_valid between sk_buffs when that field
is present.  However the check for CONFIG_XEN plus kernel version 2.6.18
isn't sufficient, because SLES 11 kernels are version 2.6.27 but do have
this field.

This commit adds a configure-time check for the presence of the member
instead of attempting to guess based on the kernel version.

Thanks to Ian Campbell for reporting this problem.

CC: <Ian.Campbell@citrix.com>
15 years agoMerge citrix branch into master.
Ben Pfaff [Wed, 18 Nov 2009 22:14:29 +0000 (14:14 -0800)]
Merge citrix branch into master.

15 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.

15 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

15 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.

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

15 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.

15 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

15 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

15 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

15 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.

15 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.

15 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.

15 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.

15 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.

15 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.

15 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>
15 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.

15 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

15 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

15 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

15 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.

15 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

15 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.

15 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

15 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>
15 years agoMerge citrix branch into master.
Jesse Gross [Tue, 10 Nov 2009 23:12:01 +0000 (15:12 -0800)]
Merge citrix branch into master.