openvswitch
12 years agoofp-util: ofputil_pull_ofp11_match: Allow OXM match
Simon Horman [Tue, 7 Aug 2012 21:49:36 +0000 (06:49 +0900)]
ofp-util: ofputil_pull_ofp11_match: Allow OXM match

* Allow OXM matches which specified in OpenFlow 1.2.
  Also allow them for OpenFlow 1.1 as there seems little reason not to.

* Pass padded_match_len parameter which if on NULL will be set to
  the padded match len. This will be used when decoding flow statistics
  response messages.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev-bsd: Initialize variable to silence a compiler warning.
Ed Maste [Wed, 8 Aug 2012 18:48:01 +0000 (18:48 +0000)]
netdev-bsd: Initialize variable to silence a compiler warning.

FreeBSD's system compiler is a somewhat old version of GCC that produced
a spurious warning about a potential unitialized variable use.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolib: Add header #include for writev
Ed Maste [Wed, 8 Aug 2012 18:35:13 +0000 (18:35 +0000)]
lib: Add header #include for writev

This fixes a warning on FreeBSD.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolib: Correct "old-style function definition" warning.
Ed Maste [Wed, 8 Aug 2012 18:29:32 +0000 (18:29 +0000)]
lib: Correct "old-style function definition" warning.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoAUTHORS: Add Kyle Mestery.
Jesse Gross [Wed, 8 Aug 2012 18:06:30 +0000 (11:06 -0700)]
AUTHORS: Add Kyle Mestery.

Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agoBump up the supported kernel versions to include 3.5.x.
Kyle Mestery [Tue, 7 Aug 2012 22:48:21 +0000 (18:48 -0400)]
Bump up the supported kernel versions to include 3.5.x.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agovlog: Ignore return value of some write() calls.
Justin Pettit [Tue, 7 Aug 2012 22:45:06 +0000 (15:45 -0700)]
vlog: Ignore return value of some write() calls.

A couple of calls to write() would generate warnings when the
"-Wunused-result" compiler option is enabled.  This change ignores the
return value, since we can't do anything about it in logging code.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agotests: Test that ofp10_match bytes that should be ignored really are.
Ben Pfaff [Sat, 21 Jul 2012 16:56:28 +0000 (09:56 -0700)]
tests: Test that ofp10_match bytes that should be ignored really are.

Rob Sherwood reported a bug in OVS treatment of ofp10_match bytes that
should be ignored some time ago:

> In any case, the pktact.SingleWildcardMatch and
> pktact.AllExceptOneWildcardMatch tests were failing because it looks
> like OVS (v1.4 release) was  not matching vlan tagged packets when the
> match wildcarded vlan but the dl_vlan value (which should be ignored,
> because it is wildcarded) was non-zero.  We've worked around this in
> OFTest by making sure that the dl_vlan value is zero when vlan is
> wildcarded and now the test passes.
>
> In other words:
>
> if (ofp_match->wildcards&OFPFW_DL_VLAN) is true, then the match should
> match both tagged and untagged packets, independent of the value of
> ofp_match->dl_vlan.  OVS (seemingly) only matches tagged packets if
> ofp_match->dl_vlan == 0.

I wasn't able to spot the problem at the time, and I still don't see a
problem (perhaps it has been fixed since then), but this commit should
prevent any regression for this specific problem and for anything like it.

It would be natural to modify the parse-ofp11-match test in the same way,
but this commit doesn't do it.

Rob's original bug report is at:
https://mailman.stanford.edu/pipermail/openflow-discuss/2012-March/003107.html

Reported-by: Rob Sherwood <rob.sherwood@bigswitch.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovconn: Properly line up description for "tcp:" and "ssl:" usage.
Justin Pettit [Tue, 7 Aug 2012 22:18:27 +0000 (15:18 -0700)]
vconn: Properly line up description for "tcp:" and "ssl:" usage.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agolearning-switch: Normalize the flows that are sent to the switch.
Ben Pfaff [Tue, 7 Aug 2012 18:32:32 +0000 (11:32 -0700)]
learning-switch: Normalize the flows that are sent to the switch.

This suppresses a long-standing warning from ovs-vswitchd about
non-normalized flows.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolearning-switch: Don't use exact-match on every field by default.
Ben Pfaff [Tue, 7 Aug 2012 18:30:46 +0000 (11:30 -0700)]
learning-switch: Don't use exact-match on every field by default.

OVS has all kinds of odd fields, e.g. registers, and it doesn't make sense
to try to match on all of them.  This commit changes learning-switch to
only try to match on the fields defined by OpenFlow 1.0.  That's still not
minimal, but it's more reasonable.

This commit should not have an immediately visible effect since
ovs-controller always sends OF1.0 format flows to the switch, and OF1.0
format flows don't have these extra fields.  But in the future when we
add support for new protocols and flow formats to ovs-controller, it
will make a difference.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolearning-switch: Delay sending handshake until version negotiation is done.
Ben Pfaff [Tue, 7 Aug 2012 17:38:35 +0000 (10:38 -0700)]
learning-switch: Delay sending handshake until version negotiation is done.

The learning-switch implementation needs to know the OpenFlow version in
use to send the initial handshake messages (e.g. the feature request), but
the version is not always available at the time that the code currently
sends the handshake.  This can cause an assertion failure later when
ofputil_encode_flow_mod() checks the protocol, which will be 0 if the
version wasn't known.

