sliver-openvswitch.git
11 years agolinux/Makefile.main.in, acinclude: preparation for linux 3.7.0+
Isaku Yamahata [Fri, 7 Dec 2012 03:37:02 +0000 (12:37 +0900)]
linux/Makefile.main.in, acinclude: preparation for linux 3.7.0+

The version.h is moved from include/linux/version.h to
include/generated/uapi/linux/version.h.
So check both pathes.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoPrevent pager from appearing during build
Ed Maste [Fri, 7 Dec 2012 15:26:12 +0000 (10:26 -0500)]
Prevent pager from appearing during build

The config.h check added in commit 9e4ba00 may bring up the pager during
build (depending on git config).

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoMakefile.am: Exclude third-party code from config.h check.
Jesse Gross [Thu, 6 Dec 2012 22:14:02 +0000 (14:14 -0800)]
Makefile.am: Exclude third-party code from config.h check.

It doesn't make sense to enforce our rules for code in the third-
party directory.

Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoMakefile.am: Add a build check that every .c file #includes <config.h>.
Ben Pfaff [Thu, 6 Dec 2012 20:48:48 +0000 (12:48 -0800)]
Makefile.am: Add a build check that every .c file #includes <config.h>.

This can find mysterious build problems.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
11 years agolib: remove duplicate #include <config.h>
Ed Maste [Thu, 6 Dec 2012 20:14:34 +0000 (15:14 -0500)]
lib: remove duplicate #include <config.h>

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agonetdev-vport: Drop extra parentheses around "vxlan".
Jesse Gross [Thu, 6 Dec 2012 19:10:08 +0000 (11:10 -0800)]
netdev-vport: Drop extra parentheses around "vxlan".

Cc: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agovxlan: Use sk_release_kernel() instead of sock_release().
Jesse Gross [Thu, 6 Dec 2012 19:06:06 +0000 (11:06 -0800)]
vxlan: Use sk_release_kernel() instead of sock_release().

A socket that is created using sock_create_kern() and then switched
to a namespace using sk_change_net() should be released using
sk_release_kernel() instead of sock_release().  This is because
sk_change_net() has already released a reference to the namespace
and we shouldn't try to release it again later.

Cc: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
11 years agodatapath: Add support for VXLAN tunnels to Open vSwitch
Kyle Mestery [Wed, 5 Dec 2012 21:06:46 +0000 (16:06 -0500)]
datapath: Add support for VXLAN tunnels to Open vSwitch

Add support for VXLAN tunnels to Open vSwitch. Add support
for setting the destination UDP port on a per-port basis.
This is done by adding a "dst_port" parameter to the port
configuration. This is only applicable currently to VXLAN
tunnels.

Please note this currently does not implement any sort of multicast
learning. With this patch, VXLAN tunnels must be configured similar
to GRE tunnels (e.g. point to point). A subsequent patch will implement
a VXLAN control plane in userspace to handle multicast learning.

This patch set is based on one posted by Ben Pfaff on Oct. 12, 2011
to the ovs-dev mailing list:

http://openvswitch.org/pipermail/dev/2011-October/012051.html

The patch has been maintained, updated, and freshened by me and a
version of it is available at the following github repository:

https://github.com/mestery/ovs-vxlan/tree/vxlan

I've tested this patch with multiple VXLAN tunnels between hosts
using different UDP port numbers. Performance is on par (though
slightly faster) than comparable GRE tunnels.

See the following IETF draft for additional information about VXLAN:
http://tools.ietf.org/html/draft-mahalingam-dutt-dcops-vxlan-02

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
[jesse: simplify error path in vxlan_tunnel_setup, don't print default VXLAN port,
        and remove dead code]
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agorconn: Maintain original allowed_versions instead of substituting for zero.
Ben Pfaff [Wed, 5 Dec 2012 02:23:00 +0000 (18:23 -0800)]
rconn: Maintain original allowed_versions instead of substituting for zero.

rconn_create() was substituting OFPUTIL_DEFAULT_VERSIONS if an
allowed_versions of 0 was passed in.  At the same time,
connmgr_set_controllers() compared the adjusted value of allowed_versions
against the original value, saw that they were different, and concluded
that it should kill off and recreate the rconn with the "corrected"
allowed_versions.

This commit fixes the problem by no longer adjusting allowed_versions.
There is no need, because it is only used in contexts where the original
version is OK.

This problem was introduced by commit 90ef0206ea8f5a39 (connmgr:
Reinitialise controllers if protocols changes).

Bug #14126.
CC: Simon Horman <horms@verge.net.au>
Reported-by: Natasha Gude <natasha@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoFAQ: Add table of supported Linux versions.
Ben Pfaff [Tue, 4 Dec 2012 21:43:14 +0000 (13:43 -0800)]
FAQ: Add table of supported Linux versions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Avoid useless holes in struct vport
Thomas Graf [Tue, 4 Dec 2012 17:39:13 +0000 (09:39 -0800)]
datapath: Avoid useless holes in struct vport

Having the 16bit port_no in between a set of pointers creates
an unwanted and useless hole in the struct.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Use eth_mac_addr() instead of duplicating it
Thomas Graf [Tue, 4 Dec 2012 17:33:47 +0000 (09:33 -0800)]
datapath: Use eth_mac_addr() instead of duplicating it

