openvswitch
13 years agodatapath: Fix tunnel lookup
Pravin Shelar [Thu, 15 Sep 2011 00:39:43 +0000 (17:39 -0700)]
datapath: Fix tunnel lookup

        Attached patch fixes tunnel lookup to do correct port comparison.
This bug is introduced by commit 3544358aa5960b148bc31435a0062e9392530ec2

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: Set vport in skb when executed from userspace.
Jesse Gross [Mon, 1 Aug 2011 07:35:20 +0000 (00:35 -0700)]
datapath: Set vport in skb when executed from userspace.

Currently, the OVS_CB(skb)->vport member is never initialized for
packets coming from userspace.  This means that they can never be
sampled by sFlow and generally violates our principle that userspace
packets should be made to look the same as others.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin Shelar <pshelar@nicira.com>
13 years agoman: pic failed to run during manpage-check
Ethan Jackson [Tue, 13 Sep 2011 20:30:30 +0000 (13:30 -0700)]
man: pic failed to run during manpage-check

This patch fixes the following warnings on my system:

vswitchd/ovs-vswitchd.conf.db.5:62: warning: macro `PS' not defined
vswitchd/ovs-vswitchd.conf.db.5:138: warning: macro `PE' not defined

13 years agolib: TYPE_IS_SIGNED macro generates compiler warnings.
Ethan Jackson [Tue, 13 Sep 2011 20:27:38 +0000 (13:27 -0700)]
lib: TYPE_IS_SIGNED macro generates compiler warnings.

The TYPE_IS_SIGNED macro does a less than zero comparision with an
unsigned type which can cause compiler warnings like the following:

lib/tag.c:100:9: error: comparison of unsigned expression < 0 is
always false [-Werror=type-limits]

13 years agosocket-util: inet_parse_passive() had incorrect argument type.
Ethan Jackson [Tue, 13 Sep 2011 20:28:49 +0000 (13:28 -0700)]
socket-util:  inet_parse_passive() had incorrect argument type.

This patch fixes the following compiler warning:

lib/socket-util.c:621:5: error: comparison is always false due to
limited range of data type [-Werror=type-limits]

13 years agolib: Suppress comparison warnings in ovsdb libraries.
Ethan Jackson [Tue, 13 Sep 2011 20:15:48 +0000 (13:15 -0700)]
lib: Suppress comparison warnings in ovsdb libraries.

This patch fixes compiler warnings like the following:

./lib/ovsdb-types.h:171:5: error: comparison of unsigned expression
>= 0 is always true [-Werror=type-limits]

13 years agoofproto-dpif: Optimize flow revalidation for MAC learning.
Ben Pfaff [Mon, 12 Sep 2011 23:48:07 +0000 (16:48 -0700)]
ofproto-dpif: Optimize flow revalidation for MAC learning.

Without this commit, every NXAST_LEARN action that adds a flow causes every
facet to be revalidated.  With this commit, as long as the "Usage Advice"
in the large comment on struct nx_action_learn in nicira-ext.h is followed,
this no longer happens.

13 years agoofproto-dpif: Introduce an enum for the number of tables.
Ben Pfaff [Mon, 12 Sep 2011 23:40:03 +0000 (16:40 -0700)]
ofproto-dpif: Introduce an enum for the number of tables.

It seems reasonable that someone might want to reduce this number, so
make it an enum to simplify that.

If someone does reduce the number then rule_dpif_lookup() needs to validate
the table_id, so add code to do that too.

13 years agoflow: New function flow_wildcards_is_catchall().
Ben Pfaff [Mon, 12 Sep 2011 23:38:52 +0000 (16:38 -0700)]
flow: New function flow_wildcards_is_catchall().

This will be used in an upcoming commit.

13 years agoclassifier: Move zero_wildcards() to flow.c as public flow_zero_wildcards().
Ben Pfaff [Fri, 19 Aug 2011 16:39:16 +0000 (09:39 -0700)]
classifier: Move zero_wildcards() to flow.c as public flow_zero_wildcards().

This function will soon be used elsewhere.  As it doesn't inherently have
anything to with the classifier, move it to flow.c.

13 years agoImplement new "learn" action.
Ben Pfaff [Mon, 12 Sep 2011 23:19:57 +0000 (16:19 -0700)]
Implement new "learn" action.

There are a few loose ends here.  First, learning actions cause too much
flow revalidation.  Upcoming commits will fix that problem.  The following
additional issues have not yet been addressed:

    * Resource limits: nothing yet limits the maximum number of flows that
      can be learned.  It is possible to exhaust all system memory.

    * Age reporting: there is no way to find out how soon a learned table
      entry is due to be evicted.

To try this action out, here's a recipe for a very simple-minded MAC
learning switch.  It uses a 10-second MAC expiration time to make it easier
to see what's going on:

ovs-vsctl del-controller br0
ovs-ofctl del-flows br0
ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=10, \
NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
output:NXM_OF_IN_PORT[]), resubmit(,1)"
ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood"

You can then dump the MAC learning table with:

ovs-ofctl dump-flows br0 table=1

13 years agoofproto: Reinterpret meaning of OpenFlow hard timeouts with OFPFC_MODIFY.
Ben Pfaff [Fri, 19 Aug 2011 17:33:09 +0000 (10:33 -0700)]
ofproto: Reinterpret meaning of OpenFlow hard timeouts with OFPFC_MODIFY.