This commit fixes the problem by introducing a state machine that sends the
handshake messages only after version negotiation has finished.

Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolearning-switch: Make lswitch own its rconn.
Ben Pfaff [Tue, 24 Jul 2012 23:15:37 +0000 (16:15 -0700)]
learning-switch: Make lswitch own its rconn.

Until now, ovs-controller and the learning-switch code split responsibility
for the OpenFlow connection.  This commit moves all the responsibility into
the learning-switch code.

The rationale here is twofold.  First, the split itself seems odd; I think
there must have been a reason for it at one time, but I don't remember it
and don't see one anymore.  Second, I intend to make the lswitch code more
stateful in upcoming commits, and it seems odd to have the lswitch manage
quite a bit of state but not the entity that that state applies to.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovconn: Fix vconn_get_version().
Ben Pfaff [Tue, 7 Aug 2012 18:33:35 +0000 (11:33 -0700)]
vconn: Fix vconn_get_version().

It's documented to return -1 if the version isn't yet known, but in fact
it returned 0.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovconn: Ensure that vconn_run() is enough to complete a connection.
Ben Pfaff [Tue, 7 Aug 2012 18:45:44 +0000 (11:45 -0700)]
vconn: Ensure that vconn_run() is enough to complete a connection.

Until now, it seems that all vconn users have immediately started reading
messages from the connection.  Today, however, I added a new user that
only wants to read packets after the OpenFlow version is negotiated, so
it never called vconn_recv() before that happened.  It turns out that if
you do this, the version never gets negotiated at all.

This commit fixes the problem by ensuring that vconn_run() will continue
version negotiation if it isn't done yet.

This changes the error return that I get for Unix sockets in the
test-vconn "accept-then-close" test from EPIPE to ECONNRESET, so this
commit also adjusts that test to accept either error code; both of them
seem reasonable enough to me.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoAdding checksum to ICMP packets created by OVS for testing.
Mehak Mahajan [Tue, 7 Aug 2012 19:40:23 +0000 (12:40 -0700)]
Adding checksum to ICMP packets created by OVS for testing.

OVS provides a utility to create ICMP packets for the purpose of
testing using ovs-appctl netdev-dummy/receive.  These packets created
by flow_compose() earlier did not have the ICMP checksum in them.
With this commit, the checksum will be added to these test ICMP
packets.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
12 years agoofp-util: Allow encoding of Open Flow 1.2 Flow Mod messages
Simon Horman [Wed, 1 Aug 2012 07:01:53 +0000 (16:01 +0900)]
ofp-util: Allow encoding of Open Flow 1.2 Flow Mod messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolearning-switch: Send Features Request and Set Config with correct version
Simon Horman [Wed, 1 Aug 2012 07:01:52 +0000 (16:01 +0900)]
learning-switch: Send Features Request and Set Config with correct version

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-print: Use the prevailing protocol to call ofputil_decode_flow_mod()
Simon Horman [Wed, 1 Aug 2012 07:01:51 +0000 (16:01 +0900)]
ofp-print: Use the prevailing protocol to call ofputil_decode_flow_mod()

Pass a protocol based on the prevailing protocol to ofputil_decode_flow_mod()

Note that ofputil_protocol_from_ofp_version() needs to be made
Open Flow 1.1 aware.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: Make make_echo_request() aware of different OpenFlow versions.
Simon Horman [Wed, 1 Aug 2012 07:01:50 +0000 (16:01 +0900)]
ofp-util: Make make_echo_request() aware of different OpenFlow versions.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-error: Remove ofperr_domain from external API
Simon Horman [Wed, 1 Aug 2012 07:01:49 +0000 (16:01 +0900)]
ofp-error: Remove ofperr_domain from external API

It seems that ofp_version suffices in all cases.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: Make ofperr_encode_msg__() use correct Open Flow version
Simon Horman [Wed, 1 Aug 2012 07:01:48 +0000 (16:01 +0900)]
ofp-util: Make ofperr_encode_msg__() use correct Open Flow version

Make ofperr_encode_msg__() use correct Open Flow version in the header
of messages.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: Allow encoding of Open Flow 1.1 & 1.2 Barrier Request Messages
Simon Horman [Wed, 1 Aug 2012 07:01:47 +0000 (16:01 +0900)]
ofp-util: Allow encoding of Open Flow 1.1 & 1.2 Barrier Request Messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoFAQ: Add section on basic configuration.
Ben Pfaff [Mon, 6 Aug 2012 22:41:37 +0000 (15:41 -0700)]
FAQ: Add section on basic configuration.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agorconn: Treat draining a message from the send queue as activity.
Ben Pfaff [Mon, 6 Aug 2012 22:03:32 +0000 (15:03 -0700)]
rconn: Treat draining a message from the send queue as activity.

Until now, the rconn module has used messages received from the
controller as the sole means to determine that the connection is up.
This can interact badly with the OVS connection manager in ofproto,
which stops reading and processing messages from the receive queue
when there is a backlog in the send queue for a given connection
(because reading and processes messages is the main cause of messages
getting pushed onto the send queue).  So, if a send queue backlog
lasts more than twice the inactivity probe interval, then the
connection drops, whether the controller is sending messages or not.
Dumping a large flow table can trigger this behavior if the controller
becomes temporarily busy or if the network between OVS and a
controller is slow.  The problem can easily repeat itself, since upon
reconnection the controller will generally dump the flow table.