bonus: if we ever are to use IFF_LIVE_ADDR_CHANGE for
anything further than to check availability in eth_mac_addr(),
Open vSwitch will be ready for that.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Backport eth_mac_addr().
Jesse Gross [Tue, 4 Dec 2012 18:06:55 +0000 (10:06 -0800)]
datapath: Backport eth_mac_addr().

eth_mac_addr() has always been available on the kernels that we
support but the behavior has varied over time.  This provides a
backport that is equivalent to the current kernel, previous OVS
behavior, and the bridge.

Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoofp-errors: Make every error encodable.
Ben Pfaff [Sat, 1 Dec 2012 00:22:52 +0000 (16:22 -0800)]
ofp-errors: Make every error encodable.

Until now, some values could not be encoded to send over OpenFlow, for a
few possible reasons.  This meant that, when one of these situations came
up, that a controller would not receive any notification that its request
failed.  This is not a good way to behave, so this commit changes the
error encoder so that, if a particular error cannot be encoded, it will
instead encode a fallback error code.

This commit also slightly simplifies ofconn_send_error() because it no
longer has to handle ofperr_encode_error() returning NULL.

Reported-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-errors: Remove OFPERR_* values for error categories.
Jarno Rajahalme [Fri, 30 Nov 2012 22:32:12 +0000 (14:32 -0800)]
ofp-errors: Remove OFPERR_* values for error categories.

The main use of OFPERR_* is to define specific errors, but OFPERR_* also
existed for each possible category of error, to enable partial decoding of
unknown specific errors within a known category.  However, in practice,
it was very easy to misuse the error categories as if they were particular
errors.  This commit removes the error category values, to make that error
impossible.

(If partial decoding of unknown specific errors turns out to have been a
valuable feature, then we can reintroduce it some other way.)

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-errors: Correctly encode errors as extensions or not depending on domain.
Ben Pfaff [Fri, 30 Nov 2012 22:18:03 +0000 (14:18 -0800)]
ofp-errors: Correctly encode errors as extensions or not depending on domain.

When ofp-errors was introduced, each OFPERR_* was either an extension or
not.  However, since then, some Nicira extension error code have been
given official error codes in later OpenFlow versions, so now whether an
OFPERR_* is an extension depends on the OpenFlow versions.  This means
that certain errors were encoded incorrectly as extensions in later
OpenFlow versions.  This commit fixes the problem.

This commit also adds a test that should prevent a regression.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoDon't use error categories as if they were actually errors.
Jarno Rajahalme [Fri, 30 Nov 2012 21:45:08 +0000 (13:45 -0800)]
Don't use error categories as if they were actually errors.

The OFPERR_* naming scheme is confusing, because it mixes categories with
specific errors.  Categories can't be encoded for sending to controllers,
so this is a problem.  This commit fixes up the cases where categories
were used as errors, replacing them by real errors types.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-errors: Fix typo in comment.
Jarno Rajahalme [Fri, 30 Nov 2012 22:32:51 +0000 (14:32 -0800)]
ofp-errors: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
11 years agoINSTALL.Debian: New instructions for installing on Debian.
Ben Pfaff [Tue, 4 Dec 2012 15:39:59 +0000 (07:39 -0800)]
INSTALL.Debian: New instructions for installing on Debian.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agobridge: Set mac address when no physical ports attached.
Justin Pettit [Tue, 4 Dec 2012 03:05:08 +0000 (19:05 -0800)]
bridge: Set mac address when no physical ports attached.

Commit 1a8cfb41(bridge: Drop warning about thedefault bridge Ethernet
address.) attempted to reduce unnecessary logging, but deleted some code
that was necessary to set the mac address on local ports when no
physical ports were attached.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Issue #14126

11 years agoINSTALL.RHEL: Explain how to work around RHEL 6 kernel-devel bug.
Ben Pfaff [Mon, 3 Dec 2012 20:59:08 +0000 (12:59 -0800)]
INSTALL.RHEL: Explain how to work around RHEL 6 kernel-devel bug.

Based on http://networkstatic.net/open-vswitch-red-hat-installation/

Reported-by: Brent Salisbury <brent.salisbury@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
11 years agoinclude/openflow: Moved remaining common definitions from openflow-1.0.h
Jarno Rajahalme [Mon, 3 Dec 2012 10:37:56 +0000 (12:37 +0200)]
include/openflow: Moved remaining common definitions from openflow-1.0.h

 Moved remaining common definitions from openflow-1.0.h to
 openflow-common.h and renamed 1.0 specific definitions with
 the "10" infix. Added hstamp rules for new headers, fixed
 non-ASCII characters in openflow-1.3.h, Commented out
 trailing zero-length data members.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoconnmgr: Reinitialise controllers if protocols changes
Simon Horman [Mon, 3 Dec 2012 07:30:19 +0000 (16:30 +0900)]
connmgr: Reinitialise controllers if protocols changes

This is allows protocol changes to take effect without needing
to restart ovs-vswitchd. However, connected controllers will
be disconnected regardless of if the OpenFlow protocol of the
session remains acceptable or not.

My feeling is that this is acceptable to avoid the complexity
of further modifications to ofconn and pvconn to allow live
updates of protocols.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-ctl: Don't run "ovs-save save-flows" on fake bridges.
Justin Pettit [Sat, 1 Dec 2012 02:58:09 +0000 (18:58 -0800)]
ovs-ctl: Don't run "ovs-save save-flows" on fake bridges.