I finally found a good use for hard timeouts in OpenFlow, but they require
a slight reinterpretation of the meaning of hard timeouts.  Until now, a
hard timeout meant that a flow would be removed the specified number of
seconds after a flow was created.  Intervening modifications with
OFPFC_MODIFY(_STRICT) had no effect on the hard timeout; the flow would
still be deleted the specified number of seconds after its original
creation.

This commit changes the effect of OFPFC_MODIFY(_STRICT).  Now, modifying
a flow resets its hard timeout counter.  A flow will time out the specified
number of seconds after creation or after the last time it is modified,
whichever comes later.

13 years agotest-openflowd: Allow specifying port type on --ports option.
Ben Pfaff [Thu, 18 Aug 2011 18:20:12 +0000 (11:20 -0700)]
test-openflowd: Allow specifying port type on --ports option.

This allows a command like "test-openflowd --enable-dummy dummy@br0
--ports=dummy@eth0,dummy@eth1,dummy@eth2" to create a dummy datapath with
a number of dummy ports.  This is more useful for testing than a dummy
datapath with just an internal port, since output to "flood" and "normal"
has less pathological results.

13 years agodpif-netdev: Also allow "dummy" netdevs in a dpif-netdev.
Ben Pfaff [Thu, 18 Aug 2011 18:17:29 +0000 (11:17 -0700)]
dpif-netdev: Also allow "dummy" netdevs in a dpif-netdev.

I've always intended this to work, but either I never tested it or the
support rotted.

This will soon be used in some tests that I will add.

13 years agoofproto-dpif: Add -generate option to ofproto/trace command.
Ben Pfaff [Thu, 8 Sep 2011 21:32:13 +0000 (14:32 -0700)]
ofproto-dpif: Add -generate option to ofproto/trace command.

13 years agometa-flow: New library for working with fields by id.
Ben Pfaff [Mon, 12 Sep 2011 19:11:50 +0000 (12:11 -0700)]
meta-flow: New library for working with fields by id.

OVS already has a fairly good set of functions for working with fields that
are known at compile time, but support for working with fields that are
known only at runtime is fairly limited (and fairly unneeded).  However,
with NXM identifiers becoming more and more widely used throughout Nicira
extensions, it's becoming corresponding more and more common to need to
refer to fields at runtime.  This new library represents a first attempt
at a systematic approach for doing so.

13 years agoofproto: Mark some parameters 'const'.
Ben Pfaff [Wed, 17 Aug 2011 22:48:50 +0000 (15:48 -0700)]
ofproto: Mark some parameters 'const'.

13 years agoofproto: Add 'ofproto' parameter to most flow_mod functions.
Ben Pfaff [Wed, 10 Aug 2011 23:16:16 +0000 (16:16 -0700)]
ofproto: Add 'ofproto' parameter to most flow_mod functions.

13 years agoofproto: Avoid using list_size() to compute length of 'pending' list.
Ben Pfaff [Wed, 10 Aug 2011 21:48:33 +0000 (14:48 -0700)]
ofproto: Avoid using list_size() to compute length of 'pending' list.

Currently this only gets checked for incoming OpenFlow OFPT_FLOW_MOD
messages, so it's hard to imagine it being any kind of bottleneck, but the
NXAST_LEARN action that is soon to be added will be able to create flows
more quickly than we normally expect from a controller.  (On the other
hand, ofproto-dpif, outside of a special testing mode, always completes
operations immediately, so 'pending' will always have length 0.  But this
change still feels right to me for some reason.)

13 years agoofp-util: New function for parsing key-value pairs.
Ben Pfaff [Wed, 17 Aug 2011 20:39:02 +0000 (13:39 -0700)]
ofp-util: New function for parsing key-value pairs.

This will soon have a new user, but it's a worthwhile cleanup on its own.

13 years agoofp-util: Add type-safe functions for serializing actions.
Ben Pfaff [Tue, 16 Aug 2011 23:30:57 +0000 (16:30 -0700)]
ofp-util: Add type-safe functions for serializing actions.

13 years agoofp-parse: Refactor action parsing to improve compiler warnings.
Ben Pfaff [Tue, 16 Aug 2011 23:08:24 +0000 (16:08 -0700)]
ofp-parse: Refactor action parsing to improve compiler warnings.

When a new action is added, compiler warnings show most of the places that
need new code to handle that action.  The action parsing code in
ofp-parse.c was the one remaining missing case.  This commit fixes that.

13 years agoofp-util: Further abstract definitions of action properties.
Ben Pfaff [Wed, 17 Aug 2011 18:01:17 +0000 (11:01 -0700)]
ofp-util: Further abstract definitions of action properties.

This commit primarily moves the OFPAT_ACTION and NXAST_ACTION invocations
into a new file ofp-util.def.  This allows multiple places in the source to
use them.

This commit also adds a new function ofputil_action_code_from_name().
The following commit will add the first user.

13 years agoofp-util: New functions for parsing and formatting OpenFlow port numbers.
Ben Pfaff [Tue, 16 Aug 2011 22:26:18 +0000 (15:26 -0700)]
ofp-util: New functions for parsing and formatting OpenFlow port numbers.