This commit fixes the problem by expanding the definition of
"activity" to include successfully sending an OpenFlow message that
was previously queued.

Bug #12789.
Reported-by: Natasha Gude <natasha@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agorconn: Remove unused functions.
Ben Pfaff [Mon, 6 Aug 2012 20:31:53 +0000 (13:31 -0700)]
rconn: Remove unused functions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonx-match: Separate raw match and header/pad pull/put
Simon Horman [Wed, 1 Aug 2012 07:01:45 +0000 (16:01 +0900)]
nx-match: Separate raw match and header/pad pull/put

In the case of Open Flow 1.2, which is currently the only
time that OXM is be used, there is a 4 byte header before
the match which needs to be taken into account when calculating
the pad length. This complicates nx_match pull and put somewhat.

This patch takes an approach suggested by Ben Pfaff to separate the
encoding of the match and the adding of padding and, in the case of OXM,
a header.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: Set switch_features actions to zero for Open Flow 1.1+
Simon Horman [Wed, 1 Aug 2012 07:01:44 +0000 (16:01 +0900)]
ofp-util: Set switch_features actions to zero for Open Flow 1.1+

As of Open Flow 1.1 what was the actions element of
struct switch_features becomes reserved. As such
it seems sensible to always decode it as zero.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-pki: Improve manpage style.
Ben Pfaff [Fri, 3 Aug 2012 18:59:16 +0000 (11:59 -0700)]
ovs-pki: Improve manpage style.

The usual manpage style is to write metasyntactic variable names in
lowercase, so this commit adopts that consistently.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoINSTALL.SSL: Remove obsolete information.
Ben Pfaff [Fri, 3 Aug 2012 18:56:58 +0000 (11:56 -0700)]
INSTALL.SSL: Remove obsolete information.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-pki: Remove "online PKI" features and ovs-pki-cgi.
Ben Pfaff [Fri, 3 Aug 2012 18:56:33 +0000 (11:56 -0700)]
ovs-pki: Remove "online PKI" features and ovs-pki-cgi.

Debian bug #683665, Red Hat bug #845350, and CVE-2012-3449 all claim that
ovs-pki's "incoming" directory is a security vulnerability.  I do not think
that this is the case, but I do not know of any users for this feature, so
on balance I prefer to remove it and the ovs-pki-cgi program associated
with it, just to be sure.

CVE-2012-3449.
Bug-report: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683665
Bug-report: https://bugzilla.redhat.com/show_bug.cgi?id=84535
Reported-by: Andreas Beckmann <debian@abeckmann.de>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-msgs: ofpmp_reserve() must add "more" flag when splitting stats.
Ben Pfaff [Fri, 3 Aug 2012 22:56:02 +0000 (15:56 -0700)]
ofp-msgs: ofpmp_reserve() must add "more" flag when splitting stats.

Commit 982697a4d2 "ofp-msgs: New approach to encoding and decoding OpenFlow
headers." introduced a bug in multipart message composition such that, when
a multipart message actually requires multiple parts, the OFPSF_REPLY_MORE
bit failed to be set on any of the parts, which in turn caused the receiver
to see a truncated reply.  This commit fixes the problem.

This commit also adds a test case that would have detected the problem and
fixes a minor bug in that test case (if an error actually occurred, then
the test case would hang).

Bug #12766.
Reported-by: James Schmidt <jschmidt@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoFAQ: Add an introduction to VLANs.
Ben Pfaff [Fri, 3 Aug 2012 23:34:04 +0000 (16:34 -0700)]
FAQ: Add an introduction to VLANs.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Relax set header validation.
Jesse Gross [Fri, 3 Aug 2012 01:22:38 +0000 (18:22 -0700)]
datapath: Relax set header validation.

When installing a flow with an action to set a particular field we
need to validate that the packets that are part of the flow actually
contain that header.  With IP we use zeroed addresses and with TCP/UDP
the check is for zeroed ports.  This check is overly broad and can catch
packets like DHCP requests that have a zero source address in a
legitimate header.  This changes the check to look for a zeroed protocol
number for IP or for both ports be zero for TCP/UDP before considering
the header to not exist.

Bug #12769

Reported-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
12 years agoofp-util: Remove extra blank line.
Ben Pfaff [Mon, 18 Jun 2012 16:56:54 +0000 (09:56 -0700)]
ofp-util: Remove extra blank line.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: Fix typo in comment.
Ben Pfaff [Mon, 18 Jun 2012 20:56:19 +0000 (13:56 -0700)]
ofp-util: Fix typo in comment.

This comment is talking about the obsolete "tun_id_from_cookie" protocol
extension that we removed from OVS long ago.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoutil: New macro CONST_CAST.
Ben Pfaff [Fri, 13 Jul 2012 23:00:29 +0000 (16:00 -0700)]
util: New macro CONST_CAST.

Casts are sometimes necessary.  One common reason that they are necessary
is for discarding a "const" qualifier.  However, this can impede
maintenance: if the type of the expression being cast changes, then the
presence of the cast can hide a necessary change in the code that does the
cast.  Using CONST_CAST, instead of a bare cast, makes these changes
visible.