Previously, ovs-ctl would determine which bridges to run "ovs-save
save-flows" on by running "ovs-vsctl list-br".  In addition to real
bridges, that command also returns fake bridges.  An error is returned
when "ovs-save save-flows" is run on a fake bridge.  By using the newly
added "--real" flag to "ovs-vsctl list-br", we can get rid of that
unnecessary warning.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agoovs-vsctl: Add "--real" and "--fake" options to "list-br".
Justin Pettit [Sat, 1 Dec 2012 02:50:18 +0000 (18:50 -0800)]
ovs-vsctl: Add "--real" and "--fake" options to "list-br".

By default, "ovs-vsctl list-br" returns all bridges, real or fake.  This
commit adds "--real" and "--fake" options that limit the output to only
bridges of that type.  This will be useful in a future commit that needs
to perform actions only on bridges of a particular type.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agoAdd OpenFlow 1.2 parse-flows test
Simon Horman [Fri, 30 Nov 2012 01:04:07 +0000 (10:04 +0900)]
Add OpenFlow 1.2 parse-flows test

This is based on an existing OpenFlow 1.0 variant of this test.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-actions: Add OpenFlow1.1+ Set Queue action
Simon Horman [Fri, 30 Nov 2012 01:04:06 +0000 (10:04 +0900)]
ofp-actions: Add OpenFlow1.1+ Set Queue action

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-dpctl: Describe -s option in usage message.
Ben Pfaff [Fri, 30 Nov 2012 00:14:53 +0000 (16:14 -0800)]
ovs-dpctl: Describe -s option in usage message.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
11 years agobond: Fix segfault sending learning packets with LACP disabled.
Ben Pfaff [Thu, 29 Nov 2012 17:32:28 +0000 (09:32 -0800)]
bond: Fix segfault sending learning packets with LACP disabled.

It is essentially an invalid configuration to disable LACP but request TCP
balancing: in this configuration, the bond drops all packets.  But
may_send_learning_packets() would still indicate that learning packets
should be sent, so bond_compose_learning_packet() would try to choose an
output slave for those packets, which would be NULL (because all packets
are dropped), which would cause a segfault upon dereference.

This commit fixes the problem by making may_send_learning_packets() no
longer indicate that learning packets should be sent.

I tested this issue by modifying bond_should_send_learning_packets() to
always return true if may_send_learning_packets() returns true, and then
introducing the invalid configuration described above.  Without this comit,
ovs-vswitchd segfaults quickly; with this commit, it does not.

Bug #14090.
Reported-by: Kiran Shanbhog <kiran@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoFAQ: Add Q&A to emphasize that VLANs partition a network.
Ben Pfaff [Thu, 29 Nov 2012 17:12:10 +0000 (09:12 -0800)]
FAQ: Add Q&A to emphasize that VLANs partition a network.

A few users don't seem to understand this.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agobridge: Drop warning about the default bridge Ethernet address.
Ben Pfaff [Fri, 26 Oct 2012 00:02:01 +0000 (17:02 -0700)]
bridge: Drop warning about the default bridge Ethernet address.

This information is also available via ovs-ofctl and through other means,
and it's not really anything we need to warn about anyhow.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
11 years agotest: add ofproto OpenFlow1.2 tests
Simon Horman [Mon, 19 Nov 2012 05:59:35 +0000 (14:59 +0900)]
test: add ofproto OpenFlow1.2 tests

These were useful in isolating a number of bugs.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-ofctl: By default, do not set flow format for OpenFlow 1.1+
Simon Horman [Mon, 19 Nov 2012 05:59:34 +0000 (14:59 +0900)]
ovs-ofctl: By default, do not set flow format for OpenFlow 1.1+

Only set the default format for ovs-ofctl monitor if
OpenFlow 1.0 is the prevailing version. IMHO that is
the only case where it makes sense.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-controller: Allow setting of allowed OpenFlow versions
Simon Horman [Mon, 19 Nov 2012 05:59:33 +0000 (14:59 +0900)]
ovs-controller: Allow setting of allowed OpenFlow versions

--protocols allows configuration of the versions
that may be used when establishing an OpenFlow connection.

The default is 'OpenFlow10' which is consistent with
the behaviour prior to this patch.

The useful values at this time are:
'OpenFlow10', 'OpenFlow12', 'OpenFlow13',
Values may be combined in a comma delimited list.

e.g.: --protocols 'OpenFlow10,OpenFlow12,OpenFlow13'

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-ofctl: Reject impossible protocols configurations at startup.
Ben Pfaff [Thu, 29 Nov 2012 06:22:38 +0000 (22:22 -0800)]
ovs-ofctl: Reject impossible protocols configurations at startup.

The -O and -F options interact, so that it's possible to select only
flow formats that are not supported on a given OpenFlow version.  It seems
best to report these problems up front rather than failing in a more
mysterious way later.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
11 years agoofp-util: New functions for converting protocols to and from versions.
Ben Pfaff [Thu, 29 Nov 2012 05:41:05 +0000 (21:41 -0800)]
ofp-util: New functions for converting protocols to and from versions.