These functions were previously used only in ofp-parse.c and ofp-print.c,
but they are more generally useful and future commits will add more users.

13 years agopackets: Add more utility functions for IPv4 and IPv6 addresses.
Ben Pfaff [Wed, 17 Aug 2011 17:55:15 +0000 (10:55 -0700)]
packets: Add more utility functions for IPv4 and IPv6 addresses.

We had these functions scattered around the source tree anyway.  packets.h
is a good place to centralize them.

I do plan to introduce some additional callers.

13 years agoclassifier: Change cls_rule_set_nd_target() to take a pointer.
Ben Pfaff [Mon, 12 Sep 2011 17:57:28 +0000 (10:57 -0700)]
classifier: Change cls_rule_set_nd_target() to take a pointer.

The other cls_rule_*() functions that take IPv6 addresses take a pointer
to an in6_addr, so cls_rule_set_nd_target() should as well for consistency.
Possibly this is more efficient also, although I guess it doesn't really
make much of a difference either way.

13 years agobridge: Don't update CFM on synthetic interfaces.
Ethan Jackson [Tue, 13 Sep 2011 05:39:01 +0000 (22:39 -0700)]
bridge: Don't update CFM on synthetic interfaces.

Synthetic interfaces don't have database records so it doesn't make
sense to update them.  In some situations this could cause a
segmentation fault.

Reported-by: Paul Ingram <paul@nicira.com>
Bug #7278.

13 years agotests: Test ofproto-dpif set_tunnel translation.
Ethan Jackson [Tue, 13 Sep 2011 00:19:13 +0000 (17:19 -0700)]
tests: Test ofproto-dpif set_tunnel translation.

This patch adds a unit test which would have caught the issue fixed
in Commit 2446268e "ofproto-dpif: set_tunnel when required to."

13 years agoofproto-dpif: Emit set_tunnel when required to.
Ethan Jackson [Mon, 12 Sep 2011 23:56:21 +0000 (16:56 -0700)]
ofproto-dpif: Emit set_tunnel when required to.

ofproto-dpif assumed that the datapath initialized the tun_id of a
flow on egress, to its tun_id on ingress.  For this reason, if
OpenFlow actions set the tun_id to a flow's ingress tun_id,
ofproto-dpif would fail to emit a set_tunnel action.

Reported-by: Igor Ganichev <iganichev@nicira.com>
Reported-by: Pankaj Thakkar <thakkar@nicira.com>
13 years agodatapath: Strip down vport interface : OVS_VPORT_ATTR_MTU
Pravin Shelar [Tue, 13 Sep 2011 00:12:52 +0000 (17:12 -0700)]
datapath: Strip down vport interface : OVS_VPORT_ATTR_MTU

There is no need to have vport attribute MTU (OVS_VPORT_ATTR_MTU) as
linux net-dev-ioctl can be used to get/set MTU for linux device.
Following patch removes OVS_VPORT_ATTR_MTU from datapath protocol.

This patch also adds netdev_set_mtu interface. So that MTU adjustments
can be done from OVS userspace. get_mtu() interface is also changed, now
get_mtu() returns EOPNOTSUPP rather than returning 0 and setting *pmtu
to INT_MAX in case there is no MTU attribute for given device.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoofproto-dpif: Fix check for 802.1Q header in commit_odp_actions().
Ben Pfaff [Mon, 12 Sep 2011 17:49:55 +0000 (10:49 -0700)]
ofproto-dpif: Fix check for 802.1Q header in commit_odp_actions().

The 'vlan_tci' member of struct flow has value 0, not OFP_VLAN_NONE, when
there is no 802.1Q header.

Fixes a problem introduced in commit d9065a90b6b "datapath: VLAN actions
should use push/pop semantics."

Found by sparse.

CC: Pravin Shelar <pshelar@nicira.com>
13 years agoNEWS: Mention support for keys in CAPWAP.
Jesse Gross [Mon, 12 Sep 2011 17:43:46 +0000 (10:43 -0700)]
NEWS: Mention support for keys in CAPWAP.

13 years agoDebian: fail gracefully if modules can't be loaded on install
Simon Horman [Sat, 10 Sep 2011 06:09:31 +0000 (15:09 +0900)]
Debian: fail gracefully if modules can't be loaded on install

By registering an error-handler for the init script used
in openvswitch-switch.postinst and detecting if module insertion fails,
it is possible to avoid failure to install in the case where the
openvswitch_mod module is not available.

This is done without altering the behaviour that the start target
of the openvswitch-switch init script will fail if module insertion fails.

This patch also adds a friendly hint as as to why starting
openvswitch-switch has failed if it is due to failure to insert
the openvswtich_mod. This message is displayed as necessary both
on package install and other calls to the start target of the
init script.

[Ben Pfaff fixed up == to = in postinst]

13 years agodatapath: add key support to CAPWAP tunnel
Valient Gough [Wed, 24 Aug 2011 06:12:06 +0000 (15:12 +0900)]
datapath: add key support to CAPWAP tunnel

Add tunnel key support to CAPWAP vport.  Uses the optional WSI field in a
CAPWAP header to store a 64bit key.  It can also be used without keys, in which
case it is backward compatible with the old code.  Documentation about the
WSI field format is in CAPWAP.txt.

