openvswitch
12 years agovswitch.xml: Remove trailing whitespace.
Ethan Jackson [Wed, 8 Feb 2012 02:12:01 +0000 (18:12 -0800)]
vswitch.xml: Remove trailing whitespace.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoovsdb-client: Fix typo in manpage.
Ben Pfaff [Tue, 7 Feb 2012 23:47:23 +0000 (15:47 -0800)]
ovsdb-client: Fix typo in manpage.

"monitor" is a command, not an option.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-print: Fix up doubled "break;".
Ben Pfaff [Wed, 8 Feb 2012 19:23:37 +0000 (11:23 -0800)]
ofp-print: Fix up doubled "break;".

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Don't output to in_port even if in_port is OFPP_LOCAL.
Aaron Rosen [Wed, 8 Feb 2012 18:59:41 +0000 (10:59 -0800)]
ofproto-dpif: Don't output to in_port even if in_port is OFPP_LOCAL.

Signed-off-by: Aaron Rosen <arosen@clemson.edu>
[Ben Pfaff added the test.]
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoAdd information about time left before timeouts to flow dumps.
Ben Pfaff [Tue, 7 Feb 2012 18:13:52 +0000 (10:13 -0800)]
Add information about time left before timeouts to flow dumps.

The "learn" action is useful for MAC learning, but until now there has been
no way to find out through OpenFlow how much time remains before a MAC
learning entry (a learned flow) expires.  This commit adds that ability.

Feature #7193.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Use ofctl_strip consistently.
Ben Pfaff [Wed, 1 Feb 2012 20:45:32 +0000 (12:45 -0800)]
tests: Use ofctl_strip consistently.

The ofctl_strip shell function was introduced a little while ago.  It makes
test results easier to read, in my opinion, by removing uninteresting
bits.  This commit adopts ofctl_strip throughout the tests.

This is useful in an upcoming commit that adds additional fields that
should also be stripped to ovs-ofctl output.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Update last-used time of initial rule in handle_flow_miss().
Ben Pfaff [Wed, 1 Feb 2012 19:42:39 +0000 (11:42 -0800)]
ofproto-dpif: Update last-used time of initial rule in handle_flow_miss().

When handle_flow_miss() handled a packet, it failed to update the rule's
last-used time.  The change to flow_push_stats() fixes the problem.

The change to rule_execute() deletes code that becomes redundant after the
change to flow_push_stats().

A test case introduced in an upcoming commit fails without this fix.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-print: Merge two cases in ofp_to_string__().
Ben Pfaff [Tue, 7 Feb 2012 22:47:27 +0000 (14:47 -0800)]
ofp-print: Merge two cases in ofp_to_string__().

It looks like other cases are merged this way, so make this one consistent.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agocoverage: Time out the coverage hash suppression once a day.
Ben Pfaff [Mon, 6 Feb 2012 18:21:59 +0000 (10:21 -0800)]
coverage: Time out the coverage hash suppression once a day.

Otherwise coverage log messages will eventually get rotated out of the
system logs and never reappear (before restarting a given daemon).

Bug #1452.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoxenserver: Remove dead code from ovs-xapi-sync.
Ben Pfaff [Fri, 3 Feb 2012 23:39:59 +0000 (15:39 -0800)]
xenserver: Remove dead code from ovs-xapi-sync.

Nothing actually uses call_vsctl(), so remove it and its dependencies.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agorhel: Space separated list of DHCP interfaces in network scripts.
Gurucharan Shetty [Fri, 3 Feb 2012 20:21:30 +0000 (12:21 -0800)]
rhel: Space separated list of DHCP interfaces in network scripts.

Use space separated list of DHCP interfaces for OVSDHCPINTERFACES
instead of comma separated list. This is done to maintain
consistency with BOND_IFACES.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
12 years agodebian: Don't install Python modules for obsolete Python versions.
Ben Pfaff [Fri, 3 Feb 2012 21:30:50 +0000 (13:30 -0800)]
debian: Don't install Python modules for obsolete Python versions.

Python 2.4 is obsolete, not present in Debian squeeze or sid, so don't
install Python modules for it.

It would be better to just put the files directly into
/usr/share/pyshared/ovs/, instead of in site-packages for some specific
Python version, but this causes problems for builds on squeeze, as
documented in commit bc3aa0bf5 (debian: Make python-openvswitch packaging
work with squeeze dh_python2.):

    The dh_python2 helper in Debian squeeze has a limitation that is not
    mentioned anywhere, as far as I can tell: Python files must be in
    /usr/lib/python#.#/site-packages to be installed.  The version in Debian
    wheezy does not have the same limitation.

    This meant that building the Debian packages on squeeze silently produced
    a broken python-openvswitch package, whereas building the same thing on
    wheezy built a working package.

    This fixes the problem by putting the .py files where squeeze expects them.
    It works on wheezy too.

