sliver-openvswitch.git
14 years agoLabel the current "citrix" release 0.90.4. v0.90.4
Justin Pettit [Tue, 28 Jul 2009 18:05:28 +0000 (11:05 -0700)]
Label the current "citrix" release 0.90.4.

14 years agoDo not try to resolve DNS for OpenFlow controllers or netflow collectors.
Ben Pfaff [Wed, 15 Jul 2009 22:29:49 +0000 (15:29 -0700)]
Do not try to resolve DNS for OpenFlow controllers or netflow collectors.

Until now, setting a netflow collector to a DNS name would cause
secchan to attempt to resolve that DNS name each time that the set of
netflow collectors is re-set.  For the vswitch, this is every time that
the vswitch reconfigures itself.

Unfortunately, DNS lookup within secchan cannot work as currently
implemented, because it needs both an asynchronous DNS resolver library
and in-band control updates.  Currently we have neither.  Attempting to
look up DNS anyway just hangs.

This commit disables DNS lookup entirely, and updates the documentation to
change user expectations.  DNS still won't work, but at least it won't
hang.

Bug #1609.

14 years agoxenserver: Fix creating, destroying bonds with the management connection.
Ben Pfaff [Fri, 17 Jul 2009 19:37:01 +0000 (12:37 -0700)]
xenserver: Fix creating, destroying bonds with the management connection.

Creating a bond from the network device that holds the Xen management
connection automatically transfers the management connection to that bond.
However, we weren't properly removing the IP address from the network
devices that constituted the bond.  This commit fixes that problem.

Bug #1566.

14 years agobrcompat: Make "brctl showmacs" honor Linux notion of bridge composition.
Ben Pfaff [Thu, 16 Jul 2009 22:16:06 +0000 (15:16 -0700)]
brcompat: Make "brctl showmacs" honor Linux notion of bridge composition.

The kernel only handles a single VLAN per bridge, but vswitchd can deal
with all the VLANs on a single bridge.  This commit makes "brctl showmacs"
pretend that the former is the case even though the latter is the
implementation.

Bug #1567.

14 years agovswitchd: Make "fdb/show" output more meaningful port numbers.
Ben Pfaff [Thu, 16 Jul 2009 22:15:02 +0000 (15:15 -0700)]
vswitchd: Make "fdb/show" output more meaningful port numbers.

The "fdb/show" unixctl command was showing vswitch-internal port indexes,
which cannot be meaningfully interpreted by software outside vswitchd.
Also, they potentially change every time the vswitchd configuration file
changes.  This commit changes it to use a datapath port index instead,
which are both more meaningful and more stable.

14 years agocfg: New function cfg_get_matches().
Ben Pfaff [Thu, 16 Jul 2009 22:07:05 +0000 (15:07 -0700)]
cfg: New function cfg_get_matches().

14 years agoImplement "brctl showmacs" support in brcompat and ovs-brcompatd.
Ben Pfaff [Wed, 15 Jul 2009 19:46:06 +0000 (12:46 -0700)]
Implement "brctl showmacs" support in brcompat and ovs-brcompatd.

This is needed by the Citrix test infrastructure.

14 years agobrcompat: Refactor infrastructure for communication with ovs-brcompatd.
Ben Pfaff [Wed, 15 Jul 2009 19:40:16 +0000 (12:40 -0700)]
brcompat: Refactor infrastructure for communication with ovs-brcompatd.

In an upcoming change, brcompat will need to receive bulk data from
ovs-brcompatd.  The existing brcompat infrastructure for receiving data
only supports returning an error code, so this commit adds the ability to
receive an arbitrary sk_buff and updates the existing users to handle it.

14 years agobrcompatd: Factor code out of prune_ports().
Ben Pfaff [Wed, 15 Jul 2009 19:09:43 +0000 (12:09 -0700)]
brcompatd: Factor code out of prune_ports().

An upcoming commit will also need to gather all of the interfaces on a
specified bridge, so break this code into a helper function.

14 years agoprocess: New function process_run_capture().
Ben Pfaff [Wed, 15 Jul 2009 19:45:44 +0000 (12:45 -0700)]
process: New function process_run_capture().

