Ethan Jackson [Thu, 12 May 2011 01:13:35 +0000 (18:13 -0700)]
cfm: Replace recv_time with a flag.
This makes the code more obviously correct in my opinion.
This patch also removes timer_enabled_at() along with its only
user.
Ethan Jackson [Thu, 12 May 2011 00:50:16 +0000 (17:50 -0700)]
cfm: No longer keep track of bad CCMs.
According to the 802.1ag specification, reception of a CCM from an
unexpected source should trigger a fault. This patch causes the CFM
module to simply warn instead. There are several reasons for this
change outlined below.
- Faults can cause controllers to make potentially expensive
changes to the network topology.
- Faults can be maliciously triggered by crafting invalid CCMs.
- With this patch, cfm->fault and rmp->fault are only updated in
cfm_run() making the code easier to debug and reason about.
Ethan Jackson [Thu, 12 May 2011 00:55:41 +0000 (17:55 -0700)]
cfm: No longer trigger fault upon unexpected ccm_interval.
According to the 802.1ag specification, when a CCM is received
which advertises a misconfigured transmission interval, a fault
should be triggered. This patch goes against the spec by simply
warning when this happens. This is done for several reasons.
- Faults can cause controllers to make potentially expensive
changes in the network topology.
- Faults can be maliciously triggered by crafting invalid CCMs.
- Reducing the number of places in the code where rmp->fault and
cfm->fault are changed makes the code easier to debug and
reason about.
Ben Pfaff [Tue, 10 May 2011 18:38:24 +0000 (11:38 -0700)]
bridge: Keep default Ethernet address stable between runs.
In some circumstances the bridge can't find a stable physical Ethernet
address to use, so until now it has just picked a random Ethernet address.
In these circumstances, therefore, the bridge Ethernet address would change
from one ovs-vswitchd run to another. But OVS does have a stable
identifier for a bridge: its UUID. This commit changes to use that as the
default bridge Ethernet address.
The datapath ID is sometimes derived from the bridge Ethernet address, so
this change also makes the bridge Ethernet address more stable.
CC: Natasha Gude <natasha@nicira.com>
Bug #5594.
Jesse Gross [Tue, 10 May 2011 18:48:36 +0000 (11:48 -0700)]
datapath: Pull data into linear area only on demand.
We currently always pull 64 bytes of data (if it exists) into the
skb linear data area when parsing flows. The theory behind this
is that the data should always be there and it's enough to parse
common flows. However, this causes a number of problems in
different situations. The first is that it is not enough to handle
IPv6 so we must pull additional data anyways. However, the main
problem is that GRO typically allocates a new skb and puts just the
headers in there. For a typical TCP/IPv4 packet there are 54 bytes
of headers, which means that we must possibly reallocate and copy
on every packet. In addition, GRO creates frag_lists with this
specific geometry in order to allow later segmentation if the packet
is forwarded to a device that does not support frag_lists. When
we pull additional data it changes the geometry and causes later
problems for the device. This patch instead incrementally pulls
data, which avoids these problems.
Signed-off-by: Jesse Gross <jesse@nicira.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Justin Pettit [Tue, 10 May 2011 06:30:07 +0000 (23:30 -0700)]
xenserver: Fix bugs related to using xe-switch-network-backend in spec file.
Commit
daf2ebb (xenserver: Use xe-switch-network-stack in RPM spec
file.) changed the spec file to use xe-switch-network-backend instead of
directly modifying "/etc/xensource/network.conf". It incorrectly
assumed that the command was in the search path. It also didn't take
into account that the command will remove the "openvswitch" service with
chkconfig. This commit fixes those errors.
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Ben Pfaff [Tue, 10 May 2011 16:17:37 +0000 (09:17 -0700)]
stream-ssl: Improve messages when configuring SSL if it is unsupported.
Previously, if --private-key or another option that requires SSL support
was used, but OVS was built without OpenSSL support, then OVS would fail
with an error message that the specified option was not supported. This
confused users because it made them think that the option had been removed:
http://openvswitch.org/pipermail/discuss/2011-April/005034.html
This commit improves the error message: OVS will now report that it was
built without SSL support. This should be make the problem clear to users.
Reported-by: Aaron Rosen <arosen@clemson.edu>
Feature #5325.
Ben Pfaff [Tue, 10 May 2011 16:15:44 +0000 (09:15 -0700)]
INSTALL.XenServer: Document Open vSwitch boot process on XenServer.
Inspired by a conversation with David Erickson <derickso@stanford.edu>.
Ben Pfaff [Mon, 9 May 2011 17:29:51 +0000 (10:29 -0700)]
ovs-vsctl: Issue warning for likely erroneous "get" commands.
Suggested-by: Reid Price <reid@nicira.com>
Feature #5527.
Ethan Jackson [Sat, 7 May 2011 00:02:02 +0000 (17:02 -0700)]
bridge: Don't configure QoS without Queues.
It doesn't make sense to create a QoS object without any queues.
Before this patch, OVS would configure the QoS object and as a
result drop all traffic going through the affected interface. With
this patch, OVS will simply clear QoS configuration on the
interface.
Bug #5583.
Ethan Jackson [Mon, 2 May 2011 20:15:59 +0000 (13:15 -0700)]
ofproto: Resubmit statistics improperly account during failover.
In some cases, when a facet's actions change because it resubmits
into a different rule, it will account all packets it as accrued
in the datapath to the new rule. Due to the algorithm we are
using, it is acceptable for a facet to miscount at most 1 second
worth of packets in this manner. This patch implements the proper
behavior.
Generally speaking, when a facet is facet_put__() into the
datapath, the kernel returns the old flow's statistics so they may
be accounted for in user space. These statistics are generally
pushed down to the relevant facet's resubmit children. Before this
patch, facet_put__() did not compensate for the fact that many of
the statistics in the datapath may have been already pushed.
Thus the entire packet count stored in the datapath would be pushed
to its children instead of simply the packets which have accrued
since the last accounting. This patch fixes the behavior by
subtracting already accounted for packets from the statistics
returned by the datapath.
Ethan Jackson [Thu, 5 May 2011 23:52:56 +0000 (16:52 -0700)]
lacp: New "lacp-heartbeat" mode.
This commit creates a new heartbeat mode for LACP. This mode
treats LACP as a protocol simply for monitoring link status. It
strips out most of the sanity checks built into the protocol.
Addition of this mode makes "lacp-force-aggregatable" and
"lacp-strict" options obsolete so they are removed.
Ethan Jackson [Thu, 5 May 2011 23:01:11 +0000 (16:01 -0700)]
bond: Create new "bond-stable-id".
Stable bonding mode needs an ID to guarantee consistent slave
selection decisions across ovs-vswitchd instances. Before this
patch, we used the lacp-port-id for this purpose. However, LACP
places restrictions on how lacp-port-ids can be allocated which may
be inconvenient. This patch creates a special purpose
bond-stable-id other_config setting which allows users to tweak
this value directly.
Ethan Jackson [Thu, 5 May 2011 21:27:38 +0000 (14:27 -0700)]
bond: Convert stb_id to 32bit parameter.
The 16 bits currently in use is artificially restrictive.
Justin Pettit [Wed, 4 May 2011 06:16:46 +0000 (23:16 -0700)]
xenserver: Better document scriplet action in RPM spec file.
Justin Pettit [Wed, 27 Apr 2011 02:58:19 +0000 (19:58 -0700)]
xenserver: Use xe-switch-network-stack in RPM spec file.
The proper way to switch the networking back-end is to use the
"xe-switch-network-stack" command rather than directly modifying
"/etc/xensource/network.conf". Use that method in the spec file.
Ben Pfaff [Wed, 4 May 2011 22:47:27 +0000 (15:47 -0700)]
ofp-util: Fix validation of OFPAT_SET_VLAN_PCP actions.
Found by sparse.
Ben Pfaff [Wed, 4 May 2011 20:46:21 +0000 (13:46 -0700)]
DESIGN: Move in-band control design discussion here.
It seems more likely that interested users and administrators will be able
to find it here.
Ben Pfaff [Wed, 4 May 2011 16:58:30 +0000 (09:58 -0700)]
ovs-tcpundump: Document that ovs-appctl sends ofproto/trace command.
Suggested-by: Reid Price <reid@nicira.com>
Bug #5538.
Ben Pfaff [Tue, 3 May 2011 18:03:08 +0000 (11:03 -0700)]
xenserver: Don't remove network.dbcache on uninstall.
network.dbcache was introduced by Open vSwitch for its own purposes, but
it has now migrated into the base install of XenServer, which uses it
whether Open vSwitch is installed or not, so we should no longer remove it
on package uninstall.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Bob Ball <bob.ball@citrix.com>
Ben Pfaff [Tue, 3 May 2011 17:30:17 +0000 (10:30 -0700)]
ovs-brcompatd: Document bug.
Reported-by: Gregor Schaffrath <grsch@net.t-labs.tu-berlin.de>
Ben Pfaff [Tue, 3 May 2011 17:51:06 +0000 (10:51 -0700)]
xenserver: Use .../extra not .../kernel/extra for kernel modules.
On XenServer, depmod.conf causes modules in /lib/modules/$(uname -r)/extra
to take priority over standard modules. Unfortunately, we were installing
our modules in /lib/modules/$(uname -r)/kernel/extra, which isn't special.
This commit fixes the problem.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Bob Ball <bob.ball@citrix.com>
Ethan Jackson [Mon, 2 May 2011 23:33:01 +0000 (16:33 -0700)]
vswitchd: Update schema version number.
Quite a few changes to LACP and bonding have gone in recently which
allowed additional other_config parameters on ports and interfaces.
These changes should have updated the vswitch.ovsschema version
number.
Requested-by: Jeremy Stribling <strib@nicira.com>
Ben Pfaff [Thu, 28 Apr 2011 20:02:15 +0000 (13:02 -0700)]
ovs-dpctl: Add -s option to print packet and byte counters.
Ben Pfaff [Thu, 28 Apr 2011 18:13:53 +0000 (11:13 -0700)]
netdev-linux: New functions for converting netdev stats formats.
An upcoming commit will introduce another function that needs to convert
between rtnl_link_stats64 and netdev_stats, so it seemed best to just add
functions to do the conversion.
Andrew Evans [Sun, 1 May 2011 17:18:45 +0000 (10:18 -0700)]
tunneling: Add DF inherit and default flags to set of public tunnel flags.
Signed-off-by: Andrew Evans <aevans@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Andrew Evans [Sat, 30 Apr 2011 00:05:58 +0000 (17:05 -0700)]
tunneling: Add df_default and df_inherit tunnel options.
Split existing pmtud tunnel option's functionality into three. Existing pmtud
option still exists, but now governs only whether datapath sends ICMP frag
needed messages. New df_inherit option controls whether DF bit is copied from
packet inner header to outer tunnel header. New df_default option controls
whether DF bit is set if inner packet isn't IP or if df_inherit is disabled.
Suggested-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Andrew Evans <aevans@nicira.com>
Feature #5456.
Ethan Jackson [Fri, 29 Apr 2011 20:12:19 +0000 (13:12 -0700)]
dpif-linux: Recycle leaked ports.
When ports are deleted from the datapath they need to be added to
an LRU list maintained in dpif-linux so they may be reallocated.
When using vswitchd to delete the ports this happens automatically.
However, if a port is deleted directly from the datapath it is
never reclaimed by dpif-linux. If this happens often, eventually
no ports will be available for allocation and dpif-linux will fall
back to using the old, kernel implemented, allocation strategy.
This commit fixes the problem by automatically reclaiming ports
missing from the datapath whenever the list of ports in the
datapath is dumped.
Bug #2140.
Ethan Jackson [Fri, 29 Apr 2011 00:13:50 +0000 (17:13 -0700)]
datapath: Remove dead code in queue_control_packets().
Fixes the following warning:
datapath.c:473:6: warning: variable 'port_no' set but not used
[-Wunused-but-set-variable]
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Ben Pfaff [Fri, 29 Apr 2011 17:49:06 +0000 (10:49 -0700)]
datapath: Drop parameters from execute_actions().
It's (almost) always easier to understand a function with fewer parameters,
so this removes the now-redundant sw_flow_key and actions parameters from
execute_actions(), since they can be found through OVS_CB(skb)->flow now.
This also necessarily moves loop detection into execute_actions().
Otherwise, the flow's actions could have changed between the time that the
loop was detected and the time that it was suppressed, which would mean
that the wrong (version of the) flow would get suppressed.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Thu, 28 Apr 2011 23:54:07 +0000 (16:54 -0700)]
datapath: Make every packet passing through the datapath have an sw_flow.
This way, it's always possible to get a packet's key or hash simply by
looking at its 'flow', without considering whether the packet came from
userspace or from a vport.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Thu, 28 Apr 2011 23:34:56 +0000 (16:34 -0700)]
datapath: Avoid freeing wild pointer in corner case.
In odp_flow_cmd_new_or_set(), if flow_actions_alloc() fails in the "new
flow" case, then flow_put() will kfree() the new flow's 'sf_acts' pointer,
but nothing has initialized that pointer. Initialize the pointer to NULL
to avoid the problem.
Found by inspection.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Thu, 28 Apr 2011 23:13:39 +0000 (16:13 -0700)]
datapath: No need to zero cb anymore in odp_packet_cmd_execute().
Before commit
3f19d399f "datapath: Fix mysterious GRE-over-IPSEC problems,"
'packet' in opd_packet_cmd_execute() was an skb cloned from one created by
Netlink, so its cb member wasn't necessarily zeroed. But that commit
changed 'packet' to be freshly allocated with __dev_alloc_skb(), which
means that cb is zeroed, so we don't have to do it again.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Justin Pettit [Wed, 27 Apr 2011 15:46:38 +0000 (08:46 -0700)]
ovs-monitor-ipsec: Allow IKE fragmentation
Some (broken) firewalls do not properly pass UDP fragments, which will
prevent IKE from completing. This commit enables the racoon option to
allow application-level fragmenting and allow security associations to
be created.
Andrew Evans [Thu, 28 Apr 2011 01:58:16 +0000 (18:58 -0700)]
datapath: Make git ignore linux-2.6/vlan.c.
Signed-off-by: Andrew Evans <aevans@nicira.com>
Jesse Gross [Thu, 14 Apr 2011 20:10:09 +0000 (13:10 -0700)]
datapath: Backport DIV_ROUND_UP.
Older kernels didn't define DIV_ROUND_UP, so this provides a
backported version.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Ethan Jackson [Tue, 26 Apr 2011 22:39:58 +0000 (15:39 -0700)]
lacp: Allow configurable aggregation keys.
Users will the ability to manually set aggregation keys on a
per-slave basis in order to use some of the more advanced LACP
features. Most notably, LACP controlled active-backup bonding
requires fine grained aggregation key configuration.
Ethan Jackson [Tue, 26 Apr 2011 22:05:19 +0000 (15:05 -0700)]
lacp: New other_config setting "lacp-force-aggregatable".
In some extremely advanced situations, one may want to force
non-bondable slaves to advertise themselves as bondable. This
patch adds that capability.
Also includes some minor code cleanup.
Ethan Jackson [Wed, 27 Apr 2011 00:32:41 +0000 (17:32 -0700)]
ofproto: Remove unused variable.
Fixes the following warning:
ofproto/ofproto.c:4176:30: error: variable 'pin' set but not used
[-Werror=unused-but-set-variable]
Ethan Jackson [Wed, 27 Apr 2011 00:28:44 +0000 (17:28 -0700)]
connmgr: Remove unused variable.
Fixes the following warning:
ofproto/connmgr.c:396:11: error: variable 'ss_exists' set but not
used [-Werror=unused-but-set-variable]
Andrew Evans [Tue, 26 Apr 2011 20:58:35 +0000 (13:58 -0700)]
vswitch.xml: s/switchs/switches/g
Ethan Jackson [Thu, 21 Apr 2011 20:55:45 +0000 (13:55 -0700)]
bond: New bond-hash-basis setting.
Ethan Jackson [Mon, 25 Apr 2011 23:06:54 +0000 (16:06 -0700)]
bridge: Create new "null" interface type.
Null interfaces are completely ignored by Open vSwitch.
Ben Pfaff [Tue, 26 Apr 2011 16:42:18 +0000 (09:42 -0700)]
Remove support for obsolete "tun_id_from_cookie" extension.
The "tun_id_from_cookie" OpenFlow extension predated NXM and supports only
a fraction of its features. Nothing (at Nicira, anyway) uses it any
longer. Support for it had been broken since January and it took until a
few days ago for anyone to complain, so it cannot be too important. This
commit removes it.
Ben Pfaff [Thu, 21 Apr 2011 23:38:05 +0000 (16:38 -0700)]
tests: Add ovs-openflowd to programs that need valgrind wrappers.
The tests run ovs-openflowd so "make check-valgrind" should run it under
valgrind.
Ben Pfaff [Thu, 21 Apr 2011 23:37:38 +0000 (16:37 -0700)]
bridge: Remove slaves from the bond before closing their netdevs.
A bond slave has a pointer to its iface's netdev, so we don't want it to
keep that pointer after the bridge closes the netdev.
This is becoming a bit of a mess so perhaps we need reference counting for
netdevs (although Jesse didn't like the idea when I proposed it before).
Ben Pfaff [Thu, 21 Apr 2011 23:34:51 +0000 (16:34 -0700)]
bond: Be more careful about adding and removing netdevs in the monitor.
The code was careless about updating the netdev_monitor. Newly added
slaves weren't added to the monitor until the next bond_reconfigure() call,
and netdevs were never removed from the monitor.
Ben Pfaff [Thu, 21 Apr 2011 23:25:41 +0000 (16:25 -0700)]
ofproto: Adjust netdev_monitor when switching netdevs.
This fixes a segfault in the "ofproto - mod-port" test. The segfault
should not occur--there must be a bug in the netdev_monitor or possibly
the netdev_dummy implementation--but the netdev_monitor_remove() and
netdev_monitor_add() calls are definitely wanted here in any case to ensure
that the new netdev, not the old one, is what gets monitored.
Ben Pfaff [Wed, 13 Apr 2011 18:10:44 +0000 (11:10 -0700)]
bridge: Tolerate missing Port and Interface records for local port.
Until now, ovs-vswitchd has been unable to configure IP addresses and
routes for bridges whose Bridge records lack a Port and an Interface
record for the bridge's local port (e.g. OFPP_LOCAL, the port with the
same name as the bridge itself). When such a bridge was reconfigured,
ovs-vswitchd would output a log message that worried people.
This commit fixes the internal limitation that led to the message being
printed.
Bug #5385.
Ben Pfaff [Wed, 20 Apr 2011 20:48:11 +0000 (13:48 -0700)]
ofproto: Rework and fix bugs in port change detection.
The OpenFlow port change detection code in update_port() is supposed to
send out an OFPT_PORT_STATUS message whenever an OpenFlow port is added or
removed or changes in some way. This commit fixes a number of bugs that
have persisted until now.
First, if a port with a given name is removed from the datapath and a new
port with the same name but a different port number is added to the
datapath, then update_port() would report this as a port "modify" change.
Reporting this as a "modify" seems likely to confuse controllers, which
have no reason to realize that the old port was deleted and may not
understand why a port that has not been reported as added would be
modified. (This scenario is more likely than before, because the Linux
datapath implementation no longer quickly reuses port numbers. This
problem has actually been reported in testing.) This commit fixes the
problem by changing update_port() to report a "delete" of the old port
followed by an "add" of the new port.
Second, suppose that a datapath initially has "eth1" on port 1 and "eth2"
on port 2. Then, "eth1" gets removed and "eth2" is reassigned to port 1.
If update_port() is first passed "eth2", then the old implementation would
have sent out an OpenFlow "modify" notification instead of "delete"
followed by "add", which is the same as the previous scenario. But as a
further wrinkle, it would have failed to remove "eth1", which meant that we
ended up with two "ofports" with port number 1! This commit fixes this
problem too.
Reported-by: David Tsai <dtsai@nicira.com>
Bug #5466.
NIC-372.
Ben Pfaff [Wed, 20 Apr 2011 20:03:45 +0000 (13:03 -0700)]
ofproto: Consistently use netdev's name instead of ofp_phy_port name.
There are at least two ways to get an ofport's name: from the netdev using
netdev_get_name() or from the ofp_phy_port's 'name' member. Some code used
one, some used the other. This switches all relevant code to use only
netdev_get_name(), because the 'name' member in ofp_phy_port is
fixed-length and thus a long name could be truncated.
This isn't a problem under Linux since the maximum length of a network
device's name under Linux is the same as the field width in ofp_phy_port.
Ben Pfaff [Thu, 21 Apr 2011 16:22:39 +0000 (09:22 -0700)]
socket-util: Use portable solution for setting Unix socket permissions.
Requested-by: Jesse Gross <jesse@nicira.com>
Ethan Jackson [Wed, 20 Apr 2011 22:53:58 +0000 (15:53 -0700)]
bond: BM_STABLE consistent hashing.
This patch converts stable bonds from modulo n based hashing to
Highest Random Weight based hashing. This hashing strategy only
redistributes 1/n_slaves traffic when a slave is enabled or
disabled. It also turns out to have a vastly simpler
implementation.
Ethan Jackson [Wed, 20 Apr 2011 23:01:28 +0000 (16:01 -0700)]
bond: New flag "bond_revalidate".
Used in future patches.
Ben Pfaff [Fri, 8 Apr 2011 19:40:49 +0000 (12:40 -0700)]
INSTALL.Linux: Mention that SSL options require building with SSL support.
Reported-by: Aaron Rosen <arosen@clemson.edu>
Ethan Jackson [Wed, 20 Apr 2011 01:02:53 +0000 (18:02 -0700)]
bond: Revalidate no_slaves_tag when revalidating everything.
Ethan Jackson [Wed, 20 Apr 2011 00:19:25 +0000 (17:19 -0700)]
bond: Give stable bonds one tag.
Stable bonds require all flows to be revalidated when anything
changes. Instead of giving each slave a tag, and ORing them
together. This commit creates one tag representing the entire
bond. This will cause less false positives when deciding which
flows to revalidate.
Ben Pfaff [Mon, 11 Apr 2011 18:22:39 +0000 (11:22 -0700)]
bridge: Avoid memory leak from RSPAN mirrors in bridge_destroy().
Mirrors that output to ports will be destroyed when their output ports are
destroyed, but mirrors that output to VLANs ("RSPAN" mirrors) don't get
automatically destroyed like this and we need to take care of them in a
separate loop.
Ethan Jackson [Tue, 19 Apr 2011 21:11:23 +0000 (14:11 -0700)]
bond: bond_stb_enable_slave() never triggered.
bond_stb_enable_slave() depended on bond->stb_slaves being
nonnull. However, bond_stb_enable_slave() is responsible for
initializing this parameter. Thus none of it's logic ever ran.
Ethan Jackson [Mon, 18 Apr 2011 19:22:12 +0000 (12:22 -0700)]
lacp: Implement custom timing mode.
With this patch, the LACP module may be manually configured to use
an arbitrary transmission rate set in the database.
Ethan Jackson [Mon, 18 Apr 2011 19:48:59 +0000 (12:48 -0700)]
lacp: Remove LACP_[FAST|SLOW]_TIME_RX macros.
The receive rate for a LACP packets is simply 3 times the
transmission rate. It doesn't make sense to maintain separate
macros for these values especially since future patches will allow
arbitrary transmission rates.
Ethan Jackson [Mon, 18 Apr 2011 19:33:14 +0000 (12:33 -0700)]
lacp: Move LACP packet data to lacp header file.
Ben Pfaff [Mon, 18 Apr 2011 17:11:43 +0000 (10:11 -0700)]
ofp-util: Properly handle "tun_id"s in tun_id_from_cookie flows.
Just setting the tun_id field isn't enough--it's also necessary to set
the tun_id_mask. Otherwise the call to cls_rule_zero_wildcarded_fields()
at the end of ofputil_cls_rule_from_match() will zero out the tun_id again.
This was broken by commit
8368c090cab "Implement arbitrary bitwise masks
for tun_id field" back in January. (This makes me wonder whether we can
drop support for tun_id_from_cookie now.)
Reported-by: Dan Wendlandt <dan@nicira.com>
Ben Pfaff [Mon, 18 Apr 2011 18:24:50 +0000 (11:24 -0700)]
socket-util: Properly set socket permissions in make_unix_socket().
Under Linux, at least, bind and fchmod interact for Unix sockets in a way
that surprised me. Calling fchmod() on a Unix socket successfully sets the
permissions for the socket's own inode. But that has no effect on any
inode that has already been created in the file system by bind(), because
that inode is not the same as the one for the Unix socket itself.
However, if you bind() *after* calling fchmod(), then the bind() takes the
permissions for the new inode from the Unix socket inode, which has the
desired effect.
This also adds a more portable fallback for non-Linux systems.
Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Ethan Jackson [Sat, 16 Apr 2011 00:03:37 +0000 (17:03 -0700)]
bridge: LACP port ID and system ID in database.
Extremely advanced users may want fine grained control over the
LACP port and system IDs of a bond. This would be extremely
unusual for the average user, so this patch puts the configuration
parameters in other_config of the relevant tables.
Ethan Jackson [Mon, 18 Apr 2011 22:13:34 +0000 (15:13 -0700)]
lacp: New "strict" lacp mode.
When LACP negotiations are unsuccessful, OVS falls back to standard
balance-slb bonding. In some cases, users may want to require
successful LACP negotiations for any slaves to be enabled at all.
This patch implements a new "strict" mode which disables all slaves
when LACP negotiations are unsuccessful.
Ethan Jackson [Mon, 18 Apr 2011 22:32:30 +0000 (15:32 -0700)]
lacp: Update attached status more often.
The attached status of slaves should be updated when certain global
configuration settings change, or when a slave is destroyed.
Ben Pfaff [Thu, 7 Apr 2011 21:39:36 +0000 (14:39 -0700)]
vlog: Fix VLOG and VLOG_RL macros' treatment of LEVEL argument.
These macros expanded the LEVEL argument without protecting it with
parentheses, which meant that an argument like 'cond ? VLL_DBG : VLL_WARN'
did not have the desired effect (and caused a GCC warning).
This commit fixes the problem and avoids expanding LEVEL more than once,
too.
Ben Pfaff [Fri, 8 Apr 2011 19:52:23 +0000 (12:52 -0700)]
bridge: Fix VLAN selection mirroring logic.
The logic here did not make sense. A packet arriving on a port is mirrored
if the port is a mirroring source port AND (not OR) the packet is in one of
the VLANs that is mirrored.
This test has been here since the mirroring code was introduced. It seems
to me that it was never correct.
Ben Pfaff [Tue, 29 Mar 2011 18:16:31 +0000 (11:16 -0700)]
bridge: Reintroduce log message that was lost (and wrong).
Setting the 'mac' in the Interface record for a bridge's local port has
always been ineffective, but the log message was suppressed because of a
check at too high of a level. This commit fixes the problem. It also
fixes the wording of the log message, which has been obsolete since the
introduction of the database.
Finally, it seems better to check for the local port before checking for a
multicast address, so this reverses the order of the checks.
Ben Pfaff [Tue, 5 Apr 2011 19:17:08 +0000 (12:17 -0700)]
daemon: Reduce log level of "pid file is stale" message.
This message will appear repeatedly when ovs-vswitchd is running, if there
is any stale pidfile in /var/run/openvswitch, because ovs-vswitchd reads
all of the pidfiles in that directory periodically to update statistics.
Ben Pfaff [Tue, 5 Apr 2011 21:17:55 +0000 (14:17 -0700)]
bridge: Initialize mirrors' uuid member.
Otherwise mirrors get destroyed and re-created on every reconfiguration.
Ben Pfaff [Tue, 5 Apr 2011 22:58:06 +0000 (15:58 -0700)]
ofproto: Avoid memory leak in classifier on destruction.
ofproto_flush_flows() flushes the flow table but then it reintroduces flows
required by fail-open or in-band. These are then leaked when the
classifier is destroyed a little later.
This fixes the problem by not reintroducing these flows when ofproto is
being destroyed.
Ethan Jackson [Mon, 18 Apr 2011 23:17:46 +0000 (16:17 -0700)]
bond: Fix ugly warnings at slave registration.
Before this patch, when a slave was registered for this first time
the following warning would display.
interface (null): enabled
This is because the slave was enabled before having its name
configured.
Ethan Jackson [Mon, 18 Apr 2011 23:14:58 +0000 (16:14 -0700)]
bond: Properly indent appctl output.
Ethan Jackson [Wed, 13 Apr 2011 23:06:50 +0000 (16:06 -0700)]
bridge: Report lacp_slave_is_current() in the database.
Whether or not a given slave is current with its LACP protocol
messages can be very interesting to a controller. If an interface
is not current, it usually indicates a connectivity problem or
misconfiguration of some sort.
Ethan Jackson [Fri, 15 Apr 2011 19:57:30 +0000 (12:57 -0700)]
bridge: Generalize CFM rate limiter.
In future patches, lacp status will need to be written to the
database in a rate limited manner. It doesn't make sense to run
two parallel rate limiters. This patch renames the CFM rate
limiter to something more generic.
Ethan Jackson [Wed, 13 Apr 2011 22:44:37 +0000 (15:44 -0700)]
lacp: New function lacp_slave_is_current().
Used in future patches.
Ben Pfaff [Fri, 15 Apr 2011 16:40:50 +0000 (09:40 -0700)]
bridge: Properly test for out-of-range values.
This code was trying to check for priorities greater than UINT16_MAX and
reset them, but it assigned the value to a uint16_t before it checked it,
which of course hid the problem.
Fixes the following GCC warning:
vswitchd/bridge.c:3034: warning: comparison is always false due to limited
range of data type
Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Ben Pfaff [Fri, 15 Apr 2011 16:39:08 +0000 (09:39 -0700)]
Avoid warnings about comparisons that are always true.
The range of "enum" types varies from one ABI to another. If the enums
being tested in these functions happen to be 16 bits wide, then GCC may
issue a warning because, in such a case, the comparison is always true.
Using an int instead of a uint16_t avoids that particular problem and
should suppress the warning.
Fixes the following reported warnings:
lib/ofp-print.c:240: warning: comparison is always true due to limited
range of data type
lib/ofp-util.c:1973: warning: comparison is always false due to limited
range of data type
Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Ben Pfaff [Fri, 15 Apr 2011 16:31:36 +0000 (09:31 -0700)]
Fix calls to ctype functions.
The ctype functions often need casts to be fully C standards compliant.
Here's the full explanation that I used to post to comp.lang.c from time
to time when the issue came up:
With the to*() and is*() functions, you should be careful to cast
`char' arguments to `unsigned char' before calling them. Type `char'
may be signed or unsigned, depending on your compiler or its
configuration. If `char' is signed, then some characters have
negative values; however, the arguments to is*() and to*() functions
must be nonnegative (or EOF). Casting to `unsigned char' fixes this
problem by forcing the character to the corresponding positive value.
This fixes the following warnings from some version of GCC:
lib/ofp-parse.c:828: warning: array subscript has type 'char'
lib/ofp-print.c:617: warning: array subscript has type 'char'
Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Ethan Jackson [Fri, 15 Apr 2011 18:06:02 +0000 (11:06 -0700)]
bridge: Destroy bond when port is destroyed.
Ethan Jackson [Thu, 14 Apr 2011 23:50:26 +0000 (16:50 -0700)]
bond: Completely pull LACP module out of bond.
The bonding code only needs to know whether a given slave may be
enabled, and whether LACP has been negotiated on the bond. Instead
of passing in the LACP handle and letting the bond query this
information. This patch passes in the information directly.
Ethan Jackson [Fri, 15 Apr 2011 00:37:29 +0000 (17:37 -0700)]
bond: Create new 'stable_id' parameter.
For BM_STABLE bonds, instead of choosing the sort key in the
qsort() comparator, this patch makes it a configuration setting of
each slave. This will help wrest LACP out of the bonding code
further in future patches.
Ethan Jackson [Thu, 14 Apr 2011 00:58:26 +0000 (17:58 -0700)]
bond: Give bridge control over LACP module.
Before this patch, the bonding code had taken over responsibility
for running the LACP module. However, the bonding code only needs
the LACP module for some basic status queries. LACP and bonding
are actually logically parallel modules and do not really have a
parent child relationship. Furthermore, we need to be able to run
LACP on non-bonded interfaces which the existing approach
prevented. This patch gives control of the LACP module back to the
bridge.
Ethan Jackson [Thu, 14 Apr 2011 22:24:18 +0000 (15:24 -0700)]
lacp: Remove enabled flag.
The enabled flag in the LACP module was only used to set the
Collecting and Distributing flags in the LACP protocol. It was
intended to be set by the bonding code to mimic its enabled flag.
The spec is relatively vague on the precise meaning of these flags,
and most implementations do something completely different with
them. For these reasons, it seems acceptable to remove the enabled
flag for the sake of simplicity. A slave is now Collecting and
Distributing if it is attached, or LACP couldn't be negotiated.
Ben Pfaff [Thu, 14 Apr 2011 17:22:21 +0000 (10:22 -0700)]
vswitchd: Document how to disable inactivity probes.
This has always been implemented but it was not documented until now.
Reported-by: Alex Yip <alex@nicira.com>
Ethan Jackson [Tue, 12 Apr 2011 21:15:46 +0000 (14:15 -0700)]
bond: New bonding mode "stable".
Stable bonds attempt to assign a given flow to the same slave
consistently.
Ethan Jackson [Tue, 12 Apr 2011 20:39:32 +0000 (13:39 -0700)]
bond: New function bond_is_balanced().
As new bond modes are added, it will be nice to have the logic
indicating whether or not a given bond mode requires rebalancing in
one place.
Ethan Jackson [Wed, 13 Apr 2011 21:55:19 +0000 (14:55 -0700)]
lacp: New function lacp_slave_get_port_id().
Will be used in future commits.
Ethan Jackson [Tue, 12 Apr 2011 22:15:32 +0000 (15:15 -0700)]
bond: Use bond_enable_slave at slave registration.
Slave registration should go through the normal slave enabling
facilities instead of doing it by hand. Before this patch, newly
created slaves would have no tag associated with them.
Furthermore, any further changes to how slaves are enabled would
not be picked up by the registration code.
Ethan Jackson [Wed, 13 Apr 2011 20:56:37 +0000 (13:56 -0700)]
bond: Reset bond_entry's during massive flow revalidations.
When all flows in a bond are revalidated, stale bond_entry's can
cause incorrect load balancing. These issues will naturally
resolve themselves overtime. However, it's better to deal with
them immediately.
Ethan Jackson [Wed, 13 Apr 2011 01:28:04 +0000 (18:28 -0700)]
bond: Revalidate flows when bond_is_tcp_hash() changes;
If LACP causes the return of bond_is_tcp_hash to change for
whatever reason, all flows should be revalidated because they will
have a different hash result.
Ethan Jackson [Wed, 13 Apr 2011 00:53:24 +0000 (17:53 -0700)]
bond: Reconfigure flows when bond mode changes.
Changes in the bonding mode can cause drastic changes in flow
assignments to slaves. This commit causes all flows in a bridge
to be revalidated when bond_reconfigure() changes its bonding mode.
This approach is a bit aggressive, but bond reconfiguration
shouldn't happen often.
Ben Pfaff [Tue, 12 Apr 2011 18:43:11 +0000 (11:43 -0700)]
configure: Add option --enable-Werror to add -Werror to CFLAGS.
-Werror is useful for development, but it screws up configure because it's
impossible to guess what new warnings compilers will add in the future.
This commit adds a new configure option to add CFLAGS after the configure
checks are done.
The use of AC_CONFIG_COMMANDS_PRE is based on Eric Blake's suggestion on
the autoconf mailing list: "AC_CONFIG_COMMANDS_PRE probably fits the bill
as the ideal macro to use for guaranteeing that you inject your shell code
at the last possible moment."
Requested-by: Andrew Evans <aevans@nicira.com>
Ethan Jackson [Tue, 12 Apr 2011 20:20:13 +0000 (13:20 -0700)]
xenserver: Fix typo in RPM install message.
Ethan Jackson [Tue, 12 Apr 2011 01:33:06 +0000 (18:33 -0700)]
xenserver: Don't openvswitch-xapi-update in bridge mode.
This commit causes the init scripts not to call the
openvswitch-cfg-update plugin when in bridge mode.
Ethan Jackson [Tue, 12 Apr 2011 01:29:02 +0000 (18:29 -0700)]
xenserver: Warn when upgrading OVS on a bridged system.
Ben Pfaff [Tue, 12 Apr 2011 18:31:58 +0000 (11:31 -0700)]
ovsdb-idl: Suppress "delete" operations for garbage-collected tables.
Deciding what delete operations to issue on garbage-collected tables has
been a bit of a difficult issue for ovs-vsctl. When garbage collection was
introduced in commit
c5f341a "ovsdb: Implement garbage collection",
ovs-vsctl did not issue any deletions for these tables at all. As a side
effect, ovs-vsctl did not notice that records were going to be deleted.
That meant that when multiple commands were issued in one ovs-vsctl run,
ovs-vsctl could get confused by apparent duplicate records that did not
in fact exist. Commit
28a14bf "ovs-vsctl: Back out garbage collection
changes" fixed the problem by putting all of the explicit deletions back
into ovs-vsctl.
However, adding these explicit deletions had the price that it then became
(again) impossible to use ovs-vsctl commands to delete duplicates, for
example to use "ovs-vsctl del-br" to delete a bridge that points to the
same Port records that some other Bridge record also does. This commit
makes that possible again, by implementing a compromise:
* Internally, ovs-vsctl deletes the records that it believes should be
deleted.
* ovsdb-idl suppresses the deletions when it makes the RPC call into
the database server.
Bug #5358.
Reported-by: Henrik Amren <henrik@nicira.com>
Ethan Jackson [Mon, 11 Apr 2011 23:17:39 +0000 (16:17 -0700)]
tests: Unit test autopath via ovs-ofctl.
This patch adds test designed to verify the correctness of the
parsing function introduced with the autopath action.