A before-and-after "debdiff" shows that the only significant effect of this
commit is to drop python2.4 symlinks.

CC: horms@debian.org
Reported-by: Luca Falavigna <ftpmaster@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoxenserver: Simplify RPM build instructions.
Ben Pfaff [Fri, 3 Feb 2012 21:34:45 +0000 (13:34 -0800)]
xenserver: Simplify RPM build instructions.

I got tired of trying to follow them properly myself.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ofctl: Fix minor memory leaks.
Ben Pfaff [Fri, 3 Feb 2012 20:33:06 +0000 (12:33 -0800)]
ovs-ofctl: Fix minor memory leaks.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoflow: Rename 'tp_addr' field in flow_hash_symmetric_l4().
Ethan Jackson [Fri, 3 Feb 2012 05:57:54 +0000 (21:57 -0800)]
flow: Rename 'tp_addr' field in flow_hash_symmetric_l4().

The 'tp_addr' field name is inappropriate because its not an
address, it's the transport port. Therefore tp is sufficient.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agorhel: Simplify ifup-ovs script use of "case".
Ben Pfaff [Fri, 3 Feb 2012 17:33:47 +0000 (09:33 -0800)]
rhel: Simplify ifup-ovs script use of "case".

Suggested-by: "Alexey I. Froloff" <raorn@altlinux.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ofctl: Fix typos in manpage.
Ben Pfaff [Fri, 3 Feb 2012 17:23:44 +0000 (09:23 -0800)]
ovs-ofctl: Fix typos in manpage.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Add dependency on ${misc:Depends} to openvswitch-test
Simon Horman [Fri, 3 Feb 2012 08:34:17 +0000 (17:34 +0900)]
debian: Add dependency on ${misc:Depends} to openvswitch-test

This is necessary as openvswitch-test makes use of debhelper.

As reported by lintian.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agocfm: Support high priority CCM broadcasts.
Ethan Jackson [Thu, 2 Feb 2012 23:48:13 +0000 (15:48 -0800)]
cfm: Support high priority CCM broadcasts.

Bug #9015.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agostp: Log topology change events.
Ethan Jackson [Wed, 25 Jan 2012 21:14:05 +0000 (13:14 -0800)]
stp: Log topology change events.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agocfm: Allow manual override of CFM fault status.
Ethan Jackson [Fri, 27 Jan 2012 02:58:51 +0000 (18:58 -0800)]
cfm: Allow manual override of CFM fault status.

This can be useful when testing.

Suggested-by: Reid Price <reid@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoAdd support for bitwise matching on TCP and UDP ports.
Ben Pfaff [Sat, 28 Jan 2012 01:16:05 +0000 (17:16 -0800)]
Add support for bitwise matching on TCP and UDP ports.

Bug #8827.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonx-match: Factor redundant code out of nx_put_match().
Ben Pfaff [Fri, 3 Feb 2012 00:44:44 +0000 (16:44 -0800)]
nx-match: Factor redundant code out of nx_put_match().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoflow: Add a couple of missing build assertions on FLOW_WC_SEQ.
Ben Pfaff [Fri, 27 Jan 2012 23:38:53 +0000 (15:38 -0800)]
flow: Add a couple of missing build assertions on FLOW_WC_SEQ.

Every piece of code that may need to change whenever struct flow or struct
flow_wildcards changes, but might easily get overlooked, should have a
build assertion on the value of FLOW_WC_SEQ, but these functions did not.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Reduce risk of port collision and remove bash dependency.
Ben Pfaff [Fri, 3 Feb 2012 00:37:31 +0000 (16:37 -0800)]
tests: Reduce risk of port collision and remove bash dependency.

A few tests need a random TCP port on which to listen for connections.
Until now, the tests have used the $RANDOM bash extension to do this, but
this runs the risk of occasionally colliding with an in-use port.  This
commit removes the bash dependency by switching to using a small Perl
program to pick random ports and reduces the risk of collision by
attempting to bind the port that it chooses.

Reported-by: Timothy Chen <tchen@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodaemon: New function daemon_save_fd() to preserve fds across detach.
Ben Pfaff [Fri, 27 Jan 2012 17:53:17 +0000 (09:53 -0800)]
daemon: New function daemon_save_fd() to preserve fds across detach.

This eliminates a kluge that was duplicated in three different daemons.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovsdb-client: Add optional timestamps to "monitor" command output.
Ben Pfaff [Fri, 27 Jan 2012 20:48:21 +0000 (12:48 -0800)]
ovsdb-client: Add optional timestamps to "monitor" command output.

Suggestion #9347.
Suggested-by: Alan Shieh <ashieh@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovsdb-client: Improve manpage.
Ben Pfaff [Fri, 27 Jan 2012 20:46:06 +0000 (12:46 -0800)]
ovsdb-client: Improve manpage.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-xapi-sync: Always set iface-id, not just when xs-vif-uuid changes.
Ben Pfaff [Thu, 2 Feb 2012 01:18:52 +0000 (17:18 -0800)]
ovs-xapi-sync: Always set iface-id, not just when xs-vif-uuid changes.