Inspired by my own work elsewhere:
http://git.savannah.gnu.org/cgit/pspp.git/tree/src/libpspp/cast.h#n80

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotest-sha1: Remove unneeded casts.
Ben Pfaff [Fri, 13 Jul 2012 21:34:51 +0000 (14:34 -0700)]
test-sha1: Remove unneeded casts.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Remove superfluous cast.
Ben Pfaff [Fri, 13 Jul 2012 21:30:15 +0000 (14:30 -0700)]
ofproto-dpif: Remove superfluous cast.

'packet' is already a struct ofpbuf *.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoflow: Remove superfluous casts.
Ben Pfaff [Fri, 13 Jul 2012 21:16:36 +0000 (14:16 -0700)]
flow: Remove superfluous casts.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoflow: Correctly consider nw_frag_mask in some flow_wildcards_*() functions.
Ben Pfaff [Mon, 18 Jun 2012 21:02:12 +0000 (14:02 -0700)]
flow: Correctly consider nw_frag_mask in some flow_wildcards_*() functions.

This probably means that some classifier functions based on the fragment
type of packets have never worked properly.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Avoid sensitivity to hash order in flow monitor pause/resume test.
Ben Pfaff [Thu, 12 Jul 2012 22:20:03 +0000 (15:20 -0700)]
ofproto: Avoid sensitivity to hash order in flow monitor pause/resume test.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodirs: dbdir default must be based on sysconfdir.
Ben Pfaff [Thu, 2 Aug 2012 23:01:49 +0000 (16:01 -0700)]
dirs: dbdir default must be based on sysconfdir.

Some in-tree and out-of-tree code sets the OVS_SYSCONFDIR environment
variable to control where /etc files go (mostly for test purposes).  When
the database directory (dbdir) was split off from the sysconfdir, the
configure-time default continued to be based on the sysconfdir, but
overriding the sysconfdir at runtime with OVS_SYSCONFDIR didn't have any
effect on the dbdir, which caused a visible change in behavior for code
that set the OVS_SYSCONFDIR environment variable.  This commit reverts that
change in behavior, by basing the dbdir on OVS_SYSCONFDIR if that
environment variable is set (but the OVS_DBDIR environment variable is
not).

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoAdding checksum to IP packets created by ovs for testing.
Mehak Mahajan [Thu, 2 Aug 2012 23:11:58 +0000 (16:11 -0700)]
Adding checksum to IP packets created by ovs for testing.

OVS provides a utility to create IP packets for the purpose of testing
using ovs-appctl netdev-dummy/receive.  These packets created by
flow_compose() earlier did not have the IP checksum in them.  With this
commit, the checksum with be added to these test IP packets.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
12 years agoCreate .conf.db.~lock~ in same dir as DBDIR.
Mehak Mahajan [Thu, 2 Aug 2012 06:25:35 +0000 (23:25 -0700)]
Create .conf.db.~lock~ in same dir as DBDIR.

Commit f973f2af (Make the location of the database separately configurable.)
introduced the environment variable OVS_DBDIR which specifies the path for
the conf.db.  With this commit, .conf.db.~lock~ will also be created in the
DBDIR.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
12 years agoFix a typo in commit f973f2af2.
Mehak Mahajan [Thu, 2 Aug 2012 02:57:03 +0000 (19:57 -0700)]
Fix a typo in commit f973f2af2.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
12 years agoImproving comment for OFP10_VLAN_NONE.
Mehak Mahajan [Thu, 2 Aug 2012 00:26:39 +0000 (17:26 -0700)]
Improving comment for OFP10_VLAN_NONE.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
12 years agoflow: Fix wild pointer dereference in flow_compose().
Ethan Jackson [Wed, 1 Aug 2012 20:01:01 +0000 (13:01 -0700)]
flow: Fix wild pointer dereference in flow_compose().

The 'ip' variable in flow_compose() points to some memory allocated
in an ofpbuf.  The ofpbuf is modified without making the necessary
updates to the location of 'ip' causing a potential wild memory
access.

Found by inspection.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoovsdb: Do not replace symlinks by regular files during compaction.
Ben Pfaff [Mon, 30 Jul 2012 21:55:10 +0000 (14:55 -0700)]
ovsdb: Do not replace symlinks by regular files during compaction.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolockfile: Be more forgiving about lockfiles for symlinks.
Ben Pfaff [Mon, 30 Jul 2012 21:41:13 +0000 (14:41 -0700)]
lockfile: Be more forgiving about lockfiles for symlinks.

As the database is being transitioned from /etc to /var, there is a symlink
from the old to the new location for the database and a symlink for its
lockfile.  This works OK, but it would be more user-friendly to still work
correctly in case the symlink for the lockfile isn't there (since its
existence is non-obvious), so this commit implements that behavior.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoutil: New function follow_symlinks().
Ben Pfaff [Mon, 30 Jul 2012 18:36:06 +0000 (11:36 -0700)]
util: New function follow_symlinks().

It will acquire its first user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Slightly generalize utility function tests.
Ben Pfaff [Mon, 30 Jul 2012 16:35:32 +0000 (09:35 -0700)]
tests: Slightly generalize utility function tests.

This will allow passing arguments in for an upcoming test.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoMake the location of the database separately configurable.
Ben Pfaff [Fri, 27 Jul 2012 22:52:21 +0000 (15:52 -0700)]
Make the location of the database separately configurable.