Signed-off-by: Valient Gough <vgough@pobox.com>
[horms@verge.net.au: Various minor fixes (v4.1)]
Signed-off-by: Simon Horman <horms@verge.net.au>
[jesse: Additional parsing fixes]
Signed-off-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: Improve kernel hash table
Pravin Shelar [Sat, 10 Sep 2011 02:09:47 +0000 (19:09 -0700)]
datapath: Improve kernel hash table

 Currently OVS uses its own hashing implmentation for hash tables
which has some problems, e.g. error case on deletion code.
Following patch replaces that with hlist based hash table which is
consistent with other kernel hash tables. As Jesse suggested, flex-array
is used for allocating hash buckets, So that we can have large
hash-table without large contiguous kernel memory.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: VLAN actions should use push/pop semantics
Pravin Shelar [Sat, 10 Sep 2011 01:13:26 +0000 (18:13 -0700)]
datapath: VLAN actions should use push/pop semantics

Currently the kernel vlan actions mirror those used by OpenFlow 1.0.
i.e. MODIFY and STRIP. More flexible approach is to have an action to
push a tag and pop a tag off, so that it can handle multiple levels of vlan
tags. Plus it aligns with newer version of OpenFlow.
        As this patch replaces MODIFY with PUSH semantic, action
mapping done in userpace is fixed accordingly.
        GSO handling for multiple levels of vlan tags is also added as
Jesse suggested before.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: Fix br_nlmsg_size
Pravin Shelar [Sat, 10 Sep 2011 00:07:35 +0000 (17:07 -0700)]
datapath: Fix br_nlmsg_size

I missed this in last vport iflink patch.
    As IFLA_LINK is not be passed in netlink msg there is no need to
allocate space for it.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agonetlink-socket: Avoid use-after-free in nl_lookup_genl_mcgroup().
Ben Pfaff [Fri, 9 Sep 2011 17:21:49 +0000 (10:21 -0700)]
netlink-socket: Avoid use-after-free in nl_lookup_genl_mcgroup().

Commit e408762f "netlink-socket: New function nl_lookup_genl_mcgroup()"
modified do_lookup_genl_family() to return the Netlink attributes to the
caller, but it still freed the Netlink message itself, which meant that
the attributes pointed into freed memory.  This commit fixes the problem.

This commit is not a minimal fix.  It refactors do_lookup_genl_family(),
changing the return value from "negative errno value or positive genl
family id" to the more common "zero or positive errno value".

Found by valgrind.

13 years agobridge: Avoid reading uninitialized data in bridge_pick_local_hw_addr().
Ben Pfaff [Fri, 9 Sep 2011 17:12:32 +0000 (10:12 -0700)]
bridge: Avoid reading uninitialized data in bridge_pick_local_hw_addr().

Commit 3a48ace3 "bridge: Make bridge_pick_local_hw_addr() easier to reason"
didn't initialize 'ea' before trying to compare against it.  We need to
check that an address has been found.

Found by valgrind.

13 years agocfm: Write remote MPIDs to the database.
Ethan Jackson [Fri, 26 Aug 2011 21:54:34 +0000 (14:54 -0700)]
cfm: Write remote MPIDs to the database.

A controller may want to know which MPIDs are reachable from an
interface configured with CFM.  This patch regularly writes this
information to the database.

Bug #7014.

13 years agocfm: Eight byte MPIDs in extended mode.
Ethan Jackson [Thu, 1 Sep 2011 20:28:25 +0000 (13:28 -0700)]
cfm: Eight byte MPIDs in extended mode.

802.1ag only allows for MPIDs in the range [1, 8191].  This is
restrictive enough to make assignment of MPIDs to instances of OVS
awkward.  This patch allows eight byte MPIDs when running in
extended mode.

Bug #7014.

13 years agocfm: Allow accurate transmission intervals in extended mode.
Ethan Jackson [Wed, 31 Aug 2011 00:37:15 +0000 (17:37 -0700)]
cfm: Allow accurate transmission intervals in extended mode.

The standard CFM protocol only allows a handful of transmission
rates.  This is particularly problematic if you want to support a
transmission rate slower than 100 ms and faster than 1000 ms.

This patch allows arbitrary transmission rates (between 1 ms and
65535 ms).  It does this by commandeering parts of a reserved
"zero" field in the ccm message.  This breaks wire compatibility
with standard 802.1ag implementations, and thus is only supported
in extended mode.

Bug #7014.

13 years agocfm: New cfm extended mode.
Ethan Jackson [Wed, 31 Aug 2011 00:37:06 +0000 (17:37 -0700)]
cfm: New cfm extended mode.

The new extended mode introduced in this patch will be used for
features which break wire compatibility with 802.1ag compliant
implementations.

Bug #7014.

13 years agocfm: Remove cfm_remote_mpid configuration.
Ethan Jackson [Fri, 19 Aug 2011 20:58:56 +0000 (13:58 -0700)]
cfm: Remove cfm_remote_mpid configuration.

According to the 802.1ag specification, users should be able to
configure the CFM module with a list of remote endpoints with which
the local endpoint should have connectivity.  Commit 93b8df3853
"cfm: Remove Maintenance_Point and Monitor tables." changed the
behavior so that only one remote endpoint could be specified.  This
commit takes it further, by disallowing specification of any
remote endpoints.