When XAPI moves an interface from one bridge to another, the vif script
removes the vif from one bridge and adds it to (possibly) a different
bridge in a single transaction.  The new record does not have an iface-id
initially (because the vif script never adds the iface-id initially) but
it has the same name and xs-vif-uuid as the old one, so the caching logic
in ovs-xapi-sync failed to add a new iface-id.  This commit fixes the
caching logic.

Observed on XenServer 5.6.100.  It's possible that XAPI behavior changed in
later versions so the bug cannot be triggered there, but we have not
checked.

Bug #9414.
Reported-by: Duffie Cooley <dcooley@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonicira-ext: Add size check for struct nx_role_request.
Ben Pfaff [Thu, 26 Jan 2012 20:50:45 +0000 (12:50 -0800)]
nicira-ext: Add size check for struct nx_role_request.

We try to have such a size check every protocol structure.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Run ovs-ofctl under valgrind too, with the "check-valgrind" target.
Ben Pfaff [Thu, 26 Jan 2012 22:51:19 +0000 (14:51 -0800)]
tests: Run ovs-ofctl under valgrind too, with the "check-valgrind" target.

I think that this was just an oversight.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ofctl: Update usage message.
Ben Pfaff [Wed, 25 Jan 2012 22:41:22 +0000 (14:41 -0800)]
ovs-ofctl: Update usage message.

Some commands weren't mentioned.  The "invalid_ttl" option to "monitor"
was missing.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitch.xml: More readably indent one section.
Ben Pfaff [Wed, 25 Jan 2012 00:35:09 +0000 (16:35 -0800)]
vswitch.xml: More readably indent one section.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agohash: Convert macros to inline functions.
Ben Pfaff [Wed, 18 Jan 2012 19:29:57 +0000 (11:29 -0800)]
hash: Convert macros to inline functions.

I always assumed that macros would generate better code.  I was wrong.  The
generated code was identical with inline functions, with GCC version 4.4.5.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Make the MAC entry aging time configurable.
Ben Pfaff [Wed, 1 Feb 2012 23:04:51 +0000 (15:04 -0800)]
vswitchd: Make the MAC entry aging time configurable.

NICS-11.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agomac-learning: Increase MAC learning timeout to 300 seconds.
Ben Pfaff [Tue, 24 Jan 2012 18:38:04 +0000 (10:38 -0800)]
mac-learning: Increase MAC learning timeout to 300 seconds.

When Cisco (and other?) routers are configured in high-availability modes,
they use two different MAC addresses.  The router uses MAC 1 only for ARP
replies.  The router uses MAC 2 for forwarding IP packets to end hosts.
When a MAC learning switch is attached to the router, therefore, it will
only learn the location of MAC 1 from ARP replies.  If the end host's ARP
cache refresh timer is longer than the switch's MAC learning timeout, then
packets to the router will be flooded from the MAC learning timeout until
the next ARP reply.

This commit fixes the problem by increasing the MAC learning timeout from
60 seconds to 300 seconds.  According to research by Sanjay Sane, this is
always sufficient, even with operating systems that use ARP timeouts
longer than 300 seconds (such as FreeBSD and Mac OS, which have 1200
seconds ARP timeouts)  because the routers that cause this problem send
unsolicited ARP replies every 180 seconds.

This issue arises in any situation where traffic between two hosts flows
only in one direction.  The explanation above describes only one special
case.

NICS-11.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ofctl: Fix typo in manpage.
Ben Pfaff [Wed, 1 Feb 2012 21:35:23 +0000 (13:35 -0800)]
ovs-ofctl: Fix typo in manpage.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoAdd support for limiting the number of flows in an OpenFlow flow table.
Ben Pfaff [Wed, 1 Feb 2012 18:27:30 +0000 (10:27 -0800)]
Add support for limiting the number of flows in an OpenFlow flow table.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Track the rule being translated during flow translation.
Ben Pfaff [Thu, 19 Jan 2012 21:03:53 +0000 (13:03 -0800)]
ofproto-dpif: Track the rule being translated during flow translation.

An upcoming commit will need access to the rule being translated during
xlate_actions(), so this commit adds that feature.  The existing 'cookie'
member of struct action_xlate_ctx can be accessed through this rule, so
this commit also removes that member.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoheap: New library that implements a binary heap-based priority queue.
Ben Pfaff [Tue, 24 Jan 2012 23:07:41 +0000 (15:07 -0800)]
heap: New library that implements a binary heap-based priority queue.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Move 'used' from ofproto_dpif into ofproto.
Ben Pfaff [Sat, 14 Jan 2012 00:40:59 +0000 (16:40 -0800)]
ofproto: Move 'used' from ofproto_dpif into ofproto.