The default is unchanged, /etc/openvswitch/conf.db.

This makes it possible to transition each Open vSwitch packaging from
/etc/openvswitch/conf.db to /var/lib/openvswitch/conf.db independently.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovsdb: Make "ovsdb-tool create" work through a dangling symlink.
Ben Pfaff [Thu, 26 Jul 2012 21:42:58 +0000 (14:42 -0700)]
ovsdb: Make "ovsdb-tool create" work through a dangling symlink.

open() with O_CREAT|O_EXCL yields EEXIST if the name passed in is a
symlink, but we would like "ovsdb-tool create /etc/openvswitch/conf.db" to
work if /etc/openvswitch/conf.db is a symlink to elsewhere in the file
system.  This commit fixes the problem.  It introduces a theoretical race,
but no one should be doing "ovsdb-tool create" in parallel anyhow; O_EXCL
is just an idiot check here, not required to be fail-safe.

Debian bug #681880.
CC: 681880@bugs.debian.org
Reported-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
12 years agolockfile: Fix hang locking through a dangling symlink.
Ben Pfaff [Thu, 26 Jul 2012 21:36:24 +0000 (14:36 -0700)]
lockfile: Fix hang locking through a dangling symlink.

open() with O_CREAT|O_EXCL yields EEXIST if the file being opened is a
symlink.  lockfile_try_lock() interpreted that error code to mean that
some other process had created the lock file in the meantime, so it went
around its loop again, which found out the same thing, which led to a hang.

This commit fixes the problem by dropping O_EXCL.  I don't see any reason
that it's actually necessary.  That means that the loop itself is
unnecessary, so this commit drops that too.

Debian bug #681880.
CC: 681880@bugs.debian.org
Reported-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
12 years agotest-vconn: Also accept EPIPE for TCP connection failures.
Ben Pfaff [Tue, 31 Jul 2012 17:12:21 +0000 (10:12 -0700)]
test-vconn: Also accept EPIPE for TCP connection failures.

Ed Maste reports that write() to a socket where the other side has closed
returns EPIPE on FreeBSD and ECONNRESET on Linux.

Reported-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotest-vconn: Block in three cases where a race is visible on FreeBSD.
Ben Pfaff [Tue, 31 Jul 2012 17:12:20 +0000 (10:12 -0700)]
test-vconn: Block in three cases where a race is visible on FreeBSD.

On FreeBSD, sometimes plain vconn_connect() or vconn_recv() reports EAGAIN
in these cases.

Reported-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Get max rx socket buffer size on FreeBSD
Ed Maste [Tue, 31 Jul 2012 18:23:35 +0000 (14:23 -0400)]
tests: Get max rx socket buffer size on FreeBSD

Also remove another sed \b that FreeBSD sed doesn't handle.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoutilities: FreeBSD compatibility.
Ed Maste [Tue, 31 Jul 2012 17:49:12 +0000 (13:49 -0400)]
utilities: FreeBSD compatibility.

FreeBSD doesn't have "date -r" and calls its sha1 hash tool "sha1".

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Avoid xargs, for FreeBSD compatibility.
Ed Maste [Tue, 31 Jul 2012 12:24:30 +0000 (08:24 -0400)]
tests: Avoid xargs, for FreeBSD compatibility.

The FreeBSD version of xargs does not run the utility argument on empty
input, while GNU xargs runs it at least once, even with empty input.  As
a result on FreeBSD VSCTL_CHECK_FIND returned no output for an empty
bridge list while on Linux it returned a single blank line.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoSet dates for release of 1.7.0.
Justin Pettit [Tue, 31 Jul 2012 00:24:39 +0000 (17:24 -0700)]
Set dates for release of 1.7.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agoofp-util: Update Capabilities for Open Flow 1.2
Simon Horman [Mon, 30 Jul 2012 02:03:03 +0000 (11:03 +0900)]
ofp-util: Update Capabilities for Open Flow 1.2

There are capabilities which are present in one, two and three
of Open Flow 1.0, 1.1 and 1.2. Update OFPC_COMMON to only include
capabilities that are present in all three Open Flow versions and
add ofputil_capabilities_mask() to return the mask of capabilities
for each version.

This does not cover OFPUTIL_C_STP and OFPUTIL_C_GROUP_STATS, which
both use capability bit 3 and are treated as special cases in
ofputil_encode_switch_features() and ofputil_decode_switch_features().

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: Reduce scope of variables in ofputil_encode_flow_mod()
Simon Horman [Mon, 30 Jul 2012 02:03:02 +0000 (11:03 +0900)]
ofp-util: Reduce scope of variables in ofputil_encode_flow_mod()

Reduce scope of per-protocol variables in ofputil_encode_flow_mod()

These variables are only needed in one of the cases covered by the switch
statement and will increase in number as more cases (protocols) are
supported.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: Add of12_action_bits
Simon Horman [Mon, 30 Jul 2012 02:03:01 +0000 (11:03 +0900)]
ofp-util: Add of12_action_bits

Add action bits for Open Flow 1.2, these are not the same as Open Flow 1.1.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: As of Open Flow 1.1 switch_features has no capabilities field
Simon Horman [Mon, 30 Jul 2012 02:03:00 +0000 (11:03 +0900)]
ofproto: As of Open Flow 1.1 switch_features has no capabilities field