In an upcoming commit, ovs-brcompatd will need to create a subprocess and
capture both its stdout and stderr separately, which one cannot do with
simple interfaces such as popen().  This function provides that ability.

14 years agoprocess: Factor code out of process_start() into helper functions.
Ben Pfaff [Wed, 15 Jul 2009 19:07:02 +0000 (12:07 -0700)]
process: Factor code out of process_start() into helper functions.

An upcoming commit will add a new function that can also use these helper
functions.

14 years agoprocess: Fix races on fatal signal handling in process_start().
Ben Pfaff [Wed, 15 Jul 2009 19:05:04 +0000 (12:05 -0700)]
process: Fix races on fatal signal handling in process_start().

To prevent fatal signals in a child process from causing the parent
process's pidfile, etc. to be deleted, we need to block fatal signals
around fork and call fatal_signal_fork() in the child process.

This problem was noticed through code inspection; it has not been observed
in practice.

14 years agovswitchd: New unixctl command "fdb/show" to print the MAC learing table.
Ben Pfaff [Wed, 15 Jul 2009 18:05:37 +0000 (11:05 -0700)]
vswitchd: New unixctl command "fdb/show" to print the MAC learing table.

To implement "brctl showmacs" for bridge compatibility, brcompatd needs to
be able to extract the MAC learning table from ovs-vswitchd.  This provides
a way, and it may be directly useful to switch administrators also.

14 years agomac-learning: New function mac_entry_age().
Ben Pfaff [Wed, 15 Jul 2009 18:02:24 +0000 (11:02 -0700)]
mac-learning: New function mac_entry_age().

This function will be used as part of printing the MAC learning table at
user request.

14 years agoAdd macros for parsing MAC addresses from strings.
Ben Pfaff [Wed, 15 Jul 2009 17:58:30 +0000 (10:58 -0700)]
Add macros for parsing MAC addresses from strings.

14 years agoNew function ds_steal_cstr().
Ben Pfaff [Wed, 15 Jul 2009 17:57:17 +0000 (10:57 -0700)]
New function ds_steal_cstr().

14 years agoAdd function get_null_fd(), to reduce code redundancy.
Ben Pfaff [Wed, 15 Jul 2009 17:54:51 +0000 (10:54 -0700)]
Add function get_null_fd(), to reduce code redundancy.

14 years agobrcompat: Improve comments in header file.
Ben Pfaff [Tue, 14 Jul 2009 16:16:55 +0000 (09:16 -0700)]
brcompat: Improve comments in header file.

14 years agovswitchd: Skip updelay on slave when only a single bond slave is up.
Ben Pfaff [Mon, 13 Jul 2009 18:09:52 +0000 (11:09 -0700)]
vswitchd: Skip updelay on slave when only a single bond slave is up.

If a network device takes a few seconds to detect carrier, as some do, then
when bringing up a network device and then immediately adding that device
to a bridge, the bond code would start out with that slave considered down
and apply the full updelay to it before bringing it up.  With the 31-second
updelay set by XenServer, this is excessive: we end up having no
connectivity at all for 31 seconds even though there is no reason for it.

This commit makes the bond code disregard the updelay when an interface
comes up on a bond that has no enabled interfaces, and updates the
documentation to match.

Part of bug #1566.

14 years agovswitchd: Fix log messages when bond slaves are enabled or disabled.
Ben Pfaff [Mon, 13 Jul 2009 17:04:45 +0000 (10:04 -0700)]
vswitchd: Fix log messages when bond slaves are enabled or disabled.

We were printg "enabled" when a slave was disabled and vice versa.

Part of bug #1566.

14 years agoFix unitialized variable in coverage_log()
Justin Pettit [Tue, 14 Jul 2009 07:25:44 +0000 (00:25 -0700)]
Fix unitialized variable in coverage_log()

When providing the ability to force coverage printouts to occur, some
code was moved around that allowed the "hash" variable to be used
unitialized.  This fixes that.

Thanks to Ben for pointing out the problem.

Bug #1577