This will allow the upcoming flow table eviction policy code to determine
which flows will expire soon.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Make ofproto_rule_destroy__() do nothing for a null argument.
Ben Pfaff [Tue, 3 Jan 2012 18:16:15 +0000 (10:16 -0800)]
ofproto: Make ofproto_rule_destroy__() do nothing for a null argument.

This is our customary way to implement a "destroy" function.  It allows
a minor simplification in ofoperation_complete().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Remove unnecessary assignment from ofoperation_complete().
Ben Pfaff [Tue, 3 Jan 2012 18:15:28 +0000 (10:15 -0800)]
ofproto: Remove unnecessary assignment from ofoperation_complete().

Nothing uses op->victim following this assignment, so it is not
needed.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Implement "hidden" and "readonly" OpenFlow tables.
Ben Pfaff [Fri, 13 Jan 2012 23:18:30 +0000 (15:18 -0800)]
ofproto: Implement "hidden" and "readonly" OpenFlow tables.

A "hidden" table is one that OpenFlow operations affect only if the
table_id is explicitly specified, that is, operations that affect
all tables ignore it.

A "read-only" table is one that OpenFlow operations are not allowed
to modify.

I intend to use these flags in an upcoming commit for implementing
tables internal to the Open vSwitch implementation.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Make ofproto ->construct() function initialize tables.
Ben Pfaff [Wed, 19 Oct 2011 23:40:36 +0000 (16:40 -0700)]
ofproto: Make ofproto ->construct() function initialize tables.

If the ->construct() function initializes the OpenFlow tables itself,
then it can conveniently do implementation-specific configuration of
those tables afterward.  There isn't any such configuration to do yet;
an upcoming commit will add some.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Encapsulate classifier tables in new "struct oftable".
Ben Pfaff [Tue, 24 Jan 2012 23:18:58 +0000 (15:18 -0800)]
ofproto: Encapsulate classifier tables in new "struct oftable".

So far, each OpenFlow table has just been a classifier.  Upcoming
commits will add more data for each OpenFlow table, so this commit
encapsulates the struct classifier in a higher-level structure
to provide a good place to keep that data.

Some of the new functions introduced in this commit are trivial, but they
will become more elaborate in upcoming commits.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotimeval: New function time_boot_msec(), factored out of vlog.
Ben Pfaff [Thu, 12 Jan 2012 01:12:17 +0000 (17:12 -0800)]
timeval: New function time_boot_msec(), factored out of vlog.

An upcoming commit has a new use for the time at which OVS started up, so
this moves this functionality to a common location.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agometa-flow: New "subfield" data structure.
Ben Pfaff [Wed, 28 Dec 2011 20:42:14 +0000 (12:42 -0800)]
meta-flow: New "subfield" data structure.

Until now, parts of a field have been dealt with in a fairly ad-hoc way.
struct mf_subfield and the supporting functions added by this commit make
their use more systematic.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoutil: New function bitwise_zero().
Ben Pfaff [Wed, 18 Jan 2012 00:53:29 +0000 (16:53 -0800)]
util: New function bitwise_zero().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoutil: Move bitwise_copy() here, add new bitwise functions, add a test.
Ben Pfaff [Wed, 18 Jan 2012 00:38:23 +0000 (16:38 -0800)]
util: Move bitwise_copy() here, add new bitwise functions, add a test.

bitwise_copy() is generally useful so make it a general utility function.
Also add a comment.

Upcoming commits will introduce users for the new functions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoAdd a few 'const's.
Ben Pfaff [Tue, 31 Jan 2012 20:56:49 +0000 (12:56 -0800)]
Add a few 'const's.

These are useful hints, in these cases, that the caller retains ownership
of the passed-in packets.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Don't dereference potentially NULL vport in patch ports.
Jesse Gross [Tue, 31 Jan 2012 22:22:25 +0000 (14:22 -0800)]
datapath: Don't dereference potentially NULL vport in patch ports.

When changing patch ports we need to update any peers pointing to us.
When destroying the port, this means pointing them to a NULL port.
However, the new namespaces code attempted to dereference this port
in order to get the namespace.  The net is already passed in, so we
can just use that instead.

Bug #9477

Reported-by: Michael Hu <mhu@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agorhel: Enable DHCP in redhat network scripts.
Gurucharan Shetty [Tue, 31 Jan 2012 04:17:53 +0000 (20:17 -0800)]
rhel: Enable DHCP in redhat network scripts.

The current network-script, ifup-ovs  does not work well if you
enable DHCP on the OVS. It will work if we name the bridge
alphabetically greater than the underlying physical interfaces.
Even then, it will do multiple DHCP attempts slowing down the boot
up process.

This patch allows DHCP on an OVS bridge.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
12 years agosflow_agent: Use snprintf() in place of sprintf().
Ben Pfaff [Tue, 31 Jan 2012 17:39:28 +0000 (09:39 -0800)]
sflow_agent: Use snprintf() in place of sprintf().