In Open Flow 1.0 switch_features has a capabilities field.
However, in Open Flow 1.1, 1.2 and 1.3 this field is reserved.
Thus it should not be read on decode and it seems most appropriate
to set as zero on encode.

This patch takes the approach of setting the features field to
all available features for Open Flow 1.1+. I am unsure if it would
be sufficient to just set it to zero.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoopenflow: Add enum ofp_version
Simon Horman [Mon, 30 Jul 2012 02:02:59 +0000 (11:02 +0900)]
openflow: Add enum ofp_version

Use an enum for ofp_version in ofp-util and ofp-msg.
This in conjunction with the use of switch() statements
allows the compiler to warn when a new ofp_version isn't handled.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofp-util: Work on decoding OF1.1 flow_mods.
Ben Pfaff [Tue, 12 Jun 2012 07:27:35 +0000 (00:27 -0700)]
ofp-util: Work on decoding OF1.1 flow_mods.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Tested-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Simon Horman <horms@verge.net.au>
12 years agoopenflow: Separate OF1.0, OF1.1 flow_mod constants and types.
Ben Pfaff [Wed, 4 Jul 2012 06:01:59 +0000 (23:01 -0700)]
openflow: Separate OF1.0, OF1.1 flow_mod constants and types.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Tested-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Simon Horman <horms@verge.net.au>
12 years agoopenflow: Rename OpenFlow 1.0 statistics messages with "10" infix.
Ben Pfaff [Thu, 28 Jun 2012 04:13:13 +0000 (21:13 -0700)]
openflow: Rename OpenFlow 1.0 statistics messages with "10" infix.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Tested-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Simon Horman <horms@verge.net.au>
12 years agonicira-ext: Drop nx_aggregate_stats_reply structure.
Ben Pfaff [Fri, 6 Jul 2012 06:04:12 +0000 (23:04 -0700)]
nicira-ext: Drop nx_aggregate_stats_reply structure.

It now duplicates ofp_aggregate_stats_reply except for alignment issues, so
we might as well unify the code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Tested-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Simon Horman <horms@verge.net.au>
12 years agoofp-msgs: New approach to encoding and decoding OpenFlow headers.
Ben Pfaff [Fri, 20 Jul 2012 06:23:17 +0000 (23:23 -0700)]
ofp-msgs: New approach to encoding and decoding OpenFlow headers.

OpenFlow headers are not as uniform as they could be, with size, alignment,
and numbering changes from one version to another and across varieties
(e.g. ordinary messages vs. "stats" messages).  Until now the Open vSwitch
internal APIs haven't done a good job of abstracting those differences in
header formats.  This commit changes that; from this commit forward very
little code actually needs to understand the header format or numbering.
Instead, it can just encode or decode, or pull or put, the header using
a more abstract API using the ofpraw_, ofptype_, and other APIs in the
new ofp-msgs module.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Tested-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Simon Horman <horms@verge.net.au>
12 years agoovs-dpctl: Allow requesting the port number from "add-if" command.
Justin Pettit [Sat, 28 Jul 2012 06:59:23 +0000 (23:59 -0700)]
ovs-dpctl: Allow requesting the port number from "add-if" command.

The datapath port number influences the OpenFlow port number in
ovs-vswitchd.  The new "port_no" option for the "add-if" command allows
the user to request a specific datapath port number.

Feature #12642

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agodpif: Allow the port number to be requested when adding an interface.
Justin Pettit [Sat, 28 Jul 2012 06:58:24 +0000 (23:58 -0700)]
dpif: Allow the port number to be requested when adding an interface.

The datapath allows requesting a specific port number for a port, but
the dpif interface didn't expose it.  This commit adds that support.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agoDon't assume python is in /usr/bin.
Ed Maste [Tue, 31 Jul 2012 00:08:03 +0000 (20:08 -0400)]
Don't assume python is in /usr/bin.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Make compatible with FreeBSD's sed.
Ed Maste [Mon, 30 Jul 2012 23:06:03 +0000 (19:06 -0400)]
tests: Make compatible with FreeBSD's sed.

FreeBSD sed doesn't support \b, at least in normal mode.  Since the
string we're matching comes at the end of the line anyway just use $
instead.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ctl.in: Don't stop forwarding while restarting the database.
Justin Pettit [Thu, 26 Jul 2012 16:41:24 +0000 (09:41 -0700)]
ovs-ctl.in: Don't stop forwarding while restarting the database.

Previously, the force-reload-kmod command would stop forwarding, stop
the database, restart the database, and then restart forwarding.  If the
database is large, it can take a while to be read (we've seen as much as
10 seconds), which means the switch is not forwarding traffic during
that time.

This change stops and starts the database before restarting the
forwarding path.  This means that ovs-vswitchd will lose its
connectivity to the database during a force-reload-kmod, but while it
will complain a little in the logs, it will continue to operate
properly.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Feature #12643

12 years agoovs-ctl.in: Consistently use spaces instead of tabs.
Justin Pettit [Thu, 26 Jul 2012 16:37:56 +0000 (09:37 -0700)]
ovs-ctl.in: Consistently use spaces instead of tabs.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agotests: Handle different output formats for 'wc -l'.
Ed Maste [Mon, 30 Jul 2012 20:34:52 +0000 (20:34 +0000)]
tests: Handle different output formats for 'wc -l'.

