Ben Pfaff [Mon, 18 May 2009 22:29:45 +0000 (15:29 -0700)]
xenserver: Only require confirmation for "vswitch restart" if interactive.
When /etc/init.d/vswitch restart is invoked non-interactively (e.g. from
a cron job), don't require interactive confirmation. Not that we should
encourage such behavior, but this approach seems closer to what most Unix
utilities do in similar situations.
Ben Pfaff [Mon, 18 May 2009 22:32:20 +0000 (15:32 -0700)]
xenserver: Remove now-unsupported commands from /etc/init.d/vswitch.
The "unload" and "update-modules" commands for /etc/init.d/vswitch were
based on the files in /etc/sysconfig/network-scripts. The current
implementation of interface-reconfigure no longer updates those files, so
these commands would no longer work reliably. Worse, they would work
*sometimes* but not other times, so it's better not to offer them at all.
It might make sense to reimplement these, if they are useful enough.
Ben Pfaff [Thu, 21 May 2009 18:18:34 +0000 (11:18 -0700)]
datapath: Disable TX on internal ports before removing.
This is a partial fix for a more pervasive problem, that destroying a
dp_dev races with its transmit work function (dp_dev_do_xmit) running.
A "better" and "correct" fix has been written, but unfortunately it seems
to be buggy and crash the system so far.
Ben Pfaff [Wed, 20 May 2009 21:57:06 +0000 (14:57 -0700)]
xenserver: Fix use of VLAN as primary management interface.
xapi insists that the device that carries the IP address for a VLAN is
the bridge that it thinks the VLAN is on. This commit makes it so.
xapi also will do the ioctl equivalent of "brctl addbr xapi#" if that
bridge appears to be missing when it reconfigures the interface. If we
return EEXIST or any other error, then it gives up at that point. So we
have to return "success" to that attempt regardless of whether we really
want to do so.
The strategy used in that commit for making the primary management
interface on a VLAN possible did not work reliably. Sometimes it would
work for a time, but eventually xapi would start listening only on the IP
address attached to the fake VLAN bridge. Since this is not a real IP
address that can be used to talk to the outside world (and in any case it
isn't the IP address requested by the administrator) xapi would become
unreachable at this point.
Ben Pfaff [Thu, 21 May 2009 16:31:11 +0000 (09:31 -0700)]
brcompat: Move more brcompat implementation into userspace.
Until now, the brcompat kernel module has had to do more of the work of
simulating a bridge than is ideal, because brcompatd was not able to find
out when the vswitchd had finished reloading. It is important that the
bridge reconfiguration be complete by the time that the bridge ioctl
returns, so this had to be done from the kernel.
Now it is possible for brcompatd to wait for the reload to finish (by
using the equivalent of "ovs-appctl -e vswitchd/reload") so this part of
the work can be done in userspace. This commit moves it there.
This commit also moves to userspace some error-checking work, in particular
checking whether a bridge or a port operation is correct. This is
important for an upcoming commit, where brcompatd wishes to send a fake
success return value for an operation that must be ignored. When the error
checking is done in the kernel, it defeats this purpose.
Justin Pettit [Thu, 21 May 2009 05:46:29 +0000 (22:46 -0700)]
Change project name to "Open vSwitch"
The project was most recently called "OpenVSwitch". This commit changes
the name to "Open vSwitch", which should be the official name (and
capitalization) going forward.
Justin Pettit [Thu, 21 May 2009 05:18:37 +0000 (22:18 -0700)]
Modify version string for various binaries.
For applications that understand OpenFlow, print the versions they
support. This change also adds that the program is part of the Open
vSwitch project.
Add support for the "--version" argument to some programs that were
missing it.
Justin Pettit [Tue, 19 May 2009 00:08:47 +0000 (17:08 -0700)]
xen: Fix a missed xapi plugin from the Nicira brand stripping
Missed a xapi plugin during the rebranding. This adds that and fixes a
couple of case-senstive variable issues. Ugh, need to figure out how to
make local Xen RPM builds...
Justin Pettit [Mon, 18 May 2009 23:22:40 +0000 (16:22 -0700)]
xen: Remove Nicira branding from vSwitch xsconsole plugin
Since the plan is to eventually integrate this code into the Xen
distribution, the Nicira tags have been removed. The copyright is still
held by Nicira until a better one is found.
Ben Pfaff [Mon, 18 May 2009 20:31:00 +0000 (13:31 -0700)]
xenserver: Fix missing default route problem.
Taking down the vlan_slave's network device deletes any routes associated
with it, including the default route, and those routes are not restored
when the network device is brought up again later.
So don't take that device down at all. There's no reason to do so.
We still want to bring that device up after configuring the pif, just in
case it was down, so this commit only deletes the down_netdev, not the
corresponding up_netdev later on.
Ben Pfaff [Mon, 18 May 2009 19:23:03 +0000 (12:23 -0700)]
xenserver: Make primary management interface on VLAN possible.
Before xapi puts the primary management interface on a new PIF, it verifies
that the PIF's network device exists and has an IP address. For physical
PIFs and for bonds, this works fine. For VLANs, the openvswitch does not
put the IP address on the network device that xapi expects, but on a
different network device (e.g. openvswitch puts it on eth0.X instead of on
xapiY), so this checks fails with the message "The specified interface
cannot be used because it has no IP address".
This commit makes interface-reconfigure "fake out" xapi by putting a
dummy IP address on the xapi# interface.
Justin Pettit [Mon, 18 May 2009 15:45:56 +0000 (08:45 -0700)]
xen: xsconsole plugin cleanup based on Citrix feedback
Various cleanups to the vSwitch plugin for xsconsole based on feedback
from Citrix. The changes include a cleaner way to pop-up temporary
messages, leaving a success or failure box after performing an action,
and safer subprocess calling.
Ben Pfaff [Fri, 15 May 2009 22:57:53 +0000 (15:57 -0700)]
ovs-dpctl: Remove get-idx and get-name commands.
These commands made some sense when dpctl only accepted numerical datapath
identifiers, but now it accepts names as well as numbers. These commands
were never really used much, so delete them.
Ben Pfaff [Fri, 15 May 2009 22:48:58 +0000 (15:48 -0700)]
Break dpctl into two programs: ovs-ofctl and ovs-dpctl.
The datapath and OpenFlow are fairly different and it seems wrong
conceptually to work with both in a single program. So this commit breaks
them up into two programs.
Ben Pfaff [Fri, 15 May 2009 19:40:05 +0000 (12:40 -0700)]
Rename vlogconf to ovs-appctl, for consistency and as a better name.
The vlogconf program at one time only affected log levels. Now, it can do
more, and probably will be expanded in the future, so appctl is a better
name.
Ben Pfaff [Fri, 15 May 2009 18:02:08 +0000 (11:02 -0700)]
Rename "controller" to "ovs-controller" and move to utilities.
The controller is unimportant and we don't want people thinking that it is
important. (They should be using NOX, not the OpenVSwitch controller.)
So kill off its top-level directory.
Justin Pettit [Fri, 15 May 2009 01:11:57 +0000 (18:11 -0700)]
netflow: Set Engine and Add Alternate Port ID Flag
Allow the Engine Type and Engine ID to be configured in NetFlow
messages. Previously, they were always set to zero. Now, by default,
they are both set to the datapath index. These can be overridden with
the "netflow.bridge.engine-type" and "netflow.bridge.engine-id" keys,
respectively.
Add the ability to allow collectors to distinguish between virtual
switches sending message from the host. When the
"netflow.bridge.add-id-to-iface" flag is enabled, the least significant
7 bits of the engine id are placed into the most significant bits of
the ingress and egress interface fields of flow records. This
mimics the behavior of VMware ESX when the "-p" option is given to the
NetFlow configuration program.
Justin Pettit [Thu, 14 May 2009 23:21:03 +0000 (16:21 -0700)]
netflow: Document 1400-byte packet length limit.
The NetFlow code accumulates records until the packet is 1400 bytes or
some amount of time has passed. This just adds a comment that NetFlow
messages are limited to 30 records, which places a ceiling on how large
the message can be (1400 is below that ceiling).
Justin Pettit [Thu, 14 May 2009 22:07:03 +0000 (15:07 -0700)]
vswitch: reduce passes through config loop
When vswitchd configures itself, it loops through the bridges to pull
relevant configuration information from vswitchd.conf. Configuration
for determining the dpid, controller, and NetFlow was inside a loop for
configuring a bridge's interfaces. This meant that these configuration
parameters were being re-set for each interface in the bridge as opposed
to just once for the bridge. This change pushes this configuration
outside of that interface loop. The LIST_FOR_EACH_SAFE macro to loop
through the bridges is switched to LIST_FOR_EACH, since bridges are not
deleted in this loop.
Ben Pfaff [Thu, 14 May 2009 23:25:12 +0000 (16:25 -0700)]
netflow: Report largest possible value when counters exceed 32 bits.
secchan tracks packets and bytes using 64-bit counters, but the
corresponding NetFlow v5 fields are only 32 bits wide. Until now we would
just report the lower 32 bits on overflow; this commit changes the
behavior to reporting 0xffffffff instead.
Ben Pfaff [Thu, 14 May 2009 19:33:34 +0000 (12:33 -0700)]
vswitch: Give up hope that the config file delimiter will be changed.
This code originally assumed that it could iterate over all the subsections
of "port" in the configuration file to obtain the names of network devices,
but this didn't work because "." is both the configuration file section
delimiter and a valid (and fairly common) character in network device
names. So it was changed to use a different technique with the hope that
the original code could be restored when the configuration file syntax was
changed.
Now we've agreed that the configuration file syntax is not going to change
before we change to a different configuration model entirely, so this
commit deletes the original code (which was #if'd out, not deleted).
Another reason to do this is to kill off some warnings due to unused
functions and variables.
Ben Pfaff [Thu, 14 May 2009 18:20:10 +0000 (11:20 -0700)]
datapath: Fix VLAN-related kernel OOPS on XenServer.
In deleting internal ports (other than the local port) we were failing to
call dp_del_if_hook even though we had called dp_add_if_hook when we added
it. This prevented the sysfs kobject from being released and caused the
wrong address to be passed to kfree. The former could cause random
memory corruption; the latter may be benign since the address was still in
the same slab object.
Ben Pfaff [Wed, 13 May 2009 21:15:58 +0000 (14:15 -0700)]
xenserver: Fix --force up/down behavior in a resource pool.
The PIFs key of a network lists one PIF for each member of the pool, not
one PIF per bond or whatever I had in mind. So we need to iterate over
all the PIFs in the network and find the one for our current host.
Ben Pfaff [Mon, 11 May 2009 21:26:44 +0000 (14:26 -0700)]
datapath: Add support for "internal" ports similar to the local port.
The datapath has supported a simulated "local port" for a long time, but it
has never been possible to create additional ports with the same
characteristics. One way to do this is using the veth driver, but this is
somewhat awkward, since there is no desire to create a pair of devices;
one suffices.
The immediate purpose for this feature is to allow an IP address to be put
on both a physical interface and a tagged VLAN attached to that interface
on Xen.
Justin Pettit [Wed, 13 May 2009 06:35:45 +0000 (23:35 -0700)]
Don't print warning about removing policy on startup.
The policing code attempts to delete any traffic control configuration on
startup, so that interfaces come up in a known state. If the interface
didn't have any traffic control configuration, this would cause it to
print a couple of scary sounding warning messages. This commit makes it
so those no longer print.
Justin Pettit [Wed, 13 May 2009 05:58:25 +0000 (22:58 -0700)]
Fix return value call on send() when sending NetFlow messages.
When sending NetFlow messages, we use the send() call, but were checking
the wrong return value. It would report an error when any non-zero
value was returned. The send() call returns the number of bytes sent or
-1 on error. Thus, whenever a NetFlow message was sent, it would
generate an error message. Now, we only log a message when a value of
-1 is returned. (Bug #1166)
Ben Pfaff [Thu, 7 May 2009 00:35:40 +0000 (17:35 -0700)]
datapath: Call rcu_barrier() before unloading module.
According to article "RCU and Unloadable Modules" available at lwn.net,
a module that uses RCU callbacks should call rcu_barrier() before
unloading, because synchronize_rcu() does not ensure that all RCU callbacks
have actually completed, only that a grace period has elapsed.
Ben Pfaff [Fri, 8 May 2009 17:39:17 +0000 (10:39 -0700)]
cfg: Log changes to config, not whole config, in cfg_read().
The configuration file is re-read on a regular basis by brcompatd and
vswitchd in practice. When debug-level logging is enabled on the cfg
module, it was logging the entire config file each time. Not only is this
a waste of log-file space, it's difficult for humans to see what actually
changed, if anything.
So this commit changes cfg_read() to log a diff instead of the whole config
file.
Justin Pettit [Tue, 12 May 2009 17:44:36 +0000 (10:44 -0700)]
Only send NetFlow notifications for IP traffic.
NetFlow only supports exporting information about IP. We were sending a
notification for any flow that expired, which included non-IP packets.
This would generate NetFlow messages with nearly all fields set to zero.
Now, we only send NetFlow for packets that are IP. (Bug #1256)
Ben Pfaff [Tue, 12 May 2009 17:25:37 +0000 (10:25 -0700)]
Remove the ChangeLog since it is no longer relevant for OpenVSwitch.
It might make perfect sense to start a new file here for OpenVSwitch, but
the first item should be something like "1 June 2009: Initial public
release".
Justin Pettit [Mon, 11 May 2009 23:33:08 +0000 (16:33 -0700)]
Update OpenFlow tcpdump patch to work with latest code.
With some of the recent (and not so recent) changes to the source code,
the OpenFlow patch to tcpdump came out of sync. This brings it back so
it works again.
Justin Pettit [Mon, 11 May 2009 23:01:14 +0000 (16:01 -0700)]
Rename strlcpy to ovs_strlcpy.
If strlpy is not defined on the build system, we build our own and added
it to the OpenVSwitch library. Unfortunately, programs that link
against the library may do the same thing, and there will be a name
conflict. This renames our implementation to prevent these linking errors.
Ben Pfaff [Wed, 6 May 2009 22:35:25 +0000 (15:35 -0700)]
datapath: Make sure that the "reserved" byte in user-provided flow is zero.
Otherwise we could return a "false negative" lookup result to the user.
(This is not known to fix any real bug; for it to do so, there would have
to be userspace code that doesn't initialize the "reserved" byte, but I
don't know of any.)
Ben Pfaff [Tue, 5 May 2009 18:47:36 +0000 (11:47 -0700)]
vswitch: Restore MAC learning for broadcast ARP replies on bonds.
Bonding has a special exception for MAC learning: don't learn from packets
on bonded ports if we already have learned it on another port. This is
because packets sent out one port can be received on the other, which would
cause us to learn incorrect locations.
But we need to make an exception for broadcast ARP replies, which indicate
that the MAC in question has moved to another switch. Before commit 76fdb7e57 "Implement OFPP_NORMAL action in secchan and hook into vswitchd"
we did so, and this commit restores that behavior.
Ben Pfaff [Tue, 5 May 2009 17:23:02 +0000 (10:23 -0700)]
Add support for coverage counters.
This commit implements a simple form of coverage instrumentation. Points
in source code that are of interest must be explicitly annotated with
COVERAGE_INC. The coverage counters may be logged at any time with
coverage_log().
This form of coverage instrumentation is intended to be so lightweight that
it can be enabled in production builds. It is obviously not a substitute
for traditional coverage instrumentation with e.g. "gcov", but it is still
a useful debugging tool.
Ben Pfaff [Mon, 4 May 2009 23:18:19 +0000 (16:18 -0700)]
secchan: When listing flows, uninstall rules that shouldn't be installed.
To implement flow expiration, secchan periodically queries all the flows
in the datapath flow table. Until now, it has then uninstalled flows that
do not have corresponding rules at all. It has not uninstalled flows that
do have rules that are not supposed to be installed. This commit makes it
also uninstall the latter.
(This is not known to fix any real problem. It is only for completeness.)
Ben Pfaff [Mon, 4 May 2009 23:14:35 +0000 (16:14 -0700)]
secchan: Reinstall flows deleted externally.
If something external to secchan deletes flows from the datapath (e.g.
the administrator runs "dpctl dp-del-flows") then until now secchan would
switch all of those packets manually, using dpif_execute(). Better
behavior is to reinstall the flow. This commit implements that.
Ben Pfaff [Mon, 4 May 2009 23:10:28 +0000 (16:10 -0700)]
datapath: Generalize flow creation and modification.
The ODP_FLOW_ADD and ODP_FLOW_SET_ACTS datapath commands can be usefully
generalized based on whether they should be allowed to create or modify
flows, or both, and whether they reset flow statistics when they modify
an existing flow. This commit does so by merging them into a single
ODP_FLOW_PUT command and adding a set of flags.
In particular this is needed to allow flows to be reinstalled if it is
uncertain whether they have been externally deleted (e.g. with "dpctl
dp-del-flows") without requiring first reading the flow table (as
handle_odp_msg() wants to do), and to replace a flow's actions and reset
its statistics without first deleting it (as rule_update_actions() wants
to do).
Also renames some other datapath commands, for naming consistency.
Ben Pfaff [Fri, 1 May 2009 20:20:07 +0000 (13:20 -0700)]
secchan: Don't let queued packets exhaust memory.
The ofproto code was queuing OpenFlow messages to connections without
limiting the maximum number that could be queued at a time. Thus, the
backlog could grow without bound and exhaust all system memory.
This commit introduces a cap on the maximum number of queued messages
in two different categories: packet-in messages and replies to OpenFlow
requests.