These functions use sprintf() into a 1000-byte buffer.  It appears to me
that the strings they format are either short, fixed-length strings or the
output of strerror(), neither of which should ordinarily overflow.
However, using snprintf() cannot hurt.

Launchpad bug #914160.
Reported-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoSet dates for 1.4.0 release.
Justin Pettit [Tue, 31 Jan 2012 03:47:33 +0000 (19:47 -0800)]
Set dates for 1.4.0 release.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agoNEWS: Point out userspace is compatible with Linux 3.3 OVS kernel module.
Justin Pettit [Tue, 31 Jan 2012 07:07:19 +0000 (23:07 -0800)]
NEWS: Point out userspace is compatible with Linux 3.3 OVS kernel module.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agoofproto-dpif: Fix use-after-free error in handle_miss_upcalls().
Ben Pfaff [Mon, 30 Jan 2012 21:09:04 +0000 (13:09 -0800)]
ofproto-dpif: Fix use-after-free error in handle_miss_upcalls().

When handle_flow_miss() saw that subfacet did not have any actions, then
the associated packet would get freed early, in the loop that constructs
the set of batched operations.  However, there would still be a "flow_put"
operation that referenced the key that shares the same memory block as the
packet.  The memory allocator would overwrite the first few bytes of this
block, causing bizarre errors in the flow_put.

This commit changes the memory release strategy to be less error-prone, by
deferring all freeing of packets to the end of the function.  With this
change, every packet gets freed in the same place, instead of having some
packets freed in one place and other packets freed in another.

Here is the valgrind report that pinpoints the problem:

Invalid read of size 4
   at 0x4026838: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
   by 0x80E9B52: dpif_linux_flow_to_ofpbuf (dpif-linux.c:1714)
   by 0x80E9C77: dpif_linux_operate (dpif-linux.c:883)
   by 0x80AFB5A: dpif_operate (dpif.c:994)
   by 0x809A03B: handle_upcalls (ofproto-dpif.c:2758)
   by 0x809A23A: run_fast (ofproto-dpif.c:757)
   by 0x808C04E: ofproto_run_fast (ofproto.c:963)
   by 0x806DFB6: bridge_run_fast (bridge.c:1811)
   by 0x8074B59: main (ovs-vswitchd.c:98)
 Address 0x4427948 is 80 bytes inside a block of size 2,048 free'd
   at 0x402421C: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
   by 0x80CD865: ofpbuf_delete (ofpbuf.c:187)
   by 0x80CD8AA: ofpbuf_list_delete (ofpbuf.c:531)
   by 0x8099F06: handle_upcalls (ofproto-dpif.c:2747)
   by 0x809A23A: run_fast (ofproto-dpif.c:757)
   by 0x808C04E: ofproto_run_fast (ofproto.c:963)
   by 0x806DFB6: bridge_run_fast (bridge.c:1811)
   by 0x8074B59: main (ovs-vswitchd.c:98)

Bug #9346.
Reported-by: Alan Shieh <ashieh@nicira.com>
Reported-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agobond: Allow users to disable rebalancing.
Ethan Jackson [Thu, 26 Jan 2012 01:41:44 +0000 (17:41 -0800)]
bond: Allow users to disable rebalancing.

Bond rebalances come with a risk of packet reordering which some
users may find unacceptable.

Requested-by: Ben Basler <bbasler@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agotable: Avoid segmentation fault when printing an empty cell in JSON format.
Ben Pfaff [Fri, 27 Jan 2012 20:37:45 +0000 (12:37 -0800)]
table: Avoid segmentation fault when printing an empty cell in JSON format.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Add support for namespace.
Pravin B Shelar [Mon, 30 Jan 2012 14:56:54 +0000 (06:56 -0800)]
datapath: Add support for namespace.

Following patch adds support for Linux net-namespace. Now we can
have independent OVS instance in each net-ns.
Namespace support requires 2.6.32 or newer kernel as per-net-ns
genl-sock is not available in earlier kernel.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #7821

12 years agovlog: Change the default timestamp structure.
Gurucharan Shetty [Fri, 27 Jan 2012 18:54:02 +0000 (10:54 -0800)]
vlog: Change the default timestamp structure.

Change the default timestamp for console and file logs to
UTC in a format that satisfies timestamp requirements in RFC 5424.

Also, add the ability for ovs-appctl to log timestamps in UTC.

Bug #9052.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
12 years agoovs-appctl: Document the facility "file" option.
Gurucharan Shetty [Fri, 27 Jan 2012 18:26:24 +0000 (10:26 -0800)]
ovs-appctl: Document the facility "file" option.