The values of enum ofputil_protocol have meanings that overlap with
OpenFlow version numbers.  These new functions provide ways to figure out
these overlaps.

These functions will be used for the first time in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
11 years agoofp-util: Make "OXM" flow format name include both OpenFlow 1.2 and 1.3.
Ben Pfaff [Thu, 29 Nov 2012 04:43:02 +0000 (20:43 -0800)]
ofp-util: Make "OXM" flow format name include both OpenFlow 1.2 and 1.3.

To my mind, it makes sense, when a user requests OXM as the flow format,
to allow any protocol based on the OXM flow format to be used.  Until this
commit, however, "OXM" was specifically OpenFlow 1.2, and "OpenFlow13" was
required to request OXM on OpenFlow 1.3.

This doesn't affect the behavior of any released version of Open vSwitch.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
11 years agoofp-util: Style fixes.
Ben Pfaff [Thu, 29 Nov 2012 05:33:04 +0000 (21:33 -0800)]
ofp-util: Style fixes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
11 years agoovs-ofctl: Add option to set allowed OpenFlow versions
Simon Horman [Mon, 19 Nov 2012 05:59:32 +0000 (14:59 +0900)]
ovs-ofctl: Add option to set allowed OpenFlow versions

--protocols allows configuration of the versions
that may be used when establishing an OpenFlow connection.

The default is 'OpenFlow10' which is consistent with
the behaviour prior to this patch.

The useful values at this time are:
'OpenFlow10', 'OpenFlow12', 'OpenFlow13',
Values may be combined in a comma delimited list.

e.g.: --protocols 'OpenFlow10,OpenFlow12,OpenFlow13'

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-version-opt: Fix wrong information in usage message.
Ben Pfaff [Thu, 29 Nov 2012 07:01:54 +0000 (23:01 -0800)]
ofp-version-opt: Fix wrong information in usage message.

This is my fault; I introduced this inconsistency when I modified Simon's
correct patch.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
11 years agodatapath: Use RCU callback when detaching netdevices.
Jesse Gross [Wed, 28 Nov 2012 20:15:49 +0000 (12:15 -0800)]
datapath: Use RCU callback when detaching netdevices.

Currently, each time a device is detached from an OVS datapath
we call synchronize RCU before freeing associated data structures.
However, if a bridge is deleted (which detaches all ports) when
many devices are connected then there can be a long delay.  This
switches to use call_rcu() to group the cost together.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoflow: use rule priority in match_format() function
Ansis Atteka [Mon, 26 Nov 2012 23:40:48 +0000 (15:40 -0800)]
flow: use rule priority in match_format() function

The flow_format() function was incorrectly passing skb_priority
to the match_format() function. match_format() function instead
expects rule priority.

This issue was introduced with aa6c9932f2937fa9a2140ec1737668eb9105b0b5
(Change logging format for flows to that accepted by ofproto/trace).

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
11 years agoAdd OF1.3 TUNNEL_ID support.
Jarno Rajahalme [Thu, 22 Nov 2012 15:25:56 +0000 (17:25 +0200)]
Add OF1.3 TUNNEL_ID support.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agolib: Add helpers for OpenFlow version command line options
Simon Horman [Tue, 27 Nov 2012 18:12:26 +0000 (10:12 -0800)]
lib: Add helpers for OpenFlow version command line options

Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com renamed some functions and options and revised
 the documentation]
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoInitial OpenFlow 1.3 support
Jarno Rajahalme [Tue, 27 Nov 2012 15:44:22 +0000 (17:44 +0200)]
Initial OpenFlow 1.3 support

Initial OpenFlow 1.3 support with new include/openflow/openflow-1.3.h.
Most of the messages that differ from 1.2 are implemented. OFPT_SET_ASYNC
is implemented via NX_SET_ASYNC_CONFIG, other new message types are yet to
be implemented. Stats replies that add duration fields are implemented at
encode/decode level only. Test cases for implemented features are included.
Remaining FIXME:s should not cause runtime aborts. Make check comes out
clean.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoAUTHORS: Add Jarno Rajahalme.
Ben Pfaff [Tue, 27 Nov 2012 16:32:42 +0000 (08:32 -0800)]
AUTHORS: Add Jarno Rajahalme.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Check out_group on flow_mod only for "delete" commands.
Jarno Rajahalme [Mon, 26 Nov 2012 17:44:38 +0000 (09:44 -0800)]
ofp-util: Check out_group on flow_mod only for "delete" commands.

This conforms with OpenFlow 1.1+ wording.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoFix handling of OFPP_ANY in OpenFlow 1.1 and later.
Jarno Rajahalme [Mon, 26 Nov 2012 16:17:08 +0000 (18:17 +0200)]
Fix handling of OFPP_ANY in OpenFlow 1.1 and later.

Add OFPP_ANY to include/openflow/openflow-1.1.h, and allow it as a port in
queue stats request. Make ovs_ofctl use OFPP_ANY instead of OFPP_ALL for queue
stats requests on OF 1.1+.

This patch changes "none" ports print out. "none" is still accepted on input
for backwards compatibility, but it prints out as "ANY". To make this less
confusing, I changed the test cases to use "controller" or "any" instead of
"none". The test case that tests for both "none" and "controller" still tests
for them.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovswitchd: Make Interface's ofport a persistent column.
Gurucharan Shetty [Tue, 20 Nov 2012 11:34:03 +0000 (03:34 -0800)]
vswitchd: Make Interface's ofport a persistent column.