Due to this change, the semantics of the fault flag are slightly
different.  Before, a fault was triggered if any of the configured
remote endpoints were unreachable (or with RDI), or if any
unconfigured remote endpoints were reachable.  Now a fault is
triggered if no remote endpoints are reachable at all, or if
reachable endpoints have set their RDI.

Bug #7014.

13 years agocfm: Trigger fault on unexpected CCM reception.
Ethan Jackson [Tue, 30 Aug 2011 01:56:28 +0000 (18:56 -0700)]
cfm: Trigger fault on unexpected CCM reception.

13 years agobridge: Clear fault when CFM is not configured.
Ethan Jackson [Wed, 7 Sep 2011 00:13:24 +0000 (17:13 -0700)]
bridge: Clear fault when CFM is not configured.

13 years agobridge: Write CFM changes more aggressively.
Ethan Jackson [Thu, 8 Sep 2011 23:15:36 +0000 (16:15 -0700)]
bridge: Write CFM changes more aggressively.

This patch no longer rate limits database updates due to CFM
changes.  Due to recent changes, the fault status of CFM only
changes once per 3.5 tx_interval seconds.  There doesn't seem to be
a good reason to add an additional rate limit on top of this.

13 years agobridge: ovsdb_idl_omit_alert() on additional columns.
Ethan Jackson [Thu, 8 Sep 2011 23:19:10 +0000 (16:19 -0700)]
bridge: ovsdb_idl_omit_alert() on additional columns.

The bridge owns the lacp_current and cfm_fault columns and should
not be alerted when they change.

13 years agoofproto: Document that ->rule_construct() should uninitialize victim rules.
Ben Pfaff [Fri, 9 Sep 2011 19:45:15 +0000 (12:45 -0700)]
ofproto: Document that ->rule_construct() should uninitialize victim rules.

The comments didn't say how this should work, so this clarifies it.

13 years agoofproto: Fix documentation for calls to ->rule_destruct().
Ben Pfaff [Thu, 8 Sep 2011 23:22:38 +0000 (16:22 -0700)]
ofproto: Fix documentation for calls to ->rule_destruct().

This documented what I intended to implement and what I thought I had
implemented, but not what the code actually did.  It is a little easier to
fix the documentation to match the implementation than vice versa, so this
commit does so.

Reported-by: Hao Zheng <hzheng@nicira.com>
13 years agoofproto-dpif: Drop special packets more judiciously.
Ethan Jackson [Wed, 31 Aug 2011 01:19:48 +0000 (18:19 -0700)]
ofproto-dpif: Drop special packets more judiciously.

Before this patch, ofproto-dpif would not forward any LACP or CFM
packets regardless of whether or not the relevant modules were
configured on the in_port.

Feature #6316.

13 years agolacp: Clean up LACP module interface.
Ethan Jackson [Wed, 31 Aug 2011 01:17:27 +0000 (18:17 -0700)]
lacp: Clean up LACP module interface.

There's no particular reason to force users of the LACP module to
be aware of the lacp_pdu structure.  This patch hides that
information in the LACP module implementation.  This results in
slightly cleaner code which is more consistent with the CFM
module.

13 years agovswitch.xml: Whitespace cleanup.
Ethan Jackson [Wed, 31 Aug 2011 01:46:50 +0000 (18:46 -0700)]
vswitch.xml: Whitespace cleanup.

13 years agodatapath: Allow a packet with no input port to omit OVS_KEY_ATTR_IN_PORT.
Ben Pfaff [Thu, 8 Sep 2011 23:30:20 +0000 (16:30 -0700)]
datapath: Allow a packet with no input port to omit OVS_KEY_ATTR_IN_PORT.

When ovs-vswitchd executes actions on a synthesized packet, that is, on a
packet that is not being forwarded from any particular port but is being
generated by ovs-vswitchd itself or by an OpenFlow controller (using a
OFPT_PACKET_OUT message with an in_port of OFPP_NONE), there is no good
choice for the in_port to pass to the kernel in the flow in the
OVS_PACKET_CMD_EXECUTE message.  This commit allows ovs-vswitchd to omit
the in_port entirely in this case.

This fixes a bug in OFPT_PACKET_OUT: using an in_port of OFPP_NONE would
cause the packet to be dropped by the kernel, since that's an invalid
input port.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Reported-by: Aaron Rosen <arosen@clemson.edu>
13 years agodatapath: Calculate flow hash after extracting metadata.
Jesse Gross [Thu, 8 Sep 2011 22:32:24 +0000 (15:32 -0700)]
datapath: Calculate flow hash after extracting metadata.

When we execute a packet from userspace we first extract the header
fields from the packet and then add supplied metadata.  However, we
compute the hash of the packet in between these two steps despite
the fact that the metadata can affect the hash.  This can lead to
two separate hashes for packets of the same flow.

Found by code inspection, not an actual real-world problem.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agoStrip down vport interface : iflink
Pravin Shelar [Thu, 8 Sep 2011 22:18:42 +0000 (15:18 -0700)]
Strip down vport interface : iflink

