Ben Pfaff [Mon, 27 Apr 2009 23:56:44 +0000 (16:56 -0700)]
secchan: Remove unused parameter from ofproto_add_flow().
The 'packet != NULL' case was effectively dead, since every caller passed
a constant NULL here, so delete the parameter and the code to handle the
non-NULL case.
Ben Pfaff [Wed, 29 Apr 2009 22:36:44 +0000 (15:36 -0700)]
secchan: Eliminate UNKNOWN_SUPER.
When a super-rule is destroyed, secchan must reassess each of its subrules.
Each subrule might now have no super-rule (which we suspect is the common
case) or it might have a new super-rule.
Until now, secchan has "optimized" this reassessment by initially assigning
each of the deleted super-rule's subrules a super-rule of UNKNOWN_SUPER,
which is not a valid rule at all. It did this in the hope that the
subrule would get deleted before we need to know what its super-rule is.
However, this has repeatedly led to bugs, since it's not always obvious
what code will need to find a rule's super-rule.
This commit fixes the problem by removing the "optimization" (in quotes
because there is no evidence that it was a useful optimization in
practice).
Ben Pfaff [Tue, 28 Apr 2009 17:28:03 +0000 (10:28 -0700)]
classifier: Make classifier_for_each() easier to use.
classifier_for_each() and classifier_for_each_match() previously had the
restriction that the callback could not delete any rule that would be
visited in the same call, even if it was in a different table (except for
the rule actually passed to the callback). But a number of callers do
want to delete rules in other tables, and it is easy to eliminate that
restriction, so this commit does so.
Ben Pfaff [Wed, 29 Apr 2009 22:28:43 +0000 (15:28 -0700)]
secchan: Reduce redundancy in handle_odp_msg().
Code cleanup.
Ben Pfaff [Mon, 27 Apr 2009 21:28:54 +0000 (14:28 -0700)]
secchan: Fix OpenFlow matching on output port with OFPFC_DELETE.
The implementation of matching on out_port was only half-implemented for
OFPFC_DELETE. It was probably just overlooked. This commit fixes it, by
supplying the other half.
Ben Pfaff [Wed, 29 Apr 2009 22:27:46 +0000 (15:27 -0700)]
secchan: Update byte, packet counts for packets switched by hand.
Sometimes packets can get passed down to userspace, in which case secchan
has to send them using dpif_execute(). When this happened we weren't
updating the packet or byte counters. Fix this.
Ben Pfaff [Fri, 1 May 2009 17:20:21 +0000 (10:20 -0700)]
datapath: Eliminate synchronize_rcu() in table swap.
We found out some time ago that synchronize_rcu() can block for multiple
seconds in some cases, so it's a good idea to eliminate as many of them
as we can.
This commit eliminates a call to synchronize_rcu() from functions that
expand or flush flow tables. To avoid adding a member to dp_table that
specifies the "free_flows" argument to dp_table_destroy(), the commit
uses two different callback functions and manually inlines dp_table_swap()
into its callers.
Bug #1233.
Ben Pfaff [Fri, 1 May 2009 17:20:35 +0000 (10:20 -0700)]
datapath: Eliminate synchronize_rcu() in port group update.
We found out some time ago that synchronize_rcu() can block for multiple
seconds in some cases, so it's a good idea to eliminate as many of them
as we can.
This removes such a call in set_port_group(). This requires adding an
rcu_head to the data structure for port groups; since until now we've just
used the same "struct odp_port_group" exported to userspace, this means
that we need to introduce a new "struct dp_port_group" for internal use,
which in turn causes a fair bit of code motion.
Bug #1233.
Ben Pfaff [Thu, 30 Apr 2009 19:57:20 +0000 (12:57 -0700)]
datapath: Fix memory leak in port group.
When we destroy a datapath, we need to free its port groups also.
This is a fairly small memory leak: a few hundred bytes, at most, and
it only occurred each time a datapath was destroyed.
Ben Pfaff [Thu, 30 Apr 2009 21:42:38 +0000 (14:42 -0700)]
leak-checker: Stop logging after fstat() fails.
When fstat() fails, we should either stop logging or re-set the leak
checker hooks. The previous code didn't do either.
Ben Pfaff [Thu, 30 Apr 2009 21:45:30 +0000 (14:45 -0700)]
leak-checker: Stop logging after an output error.
In particular it's not polite to continue trying to write to the output
file after ENOSPC, since it will immediately fill up the disk again should
anyone free up any space and keeping the log file open prevents usefully
deleting it.
Ben Pfaff [Thu, 30 Apr 2009 21:37:19 +0000 (14:37 -0700)]
leak-checker: Make output line-buffered.
Unbuffered output was ideal from the viewpoint of getting the maximum
amount of output when the process was killed, but it causes a dozen or
more system calls per log entry. Line buffering should be a reasonable
compromise.
Ben Pfaff [Thu, 30 Apr 2009 21:00:06 +0000 (14:00 -0700)]
brcompatd: Fix formatting of /proc/net/vlan files.
The C source file that I copped this from originally didn't spell out the
tab as \t, thus it was very difficult to see.
Thanks for Justin for pointing this out.
Ben Pfaff [Thu, 30 Apr 2009 20:59:08 +0000 (13:59 -0700)]
brcompat: Use named macro in place of literal constants.
Thanks to Justin for the suggestion.
Ben Pfaff [Thu, 30 Apr 2009 20:46:44 +0000 (13:46 -0700)]
datapath: Break up GSO packets before sending to userspace.
On a Xen host, over-MTU GSO packets from virtual machines can end up sent
down by the virtual switch to userspace. This happens, for example, if a
TCP flow has a long enough "pause" that the datapath flow times out. When
this happens, the packet is not marked as GSO when secchan sends it back up
via dpif_execute(), and the packet is then discarded in dp_xmit_skb() as
too large.
This commit solves the problem by breaking GSO packets into MTU-size pieces
before passing them along to userspace.
Tested by running "netperf" between two VMs on different boxes and running
"dpctl dp-del-flows" on the appropriate datapath a few times in the middle
and seeing that the total bandwidth didn't change much. Verified that
packets were actually being broken up by adding a printk call inside the
"if (skb_is_gso())" block.
Thanks to Justin and Keith for review.
Bug #1133.
Justin Pettit [Wed, 29 Apr 2009 22:43:57 +0000 (15:43 -0700)]
Fix policing performance issues with VIFs.
Policing is configured with the "tc" command. By default, it picks up
the MTU from the interface having policy applied. When a guest operating
systems is configured for segmentation offloading, the packets handed to
DOM0 may be substantially larger than the MTU. The policing code was
dropping these packets, which caused performance to dive. We now
configure policing with an MTU of 64K, which solves the problem.
Thanks to Ben for diagnosing the problem.
Keith Amidon [Wed, 29 Apr 2009 19:05:28 +0000 (12:05 -0700)]
Fix vswitch init script "restart" and "update-modules" options
These options are not guaranteed to work reliably but are useful in
some situations, especially during development. These changes fix
problems introduced by the combination of the vswitch and brcompatd
init files.
To make it clear that behavior may not be sane after a restart, a big
warning has been added and explicit user confirmation is requested
before the action is implemented.
Keith Amidon [Wed, 29 Apr 2009 16:50:53 +0000 (09:50 -0700)]
Fix copy-paste errors when combining vswitchd & brcompatd init scripts
There were a couple of places where copied functionality from one
script was properly updated to work in the combined script.
Keith Amidon [Wed, 29 Apr 2009 16:43:32 +0000 (09:43 -0700)]
Properly refer to brcompatd pidfile in init script stop option
When the init script attempted to stop brcompatd it was using the
wrong variable name to find the PID file and thus not obtaining a PID
and not stopping brcompatd.
Ben Pfaff [Tue, 28 Apr 2009 17:37:37 +0000 (10:37 -0700)]
Fix "make dist" by adding forgotten headers to the makefiles.
Ben Pfaff [Fri, 24 Apr 2009 18:12:10 +0000 (11:12 -0700)]
brcompat: Add /proc/net/vlan, /proc/net/bonding compatibility support.
This adds a kernel interface, controlled by userspace through Generic
Netlink, to create, modify, and delete files in /proc/net/vlan and
/proc/net/bonding, plus vswitch support for updating files in those
directories to fit better into legacy environments that expect specific
files to appear in those directories.
We hope that the need for this support will be temporary.
Keith Amidon [Mon, 27 Apr 2009 22:48:24 +0000 (15:48 -0700)]
Stop attempting to add mgmt interface flows at boot time.
With the change to the bridging code so that it does not change the
state of interfaces when they are added to the bridge, this no longer
appears to help in any case I've tested.
Keith Amidon [Mon, 27 Apr 2009 18:09:52 +0000 (11:09 -0700)]
Initial cut at merging vswitch and vswitch-brcompatd init files.
Ben Pfaff [Mon, 27 Apr 2009 22:05:24 +0000 (15:05 -0700)]
vswitch: Don't bring up interfaces when adding them to datapaths.
Xen expects that the bridge doesn't bring up interfaces when they get
added to a datapath, so bringing them up in our emulation was causing
problems on XenServer. Keith in particular reports that this commit fixed
boot on XenServer when the management interface was configured to get an
IP address via DHCP.
This change might cause trouble or surprise for other users who do expect
interfaces to be brought up when added to a vswitch, but Keith didn't see
any new problems on XenServer.
Bug #1259.
Ben Pfaff [Fri, 24 Apr 2009 23:47:23 +0000 (16:47 -0700)]
vswitch: Fix typo in manpage.
Ben Pfaff [Fri, 24 Apr 2009 23:46:14 +0000 (16:46 -0700)]
vswitch: By default, operate standalone when controller connection fails.
The default was previously to "fail secure" (by not passing any traffic)
when the controller could not be reached, but we came to consensus that it
is better to switch traffic in a standalone mode in this case.
Ben Pfaff [Thu, 23 Apr 2009 18:33:35 +0000 (11:33 -0700)]
brcompat: Add comments to netlink header.
Ben Pfaff [Thu, 23 Apr 2009 20:39:19 +0000 (13:39 -0700)]
brcompatd: Make vars used only in brcompatd.c "static".
Ben Pfaff [Thu, 23 Apr 2009 18:23:43 +0000 (11:23 -0700)]
brcompat: Check for null pointer before reading netlink attribute.
Netlink policy parsing only checks that, if an attribute is present, then
its format is correct. It doesn't ensure that attributes are present, so
an explicit check is needed, which this commit adds.
Ben Pfaff [Thu, 23 Apr 2009 21:42:27 +0000 (14:42 -0700)]
vswitch: Fetch interface MAC when creating an interface in iface_create().
iface_create() creates an interface but failed to initialize its MAC
address. (Fortunately, this was only used by STP, which has not been
known to be tested recently anyhow.)
This is also needed for /proc/net/bonding and /proc/net/vlan, hence fixing
the bug now.
Justin Pettit [Wed, 22 Apr 2009 00:23:37 +0000 (17:23 -0700)]
Have NetFlow account for first buffered packet of new flow (Bug #1162).
The record-keeping for NetFlow didn't track the buffered packet
associated with a flow add command. We now pull the relevant data from
the buffered packet and add it to the flow rule stats.
Ben Pfaff [Mon, 20 Apr 2009 16:56:27 +0000 (09:56 -0700)]
brcomapt: Delete VLANs and bonding entries for deleted ports.
Otherwise these entries can hang around past reboot and cause trouble
later as vif numbers are reused.
Probably another part of the full solution is to delete the whole
configuration file on reboot.
Bug #1216.
Ben Pfaff [Fri, 17 Apr 2009 22:00:55 +0000 (15:00 -0700)]
datapath: Fix Xen performance when adding a VLAN tag in presence of GSO.
When the datapath needed to add a VLAN tag to a GSO packet, it would stick
it on the front of the packet and pass it along. Then GSO would later fail
because it didn't know how to segment an 802.1Q packet. So we need to
segment GSO packets by ourselves before we put the 802.1Q header on them.
We could avoid this problem if we could patch the main kernel, either to
add GSO support to the VLAN protocol or to support hardware-accelerated
VLAN tagging without VLAN groups configured).
Bug #1231.
Ben Pfaff [Fri, 17 Apr 2009 21:59:03 +0000 (14:59 -0700)]
datapath: Define ERR_CAST on kernels that don't already have it.
ERR_CAST was introduced in Linux 2.6.25 but it is also backported into the
Red Hat 2.6.18, so we need a configure-time check.
Ben Pfaff [Thu, 16 Apr 2009 22:16:28 +0000 (15:16 -0700)]
datapath: Attempt to checksum packets sent to controller on non-Xen kernel.
Commit
96660ad113 "datapath: Fix up checksum on Xen before forwarding to
controller" made sure that packets sent to the controller were properly
checksummed on Xen, where it happens pretty commonly that they are not.
It seems possible that on non-Xen machines this could also happen, even
though it does not seem to be common, so this commit tries to fix up
packets in that case also.
This commit adds a WARN_ON_ONCE() call to make it clear that it has
triggered. If we ever see this warning, then we should figure out what
triggered it and make sure that this code actually works properly.
Ben Pfaff [Thu, 16 Apr 2009 22:10:26 +0000 (15:10 -0700)]
datapath: Fix VLAN tag insertion actions on Xen.
On Xen, a VM can pass a packet that needs to be checksummed up to Dom0 for
transmission on the wire. In this case, Dom0 is supposed to pick apart
the packet, figure out the protocol, and checksum it before sending it out.
However, this fails if we insert an 802.1Q header, because the Xen routine
that picks apart packets (skb_checksum_setup() in net/core/dev.c) does not
understand 802.1Q. Hence, we must call this function ourselves, before we
add the 802.1Q header.
Fixes bug #1215.
Ben Pfaff [Thu, 16 Apr 2009 21:43:47 +0000 (14:43 -0700)]
datapath: Fix build on 2.6.18, which doesn't have "bool" or "false".
The "bool" type is a relative newcomer to the Linux kernel, and it is
still frowned up by some developers, so instead of adding a definition
to our compatibility headers (which is what we usually do), this commit
changes "bool" to "int".
Ben Pfaff [Thu, 16 Apr 2009 00:21:26 +0000 (17:21 -0700)]
vswitch: Fix indefinite wait on reload.
If a "reload" command was sent to vswitchd via the unixctl library, then
the reconfiguration would not actually happen until another round trip
through the vswitchd poll loop. Ordinarily this happens quickly but if
nothing is going on it can become an indefinite wait.
Fix by forcing another round trip if we need to reconfigure.
Ben Pfaff [Wed, 15 Apr 2009 22:04:10 +0000 (15:04 -0700)]
svec: Avoid calling svec_sort() when it is not necessary.
When we delete an item from a sorted array we just have to move the rest
of the items down to keep it sorted; we don't have to actually re-sort
the whole thing.
Ben Pfaff [Wed, 15 Apr 2009 22:03:14 +0000 (15:03 -0700)]
vswitch: Keep list of old interfaces sorted when reconfiguring ports.
The old_ifaces array must be sorted because we apply svec_contains() to
it, but there was nothing guaranteeing that it was sorted. So add a
call to svec_sort().
Ben Pfaff [Wed, 15 Apr 2009 22:02:02 +0000 (15:02 -0700)]
cfg: Keep configuration sorted when adding entries.
Otherwise later cfg accesses are likely to assert-fail since the
configuration is no longer sorted.
Ben Pfaff [Wed, 15 Apr 2009 17:50:08 +0000 (10:50 -0700)]
datapath: Set only VID when adding a new header with ODPAT_SET_VLAN_VID.
ODPAT_SET_VLAN_VID is supposed to set only the VID field of the VLAN
header. When it was only modifying an existing VLAN header, it was doing
this correctly. However, when it added a new header, it added all of the
bits passed in as the argument, not just the VID field. Fix this, setting
the other bits to 0 implicitly.
Also fixes the analogous problem with ODPAT_SET_VLAN_PCP.
Ben Pfaff [Wed, 15 Apr 2009 17:47:52 +0000 (10:47 -0700)]
vswitch: Strip VLAN headers correctly.
When a packet comes in on a trunk port and goes out on an implicit VLAN
port, we are supposed to strip the VLAN header (because it is implicit).
We were not doing so; instead, we were setting the VLAN field to all-1s.
Strip it properly, instead.
Ben Pfaff [Wed, 15 Apr 2009 17:01:30 +0000 (10:01 -0700)]
dpctl: When parsing actions, don't let "drop" be preceded by other actions.
The dpctl manpage says that "drop" must not be used with other actions,
but we were only checking for other actions *after* it, not just ones
before it.
Ben Pfaff [Wed, 15 Apr 2009 16:57:39 +0000 (09:57 -0700)]
dpif: Remove duplicated functionality.
dpif_flow_flush() does the same thing as dpif_flow_del_all().
Keith Amidon [Tue, 14 Apr 2009 23:41:17 +0000 (16:41 -0700)]
Be more conservative about bringing up interfaces when vswitchd started
Previously we were starting all bridge interfaces when vswitchd
started to help resolve issues in Xen environemnts. However, only
starting the management interface seems to be required. The
information about which interface is the management interface is
available in /etc/xensource-inventory on Xen machines, so use that to
limit the interfaces we bring up.
Justin Pettit [Tue, 14 Apr 2009 06:52:57 +0000 (23:52 -0700)]
Add "dp-del-flows" command to dpctl.
Add ability to delete flows from the datapath. Currently, there is no
way to delete specific flows--it's all or nothing. By deleting flows
from underneath the process that set them up, some confusion may arise.
For vswitchd, this only amounts to a few warning messages, though.
Justin Pettit [Tue, 14 Apr 2009 00:41:33 +0000 (17:41 -0700)]
Add support for explicitly specifying a "drop" action when adding a flow.
When adding a flow entry with dpctl, the user specifies a set of actions
to execute when a match occurs. If none are specified, then the packet
is implicitly dropped by OpenFlow. When dumping these flows, the output
of dpctl shows an action of "drop". However, dpctl did not support
adding a flow with an explicit "drop" action. This fixes that lack of
symmetry.
Justin Pettit [Tue, 14 Apr 2009 00:21:49 +0000 (17:21 -0700)]
Add description of table output to dpctl man page.
Adds a description of the output from the "dump-flows" and
"dump-aggregate" commands of dpctl. Requested by NEC.
Ben Pfaff [Thu, 9 Apr 2009 22:20:06 +0000 (15:20 -0700)]
vswitch: Add unixctl command to reload configuration file synchronously.
The Xen interface-reconfigure script wants to tell vswitchd to reload
its configuration and wait until it is complete. Until now there has
been no way to do this: sending SIGHUP causes a reload, but there is no
way to tell when it is complete. Now "vlogconf -t <socket> -e
vswitchd/reload" does the job.
Ben Pfaff [Thu, 9 Apr 2009 21:32:12 +0000 (14:32 -0700)]
Improve infrastructure for Unix socket-based local management.
"vlog_socket" was essentially a framework for management of a process
over a simple Unix domain socket interface. Unfortunately it was a little
too simple:
* It was not extensible for use by clients other than vlog.
* It was not reliable, since it was based on datagram sockets.
* It tried to hide itself using poll_fd_callback(), instead of exposing
itself through the poll loop as does almost every other entity in
the build tree.
This commit replaces vlog_socket by unixctl, which fixes these problems:
* Arbitrary commands may now be registered.
* Use of stream sockets makes it reliable.
* The interface is exposed to clients.
Ben Pfaff [Wed, 8 Apr 2009 20:46:20 +0000 (13:46 -0700)]
vlog: Make vlog_reopen_log_file() a no-op if no log file is open.
The --log-file option is supposed to be used to create a log file, but
until now, even if this isn't done, --reopen to the vlogconf program will
make it open one. This behavior was unexpected, hence this commit that
prevents it from happening.
Fixes bug #905.
Ben Pfaff [Wed, 8 Apr 2009 20:06:02 +0000 (13:06 -0700)]
vswitch: Fix handling of ARPs received on bonded interfaces.
The vswitch must handle ARPs directed to broadcast that arrived on bonded
interfaces differently based on whether they are ARP requests or replies.
This cannot be done in a flow-based manner using OpenFlow, because
OpenFlow does not distinguish between ARP requests and replies. Thus,
every such packet must be handled separately by the bonding code, and a
flow must not be set up.
Before secchan was integrated into vswitch, this was handled correctly.
This commit restores that correct behavior, by making it possible for
a normal-action callback to signal that the actions must not be used to
set up a flow.
Ben Pfaff [Wed, 8 Apr 2009 17:36:59 +0000 (10:36 -0700)]
secchan: Fix OFPPS_LINK_DOWN detection.
netdev_get_flags() was supposed to return NETDEV_CARRIER if carrier was
detected by the network device PHY, by checking for the IFF_LOWER_UP bit
in the device flags returned by the SIOCGIFFLAGS ioctl. Unfortunately,
IFF_LOWER_UP has value 0x10000 and that ioctl returns a short int, so this
bit was always read as 0, indicating that carrier was off.
There are at least two other ways to get the carrier status. One is via
rtnetlink with RTM_GETLINK. Unfortunately that is only supported on Linux
2.6.19 and up. So we fall back to the other possibility, which is
/sys/net/class/<device>/carrier. I hope that our users mount sysfs.
Ben Pfaff [Wed, 8 Apr 2009 16:45:43 +0000 (09:45 -0700)]
dpif: Optimize no-actions case in dpif_execute().
If there are no actions, then the packet will get dropped in the kernel,
so there's no point in making the system call at all.
Ben Pfaff [Wed, 8 Apr 2009 16:44:52 +0000 (09:44 -0700)]
dpif: Improve dpif_execute() log messages.
Ben Pfaff [Wed, 8 Apr 2009 16:42:00 +0000 (09:42 -0700)]
vswitch: Drop debug print that escaped.
Justin Pettit [Tue, 7 Apr 2009 22:18:16 +0000 (15:18 -0700)]
Remove "section"-style descriptions from vswitchd.conf man page.
Due to our using programs that can modify vswitchd.conf, such as
brcompatd and cfg-mod, we are discouraging the use of "section"-style
configuration. The reason is that these programs prefer the
"dotted"-style, which is easier for a program to manipulate. This
commit changes all examples to use this dotted form.
There are also a number of other cleanups and corrections that have been
made.
Keith Amidon [Tue, 7 Apr 2009 23:49:42 +0000 (16:49 -0700)]
Change paths to match locations used in installs.
Keith Amidon [Tue, 7 Apr 2009 23:48:10 +0000 (16:48 -0700)]
Have vswitchd and brcompatd installed into sbindir
This seems more appropriate given they won't be used by regular users
normally.
Keith Amidon [Tue, 7 Apr 2009 23:35:44 +0000 (16:35 -0700)]
Add appropriate extension to profile.d script.
Keith Amidon [Tue, 7 Apr 2009 23:32:16 +0000 (16:32 -0700)]
Useful path additions, aliases, and functions for vswitch debugging.
Keith Amidon [Tue, 7 Apr 2009 22:08:48 +0000 (15:08 -0700)]
Include cfg-mod man page in extra dist.
Keith Amidon [Tue, 7 Apr 2009 22:08:28 +0000 (15:08 -0700)]
Add vswitch init files to dist target.
Ben Pfaff [Tue, 7 Apr 2009 19:50:40 +0000 (12:50 -0700)]
vlog: Improve log message when rate-limiting.
OpenFlow works with many different kinds of messages, so it can be helpful
to state that specifically *log* messages were dropped. Thanks to Pete
for pointing this out (see bug #1166).
Ben Pfaff [Tue, 7 Apr 2009 19:18:34 +0000 (12:18 -0700)]
vswitch: Let mgmt.fail-mode setting be default for bridge failure mode.
This simplifies configuration, since usually all bridges should fail in
the same way.
Ben Pfaff [Tue, 7 Apr 2009 18:10:56 +0000 (11:10 -0700)]
brcompat: Add support for bonded interfaces; avoid multiple cfg_read() call.s
Bonded interfaces have to be looked up under the bonding.* hierarchy, but
the code here didn't know about that. Also, this was calling cfg_read()
and cfg_write() for every interface to be deleted, which means that our
set of bridges and interfaces could change while we were iterating. In
theory, they shouldn't have, since the file was locked, but that
assumption still made me nervous so I eliminated it.
Ben Pfaff [Tue, 7 Apr 2009 18:08:19 +0000 (11:08 -0700)]
cfg: Avoid doing unnecessary work in cfg_del_match().
It is only necessary to compact and terminate the array if we actually
modified anything.
Ben Pfaff [Tue, 7 Apr 2009 18:07:34 +0000 (11:07 -0700)]
cfg: Always null-terminate the cfg array.
Some functions depend on the cfg array being null-terminated, so be sure
to make it so when modifying the array.
cfg_add_entry() still doesn't sort the array, but it should.
Justin Pettit [Mon, 6 Apr 2009 23:58:43 +0000 (16:58 -0700)]
Use "policing-*" instead of "policing_*" in config.
The keys to enable policing used a "_" to separate words, but everything
else in vswitchd.conf uses a "-". Use a "-" to be consistent.
Justin Pettit [Mon, 6 Apr 2009 23:54:49 +0000 (16:54 -0700)]
Add hack to get around "." delimiter problem with policing vifs.
The vswitchd.conf format uses "." as a delimiter. Unfortunately, vifs
use a "." in their name. The port is specified as part of the key when
ingress policing is enabled, but the cfg parser balks at this. For the
time-being, we check all valid ports to see if they have a policing
policy defined. This is wasteful, but it works until we change the
delimiter.
Ben Pfaff [Fri, 3 Apr 2009 00:12:14 +0000 (17:12 -0700)]
cfg-mod: Add new --del-match option.
Ben Pfaff [Mon, 6 Apr 2009 22:38:30 +0000 (15:38 -0700)]
cfg: Prevent infinite loop in cfg_del_section().
When the last entry in the file was deleted, cfg_del_section() would loop
forever because *p was never set to NULL by svec_del(). (Alternatively,
it could segfault because we were accessing freed memory.)
This better implementation is also O(N) instead of O(N**2).
Ben Pfaff [Mon, 6 Apr 2009 22:36:14 +0000 (15:36 -0700)]
cfg-mod: Complain about non-option arguments, since we don't support any.
Ben Pfaff [Mon, 6 Apr 2009 22:34:35 +0000 (15:34 -0700)]
cfg-mod: Make --help work.
Justin Pettit [Sat, 4 Apr 2009 21:17:43 +0000 (14:17 -0700)]
Use "dp-show" instead of "showdp" in dpctl.
To dump information on all datapaths, dpctl has a "showdp" command. To
be more consistent with other datapath-specific commands, this has been
changed to "dp-show".
Justin Pettit [Sat, 4 Apr 2009 07:06:43 +0000 (00:06 -0700)]
Add support for ingress policing.
This adds support for ingress policing to vswitchd. This allows a user
to limit the rate of traffic entering the switch on a particular port.
This is configured on the physical port, so this a system-wide
configuration value handled through vswitchd.
Justin Pettit [Sat, 4 Apr 2009 06:16:47 +0000 (23:16 -0700)]
NetFlow configuration is no longer is limited to eight collectors.
The vswitch.conf man page stated that at most eight collectors can be
listed per bridge. That restriction has been lifted, so this just
brings the documentation in-line with the implementation.
Justin Pettit [Sat, 4 Apr 2009 05:52:57 +0000 (22:52 -0700)]
Mention SPAN and RSPAN in vswitchd.conf man page.
The terms SPAN and RSPAN are often used in what we call mirroring. This
change points out how to achieve SPAN and RSPAN configurations using our
mirroring syntax.
Justin Pettit [Fri, 3 Apr 2009 21:56:32 +0000 (14:56 -0700)]
Use new vswitchd management settings when they change.
When changes were made to the "mgmt" section of vswitchd.conf, we
weren't noticing changes if the major sections were not modified.
Thanks to Dan for reporting this.
Ben Pfaff [Fri, 3 Apr 2009 00:11:12 +0000 (17:11 -0700)]
cfg-mod: Fix --del-section long option parsing.
Justin Pettit [Thu, 2 Apr 2009 21:05:45 +0000 (14:05 -0700)]
Don't complain when setting STP sysfs values to the default one.
We don't support configuring STP through sysfs. However, Xen tries to
disable STP by writing a zero value to some fields, which is our
default. This change suppresses the warning that we don't support
setting STP sysfs values in those circumstances.
Justin Pettit [Thu, 2 Apr 2009 07:49:01 +0000 (00:49 -0700)]
Add cfg-mod, a vswitchd.conf-style manipulation utility.
This is a first cut of a simple utility for manipulating a
vswitchd.conf-style configuration file. It uses the same locking mechanism
as vswitchd and its related utilities, so it can be used safely on "live"
configurations.
The man page needs a bit more love with deeper explanations and
examples.
Justin Pettit [Wed, 1 Apr 2009 23:44:09 +0000 (16:44 -0700)]
Fix reading wrong value when bad file provided.
When a non-existent config file is specified, we print an error message.
Unfortunately, this was attempting to read the filename from the wrong
variable, so a random pointer was being treated as a string.
Ben Pfaff [Wed, 1 Apr 2009 21:32:50 +0000 (14:32 -0700)]
Log a warning when the interval between poll_block() calls is excessive.
Ben Pfaff [Wed, 1 Apr 2009 17:05:36 +0000 (10:05 -0700)]
Fix failures in unit tests.
All of these unit test failures indicated bugs in the tests, not bugs in
the code under test.
Ben Pfaff [Wed, 1 Apr 2009 16:45:17 +0000 (09:45 -0700)]
Fix typo in manpage.
Ben Pfaff [Wed, 1 Apr 2009 16:40:07 +0000 (09:40 -0700)]
Add missing debian/automake.mk.
This file was previously (before commit
61538212, "boot.sh: Avoid the need
for Git repository information") generated automatically and hence in
.gitignore, so it was easy to forget to add it.
Ben Pfaff [Wed, 1 Apr 2009 00:12:13 +0000 (17:12 -0700)]
Add forgotten header files, to fix "make dist".
Ben Pfaff [Tue, 31 Mar 2009 23:52:57 +0000 (16:52 -0700)]
boot.sh: Avoid the need for Git repository information
It should not be necessary to have a Git repository to run boot.sh; a
checked-out tree should be sufficient. This makes it so.
Some corresponding changes to ext are necessary also.
Ben Pfaff [Tue, 31 Mar 2009 21:46:27 +0000 (14:46 -0700)]
Be more liberal about what constitutes a virtual interface MAC on Xen.
The xapi sources indicate that FE:FE:FE:FE:FE:FE can sometimes be used for
virtual interfaces, in addition to the usual FE:FF:FF:FF:FF:FF, so accept
that (and other similar variants) as well.
Ben Pfaff [Tue, 31 Mar 2009 21:45:02 +0000 (14:45 -0700)]
vswitch: Do not use "xe" on XenServer, to avoid deadlock.
Commit
4ab581b949, "vswitch: Fix duplicated DPIDs observed under
XenServer," changed vswitchd to use the "xe" program to obtain the host
UUID and network name under XenServer. Unfortunately, on XenServer pool
slaves this causes a deadlock, because on such machines "xe" always
attempts to contact the master to perform database queries. Since vswitchd
is the entity that must set up the flow that "xe" initiates as part of
that connection, this will deadlock and fail.
Instead, get the host UUID from /etc/xensource-inventory and hash it with
the bridge name. Discussion with the NOX folks indicates that this should
provide sufficient stability and uniqueness.
Justin Pettit [Mon, 30 Mar 2009 20:46:58 +0000 (13:46 -0700)]
Fix newly introduced newline in brcompatd init script.
Justin Pettit [Mon, 30 Mar 2009 20:31:46 +0000 (13:31 -0700)]
Various fixes for vswitch-brcompatd init script.
Justin Pettit [Mon, 30 Mar 2009 15:58:33 +0000 (08:58 -0700)]
Fix missing newline suppression in vswitchd automake.mk.
Justin Pettit [Mon, 30 Mar 2009 08:17:49 +0000 (01:17 -0700)]
Break bridge compatibility daemon into separate process.
The user-space bridge compatibility code formally was part of the
vswitchd process. For better separation, the bridge compatibility code
has been broken into a separate process, brcompatd.
Justin Pettit [Mon, 30 Mar 2009 08:08:38 +0000 (01:08 -0700)]
Fix skipping of lines when deleting a section with the cfg library.
When deleting a section in the "cfg" library, the cfg_del_section
function would check each line in the configuration to see if it was
part of the section to be deleted. The way it deleted was essentially
to move all future lines "down" to replace the line to be deleted.
However, it always incremented the pointer to the next entry, which
could cause it to skip over other entries that should have been deleted.
We now only increment the pointer if we didn't delete a line.
Keith Amidon [Sat, 28 Mar 2009 00:06:09 +0000 (17:06 -0700)]
New init files to work with separate brcompatd program.
Justin Pettit [Wed, 25 Mar 2009 13:00:59 +0000 (06:00 -0700)]
Return error when multiple writers are modifying vswitchd.conf.
We now have multiple writers of vswitchd.conf. The bridge compatibility
module's attempts to write can now fail due to the file being locked.
This change notifies the caller of that.
Ben Pfaff [Fri, 20 Mar 2009 20:50:51 +0000 (13:50 -0700)]
vswitch: Fix duplicated DPIDs observed under XenServer.
The procedure for choosing a bridge MAC address will, in the most
ordinary case, also choose a unique MAC that we can use as a datapath
ID. In some special cases, though, multiple bridges will end up with
the same MAC address. This is OK for the bridges, but it will confuse
the OpenFlow controller, because each datapath needs a unique datapath
ID, so this commit adds some support for two common special cases on
XenServer where DPIDs were not unique.
It is also very desirable that they be stable from one run to the
next, so that policy set on a datapath "sticks".
The special cases handled by this commit are:
1. A bridge whose MAC address is taken from a VLAN network device
(that is, a network device created with vconfig(8) or similar tool)
will have the same MAC address as a bridge on the VLAN device's
physical network device.
We handle this case by hashing the physical network device MAC
along with the VLAN identifier.
2. A purely internal bridge, that is, one that has no non-virtual
network devices on it at all, is more difficult because it has no
natural unique identifier at all.
When the host is a XenServer, we handle this case by asking "xe"
for the internal bridge's plaintext name (e.g. "Internal Network
1") and hashing that together with the XenServer's host UUID.
When the host is not a XenServer, we punt by using a random MAC
address on each run.