14 years agodatapath: Don't orphan packets in dp_dev transmit path.
Ben Pfaff [Mon, 13 Jul 2009 22:50:32 +0000 (15:50 -0700)]
datapath: Don't orphan packets in dp_dev transmit path.

Before commit 72ca14c1 "datapath: Fix race against workqueue in dp_dev and
simplify code," the dp_dev network device had a device queue, and we would
orphan packets before sticking them on the queue.  This screwed up socket
accounting a bit, but the effect was limited to the device queue length.

Now, after that commit, the dp_dev device has no device queue, but it still
orphans packets.  This screws up socket accounting a *lot*, because the
effect is now unlimited, since there is no queue to limit it.

The solution is to not orphan packets at all.  There is little need for it
now since packet transmission now happens immediately, not in a workqueue
whose execution may be delayed.

This should fix bug #1519, which tests "netperf -t UDP_STREAM" performance,
finding that an unrealistically high number of UDP packets could be sent
but that none at all were received.  The send rate is due to the orphaning,
the receive rate presumably because at least one out of approx. 65535/1500
= 44 fragments per full packet were dropped in each case.

14 years agovconn: Fix detection of vconn local IP address, to fix in-band control.
Ben Pfaff [Mon, 13 Jul 2009 22:05:51 +0000 (15:05 -0700)]
vconn: Fix detection of vconn local IP address, to fix in-band control.

The in-band control code needs to know the IP and port of both ends of the
control connection.  However, the vconn code was only reporting the local
address after the connection had already succeeded, which created a
chicken-and-egg problem.  In practice we would fail to connect until the
switch went into fail-open, at which point the connection would go through.

Fortunately, we can get the local IP address right after we try to connect,
not just after the connection completes, so this commit changes the code
to do that.

This commit also breaks setting the remote IP and port into functions
separate from vconn_init(), which makes the code more readable.

14 years agoRevert "datapath: Don't orphan packets in dp_dev transmit path."
Ben Pfaff [Mon, 13 Jul 2009 18:56:26 +0000 (11:56 -0700)]
Revert "datapath: Don't orphan packets in dp_dev transmit path."

This reverts commit 0858ad2b9d2f594f99bb11fc9b331ce8b1de953d.
Although that commit partially fixed a performance regression
relative to the Linux bridge, it introduced other problems that
were not apparent in the performance testing (e.g.
WARN_ON_ONCE(skb->destructor) now triggers in dp_process_received_packet()).
The fix is not completely obvious, so reverting now to ensure stability
while investigating the problem.

14 years agodatapath: Don't orphan packets in dp_dev transmit path.
Ben Pfaff [Mon, 13 Jul 2009 16:41:26 +0000 (09:41 -0700)]
datapath: Don't orphan packets in dp_dev transmit path.

Before commit 72ca14c1 "datapath: Fix race against workqueue in dp_dev and
simplify code," the dp_dev network device had a device queue, and we would
orphan packets before sticking them on the queue.  This screwed up socket
accounting a bit, but the effect was limited to the device queue length.

Now, after that commit, the dp_dev device has no device queue, but it still
orphans packets.  This screws up socket accounting a *lot*, because the
effect is now unlimited, since there is no queue to limit it.

The solution is to not orphan packets at all.  There is little need for it
now since packet transmission now happens immediately, not in a workqueue
whose execution may be delayed.

This should fix bug #1519, which tests "netperf -t UDP_STREAM" performance,
finding that an unrealistically high number of UDP packets could be sent
but that none at all were received.  The send rate is due to the orphaning,
the receive rate presumably because at least one out of approx. 65535/1500
= 44 fragments per full packet were dropped in each case.

14 years agoRemove "coverage/clear" command due its limited use
Justin Pettit [Sat, 11 Jul 2009 00:36:09 +0000 (17:36 -0700)]
Remove "coverage/clear" command due its limited use

The poll loop calls coverage_clear on every pass anyway, so provide a
function to call it separately is of limited value.

14 years agoFix small typo in ovs-ofctl man page.
Justin Pettit [Sat, 11 Jul 2009 00:33:41 +0000 (17:33 -0700)]
Fix small typo in ovs-ofctl man page.