FreeBSD's wc outputs leading whitespace before the count, so use test(1)
for numeric equality instead of AC_CHECK string match.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoUse int type for setsockopt IP_TOS value
Ed Maste [Mon, 30 Jul 2012 22:29:40 +0000 (15:29 -0700)]
Use int type for setsockopt IP_TOS value

FreeBSD requires that setsockopt(..., IP_TOS, ...) be passed an int
value.  Linux accepts either int or char types (and has since at least
kernel 2.6.12) so just use int type unconditionally.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoAvoid implementation-defined strerror behaviour
Ed Maste [Fri, 27 Jul 2012 21:27:15 +0000 (17:27 -0400)]
Avoid implementation-defined strerror behaviour

POSIX states that the string returned by strerror() may be overwritten
by a subsequent call (i.e., because it returns a pointer to a static
buffer).  Make a copy of one of the two strerror() strings to avoid
this.

Background: FreeBSD historically returned such a pointer only in the
case of an invalid errno.  With the addition of NLS strerror was changed
to do so for all calls.

Prior to this change I had confusing results from the test suite like
"... is 22 (Invalid argument) but should be 0 (Invalid argument)".

Signed-off-by: Ed Maste <emaste@adaranet.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ctl: Start the rest of Open vSwitch if loading brcompat module fails.
Ben Pfaff [Fri, 27 Jul 2012 20:11:20 +0000 (13:11 -0700)]
ovs-ctl: Start the rest of Open vSwitch if loading brcompat module fails.

This may be more useful in practice than failing the entire OVS startup
sequence.

Debian bug #681955.
CC: 681955@bugs.debian.org
Reported-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
12 years agoFAQ: Add another question about VLAN interaction with controllers.
Ben Pfaff [Fri, 27 Jul 2012 04:55:57 +0000 (21:55 -0700)]
FAQ: Add another question about VLAN interaction with controllers.

I'm pretty sure I've seen this one more than once.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agopackets: Remove redundant RARP header.
Ethan Jackson [Thu, 26 Jul 2012 23:29:10 +0000 (16:29 -0700)]
packets: Remove redundant RARP header.

Rarp packets had their own header definition in the packets
library.  This doesn't make sense because they have the same packet
format as arps.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agopackets: First-hop router redundancy protocol MAC addresses are not BPDUs.
Ben Pfaff [Thu, 26 Jul 2012 04:37:59 +0000 (21:37 -0700)]
packets: First-hop router redundancy protocol MAC addresses are not BPDUs.

Commit c93f9a78c349 (packets: Update the reserved protocols list.) added
a number of first-hop router redundancy protocol MAC addresses to the
list of BPDU MAC addresses.  This means that packets destined to those MAC
addresses are dropped when other-config:forward-bpdu is set to false on a
bridge (the default setting).

However, this behavior is incorrect, because these MAC addresses are not
special in the way that, say, STP frames are special.  STP is a
switch-to-switch protocol that end hosts have no use for, but end hosts do
speak directly to routers on the MAC addresses assigned by VRRP and the
other protocols in this category.  Therefore, dropping packets in this
category means that end hosts can no longer talk to their first-hop router,
if that router is running one of these protocols.

This commit also refines the match used for EDP and EAPS, and adds Cisco
CFM to the protocols that are dropped.

After this commit, the following destination MACs are dropped:

    - 01:08:c2:00:00:00
    - 01:08:c2:00:00:01
    - 01:08:c2:00:00:02
    - 01:08:c2:00:00:03
    - 01:08:c2:00:00:04
    - 01:08:c2:00:00:05
    - 01:08:c2:00:00:06
    - 01:08:c2:00:00:07
    - 01:08:c2:00:00:08
    - 01:08:c2:00:00:09
    - 01:08:c2:00:00:0a
    - 01:08:c2:00:00:0b
    - 01:08:c2:00:00:0c
    - 01:08:c2:00:00:0d
    - 01:08:c2:00:00:0e
    - 01:08:c2:00:00:0f

    - 00:e0:2b:00:00:00
    - 00:e0:2b:00:00:04
    - 00:e0:2b:00:00:06

    - 01:00:0c:00:00:00
    - 01:00:0c:cc:cc:cc
    - 01:00:0c:cc:cc:cd
    - 01:00:0c:cd:cd:cd

    - 01:00:0c:cc:cc:c0
    - 01:00:0c:cc:cc:c1
    - 01:00:0c:cc:cc:c2
    - 01:00:0c:cc:cc:c3
    - 01:00:0c:cc:cc:c4
    - 01:00:0c:cc:cc:c5
    - 01:00:0c:cc:cc:c6
    - 01:00:0c:cc:cc:c7

Bug #12618.
CC: Ben Basler <bbasler@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev implementation for FreeBSD
Giuseppe Lettieri [Wed, 25 Jul 2012 20:51:05 +0000 (22:51 +0200)]
netdev implementation for FreeBSD

This patch adds new netdev classes that implement
"system" and "tap" devices on FreeBSD using the
libpcap library. This enables the use of the
"netdev" datapath_type of Open vSwitch on FreeBSD.

Signed-off-by: Gaetano Catalli <gaetano.catalli@gmail.com>
Signed-off-by: Ed Maste <emaste@adaranet.com>
Signed-off-by: Giuseppe Lettieri <g.lettieri@iet.unipi.it>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoNEWS: Document flow setup improvement in 1.7 release.
Justin Pettit [Mon, 23 Jul 2012 07:33:32 +0000 (00:33 -0700)]
NEWS: Document flow setup improvement in 1.7 release.