The ovs-appctl man page has missing information about the
facility - "file". This patch adds that information.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
12 years agoovs-ofctl: Fix "snoop" command.
Ben Pfaff [Fri, 27 Jan 2012 17:22:41 +0000 (09:22 -0800)]
ovs-ofctl: Fix "snoop" command.

The vconn that "snoop" opens does not process and reply to requests, so
sending a request to set the packet-in format will hang forever, which
means that "snoop" never actually prints any of the traffic that it
receives.

Bug #9346.
Reported-by: Alan Shieh <ashieh@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoodp-util: Describe invalid keys and actions in more detail.
Ben Pfaff [Fri, 27 Jan 2012 00:21:50 +0000 (16:21 -0800)]
odp-util: Describe invalid keys and actions in more detail.

I have an outstanding bug report that has tons of "***56 leftover bytes***"
messages with no way to guess what the problem is.  I hope this makes
debugging possible.

Bug #9346.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ofctl: Fix typo in comment.
Ben Pfaff [Thu, 26 Jan 2012 21:39:38 +0000 (13:39 -0800)]
ovs-ofctl: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Fix typo in handle_nxt_set_packet_in_format().
Ben Pfaff [Thu, 26 Jan 2012 00:58:08 +0000 (16:58 -0800)]
ofproto: Fix typo in handle_nxt_set_packet_in_format().

NXFF_OPENFLOW10 and NXPIF_OPENFLOW10 have the same value (both zero), so
this doesn't fix an actual bug.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonicira-ext: Remove duplicative error codes.
Ben Pfaff [Wed, 25 Jan 2012 00:30:04 +0000 (16:30 -0800)]
nicira-ext: Remove duplicative error codes.

The information here duplicates the information in ofp-errors.h, so remove
it from here.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ctl: Restore ability to create 256 bridges.
Ben Pfaff [Fri, 27 Jan 2012 00:02:01 +0000 (16:02 -0800)]
ovs-ctl: Restore ability to create 256 bridges.

OVS is supposed to support at least 256 bridges simultaneously, but the
file descriptor count was a little too low for that.

Build tested only.

Bug #8218.
Reported-by: Luca Giraudo <lgiraudo@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev-linux: Add MTU check before setting MTU.
Pravin B Shelar [Wed, 25 Jan 2012 23:44:26 +0000 (15:44 -0800)]
netdev-linux: Add MTU check before setting MTU.

Following patch check if current MTU needs to be changed before
issuing set-mtu ioctl.

Suggested-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agostp: Allow manual topology change events.
Ethan Jackson [Sat, 14 Jan 2012 02:49:36 +0000 (18:49 -0800)]
stp: Allow manual topology change events.

Users may want to force the network to flush its MAC tables by
manually triggering a topology change event due to some event in
the system.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agostp: Flush MAC table on topology change.
Ethan Jackson [Mon, 16 Jan 2012 23:07:55 +0000 (15:07 -0800)]
stp: Flush MAC table on topology change.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agomac-learning: Only revalidate relevant flows upon flush.
Ethan Jackson [Wed, 25 Jan 2012 19:44:30 +0000 (11:44 -0800)]
mac-learning: Only revalidate relevant flows upon flush.