14 years agoProvide ability to retrieve coverage information
Justin Pettit [Fri, 10 Jul 2009 22:09:41 +0000 (15:09 -0700)]
Provide ability to retrieve coverage information

Previously, there was no way to induce coverage information to be
displayed; it would only print when the system noticed unusual delays
between polling intervals.  Now, production of coverage logs can be
forced with "coverage/log" command in ovs-appctl.  Coverage counters may
be reset with "coverage/clear".

14 years agodatapath: Fix races in updating dp_dev port statistics.
Ben Pfaff [Wed, 8 Jul 2009 19:32:07 +0000 (12:32 -0700)]
datapath: Fix races in updating dp_dev port statistics.

14 years agodatapath: Fix race in datapath creation.
Ben Pfaff [Wed, 8 Jul 2009 18:31:59 +0000 (11:31 -0700)]
datapath: Fix race in datapath creation.

Before we create the local port, we should allocate and assign the table.
Otherwise packets sent on the local port before we do so will cause an
OOPS.

This is a theoretical race that has not been observed in practice.

14 years agodatapath: Fix race against workqueue in dp_dev and simplify code.
Ben Pfaff [Wed, 8 Jul 2009 19:23:32 +0000 (12:23 -0700)]
datapath: Fix race against workqueue in dp_dev and simplify code.

The dp_dev_destroy() function failed to cancel the xmit_queue work, which
allowed it to run after the device had been destroyed, accessing freed
memory.  However, simply canceling the work with cancel_work_sync() would
be insufficient, since other packets could get queued while the work
function was running.  Stopping the queue with netif_tx_disable() doesn't
help, because the final action in dp_dev_do_xmit() is to re-enable the TX
queue.

This issue led me to re-examine why the dp_dev needs to use a work_struct
at all.  This was implemented in commit 71f13ed0b "Send of0 packets from
workqueue, to avoid recursive locking of ofN device" due to a complaint
from lockdep about recursive locking.

However, there's no actual reason that we need any locking around
dp_dev_xmit().  Until now, it has accepted the standard locking provided
by the network stack.  But looking at the other software devices (veth,
loopback), those use NETIF_F_LLTX, which disables this locking, and
presumably do so for this very reason.  In fact, the lwn article at
http://lwn.net/Articles/121566/ hints that NETIF_F_LLTX, which is otherwise
discouraged in the kernel, is acceptable for "certain types of software
device."

So this commit switches to using NETIF_F_LLTX for dp_dev and gets rid
of the work_struct.

In the process, I noticed that veth and loopback also take advantage of
a network device destruction "hook" using the net_device "destructor"
member.  Using this we can automatically get called on network device
destruction at the point where rtnl_unlock() is called.  This allows us
to stop stringing the dp_devs that are being destroyed onto a list so
that we can free them, and thus simplifies the code along all the paths
that call dp_dev_destroy().

This commit gets rid of a call to synchronize_rcu() (disguised as a call
to synchronize_net(), which is a macro that expands to synchronize_rcu()),
so it probably speeds up deleting ports, too.

14 years agodatapath: Remove declarations of functions that are never defined or used.
Ben Pfaff [Wed, 8 Jul 2009 17:53:18 +0000 (10:53 -0700)]
datapath: Remove declarations of functions that are never defined or used.

14 years agodatapath: Fix use-after-free error in datapath destruction.
Ben Pfaff [Fri, 26 Jun 2009 21:15:04 +0000 (14:15 -0700)]
datapath: Fix use-after-free error in datapath destruction.

When we create a datapath we do this:

1. Create local port.
2. Call add_dp hook.
3. Allow userspace to add more ports.

When we deleted a datapath we were doing this:

1. Call del_dp hook
2. Delete all the ports.

Unfortunately step 1 destroys dp->ifobj, then dp_del_port on any port other
than the local port in step 2 tries to reference dp->ifobj through a call
to sysfs_remove_link().

This commit fixes the problem by changing datapath deletion to mirror
creation:

1. Delete all the ports but the local port.
2. Call dp_del hook.
3. Delete local port.

