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>
Ethan Jackson [Fri, 28 Oct 2011 21:46:42 +0000 (14:46 -0700)]
nicira-ext: New action "exit".
The exit action causes the switch to immediately halt processing of
further actions. It's intended to be used in conjunction with
multi table support. It allows a table to force tables which call
it to discontinue processing a flow.
Ethan Jackson [Wed, 26 Oct 2011 23:10:26 +0000 (16:10 -0700)]
bundle: Allow OFPP_NONE in bundle actions.
This patch special cases OFPP_NONE to be always up in bundle
actions. Presumably, if a controller put OFPP_NONE in their bundle
action, they want it to be an available choice.
This patch also adds documentation to the bundle action about slave
liveness.
Ben Pfaff [Fri, 30 Sep 2011 18:01:49 +0000 (11:01 -0700)]
ofp-print: Pretty-print payloads in all error messages, except "hello"s.
This function was only pretty-printing "bad request" error payloads. I
don't know why. It makes sense to pretty-print all of them except for
"hello" messages, which already have their own special cases.
Ben Pfaff [Wed, 26 Oct 2011 22:46:48 +0000 (15:46 -0700)]
ovsdb-idl: Don't even try to modify synthetic rows, instead of segfaulting.
Synthetic rows lack a lot of important metadata that the IDL adds to rows
actually obtained from the database, and it's impractical to add that
metadata to synthetic rows. This means that the IDL functions to modify
these rows dereference null pointers and segfault. So, it's really
important not to pass synthetic rows to such functions. However, we've
screwed this up a number of times now and in the end it seems that it's
probably better to just ignore attempts to modify these rows. This commit
implements that.
Feature #8013. Reported-by: Ethan Jackson <ethan@nicira.com>
Ben Pfaff [Thu, 27 Oct 2011 16:39:24 +0000 (09:39 -0700)]
Fix manpage-check on RHEL 5.
The version of groff on RHEL 5 doesn't include the .SY, .OP, or .YS macros
that ovs-benchmark.1 uses, so the manpage-check target fails on that
platform. This commit adds the groff definitions of those macros to a
file and includes it into ovs-benchmark.1.
I tested that this allows RHEL 5 to pass manpage-check.
Jesse Gross [Thu, 27 Oct 2011 04:14:46 +0000 (21:14 -0700)]
tests: Fix intermittent failure in ovs-monitor-ipsec test.
The ovs-monitor-ipsec test waits for a specific number of lines
of output before doing a comparison to the correct values. However,
some copy and pasted code did not update the number of lines to
look for resulting in a race condition where the comparison could
happen before the script finished running.
Ben Pfaff [Wed, 26 Oct 2011 23:11:32 +0000 (16:11 -0700)]
Improve manpage checking rule.
The coverage of the previous version of this rule was incomplete because
$(MANS) does not include $(noinst_man_MANS). (Also, $(MANS) is
undocumented.) Writing it out as the list of manpages variables that
Open vSwitch uses is better.
Also, the previous version of the rule didn't actually signal an error
when warnings appeared. It looks like troff doesn't have a way to indicate
warnings as part of its exit status, so instead we grep the output for
"warning".
Ben Pfaff [Thu, 25 Aug 2011 18:15:27 +0000 (11:15 -0700)]
Move soexpand.pl into build-aux and make it non-executable.
Scripts for the build generally go in build-aux, so move soexpand.pl.
soexpand.pl had the "executable" bit set, but it doesn't have a #! line
and it's not a shell script, so that didn't make sense.
Ben Pfaff [Tue, 25 Oct 2011 21:03:35 +0000 (14:03 -0700)]
datapath: Improve <linux/openvswitch.h> comments.
Generally we've used the comments to the right of attribute enums to
explain the types of the arguments and the ones above them to explain their
meaning. This is a reasonable separation since it ensures that the type
of the argument is obvious, which in my opinion is important.
This updates a few comments to match this pattern.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Justin Pettit [Mon, 24 Oct 2011 21:40:58 +0000 (14:40 -0700)]
debian: Start ovs-monitor-ipsec after ovsdb running.
ovs-monitor-ipsec uses the OVS database to get configuration, so don't
bother starting the daemon until it's up.
Debian recently switched to using the LSB fields in the header of init
scripts to allow dependency-based boots. This is described in the
following page:
Ben Pfaff [Mon, 24 Oct 2011 19:27:36 +0000 (12:27 -0700)]
datapath: Add multicast tunnel support.
Something like this, on two separate vswitches, works to try it out:
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
ovs-vsctl \
-- add-port br0 gre0 \
-- set interface gre0 type=gre options:remote_ip=224.0.0.1
Runtime tested on Linux 3.0, build tested on Linux 2.6.18, both i386.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Mon, 24 Oct 2011 16:58:35 +0000 (09:58 -0700)]
ofproto-dpif: Fix uninitialized struct member in xlate_actions().
Commit 7257b535ab "Implement new fragment handling policy." moved around
a bunch of initialization code in xlate_actions() so that the assignment
to ctx->flow.tp_src and .tp_dst would not have to also assign to
ctx->base_flow.tp_src and .tp_dst. However, this meant that the early-exit
"return" in the new switch statement exited without initializing a lot of
the context. In particular 'may_set_up_flow' didn't get initialized, so
something the early-exit would produce a flow that couldn't be installed,
which wasn't the intent.
It seems that this optimization was a bad tradeoff, so this commit puts
all of the initialization up front and just assigns to both copies of the
tp_src and tp_dst members.
Fixes a nondeterministic "make check" failure in the VLAN handling test.
Ben Pfaff [Thu, 6 Oct 2011 18:25:25 +0000 (11:25 -0700)]
ovsdb-tool: Make "show-log" convert raw JSON to easier-to-read syntax.
Now output that formerly looked like ["map", [["key1", "value1"], ["key2",
"value2"]]] is printed like {key1=value1, key2=value2}, which I find easier
to read.
Ben Pfaff [Thu, 6 Oct 2011 18:23:54 +0000 (11:23 -0700)]
ovsdb-tool: Add abbreviated UUIDs to "show-log" even when we have a name.
The "show-log" command tries to give names to the rows to make it easier to
understand what's going on, but it's still important to see at least
partial UUIDs so that one can search the output for references to the rows
by UUID.
Ben Pfaff [Mon, 24 Oct 2011 16:14:12 +0000 (09:14 -0700)]
ovs-bugtool: Improve how Open vSwitch log files are saved.
This moves the OVS log files from the "network-status" capability, which
has a very small maximum size, to the "system-logs" capability, which is
much larger. It ensures that the newest OVS log files are prioritized over
old versions of system log files (if we just added the OVS log files after
the existing file_output, then new OVS log files would only be included
*after* all archived system log files were added).
Justin Pettit [Fri, 14 Oct 2011 16:48:43 +0000 (09:48 -0700)]
Various bug fixes and cleanups to STP library.
- Don't apply endian conversions to flags, which are 8 bits.
- Use #defines for default times for use outside library.
- Clarify our behavior when in STP_DISABLED state.
- Add "aux" member to STP port struct to be able to refer back to
the owning port.
- Define macros to print STP bridge and port ids.
- New helper function to get port id.
- New helper function to convert speed to cost.
- New functions to describe current role of port.
Add back 802.1D Spanning Tree Protocol (STP) library code.
At one point, the OVS distribution contained an IEEE 802.1D Spanning
Tree Protocol (STP) library written by Ben Pfaff and based on the
802.1D-1998 reference code. It was never integrated into ovs-vswitchd,
so it was removed as part of commit ba18611 (Remove vestigial support
for Spanning Tree Protocol.)
This commit reintroduces the library, cleans up a few spots, and makes
it build cleanly against new code. A future commit will have
ovs-vswitchd use this library.
Justin Pettit [Mon, 17 Oct 2011 17:27:35 +0000 (10:27 -0700)]
ofproto-dpif: Update bundle when OFPPC_NO_FLOOD changed.
When the OFPPC_NO_FLOOD flag is toggled on the port, the "floodable"
member of the bundle was not updated. This would cause OFPP_NORMAL to
not include the proper ports when flooding. With this commit,
OFPPC_NO_FLOOD changes will cause the floodable members to be
recalculated.
Jesse Gross [Fri, 21 Oct 2011 22:19:33 +0000 (15:19 -0700)]
datapath: Fix uninitialized variable warning.
Commit 4edb9ae90e4092f5f56b9d914d2b88783c49860d "datapath: Refactor
actions in terms of match fields." introduced a spurious warning
because the compiler thinks a value might not have been assigned to
'err'. In practice this can't happen because we've already validated
the actions.
CC: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
Ben Pfaff [Fri, 21 Oct 2011 22:34:25 +0000 (15:34 -0700)]
vport-capwap: Fix use-after-free on error path.
I originally meant just to fix the use of kfree_skb() instead of
consume_skb() on the success path, but then I realized that the failure
path returned an skb that it had just freed.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Thu, 20 Oct 2011 04:33:44 +0000 (21:33 -0700)]
Implement new fragment handling policy.
Until now, OVS has handled IP fragments more awkwardly than necessary. It
has not been possible to match on L4 headers, even in fragments with offset
0 where they are actually present. This means that there was no way to
implement ACLs that treat, say, different TCP ports differently, on
fragmented traffic; instead, all decisions for fragment forwarding had to
be made on the basis of L2 and L3 headers alone.
This commit improves the situation significantly. It is still not possible
to match on L4 headers in fragments with nonzero offset, because that
information is simply not present in such fragments, but this commit adds
the ability to match on L4 headers for fragments with zero offset. This
means that it becomes possible to implement ACLs that drop such "first
fragments" on the basis of L4 headers. In practice, that effectively
blocks even fragmented traffic on an L4 basis, because the receiving IP
stack cannot reassemble a full packet when the first fragment is missing.
This commit works by adding a new "fragment type" to the kernel flow match
and making it available through OpenFlow as a new NXM field named
NXM_NX_IP_FRAG. Because OpenFlow 1.0 explicitly says that the L4 fields
are always 0 for IP fragments, it adds a new OpenFlow fragment handling
mode that fills in the L4 fields for "first fragments". It also enhances
ovs-ofctl to allow users to configure this new fragment handling mode and
to parse the new field.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Bug #7557.
Pravin B Shelar [Fri, 21 Oct 2011 21:38:54 +0000 (14:38 -0700)]
datapath: Refactor actions in terms of match fields.
Almost all current actions can be expressed in the form of
push/pop/set <field>, where field is one of the match fields. We can
create three base actions and take a field. This has both a nice
symmetry and avoids inconsistencies where we can match on the vlan
TPID but not set it.
Following patch converts all actions to this new format.
Pravin B Shelar [Fri, 21 Oct 2011 21:16:04 +0000 (14:16 -0700)]
tunnel: hh_cache access cleanup
Following patch cleanup hh_cache access by avoiding hh pointer fetching
most of time. Now hh is read and checked at beginning of function. All
hh->hh_len access are done inside hh_lock.
This is required cleanup for next patch which adds support for kernel
3.1.
Ben Pfaff [Thu, 29 Sep 2011 17:39:49 +0000 (10:39 -0700)]
test-lockfile: Provide better diagnostics on failure.
We spotted one failure of the "lock_timeout_runs_out" test several builds
ago, but there weren't enough diagnostics to track it down and I couldn't
reproduce it.
This commit should make the failure easier to understand if it recurs.
Ben Pfaff [Sun, 9 Oct 2011 22:52:21 +0000 (15:52 -0700)]
ofproto-dpif: Make OFPAT_ENQUEUE to input port do nothing.
This makes OFPAT_ENQUEUE consistent with OFPAT_OUTPUT for the purpose of
sending a packet back out the input port: both only do it if the port is
given as OFPP_IN_PORT.
Ben Pfaff [Tue, 27 Sep 2011 20:12:04 +0000 (13:12 -0700)]
learn: Check learn actions after parsing in learn_parse().
learn_parse() and learn_check() are supposed to apply the same checks, but
they are implemented very differently. It seems best to have learn_parse()
actually call learn_check() just to be sure.
This would have caught the bug fixed in the previous commit, because
the tests actually contain instances of "learn" actions that trigger the
bug, but the tests only parsed the actions without ever doing anything
that checked them (like sending them to ovs-vswitchd over OpenFlow).
Ben Pfaff [Tue, 27 Sep 2011 20:10:58 +0000 (13:10 -0700)]
learn: Allow read-only fields to be matched.
nxm_dst_check() requires a writable field. Since NX_LEARN_DST_MATCH only
matches on a field and doesn't write to a field, use nxm_src_check() for
that case instead.
Bug #7507. Reported-by: Michael Mao <mmao@nicira.com>
Ben Pfaff [Tue, 18 Oct 2011 16:29:54 +0000 (09:29 -0700)]
ovsdb: Remove dead Python-related code.
Initial versions of commit 8cdf034974 "python: Implement write support in
Python IDL for OVSDB" converted the OVSDB schemas to Python code so that
their Python clients could just import them. The final version instead
read the schemas from a file, but I forgot to remove some code that
generated the Python schema modules. This commit removes that code.
Ben Pfaff [Mon, 17 Oct 2011 18:32:23 +0000 (11:32 -0700)]
datapath: Fix tunnel reconfiguration that does not change key data.
Without this commit, a pair of commands like
ovs-dpctl add-if br0 gre0,type=gre,remote_ip=192.168.5.2,csum=true
ovs-dpctl set-if br0 gre0,csum=false
would result in a csum of "true" for gre0, that is, the second command
would silently have no effect. This could also happen when the key data
(such as remote_ip) changed but the port hash just happened to have the
same value.
This also fixes a small kernel memory leak in this case.
An upcoming commit implements the "ovs-dpctl set-if" command mentioned
above.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
datapath: Assert IFF_TX_SKB_SHARING on internal devices.
Linux 3.1 adds a flag to check whether it's OK for shared skbs to
be transmitted on devices. This generally isn't a problem for
hardware devices but software devices such as OVS that hold state
in the skb need to clear the flag, which is enabled by default.
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
datapath: Add version check for struct netdev_ops.
Linux 3.1 drops the symbol HAVE_NET_DEVICE_OPS that lets us know
whether struct netdev_ops is present. As a result, we need to
replace it with an explicit version check.
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>