Remove iflink from vport interface. iflink is not used anywhere in
OVS. So there is not need to have iflink as vport attribute.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agoovs-ctl: Add load-kmod command
Simon Horman [Wed, 7 Sep 2011 01:10:30 +0000 (10:10 +0900)]
ovs-ctl: Add load-kmod command

On Debian there is a need for the init scripts to die gracefully
if module insertion fails. In such a case it is desirable to print
some sort of informative message.

By adding the load-kmod sub-command to ovs-ctl init scripts
may try to load modules and take appropriate action on failure
or then try to start the daemons.

13 years agorhel: add ability to build kmod packages for arbitrary kernel version/variant(s)
Alexey I. Froloff [Wed, 7 Sep 2011 09:02:58 +0000 (13:02 +0400)]
rhel: add ability to build kmod packages for arbitrary kernel version/variant(s)

Usage:

rpmbuild --rebuild \
  -D 'kversion KERNEL_VERSION' \
  -D 'kflavors FLAVORS TO BUILD' \
  openvswitch-kmod-VERSION-RELEASE.src.rpm

Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agorhel: rename RHEL6 kmod source package
Alexey I. Froloff [Thu, 1 Sep 2011 14:56:29 +0000 (18:56 +0400)]
rhel: rename RHEL6 kmod source package

Rename RHEL6 source package to openvswitch-kmod, so it doesn't intersect
with main package.

Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agonetlink-protocol: Move CTRL_ATTR_MCAST definitions for consistency.
Ben Pfaff [Tue, 6 Sep 2011 16:33:26 +0000 (09:33 -0700)]
netlink-protocol: Move CTRL_ATTR_MCAST definitions for consistency.

One of the current goals of netlink-protocol.h, for better or for worse, is
to ensure that the same definitions are available whether a Linux kernel is
in use or not.  One of the ways it accomplishes this is by putting the
conditional definitions that test for features missing in old kernels at
the very end, after the dummy definitions used on non-Linux platforms.
However, commit b0025c8389f "netlink-protocol: Define missing symbols"
added new conditional definitions only in the Linux platform case, which
means that those definitions won't be available on non-Linux platforms.
This commit moves them to the end, instead.

The symbols that are moved are only used from netlink-socket.c, which is
only built on Linux platforms, so this does not change an actual bug.  It
only makes the location of the definitions consistent with prior practice.

13 years agonetlink-protocol: Define missing symbols.
Ethan Jackson [Fri, 2 Sep 2011 01:48:29 +0000 (18:48 -0700)]
netlink-protocol: Define missing symbols.

OVS fails to build with xenddk-56100build3926 because it has an
outdated genetlink header.

13 years agodpif-linux: Stop listening for RTNL notifications.
Ethan Jackson [Wed, 24 Aug 2011 23:21:10 +0000 (16:21 -0700)]
dpif-linux: Stop listening for RTNL notifications.

Currently dpif-linux listens for vport change events using
rtnetlink notifications.  This patch switches to the ovs genl
notification system.

Feature #6809.

13 years agodatapath: genl_notify() on port disappearances.
Ethan Jackson [Wed, 24 Aug 2011 00:20:00 +0000 (17:20 -0700)]
datapath: genl_notify() on port disappearances.

Before this patch, if a vport detached itself from the datapath
without interaction from userspace, rtnetlink notifications would
be sent, but genl notifications would not.

Feature #6809.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agonetlink-socket: New function nl_lookup_genl_mcgroup().
Ethan Jackson [Tue, 23 Aug 2011 20:13:34 +0000 (13:13 -0700)]
netlink-socket: New function nl_lookup_genl_mcgroup().

13 years agonetlink-notifier: Rename rtnetlink code.
Ethan Jackson [Wed, 24 Aug 2011 22:17:32 +0000 (15:17 -0700)]
netlink-notifier: Rename rtnetlink code.

This patch renames the rtnetlink module's code to "nln" for
"netlink notifier".  Callers are now required to pass in the
netlink protocol to he newly renamed nln_create() function.

13 years agolib: Rename rtnetlink.[ch] files.
Ethan Jackson [Thu, 25 Aug 2011 21:06:54 +0000 (14:06 -0700)]
lib: Rename rtnetlink.[ch] files.

The only rtnetlink specific functionality contained in the
rtnetlink module is the use of the NETLINK_ROUTE protocol.  This
can easily be passed in by callers.

In preparation for generalization, this patch renames
rtnetlink.[ch] to netlink-notifier.[ch].  Future patches will
complete the transition.

13 years agolacp: Clarify documentation.
Ethan Jackson [Wed, 31 Aug 2011 22:18:17 +0000 (15:18 -0700)]
lacp: Clarify documentation.

Requested-by: Dan Wendlandt <dan@nicira.com>
13 years agorhel: Poke iptables hole for gre in init scripts.
Ethan Jackson [Thu, 1 Sep 2011 00:56:07 +0000 (17:56 -0700)]
rhel: Poke iptables hole for gre in init scripts.

13 years agorhel: Add ovs-pki to rpm.
Ethan Jackson [Wed, 31 Aug 2011 19:33:21 +0000 (12:33 -0700)]
rhel: Add ovs-pki to rpm.

13 years agorhel: Don't delete bridges on boot.
Ethan Jackson [Wed, 31 Aug 2011 18:23:21 +0000 (11:23 -0700)]
rhel: Don't delete bridges on boot.