Commit 010082639 "datapath: Add sysfs support for all (otherwise supported)
Linux versions" makes this problem obvious on a 2.6.25+ kernel configured
with slab debugging, because on such kernels the ifobj is a pointer to a
slab object that is freed by the del_dp hook function (when brcompat_mod
is loaded).  This bug may be just as present on older kernels, but there
the ifobj is part of struct datapath, not a pointer, and thus it is much
harder to trigger.

Bug #1465.

14 years agodatapath: Remove redundant synchronize_rcu() call.
Ben Pfaff [Fri, 26 Jun 2009 19:20:02 +0000 (12:20 -0700)]
datapath: Remove redundant synchronize_rcu() call.

There is no benefit to synchronizing twice, and it might cost us a lot of
time.

14 years agosecchan: Various fixes to run in-band on non-"local" port
Justin Pettit [Wed, 8 Jul 2009 17:40:55 +0000 (10:40 -0700)]
secchan: Various fixes to run in-band on non-"local" port

The in-band control code assumed that we would connect to the controller
over the datapath's "local" port.  If the switch had multiple datapaths,
and the controller was only available through one of them, the other
datapaths would fail to connect.  This is addressed by the following
changes:

    - The controller's MAC address is looked up through the connection's
      interface instead of the datapath's local one.

    - We allow ARP traffic to be sent by the connection's interface.

    - We allow ARP traffic to be sent to the controller's MAC address.
      This is necessary if the controller is running locally (e.g. in a VM).

Bug #1466

14 years agoProvide method to locate device by IP and add more nodev functions to netdev
Justin Pettit [Mon, 6 Jul 2009 22:37:19 +0000 (15:37 -0700)]
Provide method to locate device by IP and add more nodev functions to netdev

In some cases we need to be able to locate a device by its IPv4 address.
There doesn't seem to be an easy way to do this on Linux, so we iterate
through all devices until it's found.  The caller can provide a hint as
to the device, so subsequent checks can be quicker.

This checkin also adds nodev versions of functions to lookup ARP entries
and the IPv4 address of a device.

14 years agoShow more information about connection when querying status.
Justin Pettit [Thu, 2 Jul 2009 20:40:20 +0000 (13:40 -0700)]
Show more information about connection when querying status.

It is often useful in debugging to know the ports and IP addresses being
used in an OpenFlow connection.  This commit adds the remote and local
IP addresses and ports used for a connection to the "status" information
returned by ovs-ofctl.

Feature #1484.

14 years agoHave rconn and vconn export information about IPs and ports
Justin Pettit [Mon, 6 Jul 2009 22:15:11 +0000 (15:15 -0700)]
Have rconn and vconn export information about IPs and ports

Previously, rconn and vconn only allowed users to find out about the
remote IP address.  This set of changes allows users to retrieve the
remote port, local IP, and local port used for the connection.

14 years agoInclude "inttypes.h" to pickup definition of PRIu8.
Justin Pettit [Thu, 2 Jul 2009 19:49:44 +0000 (12:49 -0700)]
Include "inttypes.h" to pickup definition of PRIu8.

14 years agosecchan: Display mgmt and datapath id in status messages
Justin Pettit [Tue, 7 Jul 2009 16:34:37 +0000 (09:34 -0700)]
secchan: Display mgmt and datapath id in status messages

Since it's not always easy to determine the management id, this adds the
ability to see it (and the datapath id) with the "ovs-ofctl status"
command.

Feature #1533

14 years agovswitchd: Add missing argument to check for update-resolv.conf config
Justin Pettit [Tue, 7 Jul 2009 05:12:53 +0000 (22:12 -0700)]
vswitchd: Add missing argument to check for update-resolv.conf config

14 years agovswitchd: Enable updating resolv.conf by default when using discovery
Justin Pettit [Wed, 1 Jul 2009 20:58:19 +0000 (13:58 -0700)]
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.

14 years agovswitch: Set minimum probe interval to 5 seconds
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.

Possible fix to Bug #1466.

14 years agoLog more rconn status.
Ben Pfaff [Fri, 26 Jun 2009 23:00:07 +0000 (16:00 -0700)]
Log more rconn status.

14 years agoxenserver: Remove cacert when user reconfigures the controller
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.