Most callers of mac_learning_flush() need to revalidate all flows
anyway, but this update forces new callers of mac_learning_flush()
to think about whether or not they need to explicitly handle
revalidation.  Also, it's theoretically more efficient when there
are lots of flows but the learning table is empty, (e.g. bridges
that don't use the NORMAL action).

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agovswitchd: Stop documenting nonexistent "min-rate" QoS.
Ethan Jackson [Wed, 25 Jan 2012 02:09:32 +0000 (18:09 -0800)]
vswitchd: Stop documenting nonexistent "min-rate" QoS.

There are no known implementations of the "min-rate" QoS algorithm
documented on ovs-vswitchd.conf.db.  This patch removes its
documentation pending an implementation.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoofproto: Optionally flush all learning tables with appctl.
Ethan Jackson [Tue, 24 Jan 2012 22:33:23 +0000 (14:33 -0800)]
ofproto: Optionally flush all learning tables with appctl.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agotests: Fix broken interface-reconfigure tests.
Ben Pfaff [Tue, 24 Jan 2012 22:49:11 +0000 (14:49 -0800)]
tests: Fix broken interface-reconfigure tests.

Commit acfb4e9597 updated the interface-reconfigure scripts without
updating the corresponding tests, causing false test failures.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Delete log files correctly when packages are purged.
Ben Pfaff [Thu, 19 Jan 2012 18:07:38 +0000 (10:07 -0800)]
debian: Delete log files correctly when packages are purged.

Debian Policy 10.8 says "Log files should be removed when the package is
purged (but not when it is only removed)," but the Open vSwitch packages
didn't properly implement this:

   - The openvswitch-brcompat and openvswitch-pki packages didn't delete
     their log files at purge time.

   - The openvswitch-switch package deleted all of the log files at purge
     time, even those owned by openvswitch-brcompat or openvswitch-pki.

This commit fixes both problems.

CC: 656448@bugs.debian.org
Reported-by: Andreas Beckmann <debian@abeckmann.de>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoopenvswitch-xen.spec: Avoid warning if build_number not defined.
Ben Pfaff [Tue, 24 Jan 2012 18:23:36 +0000 (10:23 -0800)]
openvswitch-xen.spec: Avoid warning if build_number not defined.

I expect that only Nicira internal builds want a build number, so it's
nice to avoid a complaint from RPM if the build_number macro is not
defined.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoxenserver/README: Remove bad instructions.
Ben Pfaff [Tue, 24 Jan 2012 18:18:30 +0000 (10:18 -0800)]
xenserver/README: Remove bad instructions.

The instructions in INSTALL.XenServer are more detailed and correct.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoINSTALL.XenServer: spelling fix.
Ben Pfaff [Tue, 24 Jan 2012 18:18:01 +0000 (10:18 -0800)]
INSTALL.XenServer: spelling fix.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoxenserver: Only replace XenServer hosts scripts that we recognize.
Ben Pfaff [Tue, 24 Jan 2012 17:53:44 +0000 (09:53 -0800)]
xenserver: Only replace XenServer hosts scripts that we recognize.

Open vSwitch comes with slightly improved versions of upstream Citrix
XenSever host scripts.  Until now, the Open vSwitch RPMs have always
installed its own versions of the scripts over the Citrix versions.  This
commit changes behavior to replace the scripts only if we recognize the
exact versions being replaced.  This approach seems safer given that the
benefits of the OVS changes are minor and we don't want to break any
upstream changes inadvertently.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoxenserver: Synchronize scripts with XenServer 6.0.0.
Ben Pfaff [Mon, 16 Jan 2012 19:23:26 +0000 (11:23 -0800)]
xenserver: Synchronize scripts with XenServer 6.0.0.

This commit updates the "vif" and "interface-reconfigure" scripts installed
by Open vSwitch on Citrix XenServer with those in XenServer 6.0.0.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Revalidate flows after "fdb/flush".
Ben Pfaff [Thu, 19 Jan 2012 00:08:46 +0000 (16:08 -0800)]
ofproto-dpif: Revalidate flows after "fdb/flush".

Otherwise bad translations can stick around.

Bug #9253.
Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Rate-limit all messages output by facet_check_consistency().
Ben Pfaff [Wed, 18 Jan 2012 22:27:10 +0000 (14:27 -0800)]
ofproto-dpif: Rate-limit all messages output by facet_check_consistency().

Some but not all of the log messages were rate-limited here.  Rate-limit
all of them to avoid filling up logs if an inconsistency persists.

Bug #9345.
Reported-by: Ethan Jackson <ethan@nicira.com>
Reported-by: Michael Hu <mhu@nicira.com>
Reported-by: Alan Shieh <ashieh@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agocfm: Log more aggressively amidst packet loss.
Ethan Jackson [Tue, 17 Jan 2012 00:42:08 +0000 (16:42 -0800)]
cfm: Log more aggressively amidst packet loss.

While debugging some issues today it became clear that it would be
useful to log when the CFM fault status changes and when packets
are lost.  The CFM module logs pretty aggressively when in debug
mode, but this can be chatty and most systems don't operate under
this logging level for extended periods of time.  This patch logs
when CCMs are received which indicate reordering or packet loss and
when the CFM fault status changed.

Requested-by: Jacob Cherkas <jcherkas@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agolacp: Require successful LACP negotiations when configured.
Ethan Jackson [Mon, 28 Nov 2011 21:54:08 +0000 (13:54 -0800)]
lacp: Require successful LACP negotiations when configured.

In the original Open vSwitch LACP implementation, when no slaves
found a LACP partner, the LACP module would attach all of them.
This allowed the LACP bond to fall back to a standard bond when
partnered with a non-LACP switch.  In practice, this has caused
confusion with marginal benefit, so this feature is removed with
this patch.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agorhel: Correct an example in README.RHEL
Gurucharan Shetty [Fri, 20 Jan 2012 23:07:50 +0000 (15:07 -0800)]
rhel: Correct an example in README.RHEL

Change the value of OVS_BRIDGE in an example to point
to the correct bridge name.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
12 years agodatapath: Correct GRE checksum offset.
Jesse Gross [Fri, 20 Jan 2012 23:12:38 +0000 (15:12 -0800)]
datapath: Correct GRE checksum offset.

If a statically defined GRE key is used with checksums then the
checksum will overwrite the key.  This is because the key is set
at header caching time and the checksum is set at packet processing
time and we don't update the offset on packet processing because
we don't do anything with the key.

Reported-by: Christos Argyropoulos <cargious@netmode.ntua.gr>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agoofproto-dpif: Fix "ofproto/trace" command.
Ben Pfaff [Fri, 20 Jan 2012 00:23:32 +0000 (16:23 -0800)]
ofproto-dpif: Fix "ofproto/trace" command.

Commit 0e15264f96e3c (unixctl: Implement quoting.) broke one form of
ofproto/trace.  This fixes it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoAdd cmdline arg to specify unix domain control socket.
Andrew Lambeth [Thu, 19 Jan 2012 18:26:03 +0000 (10:26 -0800)]
Add cmdline arg to specify unix domain control socket.

This is useful for sandboxing multiple instances of the daemon for
testing purposes.

Signed-off-by: Andrew Lambeth <wal@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodummy: Make --enable-dummy=override replace all dpifs, netdevs by dummies.
Ben Pfaff [Thu, 19 Jan 2012 18:24:46 +0000 (10:24 -0800)]
dummy: Make --enable-dummy=override replace all dpifs, netdevs by dummies.

Plain "--enable-dummy" just creates new dummy dpif and netdev classes.
This commit makes "--enable-dummy=override" go a step farther and actually
delete and replace all the existing dpif and netdev classes by copies of
the dummy class.

This is useful for testing in an environment where changing the classes in
Bridge or Interface records is challenging.

Requested-by: Andrew Lambeth <wal@nicira.com>
Tested-by: Andrew Lambeth <wal@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Enforce mutual exclusion between bridge and brcompat_mod.
Ben Pfaff [Tue, 17 Jan 2012 19:15:49 +0000 (11:15 -0800)]
datapath: Enforce mutual exclusion between bridge and brcompat_mod.

In kernels 2.6.36, Open vSwitch can (and does) safely coexist with the
Linux bridge module, but it does not make sense to load both bridge and
brcompat_mod at the same time.  Until now, nothing has prevented both from
loading; when they both load, confusion (at best) results.  This fixes
the problem by enforcing mutual exclusion.

Bug #9226.
Launchpad bug #917309.
Reported-by: Rogério Vinhal Nunes
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoAUTHORS: Add Linux upstream committers.
Jesse Gross [Tue, 17 Jan 2012 17:13:21 +0000 (09:13 -0800)]
AUTHORS: Add Linux upstream committers.

Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: kill duplicate included header
Shan Wei [Tue, 17 Jan 2012 17:08:20 +0000 (09:08 -0800)]
datapath: kill duplicate included header

For net part, remove duplicate included header.

Signed-off-by: Shan Wei <davidshan@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: remove unused version.h includes
Devendra Naga [Tue, 17 Jan 2012 17:05:33 +0000 (09:05 -0800)]
datapath: remove unused version.h includes

remove unused version.h includes as reported by make versioncheck.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agobond: Change default bond_mode to active-backup.
Ethan Jackson [Thu, 12 Jan 2012 01:23:38 +0000 (17:23 -0800)]
bond: Change default bond_mode to active-backup.

As promised, post version 1.4 the default bond_mode is changing to
active-backup with this commit.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agobond: Revalidate when lacp_negotiated status changes.
Ethan Jackson [Mon, 28 Nov 2011 23:14:11 +0000 (15:14 -0800)]
bond: Revalidate when lacp_negotiated status changes.

Typically, when the lacp_negotiated flag changes, the result of
bond_is_tcp_hash() will change as well.  However, for certain bond
types (SLB, Active-Backup, etc) this may not be true.  Since the
lacp_negotiated flag affects the results of
bond_check_admissibility() revalidation needs to happen whenever it
changes.  This patch makes the revalidation explicit.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agolacp: Enforce valid lacp-system-id configuration.
Ethan Jackson [Thu, 15 Dec 2011 00:34:52 +0000 (16:34 -0800)]
lacp: Enforce valid lacp-system-id configuration.

With this patch, when a user attempts to configure LACP with an
invalid system ID, OVS will fail to create the bond and warn.
This behavior seems safer then defaulting to the bridge Ethernet
address which may surprise users.

Bug #8710.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agobond: Add ovs-appctl bond/show to LACP sanity checks.
Ethan Jackson [Thu, 15 Dec 2011 02:35:42 +0000 (18:35 -0800)]
bond: Add ovs-appctl bond/show to LACP sanity checks.

This commit makes the LACP unit tests more general by adding
ovs-appctl bond/show output.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agobond: Sort slaves in ovs-appctl bond/show.
Ethan Jackson [Thu, 15 Dec 2011 02:56:07 +0000 (18:56 -0800)]
bond: Sort slaves in ovs-appctl bond/show.

This will simplify unit tests which appear in future commits.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agobond: Support ovs-appctl bond/show without arguments.
Ethan Jackson [Thu, 15 Dec 2011 02:48:07 +0000 (18:48 -0800)]
bond: Support ovs-appctl bond/show without arguments.

Similarly to lacp/show and cfm/show, the bond/show ovs-appctl
command now shows all bonds when given no arguments.

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