Before this patch, the RHEL init scripts would remove all bridges
configured on the system at boot.

13 years agodatapath: Disable LRO from userspace instead of the kernel.
Justin Pettit [Sat, 27 Aug 2011 06:34:40 +0000 (23:34 -0700)]
datapath: Disable LRO from userspace instead of the kernel.

Whenever a port is added to the datapath, LRO is automatically disabled.
In the future, we may want to enable LRO in some circumstances, so have
userspace disable LRO through the ethtool ioctls.

As part of this change, the MTU and LRO checks are moved to
netdev-vport's send(), which is where they're actually needed.

Feature #6810

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agonetdev-linux: Introduce netdev_linux_ethtool_set_flag().
Justin Pettit [Wed, 17 Aug 2011 21:38:08 +0000 (14:38 -0700)]
netdev-linux: Introduce netdev_linux_ethtool_set_flag().

There will be a caller added soon.

13 years agocfm: Zero out empty field as required.
Ethan Jackson [Sat, 27 Aug 2011 00:12:21 +0000 (17:12 -0700)]
cfm: Zero out empty field as required.

Found with valgrind.

13 years agosocket-util: Suppress valgrind uninitialized use warning.
Ethan Jackson [Fri, 26 Aug 2011 23:55:07 +0000 (16:55 -0700)]
socket-util: Suppress valgrind uninitialized use warning.

13 years agoovs-monitor-ipsec: Don't abort if syslog is not available.
Ben Pfaff [Fri, 26 Aug 2011 23:46:16 +0000 (16:46 -0700)]
ovs-monitor-ipsec: Don't abort if syslog is not available.

If /dev/log doesn't exist or cannot be contacted, ovs-monitor-ipsec would
abort with an exception.  This allows it to start up and run.

It's pretty common for a chroot used for testing not to have a syslogd
instance set up and running, so this limitation caused testing problems.

Reported-by: Simon Horman <horms@verge.net.au>
Tested-by: Simon Horman <horms@verge.net.au>
13 years agobridge: Make bridge_pick_local_hw_addr() easier to reason.
Justin Pettit [Fri, 26 Aug 2011 22:05:53 +0000 (15:05 -0700)]
bridge: Make bridge_pick_local_hw_addr() easier to reason.

The use of eth_addr_is_multicast() to see if a reasonable address was
found always caused me momentary confusion.  This commit uses a flag
instead, and also saves a bit of unnecessary array reading and writing.

13 years agodebian: Transition to dh_python2
Simon Horman [Fri, 26 Aug 2011 09:03:42 +0000 (18:03 +0900)]
debian: Transition to dh_python2

dh_pysupport that the packaging used until now is deprecated, with
dh_python2 as its successor.

This commit removes the PYTHONPATH setting from
debian/openvswitch-ipsec.init because it is not needed, as the Python
packaging is public.  In fact, the Python packaging was public,
unintentionally, before, so the PYTHONPATH could have been removed earlier.

13 years agogitignore: Add manpage-check.
Ethan Jackson [Thu, 25 Aug 2011 23:03:25 +0000 (16:03 -0700)]
gitignore: Add manpage-check.

13 years agoovs.db.types: Remove write-only variable from constraintsToEnglish().
Ben Pfaff [Thu, 25 Aug 2011 00:09:27 +0000 (17:09 -0700)]
ovs.db.types: Remove write-only variable from constraintsToEnglish().

Found by pychecker.

13 years agopython: Remove unused imports.
Ben Pfaff [Thu, 25 Aug 2011 00:08:50 +0000 (17:08 -0700)]
python: Remove unused imports.

Found by pychecker.

13 years agoovs.stream: Remove unused parameter from usage().
Ben Pfaff [Thu, 25 Aug 2011 00:08:24 +0000 (17:08 -0700)]
ovs.stream: Remove unused parameter from usage().

This function has no callers.  We could delete it entirely, instead.

13 years agoovs.ovsuuid: Fix UUID.cInitUUID invocation of re.match with too few params.
Ben Pfaff [Thu, 25 Aug 2011 00:07:32 +0000 (17:07 -0700)]
ovs.ovsuuid: Fix UUID.cInitUUID invocation of re.match with too few params.

Found by pychecker.

13 years agoovs.jsonrpc: Fix static method Session.open() reference to 'self'.
Ben Pfaff [Thu, 25 Aug 2011 00:06:37 +0000 (17:06 -0700)]
ovs.jsonrpc: Fix static method Session.open() reference to 'self'.

Found by pychecker.

13 years agoovs.jsonrpc: Fix static method Message.__validate_arg reference to 'self'.
Ben Pfaff [Thu, 25 Aug 2011 00:06:11 +0000 (17:06 -0700)]
ovs.jsonrpc: Fix static method Message.__validate_arg reference to 'self'.

This method needs to be an instance method because it refers to 'self'.

Found by pychecker.

13 years agoovs.json: Use Exception, which exists, instead of Error, which doesn't.
Ben Pfaff [Thu, 25 Aug 2011 00:04:20 +0000 (17:04 -0700)]
ovs.json: Use Exception, which exists, instead of Error, which doesn't.

Found by pychecker.