Bug #1457

14 years agoxenserver: Validate controller IP address in xsconsole
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.

14 years agovswitchd: Adding and removing mgmt interface breaks connection
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.

Bug #1448

14 years agoxenserver: Also log ovs-brcompatd messages at INFO level to syslog.
Ben Pfaff [Tue, 23 Jun 2009 18:03:52 +0000 (11:03 -0700)]
xenserver: Also log ovs-brcompatd messages at INFO level to syslog.

INFO level messages are meant to be logged in the ordinary case, and they
are useful for debugging problems, so turn them on by default.

It would be a good idea to do so for ovs-vswitchd also, but we have not
tested how much this would increase the log volume.

14 years agoovs-brcompatd: Turn up log level of port removal messages.
Ben Pfaff [Tue, 23 Jun 2009 18:02:30 +0000 (11:02 -0700)]
ovs-brcompatd: Turn up log level of port removal messages.

These messages proved useful during debugging, and they should not be too
common, so log them at a higher level.

14 years agoovs-brcompatd: Handle XS Tools 5.0.0 destroying and recreating devices
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.

Bug #1429.

14 years agovswitchd: Reduce number of calls to reconfigure() during mgmt updates
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.

14 years agocfg: Log accurate waiting times in cfg_lock().
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.

14 years agoxenserver: xsconsole plugin doesn't need execute permissions
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.

14 years agoxenserver: Handle slave disconnection more gracefully in xsconsole plugin
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.

Bug #1341

14 years agoxenserver: Force reload of config file after VIF deleted
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.

Thanks to Natasha for catching this.

14 years agoReplace SHA-1 library with one that is clearly licensed.
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.

14 years agoUpdate primary code license to Apache 2.0.
Ben Pfaff [Mon, 15 Jun 2009 22:11:30 +0000 (15:11 -0700)]
Update primary code license to Apache 2.0.

14 years agovswitch: Avoid segfault when revalidating ARP flows.
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.

Bug #1394.

14 years agoxenserver: Fix key used to identify network UUID
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".

Thanks to Natasha for catching the problem.

14 years agoxenserver: Pass network UUID to controller for internal networks too.
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.

14 years agovswitch: Add support for large OFMP messages
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.

14 years agoxenserver: Remove debugging redirect from vif script
Justin Pettit [Wed, 10 Jun 2009 22:30:55 +0000 (15:30 -0700)]
xenserver: Remove debugging redirect from vif script

I redirected some output to a temporary file during debugging, but
forgot to remove it.  Now it's removed.

Thanks to Ben for pointing it out.

14 years agovswitch: Fix memory leak when OFMP resource updates are sent
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.

14 years agoAdd unit test for SHA-1 library.
Ben Pfaff [Wed, 10 Jun 2009 23:45:28 +0000 (16:45 -0700)]
Add unit test for SHA-1 library.

14 years agoAdd file missing from commit baf099 "Fix glibc 2.7 strtok_r() bug...".
Ben Pfaff [Wed, 10 Jun 2009 23:45:02 +0000 (16:45 -0700)]
Add file missing from commit baf099 "Fix glibc 2.7 strtok_r() bug...".

Oops.

14 years agovswitch: Fix handling of multicast packets received by bonds.
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.

Bug #1387.

14 years agovswitch: Add ovs-appctl commands for debugging and managing bonds.
Ben Pfaff [Wed, 10 Jun 2009 22:13:21 +0000 (15:13 -0700)]
vswitch: Add ovs-appctl commands for debugging and managing bonds.

14 years agoFix glibc 2.7 strtok_r() bug in a more permanent fashion.
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.

14 years agovswitch: Clarify what "ingress" means in policing
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.

Thanks to Johan for pointing out the problem.

14 years agoxenserver: Add dump-vif-details to automake
Justin Pettit [Wed, 10 Jun 2009 01:40:15 +0000 (18:40 -0700)]
xenserver: Add dump-vif-details to automake

14 years agoxenserver: Send VIF details to controller
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.

Feature #1324

14 years agoXen: Fixes for core handling configuration
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.

Thanks to Ben for help debugging the issue.