Currently, the 'ofport' column in Interface table is
ephemeral and is populated by vswitchd everytime it is
started or when a new interface is created with vswitchd
running.

Making it persistent lets vswitchd try and assign the
same ofport number to a particular interface across
restarts. This is just a fallback option when
'ofport_request' column is empty.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agoovs-ctl.in: Don't save kernel datapath config.
Gurucharan Shetty [Tue, 6 Nov 2012 19:11:30 +0000 (11:11 -0800)]
ovs-ctl.in: Don't save kernel datapath config.

Commit a41754333f6 (ovs-ctl.in: Ability to save flows and kernel
datapath config.) made ovs-ctl able to usefully save and restore
the flow table across loading and unloading the OVS kernel module
and stopping and starting the OVS daemons.  To ensure that the
flow table was still meaningful, it ensured that the datapath port
numbers were the same with the old and new versions of the kernel
module.

However, later commit e1b1d06afde (Separate OpenFlow port numbers
from datapath ones.) changed the OpenFlow implementation so that
keeping the same datapath port numbers no longer ensured that the
OpenFlow port numbers would be the same.  This caused a regression
in saving and restoring the flow table.  Although the flow table
was still saved and restored, it was no longer useful, since the
datapath port numbers might change.

This commit does not fix the regression, but it does drop the code
that saves and restores the port datapath numbers, since it is no
longer useful.  The following commit fixes the regression.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agovswitchd: fix 32-bit builds
Ansis Atteka [Thu, 22 Nov 2012 21:00:05 +0000 (13:00 -0800)]
vswitchd: fix 32-bit builds

My previous 72e8bf28bb38e8816435c64859fb350215b6a9e6 (datapath:
add skb mark matching and set action) commit broke 32-bit builds.
This patch assures that size of struct flow is equal on both
32-bit and 64-bit architectures so that build asserts would
not fire anymore.

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
11 years agopython/ovs/stream: Fix Stream.connect() retval for incomplete connection.
Ben Pfaff [Thu, 22 Nov 2012 06:09:55 +0000 (22:09 -0800)]
python/ovs/stream: Fix Stream.connect() retval for incomplete connection.

If the loop condition in Stream.connect() was false, which is especially
likely for TCP connections, then Stream.connect() would return None,
which violates its documented behavior.  This commit fixes the problem.

Reported-by: Isaku Yamahata <yamahata@valinux.co.jp>
Tested-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovswitchd: Log all tunnel parameters of given flow.
Pravin B Shelar [Thu, 22 Nov 2012 02:51:36 +0000 (18:51 -0800)]
vswitchd: Log all tunnel parameters of given flow.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
11 years agodatapath: add skb mark matching and set action
Ansis Atteka [Tue, 13 Nov 2012 17:19:36 +0000 (19:19 +0200)]
datapath: add skb mark matching and set action

This patch adds support for skb mark matching and set action.

Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
11 years agosocket-util: Remove get_socket_error().
Ben Pfaff [Mon, 19 Nov 2012 23:56:47 +0000 (15:56 -0800)]
socket-util: Remove get_socket_error().

It has no remaining users.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
11 years agosocket-util: Avoid using SO_ERROR.
Ben Pfaff [Mon, 19 Nov 2012 23:55:54 +0000 (15:55 -0800)]
socket-util: Avoid using SO_ERROR.

ESX doesn't implement it, and there's another approach that should work
everywhere, so drop back to that.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
11 years agoovs-ofctl: Don't rely on stat() to check unix sockets.
Ethan Jackson [Wed, 10 Oct 2012 20:33:54 +0000 (13:33 -0700)]
ovs-ofctl: Don't rely on stat() to check unix sockets.

ESX supports unix sockets, but they don't manifest themselves in
file system like they do on Linux.  Instead of using stat to check
if a unix socket exist, this patch simply tries to open it instead.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agoovs-appctl: fix help message for ofproto/trace command
Ansis Atteka [Tue, 20 Nov 2012 21:40:12 +0000 (13:40 -0800)]
ovs-appctl: fix help message for ofproto/trace command

The usage message for this command was wrong, because it did not
specify priority as one of its arguments.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
11 years agoofproto: Fix ofport allocation.
Gurucharan Shetty [Tue, 20 Nov 2012 11:18:11 +0000 (03:18 -0800)]
ofproto: Fix ofport allocation.

Currently running the following 3 commands results
in vswitchd running in an infinite loop.

ovs-vsctl add-port br1 port1 -- set interface port1 \
type=internal ofport_request=1
ovs-vsctl add-port br1 port2 -- set interface port2 \
type=internal ofport_request=2
ovs-vsctl add-port br1 port3 -- set interface port3 \
type=internal

This patch lets us go through all the possible ofport
values to find a free ofport.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agobridge: Fix typo in comment.
Ben Pfaff [Tue, 20 Nov 2012 21:09:07 +0000 (13:09 -0800)]
bridge: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodpif-netdev: Make odp_flow_key_to_flow() check more explicit.
Ben Pfaff [Tue, 20 Nov 2012 15:46:41 +0000 (07:46 -0800)]
dpif-netdev: Make odp_flow_key_to_flow() check more explicit.

