Ben Pfaff [Wed, 5 Oct 2011 23:33:57 +0000 (16:33 -0700)]
ofproto-dpif: Improve RSPAN translation performance from O(n**2) to O(n).
This code previously checked whether each individual mirror output was
already in the set of destinations. This is O(n**2) in the number of
ports in a bridge.
The new code uses a smarter algorithm to eliminate duplicates, one that is
O(n) in the number of ports in a bridge.
Ben Pfaff [Wed, 5 Oct 2011 22:42:17 +0000 (15:42 -0700)]
ofproto-dpif: Make compose_mirror_dsts() harder to screw up.
I came close to add a "continue;" inside the main "while" loop in
compose_mirror_dsts(), which would have turned it into an infinite loop.
This commit changes it to a "for" loop that is harder to screw up.
Ben Pfaff [Fri, 11 Nov 2011 23:25:49 +0000 (15:25 -0800)]
ofproto-dpif: Remove duplicate VLAN logic.
flow_get_vlan() duplicated the logic in input_vid_to_vlan() in an
unclear way and added some logic of its own to detect invalid
input VLANs. This commit eliminates the duplication and makes the
code easier to understand.
Ben Pfaff [Wed, 5 Oct 2011 22:26:49 +0000 (15:26 -0700)]
ofproto-dpif: Do not output RSPAN packets to SPAN ports.
It's always been my intention that ports used as port mirroring
destinations (SPAN) be reserved solely for that purpose. When SPAN and
RSPAN are both configured, however, RSPAN mirror packets could get directed
to SPAN ports, which was unintentional.
This commit also updates the documentation to make it clear (if that is
even necessary) that this behavior is intentional.
Jesse Gross [Wed, 16 Nov 2011 21:39:40 +0000 (13:39 -0800)]
datapath: Reformat copyright messages.
Many of our kernel copyright messages make reference to code being
copied from the Linux kernel, which is a bit odd for code in the
kernel. This changes them to use the standard GNU GPL boilerplate
instead. It does not change the actual license, which continues to
be GPLv2.
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Justin Pettit [Tue, 15 Nov 2011 09:33:08 +0000 (01:33 -0800)]
ofproto: Disable STP when unregistering a port.
If a port is removed when spanning tree was configured on it, then the
system may crash, since the STP library will try to send packets out a
now non-existent port. This commit disables STP on ports when they are
destroyed.
Justin Pettit [Tue, 15 Nov 2011 08:20:09 +0000 (00:20 -0800)]
stp: Fix tick remainder calculation.
The spanning tree library keeps track of time to know how often it
should update its state and send out BPDUs. OVS is able to track time
in milliseconds, but STP uses a coarser-grained count (256 ticks per
second). To prevent losing milliseconds that didn't account for an
entire tick, the library keeps track of these remaining milliseconds. A
bug miscalculated the remainder and made it too high, which caused the
library to think time was passing more quickly than it was.
This bug wasn't noticeable on a quiet system, since STP only asks to be
woken every second. However, a system with a lot of activity would wake
OVS more frequently and have it call the subsystems' "run" functions.
Justin Pettit [Mon, 14 Nov 2011 23:04:14 +0000 (15:04 -0800)]
stp: Track BPDU tx and rx counts.
When debugging spanning tree, it's useful to have counters about how
many BPDUs have been sent and received. This commit keeps track of
these counters and stores them in a new "statistics" column of the Port
table.
Ben Pfaff [Tue, 15 Nov 2011 01:19:41 +0000 (17:19 -0800)]
datapath: Don't drop packets with partial vlan tags.
In the future it is likely that our vlan support will expand to
include multiply tagged packets. When this happens, we would
ideally like for it to be consistent with our current tagging.
Currently, if we receive a packet with a partial VLAN tag we will
automatically drop it in the kernel, which is unique among the
protocols we support. The only other reason to drop a packet is
a memory allocation error. For a doubly tagged packet, we will
parse the first tag and indicate that another tag was present but
do not drop if the second tag is incorrect as we do not parse it.
This changes the behavior of the vlan parser to match other protocols
and also deeper tags by indicating the presence of a broken tag with
the 802.1Q EtherType but no vlan information. This shifts the policy
decision to userspace on whether to drop broken tags and allows us to
uniformly add new levels of tag parsing.
Although additional levels of control are provided to userspace, this
maintains the current behavior of dropping packets with a broken
tag when using the NORMAL action because that is the correct behavior
for an 802.1Q-aware switch. The userspace flow parser actually
already had the new behavior so this corrects an inconsistency.
Ben Pfaff [Mon, 14 Nov 2011 23:56:43 +0000 (15:56 -0800)]
datapath: Describe policy for extending flow key, implement needed changes.
When the datapath was converted to use Netlink attributes for describing
flow keys, I had a vague idea of how it could be smoothly extensible, but
I didn't actually implement extensibility or carefully think it through.
This commit adds a document that describes how flow keys can be extended
in a compatible fashion and adapts the existing interface to match what
it says.
This commit doesn't actually implement extensibility. I already have a
separate patch series out for that. This patch series borrows from that
one heavily, but the extensibility series will need to be reworked
somewhat once this one is in.
This commit is only lightly tested because I don't have a good test setup
for VLANs.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Simon Horman [Mon, 14 Nov 2011 08:41:28 +0000 (17:41 +0900)]
Make unixctl_command_register() idempotent
The assert() statement in unixctl_command_register() implies that it is
intended to be idempotent but inserting the same name and callback twice
would fail because:
* The callback is not stored directly in the hash, rather it the
cb element of a struct unixctl_command which is stored in the hash.
* Insertion would be attempted even if the entry was already present.
Tyler Coumbes [Mon, 14 Nov 2011 17:08:03 +0000 (09:08 -0800)]
rhel: Add ability to enable bridge compatibility mode in /etc/sysconfig/openvswitch
Add the ability to enable bridge compatibility mode through BRCOMPAT
variable in /etc/sysconfig/openvswitch for the rhel build. When
BRCOMPAT is set to 'yes' the brcompat_mod will be loaded and
ovs-brcompatd daemon will be started.
Ben Pfaff [Thu, 10 Nov 2011 00:15:36 +0000 (16:15 -0800)]
openvswitch.h: Change OVS_KEY_ATTR_TUN_ID from 100 to 63.
It's useful to be able to track sets of attributes by using their values as
bit indexes. That's easier if the values are all in the range of a basic
C integer type.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Fri, 11 Nov 2011 23:10:55 +0000 (15:10 -0800)]
docs: Always build ovs-vswitchd.conf.db.5 in srcdir.
Otherwise we build it in the build directory by default, which breaks the
Debian package build (unless we're working from a "make dist" created
tarball since that has ovs-vswitchd.conf.db.5 in the srcdir as part of
the distribution).
Justin Pettit [Thu, 10 Nov 2011 07:39:16 +0000 (23:39 -0800)]
flow: Use FWW_ flags to wildcard IP DSCP and ECN.
It's no longer necessary to maintain a "nw_tos_mask" wildcard member,
since we only care about completely wildcarding the DSCP and ECN
portions of the IP TOS field. This commit makes that change. It also
goes a bit further in internally using "tos" to refer to the entire TOS
field (ie, DSCP and ECN). We must still refer to the DSCP portions as
"nw_tos" externally through OpenFlow 1.0, since that's the convention it
uses.
Justin Pettit [Thu, 10 Nov 2011 01:42:17 +0000 (17:42 -0800)]
classifier: Don't check masks when adding IPv4/IPv6 addresses.
The meta-flow code enforces IPv4/IPv6 masks, so there's no reason to do
it again in the classifier. This allows a number of functions to be
removed, since the only callers were in this classifier code.
Justin Pettit [Thu, 10 Nov 2011 01:10:27 +0000 (17:10 -0800)]
Prepend "nw_" to "frag" and "tos" elements.
Most of the members in structures referring to network elements indicate
the layer (e.g., "tl_", "nw_", "tp_"). The "frag" and "tos" members
didn't, so this commit add them.
Ansis Atteka [Tue, 8 Nov 2011 22:32:13 +0000 (14:32 -0800)]
datapath: Kernel flow metadata parsing should be less restrictive
The function flow_metadata_from_nlattrs() is very restrictive
about the ordering and type of metadata attributes that it receives.
This patch will change flow_metadata_from_nlattrs() behavior by
ignoring attributes that it does not understand and allowing them
to be passed in arbitrary order.
Ben Pfaff [Wed, 9 Nov 2011 16:35:33 +0000 (08:35 -0800)]
debian: Strip epoch from version number used in directory names.
This doesn't fix a visible bug, since there's no epoch in the Open vSwitch
version used in Debian, but some Nicira internal build scripts were
inserting an epoch so it was visible in our builds.
Justin Pettit [Wed, 9 Nov 2011 20:17:38 +0000 (12:17 -0800)]
datapath: Rename ipv6_tos to ipv6_tclass.
IPv6 uses the term "traffic class" for what IPv4 calls
"type-of-service". This commit renames the the "ipv6_tos" field to
"ipv6_tclass" in the "ovs-key_ipv6" struct to be more consistent with
the IPv6 terminology.
Justin Pettit [Sat, 5 Nov 2011 22:48:12 +0000 (15:48 -0700)]
Support matching and modifying IP TTL.
Add support matching the IPv4 TTL and IPv6 hop limit fields. This
commit also adds support for modifying the IPv4 TTL. Modifying the IPv6
hop limit isn't currently supported, since we don't support modifying
IPv6 headers.
We will likely want to change the user-space interface, since basic
matching and setting the TTL are not generally useful. We will probably
want the ability to match on extraordinary events (such as TTL of 0 or 1)
and a decrement action.
Justin Pettit [Thu, 3 Nov 2011 01:22:22 +0000 (18:22 -0700)]
flow: Rearrange IPv6 addresses to remove potential hole in structure.
On some platforms, the in6_addr structure is made up of 16- or 32-bit
members. Depending on the members of the "flow" structure, this can
lead to holes in the middle. Moving the IPv6 addresses to the middle
fixes that on these platforms.
Justin Pettit [Wed, 9 Nov 2011 01:31:04 +0000 (17:31 -0800)]
ofproto-dpif: Actually disable STP on port when disabling STP on port.
When disabling STP on a port that has it enabled on the bridge, STP was
not actually being disabled on the port. This commit directly calls the
update function in this situation.
Jesse Gross [Tue, 8 Nov 2011 04:01:52 +0000 (20:01 -0800)]
tunneling: Separate out multicast port pools.
Currently multicast and unicast tunnel ports share port pools but
there's no overlap between the two in the lookup, which means that
we can do a lookup that has no chance of ever finding a port. This
separates them out.
Suggested-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Sun, 6 Nov 2011 00:18:04 +0000 (17:18 -0700)]
tunneling: Reduce priority of multicast tunnels.
It's possible to have an incoming packet that matches both a unicast
and multicast tunnel if the source address corresponds to the remote_ip
of a unicast tunnel and the destination is multicast. Currently this
will match the multicast tunnel but in reality the unicast tunnel
should probably be considered more specific. This is actually a
common situation in protocols that use a combination of multicast
for flooding and unicast for responses.
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Sun, 6 Nov 2011 03:13:55 +0000 (20:13 -0700)]
datapath: Renumber non-upstreamable interfaces.
The interfaces related to tunneling aren't finalized enough to be
sent upstream but we also still want to retain them in the OVS
repository. Since userspace should be compatible with both versions
of the kernel, this renumbers the tunnel interfaces to high numbers
so that we can continue to add new interfaces without conflict.
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Sun, 6 Nov 2011 00:08:21 +0000 (17:08 -0700)]
datapath: Slim down the vport interface.
Many of the function in vport.c are simply pass throughs to their
underlying vport implementation and, of these, many are used only
for bridge compatibility code. This allows users of these functions
to directly call through the ops structure, reducing boilerplate code
and keeping more of the compatibility code together.
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
ovs-vswitchd.conf.db is distributed so it's in the source directory not
the build directory.
This fixes a Debian package build failure introduced by commit 9840bdbd
"debian: Install ovs-vswitchd.conf.db(5) manpage." I did test that commit
but the build failure didn't show up in my environment (probably I had a
stray file left over from development).
Pravin B Shelar [Fri, 4 Nov 2011 20:31:45 +0000 (13:31 -0700)]
datapath: Convert internal_dev to ndo_fix_features.
From 2.6.39 kernel netdev features are set using set_features and
fix_features APIs. Since internal-dev does not need any special
checks on setting feature, there is no need to define set_features
or fix_features. Only hw_features needs to be set to features that
are supported by internal-dev.
Following patch does same and drops discrete offload setting ops for
newer kernel.
Justin Pettit [Sun, 30 Oct 2011 03:31:00 +0000 (20:31 -0700)]
meta-flow: Update mf_field description of size.
Commit 7257b5 (Implement new fragment handling policy.) added a new
"is_frag" meta-field that used fewer bits than the width of the field.
A comment in mf_field lists these cases, but "is_frag" wasn't included.
This commit updates that.
Justin Pettit [Sun, 30 Oct 2011 03:04:21 +0000 (20:04 -0700)]
nx-match: Increase upper bound length for an nx_match.
Commits d2c0fed (nicira-ext: Bump number of registers to five from
four.) and 7257b5 (Implement new fragment handling policy.) added new
match fields, but didn't update the maximum length of an NXM message.
This commit increases the maximum NXM size to 384 bytes.
Justin Pettit [Mon, 31 Oct 2011 21:32:08 +0000 (14:32 -0700)]
tests: Provide banner for ODP tests.
Previously, the ODP tests were being grouped together with the ovs-ofctl
ones, which is clearly not right. This commit puts it in its own
"datapath parsing and formatting" group.
Ben Pfaff [Fri, 28 Oct 2011 20:27:27 +0000 (13:27 -0700)]
bond: Only drop packets that indicate moves on SLB bonds.
SLB bonds, for important reasons, drop most incoming packets that indicate
that a MAC has moved to the bond from another port. These reasons do not
apply to other types of bonds, but until now OVS has still dropped them.
This fixes the problem. It changes behavior of active-backup bonds and
stable bonds, neither of which has the same problem as SLB. Behavior of
SLB bonds and TCP bonds in SLB fallback mode is unaffected.
Ben Pfaff [Fri, 4 Nov 2011 16:57:50 +0000 (09:57 -0700)]
debian: Install ovs-vswitchd.conf.db(5) manpage.
This manpage wasn't getting installed. This fixes it.
The --language=C option to dh_installman is necessary to keep that script
from thinking that the ".db" suffix indicates a translation into the "db"
language (which doesn't actually exist) and therefore installing it into
the wrong directory with the .db suffix stripped.
Bug #8138. Reported-by: Ethan Jackson <ethan@nicira.com>
Jesse Gross [Sun, 23 Oct 2011 00:22:11 +0000 (17:22 -0700)]
ofproto-dpif: Use send_packet() instead of netdev_send().
netdev_send() directly sends a packet using Linux mechanisms, skipping
our kernel module. Several upper layer abstractions are built on top of
the kernel module, so this means that we loose stats, sFlow, etc. on
these packets. This changes bonding, LACP, and STP to use send_packet()
as CFM does, which uses the standard kernel mechanisms and provides a
single place that needs to be updated.
Ben Pfaff [Wed, 2 Nov 2011 19:59:06 +0000 (12:59 -0700)]
stream: Fix uninitialized values in stream_init().
stream_init() didn't initialize the remote_ip, remote_port, local_ip, or
local_port members of the stream, so "unix" streams that don't have any of
those would get random values instead.
Reported-by: "Voravit T." <voravit@kth.se> Reported-by: Jari Sundell <sundell.software@gmail.com>
Ben Pfaff [Thu, 8 Sep 2011 18:25:29 +0000 (11:25 -0700)]
ofproto: Reject invalid input ports in OFPT_PACKET_OUT requests.
Some invalid ports (those above the maximum port number supported by the
datapath, including OpenFlow reserved ports that are not translated by OVS
into some other number) will be rejected by the datapath. It's better to
catch these early and send back an appropriate OpenFlow error code, rather
than to just get EINVAL from the kernel and have to guess at the problem.
Ben Pfaff [Thu, 8 Sep 2011 18:17:54 +0000 (11:17 -0700)]
ofproto: Consistently log OpenFlow error replies.
Until now, logging of OpenFlow error replies sent to controllers has been
haphazard. This commit logs them centrally, ensuring that every OpenFlow
error sent to a controller is logged.
At the same time, we can eliminate the individual log messages that a few
OpenFlow errors triggered.
Ansis Atteka [Tue, 1 Nov 2011 18:08:24 +0000 (11:08 -0700)]
packaging: dpkg --purge command fails on Ubuntu 11.04
The problem is that postrm script is unable to remove
contents of /var/log/openvswitch/ directory in case if
it contains any other directories. Steps to reproduce
on Ubuntu 11.04:
1. apt-get install openvswitch-switch
2. dpkg --purge openvswitch-switch
3. observe that purge failed, because of an empty "cores"
directory inside /var/log/openvswitch/
Pravin B Shelar [Tue, 1 Nov 2011 17:13:16 +0000 (10:13 -0700)]
datapath: Convert kernel priority actions into match/set.
Following patch adds skb-priority to flow key. So userspace will know
what was priority when packet arrived and we can remove the pop/reset
priority action. It's no longer necessary to have a special action for
pop that is based on the kernel remembering original skb->priority.
Userspace can just emit a set priority action with the original value.
Since the priority field is a match field with just a normal set action,
we can convert it into the new model for actions that are based on
matches.
Ben Pfaff [Sat, 29 Oct 2011 17:08:42 +0000 (10:08 -0700)]
ofproto: Add OFPC_QUEUE_STATS to switch feature reply.
Open vSwitch has supported queue stats for a long time, but we forgot to
set the OFPC_QUEUE_STATS bit in the switch features reply to show that they
are supported. This fixes it.
Ben Pfaff [Mon, 31 Oct 2011 16:15:14 +0000 (09:15 -0700)]
ovsdb-idl: Prevent occasional hang when multiple database clients race.
When a client of the IDL tries to commit a read-modify-write transaction
but the database has changed in the meantime, the IDL tells its client to
wait for the IDL to change and then try the transaction again by returning
TXN_TRY_AGAIN. The "wait for the IDL to change" part is important because
there's no point in retrying the transaction before the IDL has received
the database updates (the transaction would fail in the same way all over
again).
However, the logic was incomplete: the database update can be received
*before* the reply to the transaction RPC (I think that in the current
ovsdb-server implementation this will always happen, in fact). When this
happens, the right thing to do is to retry the transaction immediately;
if we wait, then we're waiting for an additional change to the database
that may never come, causing an indefinite hang.
This commit therefore breaks the "try again" IDL commit status code
into two, one that means "try again immediately" and another that means
"wait for a change then try again". When an update is processed after a
transaction is committed but before the reply is received, the "try again
now" tells the IDL client not to wait for another database change before
retrying its transaction.
Bug #5980. Reported-by: Ram Jothikumar <rjothikumar@nicira.com> Reproduced-by: Alex Yip <alex@nicira.com>