vswitchd: Enable updating resolv.conf by default when using discovery
When vSwitch does discovery, it is supposed to update resolv.conf by
default. The way configuration parameters were being read, it would
disable this update by default.
Justin Pettit [Tue, 30 Jun 2009 22:24:54 +0000 (15:24 -0700)]
vswitch: Set minimum probe interval to 5 seconds
In vSwitch, the minimum probe interval is supposed to be 5 seconds, but
that was not enforced. If no interval was specified in the config file,
a value of 0 was being used, which would cause probes to never be sent
and the rconn not to move out of its ACTIVE state.
Justin Pettit [Fri, 26 Jun 2009 19:39:50 +0000 (12:39 -0700)]
xenserver: Remove cacert when user reconfigures the controller
If a user moves from one controller to another, we did not remove the
cacert. This prevents the switch from connecting to the new controller.
To ease confusion, we now delete the cacert when the user changes or
removes the controller in xsconsole.
Note: This commit has a minor security issue, since we do not remove
trust for the old certificate until the switch is restarted. In
general, users should only be connected to trusted servers, so the
impact should be low. Fixes this would require larger changes to the
vconn-ssl code, which we don't want to do so late in the release cycle.
Justin Pettit [Thu, 25 Jun 2009 04:52:34 +0000 (21:52 -0700)]
xenserver: Validate controller IP address in xsconsole
When a switch is using in-band control, the controller must be specified
in dotted quad format, since DNS names cannot be resolved until a
connection to the controller has been established. This commit
validates the user input in the xsconsole plugin.
Justin Pettit [Thu, 25 Jun 2009 01:03:44 +0000 (18:03 -0700)]
vswitchd: Adding and removing mgmt interface breaks connection
When a managment connection is configured and then removed, putting it
back causes the management connection to never be reestablished. The
management code checks whether the configuration file has changed before
it attempts to reconfigure itself. If the only thing that changed was
the lack of a management connection, then it tore down the connection
but didn't update its view of the configuration. When the same
manager IP is configured, the cached version matches the new version, so
no changes are made. This commit clears the cached version, so that a
removing and then adding the manager will be detected as a change.
Ben Pfaff [Tue, 23 Jun 2009 18:00:43 +0000 (11:00 -0700)]
ovs-brcompatd: Handle XS Tools 5.0.0 destroying and recreating devices
XenServer Tools version 5.0.0 destroys and recreates network devices with
the same name on boot of (at least) Windows VMs. We had a race such that
ovs-brcompatd would delete the new device from the vswitchd configuration
file (not the old one). This commit fixes that problem.
Justin Pettit [Sat, 20 Jun 2009 00:41:42 +0000 (17:41 -0700)]
vswitchd: Reduce number of calls to reconfigure() during mgmt updates
When we receive an OpenFlow management protocol Config Update, we
immediately force the switch to reconfigure itself. This is
functionally correct, but it can cause long delays before return control
back to the switch. We now keep track of whether there were any changes
and then only force a reconfigure once per management run.
Ben Pfaff [Sat, 20 Jun 2009 00:13:57 +0000 (17:13 -0700)]
cfg: Log accurate waiting times in cfg_lock().
When cfg_lock() has to block for some time to obtain the configuration file
lock, it logs the amount of time that it waited. However, it did not
refresh the current time before it began waiting, so the time that it
logged could be off by a significant amount, which make interpreting the
log file more challenging than it should have been.
This change should mainly affect log output. It should have little or no
effect on Open vSwitch operation because the factor by which the timeouts
were off is an order of magnitude smaller than the actual timeouts that we
pass into the function.
This is related to bug #1426, but it is not a fix for this bug, which will
be committed separately.
Justin Pettit [Thu, 18 Jun 2009 21:17:32 +0000 (14:17 -0700)]
xenserver: xsconsole plugin doesn't need execute permissions
When the vSwitch xsconsole plugin is installed, it doesn't need execute
permissions. This commit changes the permissions from 755 to 644 to
match the other plugins.
Justin Pettit [Thu, 18 Jun 2009 21:13:00 +0000 (14:13 -0700)]
xenserver: Handle slave disconnection more gracefully in xsconsole plugin
When a slave cannot connect to the master, the vSwitch xsconsole plugin
complained with some Python style errors on the main display. This
commit cleans up that behavior.
Justin Pettit [Tue, 16 Jun 2009 19:57:25 +0000 (12:57 -0700)]
xenserver: Force reload of config file after VIF deleted
When a VIF is deleted, the "vif" script modifies "/etc/ovs-vswitchd.conf".
After changes are made to the config file, ovs-vswitchd should be told
to reload it, but this wasn't happening. Now it does.
Ben Pfaff [Mon, 15 Jun 2009 23:03:28 +0000 (16:03 -0700)]
Replace SHA-1 library with one that is clearly licensed.
The SHA-1 library that we used until now was taken from RFC 3174. That
library has no clearly free license statement, only a license on the text
of the RFC. This commit replaces this library with a modified version of
the code from the Apache Portable Runtime library from apr.apache.org,
which is licensed under the Apache 2.0 license, the same as the rest of
Open vSwitch.
Ben Pfaff [Mon, 15 Jun 2009 19:14:47 +0000 (12:14 -0700)]
vswitch: Avoid segfault when revalidating ARP flows.
The 'packet' argument to process_flow() is allowed to be null, but some of
the code was assuming that it was always non-null, which caused a segfault
while revalidating ARP flows.
Justin Pettit [Fri, 12 Jun 2009 01:30:41 +0000 (18:30 -0700)]
xenserver: Fix key used to identify network UUID
The "dump-vif-details" script adds the network UUID to the
ovs-vswitchd.conf file. Unfortunately, it wrote the key as
"network-uuid", but the code that retrieves it for the management
protocol checked our "net-uuid". The script now uses the key
"net-uuid".
Ben Pfaff [Thu, 11 Jun 2009 18:33:39 +0000 (11:33 -0700)]
xenserver: Pass network UUID to controller for internal networks too.
vNetManager needs to know the xapi UUIDs for the networks that correspond
to OpenFlow connections. For some time now we have passed these to it
over the management connection using bridge.<bridgename>.xs-network-uuids
configuration keys, but only now did we notice that this didn't get set for
internal networks.
The reason that it didn't get set is that interface-reconfigure is the
script that sets up these configuration keys, but interface-reconfigure
is never called for internal networks. Instead, xapi creates them itself
using directly calls to bridge ioctls. So no amount of tweaks to
interface-reconfigure will help.
This commit fixes the problem by modifying the vif script instead. This
works acceptably only because xapi is lazy about creating bridges for
internal networks: it creates them only just before it is about to add the
first vif to them. Thus, by setting up the configuration key in the vif
script, it gets added just after the bridge itself is created. There is
a race, of course, meaning that there may be a delay between the initial
OpenFlow connection and the time when the configuration key is set up,
but vNetManager can tolerate that.
Justin Pettit [Thu, 11 Jun 2009 08:58:52 +0000 (01:58 -0700)]
vswitch: Add support for large OFMP messages
OpenFlow uses a 16-bit field to describe the message length, which
limits messages to a maximum 65535 bytes. Some of the messages passed
by the management protocol may be larger than this, so a general
Extended Data message has been added to management protocol. It
encapsulates a single giant OpenFlow-like message, and breaks it into
however many vaild smaller ones are required.
Justin Pettit [Wed, 10 Jun 2009 20:00:10 +0000 (13:00 -0700)]
vswitch: Fix memory leak when OFMP resource updates are sent
When a resource update message is generated by vSwitch, it creates a
couple of svec objects that need to be explicitly destroyed. This
wasn't happening, so memory would leak after each resource update. This
commit properly destroys them after use.
Ben Pfaff [Wed, 10 Jun 2009 22:24:03 +0000 (15:24 -0700)]
vswitch: Fix handling of multicast packets received by bonds.
As long as bonding has been implemented, the vswitch has refused to learn
from multicast packets that arrive on a bond slave if it has already
learned any other port for that source MAC, because it is likely that we
sent the packet out ourselves and are only now receiving a copy of it on
our active slave.
This is entirely correct, but it does not go far enough. In fact, the
bridge needs to entirely drop such packets. Otherwise, a host whose MAC
is assigned to a slave other than the active slave will receive a second
copy of multicast packets that it sends out the bond, and other ports
will receive two copies of every multicast packet sent by such a host.
This commit implements this new policy, which simplifies the code at the
same time.
Ben Pfaff [Wed, 10 Jun 2009 21:16:40 +0000 (14:16 -0700)]
Fix glibc 2.7 strtok_r() bug in a more permanent fashion.
The glibc 2.7 headers contain a bug that causes strtok_r() to segfault
in some circumstances. Until now, we have been working around this
problem at each invocation, but this depends on the programmer to remember
to do so each time.
This commit instead adds a shim that adds a work-around to the string.h
header itself, so that it is much more difficult to miss the workaround.
Justin Pettit [Wed, 10 Jun 2009 06:32:30 +0000 (23:32 -0700)]
vswitch: Clarify what "ingress" means in policing
The man page for ovs-vswitchd.conf explains how ingress policing works.
However, what "ingress" means is a bit confusing depending on the
perspective. For vSwitch, it's from the switch's perspective. This
means on a PIF, it's the rate traffic comes into the box. On a VIF,
it's the rate traffic can be *transmitted* from a VM. This commit
clarifies the man page a bit.
Justin Pettit [Wed, 10 Jun 2009 01:19:02 +0000 (18:19 -0700)]
xenserver: Send VIF details to controller
The controller needs to know various things about virtual interfaces as
they move about the network. This commit sends the VIF, virtual
machine, and network UUIDs associated with the VIF, as well as its MAC
address over the management channel.
Justin Pettit [Tue, 9 Jun 2009 22:46:50 +0000 (15:46 -0700)]
Xen: Fixes for core handling configuration
An improper string comparison operator was used to check whether
FORCE_COREFILES was enabled. Further, the check to enable core files
was only down when vswitch was started, and not when restarted.
Ben Pfaff [Tue, 9 Jun 2009 21:22:52 +0000 (14:22 -0700)]
Remove "dpkg-buildpackage" test from "make distcheck".
Now the Debian packaging is regularly tested via the autobuilder, so there
is less need to do it from "make distcheck", and not doing it saves time
there.
Ben Pfaff [Tue, 9 Jun 2009 21:19:53 +0000 (14:19 -0700)]
Fix behavior of simultaneous "make" and "make dist".
We were distributing lib/dirs.c, which doesn't make sense, but in any case
it created a race between "make" and "make dist" in updating lib/dirs.c,
which showed up in the Debian package build (which runs build-indep and
build-arch in parallel).
Also, clean lib/dhparams.c.
This should fix the failure seen in build openvswitch843.
Ben Pfaff [Mon, 8 Jun 2009 19:26:27 +0000 (12:26 -0700)]
vswitch: Send gratuitous learning packets when bond slaves go down.
When a bond slave goes down, all of the MACs that were on it are migrated
to another slave, but this is not apparent to the switch that the bond is
connected to until each MAC sends out a packet. This causes incoming
traffic for a given MAC to be dropped until the MAC sends out a packet.
This is not usually a problem, because traffic is not ordinarily one-way,
and we can't avoid losing some packets in some cases, but we can do a
little better by sending out a gratuitous learning packet on the new slave
as soon as we know about it, and that is what this commit implements.
Ben Pfaff [Mon, 8 Jun 2009 19:20:38 +0000 (12:20 -0700)]
mac-learning: Make data structures public.
The vswitchd bonding code needs to iterate through the table entries to
be able to send out gratuitous learning packets when bond slaves go down.
It might be best to create an abstract interface to the MAC learning table,
but this commit does the simpler thing and exposes the data structures in
the header file.
Justin Pettit [Fri, 5 Jun 2009 21:50:08 +0000 (14:50 -0700)]
vswitch: Fix OFMP alignment problem on 64-bit systems.
One of the OpenFlow managment protocol's UUID TLV messages had a problem
building on 64-bit systems. By extending the structure length by 4
bytes, the problem goes away.
Ben Pfaff [Fri, 5 Jun 2009 21:28:39 +0000 (14:28 -0700)]
vswitch: Enable bond slaves based on carrier status, not up/down.
Whether a bond slave is enabled should be based on whether the device's
PHY sees carrier, not based on whether the device is configured up or down.
(Note that a device that is configured down will always see "no carrier").
Otherwise a device that is up but has no carrier will initially be enabled,
which does not make sense.
This has no effect on interfaces that are not bond slaves, because the
"enabled" setting is used only by bond slaves.
Ben Pfaff [Fri, 5 Jun 2009 21:08:36 +0000 (14:08 -0700)]
xenserver: Bring up bond slave device before adding to bond.
Until now, we've added network devices to the ovs-vswitchd configuration
file before bringing them up. This works suboptimally for bond slaves,
because vswitchd takes the initial carrier state of the bond slaves as
whether to initially enable or disable them, and a device that is down
always reports "no carrier". So this commit changes interface-reconfigure
to bring up bond slaves before adding them to the configuration file,
which gives them a chance to detect carrier before vswitchd checks for it.
This might still be an imperfect situation, because it takes quite a while
(maybe 1 second?) for some network devices to detect carrier after being
brought up. But the kernel implementation of bonding seems to do the very
same thing, so we should be at least no worse than it.
Incidentally, this is only important for bonds that have long updelays.
XenServer uses an updelay of 31 seconds (!), so it is especially important
there.
Justin Pettit [Fri, 5 Jun 2009 19:13:37 +0000 (12:13 -0700)]
vswitch: Send Xen UUIDs associated with system and networks
This commit sends information about Xen UUIDs to the controller through
the management connection. Specifically, it sends the XenServer UUID
and a list of network UUIDs associated with each datapath.