ODP_FIT_PERFECT has value 0 but this 'if' statement doesn't make much sense
unless you happen to know that.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
11 years agopython/ovs/socket_util: Fix error path in set_nonblocking.
Ben Pfaff [Tue, 20 Nov 2012 15:45:56 +0000 (07:45 -0800)]
python/ovs/socket_util: Fix error path in set_nonblocking.

'e' is an exception, not a socket, so get_exception_errno() is the
appropriate function to obtain an error code from it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
11 years agoofp-util: Flow Dump Protocol for OpenFlow 12
Simon Horman [Tue, 20 Nov 2012 01:50:39 +0000 (10:50 +0900)]
ofp-util: Flow Dump Protocol for OpenFlow 12

Allow only OpenFlow 12 as a flow dump protocol.

The implementation of set_protocol_for_flow_dump ensures that
this will only be selected if an OpenFlow12 connection has
been negotiated.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodaemon: Avoid the link() syscall.
Ethan Jackson [Thu, 15 Nov 2012 02:34:14 +0000 (18:34 -0800)]
daemon: Avoid the link() syscall.

make_pidfile() depends on the link() system call to atomically
create pidfiles when multiple daemons are started concurrently.
However, this system call isn't available on ESX so an alternative
strategy is necessary.  Fortunately, the approach this patch takes
is cleaner than the original code.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agovswitchd: Configuration of allowed OpenFlow versions
Simon Horman [Mon, 19 Nov 2012 05:59:30 +0000 (14:59 +0900)]
vswitchd: Configuration of allowed OpenFlow versions

Versions may be configured using the protocols column of
the bridge table. The protocols column is a set which accepts zero
or more of the values: 'OpenFlow10' and 'OpenFlow12'.

If the protocols column is empty, then OpenFlow10 is used.
This default is consistent with the behaviour of ovs-vswtichd
prior to this patch.

Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com adjusted comments and documentation]
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoconnmgr: Use version of underlying rconn
Ben Pfaff [Mon, 19 Nov 2012 17:49:13 +0000 (09:49 -0800)]
connmgr: Use version of underlying rconn

Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com add OFPUTIL_P_NONE handling to ofconn_receives_async_msg()]
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoconnmgr: Mark ofconn_get_protocol() parameter const.
Ben Pfaff [Mon, 19 Nov 2012 17:50:44 +0000 (09:50 -0800)]
connmgr: Mark ofconn_get_protocol() parameter const.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodon't use select.POLL* constants
FUJITA Tomonori [Sun, 18 Nov 2012 18:50:52 +0000 (03:50 +0900)]
don't use select.POLL* constants

Python doesn't have select.POLL* constants on some architectures
(e.g. MacOSX). This code needs to define the constants for itself. It
uses select.POLL* constants only internally (doesn't pass them
outside). So there is no harm even if the definition would conflict
with Python's those.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoCodingStyle: Fix indentation.
Ben Pfaff [Fri, 16 Nov 2012 19:19:17 +0000 (11:19 -0800)]
CodingStyle: Fix indentation.

This got changed away from what I actually prefer in commit be2c418b73fc
(Cleanup isdigit() warnings.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodatapath: use this_cpu_ptr per-cpu helper
Shan Wei [Fri, 16 Nov 2012 21:21:36 +0000 (13:21 -0800)]
datapath: use this_cpu_ptr per-cpu helper

just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id());

Signed-off-by: Shan Wei <davidshan@tencent.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Backport this_cpu_ptr to kernels < 2.6.33
Jesse Gross [Fri, 16 Nov 2012 21:20:58 +0000 (13:20 -0800)]
datapath: Backport this_cpu_ptr to kernels < 2.6.33

An upstream commit uses this_cpu_ptr for a small performance benefit,
so this provides an equivalent to kernels that don't have that
function.

Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoofproto-dpif: Remove datapath flows of deleted ports.
Justin Pettit [Fri, 16 Nov 2012 06:30:41 +0000 (22:30 -0800)]
ofproto-dpif: Remove datapath flows of deleted ports.

Commit acf608 (ofproto-dpif: Use a single underlying datapath across
multiple bridges.) causes datapath flows from deleted ports to not be
removed.  The issue is that the code that bulk deletes old flows doesn't
know the datapath port number that makes up the datapath flow
definition.  This commit keeps track of the datapath port in the facet
for use when the datapath flow eventually needs to be removed.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agonetdev-linux: Don't log vport warnings when kernel datapath not loaded.
Justin Pettit [Thu, 15 Nov 2012 22:42:10 +0000 (14:42 -0800)]
netdev-linux: Don't log vport warnings when kernel datapath not loaded.