Also use consistent capitalization for "DSCP".

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agoFix "*tivty" typos.
Justin Pettit [Mon, 23 Jul 2012 07:24:30 +0000 (00:24 -0700)]
Fix "*tivty" typos.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
12 years agoMakefiles: Enable "dist-hook-git" check only when GNU make is in use.
Ben Pfaff [Wed, 25 Jul 2012 17:25:55 +0000 (10:25 -0700)]
Makefiles: Enable "dist-hook-git" check only when GNU make is in use.

Otherwise, it will always fail because the Makefile in datapath/linux
requires GNU make to generate the list of distributed files.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Ed Maste <emaste@freebsd.org>
12 years agoconfigure: Fix check for GNU make $(if) extension.
Ben Pfaff [Wed, 25 Jul 2012 17:28:38 +0000 (10:28 -0700)]
configure: Fix check for GNU make $(if) extension.

As it turns out, the argument to AC_CONFIG_COMMANDS_PRE gets copied into
config.status whether or not it gets run by the shell at "configure" time,
defeating my attempt to support non-GNU make here.

Reported-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoMakefile: Mark dist-hook-git and rate-limit-check as phony rules.
Ben Pfaff [Wed, 25 Jul 2012 16:56:53 +0000 (09:56 -0700)]
Makefile: Mark dist-hook-git and rate-limit-check as phony rules.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agometa-flow: Fix "sparse" warning in mf_are_prereqs_ok().
Ben Pfaff [Tue, 24 Jul 2012 22:43:27 +0000 (15:43 -0700)]
meta-flow: Fix "sparse" warning in mf_are_prereqs_ok().

This fixes the following warning from "sparse":

meta-flow.c:830:31: warning: incorrect type in return expression (different
base types)
meta-flow.c:830:31:    expected bool
meta-flow.c:830:31:    got restricted __be16

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Add more details to "ofproto/trace" output.
Ben Pfaff [Tue, 24 Jul 2012 20:06:44 +0000 (13:06 -0700)]
ofproto-dpif: Add more details to "ofproto/trace" output.

There are many reasons why OFPP_NORMAL translation can drop packets, and
it's often far from obvious why.  This should make it easier to debug.

Bug #12618.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoFix race condition in parallel execution of "make install".
Ben Pfaff [Mon, 23 Jul 2012 16:54:16 +0000 (09:54 -0700)]
Fix race condition in parallel execution of "make install".

ovs-vsctl is listed, incorrectly, in both bin_PROGRAMS and bin_SCRIPTS.
This meant that "make install" with the -j option could try to install
ovs-vsctl two times in parallel, a race that occasionally caused a build
failure, e.g.:
http://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=s390&ver=1.4.2%2Bgit20120612-5&stamp=1342851603

Debian bug #682384.
CC: 682384@bugs.debian.org
Reported-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitch.xml: Fix typo in documentation.
Ben Pfaff [Mon, 23 Jul 2012 17:31:40 +0000 (10:31 -0700)]
vswitch.xml: Fix typo in documentation.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ofctl: Avoid printing false differences on "ovs-ofctl diff-flows".
Ben Pfaff [Mon, 23 Jul 2012 17:16:31 +0000 (10:16 -0700)]
ovs-ofctl: Avoid printing false differences on "ovs-ofctl diff-flows".

It is possible for "struct ofpact"s to differ bytewise even if they are
equivalent when converted to another representation, such as OpenFlow 1.0
action format or a string representation.  This can cause "ovs-ofctl
diff-flows" to print surprising false "differences", e.g. as in the bug
report:

    - actions=resubmit(,1)
    + actions=resubmit(,1)

This commit fixes the problem by comparing not just the ofpacts but also
the string representation and printing a difference only if both differ.

Bug #8899.
Reported-by: Luca Giraudo <lgiraudo@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoOXM: Add tests for masked VLAN VID match
Simon Horman [Mon, 23 Jul 2012 06:33:16 +0000 (23:33 -0700)]
OXM: Add tests for masked VLAN VID match

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: OXM VLAN match encoding and decoding
Simon Horman [Mon, 23 Jul 2012 02:36:46 +0000 (11:36 +0900)]
tests: OXM VLAN match encoding and decoding

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoOXM: Add VLAN VID as a prerequisite for VLAN PCP
Simon Horman [Mon, 23 Jul 2012 02:36:44 +0000 (11:36 +0900)]
OXM: Add VLAN VID as a prerequisite for VLAN PCP

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoOXM: Add encoding of VLAN VID and VLAN PCP
Simon Horman [Mon, 23 Jul 2012 02:36:43 +0000 (11:36 +0900)]
OXM: Add encoding of VLAN VID and VLAN PCP

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agometa-flow: Add OF1.2-like MFF_VLAN_VID and MFF_VLAN_PCP.
Ben Pfaff [Mon, 23 Jul 2012 06:20:22 +0000 (23:20 -0700)]
meta-flow: Add OF1.2-like MFF_VLAN_VID and MFF_VLAN_PCP.

OpenFlow 1.0 and 1.2 have notions of VLAN that are different
enough to warrant separate "meta-flow" fields, which this commit
adds.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>