13 years agoovs.db.idl: Fix error message format arguments.
Ben Pfaff [Thu, 25 Aug 2011 00:03:42 +0000 (17:03 -0700)]
ovs.db.idl: Fix error message format arguments.

There's no variable table_name.

Found by pychecker.

13 years agoovs.daemon: Add missing format string argument.
Ben Pfaff [Thu, 25 Aug 2011 00:01:14 +0000 (17:01 -0700)]
ovs.daemon: Add missing format string argument.

Found by pychecker.

13 years agoovs.daemon: Fix name of EALREADY error.
Ben Pfaff [Thu, 25 Aug 2011 00:00:46 +0000 (17:00 -0700)]
ovs.daemon: Fix name of EALREADY error.

Found by pychecker.

13 years agoovs.daemon: Add missing 'global' when setting _pidfile_dev, _pidfile_ino.
Ben Pfaff [Thu, 25 Aug 2011 00:00:15 +0000 (17:00 -0700)]
ovs.daemon: Add missing 'global' when setting _pidfile_dev, _pidfile_ino.

Found by pychecker.

13 years agoovs.db.idl: Fix call to ovs.db.parser.Parser constructor.
Ben Pfaff [Thu, 25 Aug 2011 18:06:53 +0000 (11:06 -0700)]
ovs.db.idl: Fix call to ovs.db.parser.Parser constructor.

This bug was introduced by commit 4c0f62718f "ovs.db.idl: Improve error
reporting for bad <row-update>s."

Found by pychecker.
Bug #7006.

13 years agodebian: Apply Ubuntu patch to add DKMS support.
Chuck Short [Tue, 23 Aug 2011 22:37:11 +0000 (15:37 -0700)]
debian: Apply Ubuntu patch to add DKMS support.

I tested that installing openvswitch-datapath-dkms worked OK on my own
Debian machine.

The bulk of this patch is taken from downstream Ubuntu DKMS support written
by Chuck Short <zulcss@ubuntu.com>, version 1.2.0-1ubuntu1.  I made the
following changes:

  * Update debian/.gitignore.

  * Update debian/automake.mk.

  * Correct description in debian/control (it was a cut-and-paste from
    the openvswitch-datapath-source description without editing).

  * Fix up for --with-l26 to --with-linux and datapath/linux-2.6 to
    datapath/linux transitions.

CC: Chuck Short <zulcss@ubuntu.com>
CC: Dave Walker <DaveWalker@ubuntu.com>
Acked-by: Simon Horman <horms@verge.net.au>
13 years agodocs: Add Makefile rule to check syntax of manpages.
Ben Pfaff [Wed, 24 Aug 2011 17:45:32 +0000 (10:45 -0700)]
docs: Add Makefile rule to check syntax of manpages.

This should catch future nroff syntax errors immediately, instead of much
later.

13 years agodocs: Fix some manpage syntax errors found with "groff".
Ben Pfaff [Wed, 24 Aug 2011 17:43:41 +0000 (10:43 -0700)]
docs: Fix some manpage syntax errors found with "groff".

13 years agopython: Use enumerate() builtin function to simplify counted iteration.
Ben Pfaff [Tue, 23 Aug 2011 21:43:54 +0000 (14:43 -0700)]
python: Use enumerate() builtin function to simplify counted iteration.

Suggested-by: Reid Price <reid@nicira.com>
13 years agoovs.stream: Simplify logic in Stream.wait().
Ben Pfaff [Tue, 23 Aug 2011 18:16:57 +0000 (11:16 -0700)]
ovs.stream: Simplify logic in Stream.wait().

Suggested-by: Reid Price <reid@nicira.com>
13 years agoovs.stream: Drop Stream.get_name() since clients can use 'name' directly.
Ben Pfaff [Tue, 23 Aug 2011 18:16:27 +0000 (11:16 -0700)]
ovs.stream: Drop Stream.get_name() since clients can use 'name' directly.

Suggested-by: Reid Price <reid@nicira.com>
13 years agoovs.stream: Use %d in place of %ld since the two are equivalent in Python.
Ben Pfaff [Tue, 23 Aug 2011 17:47:53 +0000 (10:47 -0700)]
ovs.stream: Use %d in place of %ld since the two are equivalent in Python.

Reported-by: Reid Price <reid@nicira.com>
13 years agoovs.reconnect: Fix typo in documentation.
Ben Pfaff [Tue, 23 Aug 2011 18:33:08 +0000 (11:33 -0700)]
ovs.reconnect: Fix typo in documentation.

Reported-by: Reid Price <reid@nicira.com>
13 years agoovs.reconnect: Make Reconnect.Reconnect inherit from object.
Ben Pfaff [Tue, 23 Aug 2011 17:45:43 +0000 (10:45 -0700)]
ovs.reconnect: Make Reconnect.Reconnect inherit from object.

Reported-by: Reid Price <reid@nicira.com>
13 years agoovs.jsonrpc: Use "not X" in place of "len(X) == 0" for testing strings.
Ben Pfaff [Tue, 23 Aug 2011 17:43:26 +0000 (10:43 -0700)]
ovs.jsonrpc: Use "not X" in place of "len(X) == 0" for testing strings.

Suggested-by: Reid Price <reid@nicira.com>