The *_get_stats functions call get_stats_via_vport(), which tries to get
information about ports attached to the kernel datapath.  When a pure
userspace switch is used (eg, the OVS kernel module isn't loaded), ports
are not attached to a kernel datapath, so warnings get logged.  This
commit handles that case and doesn't log a warning.  However, if the
kernel datapath is loaded, ports attached to a userspace datapath will
still log a warning.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agonetdev-linux: "Down" tap devices before setting hw addr.
Justin Pettit [Thu, 15 Nov 2012 22:27:28 +0000 (14:27 -0800)]
netdev-linux: "Down" tap devices before setting hw addr.

On Linux, it is not possible to set the mac address on "up" tap
interfaces.  This commit temporarily "down"s the interface so the
address can be set for the netdev_linux_set_etheraddr() call.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agobridge: Always "up" internal devices.
Justin Pettit [Thu, 15 Nov 2012 21:55:06 +0000 (13:55 -0800)]
bridge: Always "up" internal devices.

The kernel datapath automatically "up"s internal devices, but this
wasn't happening for the userspace datapath.  This change has the bridge
module always "up" them.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agobridge: Introduce iface_is_internal() function.
Justin Pettit [Thu, 15 Nov 2012 21:53:16 +0000 (13:53 -0800)]
bridge: Introduce iface_is_internal() function.

This will have an additional caller in the future.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agoofproto-dpif: Query port existence by name to prevent warnings.
Justin Pettit [Fri, 16 Nov 2012 07:00:39 +0000 (23:00 -0800)]
ofproto-dpif: Query port existence by name to prevent warnings.

The port_destruct() function checks if the port still exists in the
datapath to see if additional cleanup is necessary.  It used
dpif_port_query_by_number(), since the datapath port number is readily
available and cheap to use as a lookup handle.  Unfortunately, that
function logs a warning message if a port with that number doesn't exist
(because the datapath did remove it), which is confusing.  The
dpif_port_query_by_name() function doesn't log such an warning, so use
it instead.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agodpif: Don't log warning for ENOENT with dpif_port_exists().
Justin Pettit [Thu, 15 Nov 2012 21:05:58 +0000 (13:05 -0800)]
dpif: Don't log warning for ENOENT with dpif_port_exists().

The caller wants to know whether 'devname' is attached to 'dpif', and
ENOENT is a legitimate response to that not being the case.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agoofproto-dpif: Correct in_port on send_packet().
Justin Pettit [Tue, 13 Nov 2012 02:57:42 +0000 (18:57 -0800)]
ofproto-dpif: Correct in_port on send_packet().

The switch to a single datapath uncovered a long-standing bug in the
send_packet() function.  The code had used an (invalid) ingress OpenFlow
port of 0, which happened to get translated to the datapath's local
port, which was always 0.  With the single datapath, this invalid
OpenFlow port number no longer maps properly, so switch-generated
packets could not be transmitted.  This patch properly sets the ingress
port to OFPP_LOCAL.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agobridge: Open internal ports with the correct type.
Justin Pettit [Wed, 14 Nov 2012 23:49:47 +0000 (15:49 -0800)]
bridge: Open internal ports with the correct type.

Use the new ofproto function that returns how a port should be opened
based on the datapath type.  This fixes a problem with internal ports
being attached to userspace datapaths.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agoAdd functions to determine how port should be opened based on type.
Justin Pettit [Wed, 14 Nov 2012 23:50:20 +0000 (15:50 -0800)]
Add functions to determine how port should be opened based on type.

Depending on the port and type of datapath, a port may need to be opened
as a different type of device than it's configured.  For example, an
"internal" port on a "dummy" datapath should opened as a "dummy" port.
This commit adds the ability for a dpif to provide this information to a
caller.  It will be used in a future commit.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agodpif-linux.c: Let the kernel pick a port number if one not requested.
Justin Pettit [Wed, 14 Nov 2012 23:58:19 +0000 (15:58 -0800)]
dpif-linux.c: Let the kernel pick a port number if one not requested.

With the single datapath change, we no longer depend on the kernel to
make sure that we don't reuse OpenFlow port numbers, since the ofproto
library now picks them.  Remove the code that contained that logic.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agodpif-netdev: Don't special-case "br" bridges in create_dp_netdev().
Justin Pettit [Wed, 14 Nov 2012 01:57:11 +0000 (17:57 -0800)]
dpif-netdev: Don't special-case "br" bridges in create_dp_netdev().

With a single datapath, we no longer need to special case bridges
beginning with "br*" for testing, since all netdev-based bridges
are named "ovs-netdev".  This removes that unnecessary code.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agonicira-ext: Remove NXFF_OPENFLOW12.
Ben Pfaff [Fri, 16 Nov 2012 06:10:56 +0000 (22:10 -0800)]
nicira-ext: Remove NXFF_OPENFLOW12.

This was meant to splice OXM support into OpenFlow 1.0, in place of NXM,
but I no longer see any value in it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
11 years agoofp-util: Make ofputil_encode_set_protocol() able to return failure.
Ben Pfaff [Fri, 16 Nov 2012 06:09:07 +0000 (22:09 -0800)]
ofp-util: Make ofputil_encode_set_protocol() able to return failure.

Soon, it's not going to be possible to switch between every possible
protocol on an established OpenFlow connection, yet
ofputil_encode_set_protocol() didn't have a documented way to report such
a problem.  This commit adds a means for reporting and makes its callers
able to handle the problem.

Also, initially make ofputil_encode_set_protocol() fail when the current
and requested protocols are for different OpenFlow versions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
11 years agoofp-util: Allow use of OpenFlow 12 flow format
Ben Pfaff [Fri, 16 Nov 2012 06:36:15 +0000 (22:36 -0800)]
ofp-util: Allow use of OpenFlow 12 flow format

This enables the use of the OpenFlow 12 flow format.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Rename OFPUTIL_P_* constants and update comments for clarity.
Ben Pfaff [Fri, 16 Nov 2012 05:01:13 +0000 (21:01 -0800)]
ofp-util: Rename OFPUTIL_P_* constants and update comments for clarity.

It wasn't clear to me, at least, whether an OFPUTIL_P_* constant
indicated an OpenFlow version and a flow format or just a flow format.
After some reflection, I think it's more useful if it indicates both,
because otherwise it might be necessary to pass both an OpenFlow version
and an OFPUTIL_P_* constant in some contexts, but this way only the latter
is needed.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
11 years agoovs-ofctl: Style fix.
Ben Pfaff [Fri, 16 Nov 2012 05:28:56 +0000 (21:28 -0800)]
ovs-ofctl: Style fix.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
11 years agoodp-utils: Print human readable ipv4-tunnel-key flags.
Pravin B Shelar [Thu, 15 Nov 2012 05:10:54 +0000 (21:10 -0800)]
odp-utils: Print human readable ipv4-tunnel-key flags.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
11 years agoodp-utils: Refactor slow_path_reason parse and format functions.
Pravin B Shelar [Thu, 15 Nov 2012 05:10:22 +0000 (21:10 -0800)]
odp-utils: Refactor slow_path_reason parse and format functions.

These functions are used in next patch.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
11 years agovswitchd: Fix function prototype of packet_set_ipv6()
Pravin B Shelar [Wed, 14 Nov 2012 01:20:22 +0000 (17:20 -0800)]
vswitchd: Fix function prototype of packet_set_ipv6()

Follwoing patch fixes sparse error:
lib/packets.c:643:1: error: symbol 'packet_set_ipv6' redeclared
with different type (originally declared at lib/packets.h:493)
- incompatible argument 6 (different base types)

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
11 years agodatapath: add ipv6 'set' action
Ansis Atteka [Mon, 5 Nov 2012 13:53:32 +0000 (15:53 +0200)]
datapath: add ipv6 'set' action

This patch adds ipv6 set action functionality. It allows to change
traffic class, flow label, hop-limit, ipv6 source and destination
address fields.

Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
11 years agosparse: Add ip6_rthdr struct to the ip6.h
Ansis Atteka [Wed, 7 Nov 2012 17:14:34 +0000 (19:14 +0200)]
sparse: Add ip6_rthdr struct to the ip6.h

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
11 years agoofproto, connmgr: Parameterise OpenFlow versions for adding controller
Simon Horman [Wed, 7 Nov 2012 08:03:02 +0000 (17:03 +0900)]
ofproto, connmgr: Parameterise OpenFlow versions for adding controller

Allow allowed Open Flow versions to be passed rather
than relying on hard-coded defaults.

This is in preparation for allowing configuration of the
allowed OpenFlow versions.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovonn: Allow snoops to use the OpenFlow version of the controller connection
Simon Horman [Wed, 7 Nov 2012 08:03:01 +0000 (17:03 +0900)]
vonn: Allow snoops to use the OpenFlow version of the controller connection

Override the allowed versions of the snoop vconn so that
only the version of the controller connection is allowed.
This is because the snoop will see the same messages as the
controller.

Without this change the snoop will try to negotiate a connection
using the default allowed versions, or in other words only
allow OpenFlow 1.0. This breaks snoops for controller connections
using other OpenFlow versions, that is OpenFlow 1.2.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agorconn: Add allowed OpenFlow versions
Simon Horman [Wed, 7 Nov 2012 08:03:00 +0000 (17:03 +0900)]
rconn: Add allowed OpenFlow versions

Add allowed OpenFlow versions to struct rconn to allow
reconnect to use these parameters rather than hard-coded defaults.

This is in preparation for allowing configuration of the
allowed OpenFlow versions.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotests: Add tests for encoding and decoding OpenFlow hello messages.
Ben Pfaff [Fri, 9 Nov 2012 18:00:22 +0000 (10:00 -0800)]
tests: Add tests for encoding and decoding OpenFlow hello messages.

These tests helped me find the problems that I fixed in previous commits.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Make ofputil_encode_hello() return a message with correct length.
Ben Pfaff [Fri, 9 Nov 2012 17:59:12 +0000 (09:59 -0800)]
ofp-util: Make ofputil_encode_hello() return a message with correct length.

This doesn't fix a visible bug, because code to send OpenFlow messages
updates the length itself, but it still seems like the right thing to do.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Ignore invalid bitmaps in ofputil_decode_hello_bitmap().
Ben Pfaff [Fri, 9 Nov 2012 17:57:57 +0000 (09:57 -0800)]
ofp-util: Ignore invalid bitmaps in ofputil_decode_hello_bitmap().

This code has, until now, parsed and accepted invalid bitmaps.  It seems
better to simply ignore them, leaving the original set of allowed versions
from the version field in the ofp_header.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-msgs: Accept all versions of OpenFlow "hello" messages.
Ben Pfaff [Fri, 9 Nov 2012 17:55:12 +0000 (09:55 -0800)]
ofp-msgs: Accept all versions of OpenFlow "hello" messages.

Since the ofp-msgs code was introduced, only "hello" messages for versions
of OpenFlow actually understood (to some extent) by Open vSwitch could be
decoded correctly.  This commit corrects that, by making every version of
OpenFlow immutable messages acceptable.

Signed-off-by: Ben Pfaff <blp@nicira.com>