14 years agoFix url in RPM spec.
Justin Pettit [Tue, 9 Jun 2009 00:29:37 +0000 (17:29 -0700)]
Fix url in RPM spec.

14 years agoAdd unit test for TCP/IP checksumming code.
Ben Pfaff [Wed, 10 Jun 2009 00:10:18 +0000 (17:10 -0700)]
Add unit test for TCP/IP checksumming code.

14 years agoFix another "make" versus "make dist" build problem.
Ben Pfaff [Tue, 9 Jun 2009 22:19:24 +0000 (15:19 -0700)]
Fix another "make" versus "make dist" build problem.

14 years agoRemove "dpkg-buildpackage" test from "make distcheck".
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.

14 years agoFix behavior of simultaneous "make" and "make dist".
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.

14 years agoxenserver: Use parallel make in RPM build on SMP machines.
Ben Pfaff [Tue, 9 Jun 2009 20:49:49 +0000 (13:49 -0700)]
xenserver: Use parallel make in RPM build on SMP machines.

14 years agodebian: Honor "noopt", "parallel=<n>" build options.
Ben Pfaff [Tue, 9 Jun 2009 20:33:24 +0000 (13:33 -0700)]
debian: Honor "noopt", "parallel=<n>" build options.

14 years agodebian: Run build tests during build (unless "nocheck" is specified).
Ben Pfaff [Tue, 9 Jun 2009 20:32:59 +0000 (13:32 -0700)]
debian: Run build tests during build (unless "nocheck" is specified).

14 years agodebian: Ignore directories created as part of Debian package build.
Ben Pfaff [Tue, 9 Jun 2009 20:32:20 +0000 (13:32 -0700)]
debian: Ignore directories created as part of Debian package build.

14 years agoUpdate documentation.
Ben Pfaff [Tue, 9 Jun 2009 20:09:08 +0000 (13:09 -0700)]
Update documentation.

14 years agoovs-pki: Improve readability of manpage.
Ben Pfaff [Tue, 9 Jun 2009 00:12:27 +0000 (17:12 -0700)]
ovs-pki: Improve readability of manpage.

14 years agoovs-pki: Fix formatting errors in manpage.
Ben Pfaff [Tue, 9 Jun 2009 00:11:46 +0000 (17:11 -0700)]
ovs-pki: Fix formatting errors in manpage.

14 years agovswitch: Send gratuitous learning packets when bond slaves go down.
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.

Bug #1290.

14 years agomac-learning: Make data structures public.
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.

14 years agovswitch: Fix typos in OFMP comments.
Justin Pettit [Fri, 5 Jun 2009 21:52:55 +0000 (14:52 -0700)]
vswitch: Fix typos in OFMP comments.

A couple of comments describing the new UUID TLVs were incorrect and
this fixes them.

14 years agovswitch: Fix OFMP alignment problem on 64-bit systems.
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.

14 years agovswitch: Enable bond slaves based on carrier status, not up/down.
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.

Bug #1247.

14 years agonetdev: New function netdev_nodev_get_carrier().
Ben Pfaff [Fri, 5 Jun 2009 21:26:42 +0000 (14:26 -0700)]
netdev: New function netdev_nodev_get_carrier().

14 years agoxenserver: Bring up bond slave device before adding to bond.
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.

Bug #1247.

14 years agoxenserver: Allow RPM to install only with correct Xen kernel version.
Ben Pfaff [Fri, 5 Jun 2009 19:24:58 +0000 (12:24 -0700)]
xenserver: Allow RPM to install only with correct Xen kernel version.

Bug #638.

14 years agovswitch: Send Xen UUIDs associated with system and networks
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.

14 years agoxenserver: Rename cache file to ovs-vswitch.dbache, for consistency.
Ben Pfaff [Fri, 5 Jun 2009 18:18:33 +0000 (11:18 -0700)]
xenserver: Rename cache file to ovs-vswitch.dbache, for consistency.

Fixes bug #1374.

14 years agoImport from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45. v0.90.0
Ben Pfaff [Wed, 8 Jul 2009 20:19:16 +0000 (13:19 -0700)]
Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45.