openvswitch
14 years agoovsdb-idl: Fix bad logic in ovsdb_idl_txn_commit() state transitions.
Ben Pfaff [Sat, 27 Feb 2010 04:33:55 +0000 (20:33 -0800)]
ovsdb-idl: Fix bad logic in ovsdb_idl_txn_commit() state transitions.

If sending the transaction fails (jsonrpc_session_send() returns 0),
then we need to transition to TXN_TRY_AGAIN.  (Transitioning to
TXN_INCOMPLETE is actually a no-op, because at this point in the code
we are guaranteed to be in that state already.)

Leaving the transaction in TXN_INCOMPLETE causes a segfault later in
ovsdb_idl_txn_destroy() when it calls hmap_remove() on the transaction's
txn_node.

This bug reveals a hole in the ovsdb_idl_txn state machine: destroying
a transaction without committing it or aborting it will cause the same
problem.  This problem is *not* fixed by this patch: it really should be
handled by adding a new state TXN_UNCOMMITTED that indicates that the
transaction is not yet committed or aborted.  That's too much for this
patch, and doesn't really matter for OVS at the moment since none of its
code paths destroy a transaction without committing or aborting it.

Bug #2435.

14 years agobridge: Map an "internal" config device type to a "system" netdev type
Justin Pettit [Sun, 21 Feb 2010 07:00:32 +0000 (23:00 -0800)]
bridge: Map an "internal" config device type to a "system" netdev type

ovs-vswitchd has a concept of an "internal" port, which is created
on-demand.  The netdev library doesn't understand an "internal" device
type, so we map it to a "system" one.

Bug #2431

14 years agovswitch: interface-reconfigure: bring down physical interfaces
Ian Campbell [Thu, 25 Feb 2010 16:15:13 +0000 (16:15 +0000)]
vswitch: interface-reconfigure: bring down physical interfaces

This should be done when bringing down the last PIF which uses a
datapath in order to account for VLAN PIFs sharing a datapath.

The logic in bring_down() already acounts for this requirement by
clearing the dp variable if the datapath is still required so if we
get as far as deconfiguring that datapath then it is also correct to
bring down the physical devices.

With unit test suite update by Ben Pfaff.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agodpif-netdev: Clarify function to modify VLAN TCI field
Justin Pettit [Sun, 21 Feb 2010 03:50:14 +0000 (19:50 -0800)]
dpif-netdev: Clarify function to modify VLAN TCI field

14 years agoovsdb: Add support for "enum" constraints.
Ben Pfaff [Thu, 25 Feb 2010 22:59:33 +0000 (14:59 -0800)]
ovsdb: Add support for "enum" constraints.

Some of the uses for the formerly supported regular expression constraints
were simply to limit values to those in a set of allowed values.
This commit adds support for that kind of simple enumeration constraint.

14 years agoRemove PCRE dependency.
Ben Pfaff [Tue, 23 Feb 2010 23:48:28 +0000 (15:48 -0800)]
Remove PCRE dependency.

14 years agoovsdb: Drop regular expression constraints.
Ben Pfaff [Tue, 23 Feb 2010 23:57:50 +0000 (15:57 -0800)]
ovsdb: Drop regular expression constraints.

Regular expression constraints have caused nothing but trouble due to the
lack of a ubiquitous regular expression library.  PCRE is *almost*
everywhere, but it has different versions, and different features, and
different bugs, in different places.  It is more trouble than it is worth.
So this commit drops support.

14 years agoxenserver: In vif script, tolerate port existing when we (re)add it.
Ben Pfaff [Tue, 23 Feb 2010 22:35:08 +0000 (14:35 -0800)]
xenserver: In vif script, tolerate port existing when we (re)add it.

When a Windows VM boots, it initially has "vif" devices.  Then, when
XS Tools loads during boot, those "vif" devices disappear and then are
recreated under the same name.  The vif script is not called to remove
the old devices, but it is called to add the new ones.  It refused to do
this, however, because it saw the new device as having a duplicate name
(because the old was wasn't deleted).

This commit fixes the problem by making the vif script delete the port,
if it exists, before it adds it.

Bug #2425.

CC: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoovs-brcompatd: Delete Bridge record when deleting a bridge.
Ben Pfaff [Tue, 23 Feb 2010 20:49:27 +0000 (12:49 -0800)]
ovs-brcompatd: Delete Bridge record when deleting a bridge.

del_bridge() removed the reference to the Bridge record from the
Open_vSwitch table, but it didn't actually delete the Bridge record itself.
This fixes the problem.

Bug #2425.

14 years agoovs-brcompatd: Fix dangling reference in del_port().
Ben Pfaff [Tue, 23 Feb 2010 22:35:24 +0000 (14:35 -0800)]
ovs-brcompatd: Fix dangling reference in del_port().

Until now, del_port() was deleting Interface records without deleting the
Port record that referred to them.  OVSDB rejected that because it would
have caused a dangling reference from the Port to the Interfaces.  This
commit fixes the problem.

Bug #2425.

14 years agocollectors: Check for NULL set of collectors.
Jesse Gross [Thu, 25 Feb 2010 14:02:26 +0000 (09:02 -0500)]
collectors: Check for NULL set of collectors.

If the set of collectors for NetFlow or sFlow is empty due to
an error it will cause a crash when trying to send data.

Reported-by: Tetsuo NAKAGAWA <nakagawa@mxc.nes.nec.co.jp>
14 years agoxenserver: Avoid error due to missing MTU fields on XenServer 5.5.
Ben Pfaff [Wed, 24 Feb 2010 23:45:11 +0000 (15:45 -0800)]
xenserver: Avoid error due to missing MTU fields on XenServer 5.5.

The network records in XenServer 5.5 do not have an MTU field, so allow
these to be missing.

Diagnosed-by: Reid Price <reid@nicira.com>
CC: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoMerge "master" into "next".
Ben Pfaff [Wed, 24 Feb 2010 21:47:09 +0000 (13:47 -0800)]
Merge "master" into "next".

14 years agoofctl: Improve manpage.
Ben Pfaff [Wed, 24 Feb 2010 21:43:50 +0000 (13:43 -0800)]
ofctl: Improve manpage.

This better documents how TCP/IP field matching works, and adds
documentation for ARP.

14 years agoFix excessive white space in manpages.
Ben Pfaff [Wed, 24 Feb 2010 21:42:43 +0000 (13:42 -0800)]
Fix excessive white space in manpages.

In nroff manpages, a blank line adds vertical white space.  When this is
followed by another command that also starts a new paragraph, the result
is a vertical skip twice as big as the normal inter-paragraph gap.  The
solution is to use a line that contains just "." for white space within
the manpage, instead of a blank line.  The resulting manpages look better.

14 years agointerface-reconfigure: Fix up unit tests expected output.
Ben Pfaff [Wed, 24 Feb 2010 19:11:50 +0000 (11:11 -0800)]
interface-reconfigure: Fix up unit tests expected output.

The previous commit added "mtu" settings in various places, so the output
changed.

14 years agoCP-1592: interface-reconfigure: Configure network device MTU from Network.MTU field
Ian Campbell [Wed, 24 Feb 2010 10:48:58 +0000 (10:48 +0000)]
CP-1592: interface-reconfigure: Configure network device MTU from Network.MTU field

With override via other-config:mtu field on specific objects in the datamodel.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1267008538 0
# Node ID a91df72fd4bf6329831d3efcae45a5ff55e3ba2e
# Parent  219104a041786d7274b15800de5c3efccf0c4f42

14 years agoovs-dpctl: Fix setting of packet length for "controller" action
Tetsuo NAKAGAWA [Sat, 20 Feb 2010 10:52:46 +0000 (02:52 -0800)]
ovs-dpctl: Fix setting of packet length for "controller" action

14 years agoovs-dpctl: Fix setting of packet length for "controller" action
Tetsuo NAKAGAWA [Sat, 20 Feb 2010 10:52:46 +0000 (02:52 -0800)]
ovs-dpctl: Fix setting of packet length for "controller" action

14 years agoopenflow: Fix frag config flag values
Justin Pettit [Sat, 20 Feb 2010 05:30:03 +0000 (21:30 -0800)]
openflow: Fix frag config flag values

14 years agodatapath: Set the correct bits for OFPAT_SET_NW_TOS action.
Ben Pfaff [Thu, 11 Feb 2010 23:19:26 +0000 (15:19 -0800)]
datapath: Set the correct bits for OFPAT_SET_NW_TOS action.

The DSCP bits are the high bits, not the low bits.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
14 years agoofproto: Fix implementation of OFPAT_SET_NW_DST.
Ben Pfaff [Fri, 12 Feb 2010 20:59:50 +0000 (12:59 -0800)]
ofproto: Fix implementation of OFPAT_SET_NW_DST.

From Jean Tourrilhes <jt@hpl.hp.com>.

14 years agoezio: Fix typo in function call
Justin Pettit [Mon, 8 Feb 2010 23:13:07 +0000 (15:13 -0800)]
ezio: Fix typo in function call

14 years agoofproto: Always terminate OpenFlow description strings
Justin Pettit [Sat, 30 Jan 2010 00:43:30 +0000 (16:43 -0800)]
ofproto: Always terminate OpenFlow description strings

If an OpenFlow description was too long, it would not be properly
truncated with a final null character.  In addition to properly terminating
the string, this set of changes prints a warning if a description is too
long and standardizes on a naming standard for description variables.

14 years agoovs-openflowd: Standardize on OpenFlow description option
Justin Pettit [Fri, 29 Jan 2010 23:45:46 +0000 (15:45 -0800)]
ovs-openflowd: Standardize on OpenFlow description option

ovs-vswitchd used a slightly different way to set the manufacturer,
hardware revision, software revision, serial number, and datapath
description than ovs-openflowd.  This standardizes on the ovs-vswitch
style and describes how to use them in the man page.

14 years agoovs-vswitchd: Remove inline OpenFlow descriptions
Justin Pettit [Fri, 29 Jan 2010 23:31:52 +0000 (15:31 -0800)]
ovs-vswitchd: Remove inline OpenFlow descriptions

Replace inline OpenFlow descriptions with #define.  Also, start work to
support setting them dynamically.

(This was originally working with the config file version of vswitchd,
but needs to be updated to work with the config db.)

14 years agoovs-openflowd: Fix typo in comment describing dp_desc
Justin Pettit [Thu, 28 Jan 2010 23:07:18 +0000 (15:07 -0800)]
ovs-openflowd: Fix typo in comment describing dp_desc

14 years agoDon't go beyond buffer length when printing descriptions
Justin Pettit [Fri, 22 Jan 2010 23:12:34 +0000 (15:12 -0800)]
Don't go beyond buffer length when printing descriptions

Prevent reading past the end of the buffer when a description is not
null-terminated.

Reported-by: Ben Pfaff <blp@nicira.com>
14 years agoofproto: Don't leak descriptions when destroying an ofproto
Justin Pettit [Fri, 22 Jan 2010 22:01:16 +0000 (14:01 -0800)]
ofproto: Don't leak descriptions when destroying an ofproto

Reported-by: Ben Pfaff <blp@nicira.com>
14 years agoofproto: Set protocol version to 0x01 (OpenFlow 1.0)
Justin Pettit [Wed, 20 Jan 2010 06:47:33 +0000 (22:47 -0800)]
ofproto: Set protocol version to 0x01 (OpenFlow 1.0)

Finalize OpenFlow 1.0 wire-compatibility:

    - Set protocol version to 0x01
    - Remove references to retired OFPC_MULTI_PHY_TX
    - Clean extraneous spaces in header file

NOTE: This is the final commit in the OpenFlow 1.0 set.  Starting with
this commit, OVS is OpenFlow 1.0 wire-compatible.  Slicing is not yet
implemented.

14 years agoofproto: Add wire-compatibility for slicing (OpenFlow 1.0)
Justin Pettit [Fri, 22 Jan 2010 07:42:47 +0000 (23:42 -0800)]
ofproto: Add wire-compatibility for slicing (OpenFlow 1.0)

OpenFlow 1.0 adds support for a subset of QoS that's referred to as slicing.
Open vSwitch does not support this yet, so send errors if it's used.

NOTE: OVS at this point is not wire-compatible with OpenFlow 1.0 until
the final commit in this OpenFlow 1.0 set.

14 years agoofproto: Querying port stats for individual ports (OpenFlow 1.0)
Justin Pettit [Wed, 20 Jan 2010 06:35:18 +0000 (22:35 -0800)]
ofproto: Querying port stats for individual ports (OpenFlow 1.0)

OpenFlow 1.0 adds "port_no" field to the Port Stat request messages to
allow stats for individual ports to be queried.  Port stats for all ports
can still be requested by specifying OFPP_NONE as the port number.

NOTE: OVS at this point is not wire-compatible with OpenFlow 1.0 until
the final commit in this OpenFlow 1.0 set.

14 years agoofproto: Match on IP ToS/DSCP bits (OpenFlow 1.0)
Justin Pettit [Fri, 22 Jan 2010 01:34:05 +0000 (17:34 -0800)]
ofproto: Match on IP ToS/DSCP bits (OpenFlow 1.0)

OpenFlow 1.0 adds support for matching on IP ToS/DSCP bits.

NOTE: OVS at this point is not wire-compatible with OpenFlow 1.0 until
the final commit in this OpenFlow 1.0 set.

14 years agoofproto: Improve resolution of flow stats and removed messages (OpenFlow 1.0)
Justin Pettit [Tue, 19 Jan 2010 23:35:02 +0000 (15:35 -0800)]
ofproto: Improve resolution of flow stats and removed messages (OpenFlow 1.0)

OpenFlow 1.0 increases the resolution of flow stats and flow removed messages
from seconds to (potentially) nanoseconds.  The spec stats that only
millisecond granularity is required, so that's all we provide at this
time.  Increasing to nanoseconds would require more significant code
change and would not provide an appreciable improvement in real world
use.

NOTE: OVS at this point is not wire-compatible with OpenFlow 1.0 until
the final commit in this OpenFlow 1.0 set.

14 years agoofproto: Add support for matching IP addresses in ARP header (OpenFlow 1.0)
Justin Pettit [Tue, 10 Nov 2009 00:43:47 +0000 (16:43 -0800)]
ofproto: Add support for matching IP addresses in ARP header (OpenFlow 1.0)

The OpenFlow 1.0 specification supports matching the IP address and
opcode in ARP messages.  The datapath already supports this, so this
commit merely exposes that through the OpenFlow module.

NOTE: OVS at this point is not wire-compatible with OpenFlow 1.0
until the final commit in this OpenFlow 1.0 set.

14 years agoofproto: Add support for flow cookies (OpenFlow 1.0)
Justin Pettit [Wed, 13 Jan 2010 07:22:22 +0000 (23:22 -0800)]
ofproto: Add support for flow cookies (OpenFlow 1.0)

In OpenFlow 1.0, flows have been extended to include an opaque
identifier, referred to as a cookie. The cookie is specified by the
controller when the flow is installed; the cookie will be returned as
part of each flow stats and flow removed message.

NOTE: OVS at this point is not wire-compatible with OpenFlow 1.0 until
the final commit in this Openflow 1.0 set.

14 years agoofproto: Add user-specifiable datapath description (OpenFlow 1.0)
Justin Pettit [Wed, 13 Jan 2010 07:01:25 +0000 (23:01 -0800)]
ofproto: Add user-specifiable datapath description (OpenFlow 1.0)

In OpenFlow 1.0, a "dp_desc" character array was added to the ofp_desc_stats
structure that allows a human readable description of the datapath to be
provided.

NOTE: OVS at this point is not wire-compatible with OpenFlow 1.0 until
the final commit in this OpenFlow 1.0 set.

14 years agoofproto: Use 64-bit datapath id and management id (OpenFlow 0.9)
Justin Pettit [Fri, 13 Nov 2009 21:21:13 +0000 (13:21 -0800)]
ofproto: Use 64-bit datapath id and management id (OpenFlow 0.9)

The length of a datapath was changed from 48 bits to 64 bits in OpenFlow
0.9.  For parity, we increased the management id size to match.

NOTE: This is the final commit in the OpenFlow 0.9 set.  Starting with
this commit, OVS is OpenFlow 0.9-compliant.

14 years agoofproto: Add support for barrier command (OpenFlow 0.9)
Justin Pettit [Fri, 13 Nov 2009 20:41:57 +0000 (12:41 -0800)]
ofproto: Add support for barrier command (OpenFlow 0.9)

OpenFlow 0.9 introduces the concept of the barrier command.  When the
controller sends a Barrier Request, the switch is not allowed to respond
with a Barrier Reply until it has finished processing any other commands
that preceded it.  This commit provides that support.

NOTE: OVS at this point is not wire-compatible with OpenFlow 0.9 until the
final commit in this OpenFlow 0.9 set.

14 years agoofproto: Cleanups to openflow.h (OpenFlow 0.9)
Justin Pettit [Fri, 13 Nov 2009 19:36:02 +0000 (11:36 -0800)]
ofproto: Cleanups to openflow.h (OpenFlow 0.9)

This commit cleans up a few comments in openflow.h.  The only one of
significance is that OpenFlow port numbers now begin enumeration at 1.
OVS already behaved in this manner, so this is just a documentation
issue for us.

NOTE: OVS at this point is not wire-compatible with OpenFlow 0.9 until the
final commit in this OpenFlow 0.9 set.

14 years agoofproto: Add selective Flow Removed messages and flow deletes (OpenFlow 0.9)
Justin Pettit [Fri, 13 Nov 2009 19:08:32 +0000 (11:08 -0800)]
ofproto: Add selective Flow Removed messages and flow deletes (OpenFlow 0.9)

In OpenFlow 0.9, flow "expiration" messages are sent when flows are
explicitly removed by a delete action.  As such, the message is renamed
from Flow Expired to Flow Removed.  This commit adds that support as well
as supporting the ability to choose sending these messages on a per flow
basis.

NOTE: OVS at this point is not wire-compatible with OpenFlow 0.9 until the
final commit in this OpenFlow 0.9 set.

14 years agoofproto: Check overlap, emerg flow cache, and error code sync (OpenFlow 0.9)
Justin Pettit [Thu, 12 Nov 2009 23:40:33 +0000 (15:40 -0800)]
ofproto: Check overlap, emerg flow cache, and error code sync (OpenFlow 0.9)

This commit adds (some) support for a couple new OpenFlow 0.9 features:

    - The OFPFF_CHECK_OVERLAP flag in Flow Mod messages allows the
      controller to prevent flows that would conflict at the same
      priority.

    - An emergency flow cache that contains a small flow table that is
      used if the switch loses connectivity with the controller.  I
      believe the design has fundamental flaws and looks likely to be
      retired.  If a controller attempts to add a flow to the emergency
      flow cache, OVS always responds that the tables are full.

The OpenFlow 0.9 error codes are also sync'd in the commit.

NOTE: OVS at this point is not wire-compatible with OpenFlow 0.9 until the
final commit in this OpenFlow 0.9 set.

14 years agoofproto: Match VLAN PCP and rewrite ToS bits (OpenFlow 0.9)
Justin Pettit [Wed, 11 Nov 2009 22:59:49 +0000 (14:59 -0800)]
ofproto: Match VLAN PCP and rewrite ToS bits (OpenFlow 0.9)

Starting in OpenFlow 0.9, it is possible to match on the VLAN PCP
(priority) field and rewrite the IP ToS/DSCP bits.  This check-in
provides that support and bumps the wire protocol number to 0x98.

NOTE: The wire changes come together over the set of OpenFlow 0.9 commits,
so OVS will not be OpenFlow-compatible with any official release between
this commit and the one that completes the set.

14 years agoofproto: Delete fail-open flow when turning off fail-open mode.
Ben Pfaff [Tue, 23 Feb 2010 23:14:15 +0000 (15:14 -0800)]
ofproto: Delete fail-open flow when turning off fail-open mode.

fail_open_destroy() was not deleting the fail-open flow, so turning off
fail-open mode did not work if fail-open had already been triggered.
This commit fixes the problem.

Reported by Paul Ingram <paul@nicira.com>.

14 years agotests: Add basic unit tests for interface-reconfigure.
Ben Pfaff [Tue, 23 Feb 2010 00:28:30 +0000 (16:28 -0800)]
tests: Add basic unit tests for interface-reconfigure.

These tests are probably not perfect, and we could and should certainly
add more of them, but they should at least help us to notice when commits
change interface-reconfigure's behavior.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Add --no-syslog feature to interface-reconfigure.
Ben Pfaff [Tue, 23 Feb 2010 00:26:50 +0000 (16:26 -0800)]
xenserver: Add --no-syslog feature to interface-reconfigure.

This makes it easier to do unit tests (some of which will be added in an
upcoming commit) by allowing messages to be read from stderr instead of
having to somehow intercept syslog calls.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Add --root-prefix feature to interface-reconfigure.
Ben Pfaff [Tue, 23 Feb 2010 00:25:54 +0000 (16:25 -0800)]
xenserver: Add --root-prefix feature to interface-reconfigure.

This makes it easier to do unit tests (some of which will be added in an
upcoming commit) by allowing fake configuration files and scripts to be
added in a directory other than the real root.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Add assertion and additional comments to ovs-vsctl commands.
Ben Pfaff [Mon, 22 Feb 2010 21:42:02 +0000 (13:42 -0800)]
xenserver: Add assertion and additional comments to ovs-vsctl commands.

I found these useful while debugging.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Remove a VLAN's bridge when bringing down its PIF.
Ben Pfaff [Mon, 22 Feb 2010 21:32:01 +0000 (13:32 -0800)]
xenserver: Remove a VLAN's bridge when bringing down its PIF.

Before, interface-reconfigure would only bring remove a VLAN's bridge
incidentally as part of removing its datapath's bridge.  This commit fixes
it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Avoid doing unneeded work in deconfigure_datapath().
Ben Pfaff [Mon, 22 Feb 2010 21:27:19 +0000 (13:27 -0800)]
xenserver: Avoid doing unneeded work in deconfigure_datapath().

Deleting a bridge deletes all of its ports, too, so there's no benefit in
doing so manually beforehand.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Set xs-network-uuids for both datapath and VLAN bridges.
Ben Pfaff [Tue, 23 Feb 2010 00:41:19 +0000 (16:41 -0800)]
xenserver: Set xs-network-uuids for both datapath and VLAN bridges.

It makes sense to set xs-network-uuids for every bridge, so this commit
does so.  It also makes the code a bit more readable by factoring logic
out into a new function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Always call ovs-vsctl in bring_down().
Ben Pfaff [Mon, 22 Feb 2010 21:41:19 +0000 (13:41 -0800)]
xenserver: Always call ovs-vsctl in bring_down().

The datapath_modify_config() call here was at the wrong level of
indentation, so it was only getting called if 'dp' was to be deleted.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Fix bringing up VLAN PIFs.
Ben Pfaff [Mon, 22 Feb 2010 21:08:10 +0000 (13:08 -0800)]
xenserver: Fix bringing up VLAN PIFs.

In configure_datapath(), bringing up a VLAN PIF's datapath is no different
from bringing up a non-VLAN PIF's datapath, but the code was making
unnecessary distinctions.  Also, the test
if parent and datapath:
did not work at all, because there was no variable named 'datapath' in
scope and no obvious source of one.

In preconfigure(), it then becomes necessary to create a VLAN bridge for a
VLAN PIF, in a straightforward way.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Hoist identical bridge and vswitch functions into common code.
Ben Pfaff [Tue, 23 Feb 2010 17:47:31 +0000 (09:47 -0800)]
xenserver: Hoist identical bridge and vswitch functions into common code.

The previous commit made pif_bridge_name() in the bridge and vswitch
versions of interface-reconfigure functionally identical, so this commit
hoists them into a single common implementation in InterfaceReconfigure.py.

pif_is_bridged() also comes along for the ride because it is also generic
and because it is logically related.  Only the bridge code uses it at the
moment.

Suggested-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Accept VLAN PIFs in pif_bridge_name().
Ben Pfaff [Mon, 22 Feb 2010 20:53:17 +0000 (12:53 -0800)]
xenserver: Accept VLAN PIFs in pif_bridge_name().

pif_bridge_name() was written when the vswitch interface-reconfigure was
working with the raw Open vSwitch configuration via ovs-cfg-mod.  Then,
it made no sense to ask for the "bridge name" of a VLAN PIF, because a
VLAN PIF didn't have a bridge.

Now, however, the vSwitch interface-reconfigure works with ovs-vsctl, which
provides a thin layer over the OVS configuration that makes VLAN bridges
appear to exist.  So now it makes sense to ask for the bridge of a VLAN
PIF, and this commit enables that.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Delete ports by interface name.
Ben Pfaff [Tue, 23 Feb 2010 00:36:30 +0000 (16:36 -0800)]
xenserver: Delete ports by interface name.

ovs-vsctl command "--if-exists del-port eth0" does nothing if eth0 is on
a bridge as part of a bond, because the bond's port name is not eth0 but
something else.  But interface-reconfigure needs to do that, so this commit
adds that ability to ovs-vsctl and modifies interface-reconfigure to use it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Fix comment in interface-reconfigure.
Ben Pfaff [Mon, 22 Feb 2010 20:37:20 +0000 (12:37 -0800)]
xenserver: Fix comment in interface-reconfigure.

This comment was accurate, but didn't actually say what the function did.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoRelease Open vSwitch 0.99.2
Justin Pettit [Fri, 19 Feb 2010 07:38:42 +0000 (23:38 -0800)]
Release Open vSwitch 0.99.2

This is an "unstable" release.

14 years agoxenserver: Fix VIF script to work with XenServer 5.5
Justin Pettit [Fri, 19 Feb 2010 00:16:56 +0000 (16:16 -0800)]
xenserver: Fix VIF script to work with XenServer 5.5

14 years agoxenserver: Exclude compile Python byte code from packaging
Justin Pettit [Wed, 17 Feb 2010 06:40:17 +0000 (22:40 -0800)]
xenserver: Exclude compile Python byte code from packaging

14 years agoovsdb: Introduce <nonnull-json-value> to clarify specifications.
Ben Pfaff [Thu, 18 Feb 2010 19:01:26 +0000 (11:01 -0800)]
ovsdb: Introduce <nonnull-json-value> to clarify specifications.

14 years agoovsdb: Fix use of <value> as both a JSON value and as a database value.
Ben Pfaff [Thu, 18 Feb 2010 19:00:04 +0000 (11:00 -0800)]
ovsdb: Fix use of <value> as both a JSON value and as a database value.

14 years agoAdd extern "C" to more header files.
Jesse Gross [Wed, 17 Feb 2010 15:36:57 +0000 (10:36 -0500)]
Add extern "C" to more header files.

From partner.

14 years agoxenserver: Upgrade and compact database on system boot.
Ben Pfaff [Fri, 12 Feb 2010 19:26:32 +0000 (11:26 -0800)]
xenserver: Upgrade and compact database on system boot.

This should take care of many of the OVSDB-related upgrade and downgrade
problems reported by Nicira internal testers.

Bug #2388.

14 years agoovsdb: Implement ovsdb-tool commands "compact" and "convert".
Ben Pfaff [Fri, 12 Feb 2010 19:26:54 +0000 (11:26 -0800)]
ovsdb: Implement ovsdb-tool commands "compact" and "convert".

Partial fix for bug #2391.

14 years agoovsdb: Factor out code to fsync a file's containing directory.
Ben Pfaff [Thu, 11 Feb 2010 23:35:46 +0000 (15:35 -0800)]
ovsdb: Factor out code to fsync a file's containing directory.

In an upcoming commit, another function wants to do the same thing, so
break it out into a helper function.

14 years agoovsdb: Refactor code for writing a transaction to a file.
Ben Pfaff [Thu, 11 Feb 2010 00:35:24 +0000 (16:35 -0800)]
ovsdb: Refactor code for writing a transaction to a file.

An upcoming commit will add another user for this code, so it is good to
abstract it a little better.

14 years agoovsdb: Allow ovsdb_log_open()'s caller to choose whether to lock.
Ben Pfaff [Mon, 15 Feb 2010 19:31:32 +0000 (11:31 -0800)]
ovsdb: Allow ovsdb_log_open()'s caller to choose whether to lock.

The current callers of ovsdb_log_open() always want to lock the file if
they are accessing it for read/write access.  An upcoming commit will add
a new caller that does not fit this model (it wants to lock the file
across a wider region) and so the caller should be able to choose whether
to do locking.  This commit adds that ability.

Also, get rid of the use of <fcntl.h> flags to choose the open mode, which
has always seemed somewhat crude and which this change would make even
cruder.

14 years agoovsdb-server: Add --run option.
Ben Pfaff [Fri, 12 Feb 2010 19:17:17 +0000 (11:17 -0800)]
ovsdb-server: Add --run option.

Bug #2398.

14 years agoovsdb: Add functions to clone schemas.
Ben Pfaff [Wed, 10 Feb 2010 23:37:52 +0000 (15:37 -0800)]
ovsdb: Add functions to clone schemas.

These will be used by an upcoming commit.

14 years agoovsdb-client: Add blank line between tables in CSV, tabular output.
Ben Pfaff [Fri, 12 Feb 2010 19:35:35 +0000 (11:35 -0800)]
ovsdb-client: Add blank line between tables in CSV, tabular output.

Adding a blank line makes the output easier to read when there are
multiple tables.

14 years agoovsdb-client: Add "dump" command for dumping entire database contents.
Ben Pfaff [Mon, 15 Feb 2010 19:30:06 +0000 (11:30 -0800)]
ovsdb-client: Add "dump" command for dumping entire database contents.

There are no tests for this currently, but an upcoming commit will use it
to test other commands.

14 years agoovsdb-client: Improve HTML output.
Ben Pfaff [Fri, 12 Feb 2010 19:34:10 +0000 (11:34 -0800)]
ovsdb-client: Improve HTML output.

This commit introduces links from UUIDs to rows that represent them and
shortens UUIDs added to tables to their first 8 characters.  This makes
the output more readable.

14 years agouuid: New function uuid_from_string_prefix().
Ben Pfaff [Wed, 10 Feb 2010 23:54:43 +0000 (15:54 -0800)]
uuid: New function uuid_from_string_prefix().

For use in an upcoming commit.

14 years agoovsdb-client: Introduce new data formatting style as the default.
Ben Pfaff [Fri, 12 Feb 2010 19:32:36 +0000 (11:32 -0800)]
ovsdb-client: Introduce new data formatting style as the default.

The new data formatting style is generally shorter and easier to read than
the JSON representation (which is still available using "-d json").

14 years agoovsdb-client: Remove --wide option.
Ben Pfaff [Wed, 10 Feb 2010 22:38:05 +0000 (14:38 -0800)]
ovsdb-client: Remove --wide option.

This option just confused people, since no one really expected the output
to be truncated at 79 columns by default.

14 years agoovsdb: Fix commit to disk of rows added to a table with all-default values.
Ben Pfaff [Fri, 12 Feb 2010 19:13:24 +0000 (11:13 -0800)]
ovsdb: Fix commit to disk of rows added to a table with all-default values.

14 years agoovs-vsctl: Clarify manpage.
Ben Pfaff [Fri, 12 Feb 2010 22:33:10 +0000 (14:33 -0800)]
ovs-vsctl: Clarify manpage.

If anyone ever reads the manpage, this should help.

14 years agoofproto: Use UINT16_MAX in place of -1, for clarity.
Ben Pfaff [Fri, 12 Feb 2010 21:58:17 +0000 (13:58 -0800)]
ofproto: Use UINT16_MAX in place of -1, for clarity.

Reported-by: Jesse Gross <jesse@nicira.com>
14 years agoUse VLAN_PCP_SHIFT consistently, instead of open-coding "13".
Ben Pfaff [Fri, 12 Feb 2010 21:54:19 +0000 (13:54 -0800)]
Use VLAN_PCP_SHIFT consistently, instead of open-coding "13".

Reported-by: Jesse Gross <jesse@nicira.com>
14 years agocompiler: Don't use __attribute__ for non-GCC compilers.
Ben Pfaff [Fri, 12 Feb 2010 20:54:58 +0000 (12:54 -0800)]
compiler: Don't use __attribute__ for non-GCC compilers.

__attribute__ is a GCC feature that we should not expose to other
compilers.

14 years agoWork around bugs in system headers.
Ben Pfaff [Fri, 12 Feb 2010 20:51:36 +0000 (12:51 -0800)]
Work around bugs in system headers.

On some system, at least, one must include <sys/types.h> before
<netinet/in.h>, and <netinet/in.h> before <arpa/inet.h> or <net/if.h>.

From Jean Tourrilhes <jt@hpl.hp.com>.

14 years agoofp-print: Properly order #includes.
Ben Pfaff [Fri, 12 Feb 2010 20:41:56 +0000 (12:41 -0800)]
ofp-print: Properly order #includes.

From Jean Tourrilhes <jt@hpl.hp.com>.

14 years agoAdd missing <stdint.h> includes.
Ben Pfaff [Fri, 12 Feb 2010 20:33:47 +0000 (12:33 -0800)]
Add missing <stdint.h> includes.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
14 years agopktbuf: Assign UINT16_MAX in place of -1, for clarity.
Ben Pfaff [Thu, 11 Feb 2010 20:33:29 +0000 (12:33 -0800)]
pktbuf: Assign UINT16_MAX in place of -1, for clarity.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
14 years agoutil: Remove unused macros NOT_TESTED, NOT_IMPLEMENTED.
Ben Pfaff [Thu, 11 Feb 2010 19:55:08 +0000 (11:55 -0800)]
util: Remove unused macros NOT_TESTED, NOT_IMPLEMENTED.

Great ideas in theory, but we haven't used them.

14 years agoopenflow.h: Remove unused OFP_PACKED macro.
Ben Pfaff [Thu, 11 Feb 2010 19:45:29 +0000 (11:45 -0800)]
openflow.h: Remove unused OFP_PACKED macro.

14 years agocompiler: Remove "likely" and "unlikely" macros, since we don't use them.
Ben Pfaff [Thu, 11 Feb 2010 19:37:30 +0000 (11:37 -0800)]
compiler: Remove "likely" and "unlikely" macros, since we don't use them.

(The datapath uses these macros, but those come from Linux's kernel.h, not
from this file.)

14 years agocompiler: Remove PACKED macro and its only (unneeded) user.
Ben Pfaff [Fri, 12 Feb 2010 21:56:12 +0000 (13:56 -0800)]
compiler: Remove PACKED macro and its only (unneeded) user.

There is no point in marking a well-aligned structure PACKED.  It can only
cause trouble.

14 years agoclassifier: New function cls_rule_to_string().
Ben Pfaff [Thu, 11 Feb 2010 21:47:30 +0000 (13:47 -0800)]
classifier: New function cls_rule_to_string().

This may be useful for debugging.

From Jean Tourrilhes <jt@hpl.hp.com>.

14 years agodatapath: Add ODPP_NORMAL constant.
Ben Pfaff [Thu, 11 Feb 2010 21:45:03 +0000 (13:45 -0800)]
datapath: Add ODPP_NORMAL constant.

Some (out-of-tree) datapaths want to pass OFPP_NORMAL up to the datapath.
For now add ODPP_NORMAL.  In the long run we may want to use OFPP_ port
numbers in the datapath interface.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
14 years agovconn: New functions vconn_verify_name(), pvconn_verify_name().
Ben Pfaff [Thu, 11 Feb 2010 22:58:02 +0000 (14:58 -0800)]
vconn: New functions vconn_verify_name(), pvconn_verify_name().

These are useful for checking that the syntax of a name is valid, so that
completely invalid names can be rejected at program startup time.

CC: Jean Tourrilhes <jt@hpl.hp.com>
14 years agorconn: New function rconn_get_last_error().
Ben Pfaff [Thu, 11 Feb 2010 22:39:25 +0000 (14:39 -0800)]
rconn: New function rconn_get_last_error().

This function allows the client to find out why the rconn last
disconnected.

CC: Jean Tourrilhes <jt@hpl.hp.com>
14 years agorconn: Decentralize and improve disconnection logging.
Ben Pfaff [Thu, 11 Feb 2010 22:32:49 +0000 (14:32 -0800)]
rconn: Decentralize and improve disconnection logging.

In some cases the rconn library was logging disconnections twice, and in
other cases it was not logging them at all.  This cleans it up, so that
each disconnection or connection failure should cause one log message.

This commit makes disconnect()'s 'error' argument unused, but it will be
used again in the following commit.

14 years agovconn: When validating OpenFlow actions always check for bad length.
Ben Pfaff [Thu, 11 Feb 2010 20:26:45 +0000 (12:26 -0800)]
vconn: When validating OpenFlow actions always check for bad length.

This code was previously unreachable, but it makes sense to check the
action length before looking at the action any further.

This doesn't fix an actual bug--actions were always properly validated.

Also, rephrase a few of the switch cases to make it even more obvious
that they always return.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
14 years agoofpbuf: New function ofpbuf_to_string().
Ben Pfaff [Thu, 11 Feb 2010 21:56:45 +0000 (13:56 -0800)]
ofpbuf: New function ofpbuf_to_string().

Useful for debugging.

From Jean Tourrilhes <jt@hpl.hp.com>.

14 years agoofpbuf: Mark ofpbuf_headroom(), ofpbuf_tailroom() parameters const.
Ben Pfaff [Thu, 11 Feb 2010 22:59:01 +0000 (14:59 -0800)]
ofpbuf: Mark ofpbuf_headroom(), ofpbuf_tailroom() parameters const.

14 years agoofproto: Don't leak struct ofproto's port array.
Ben Pfaff [Thu, 11 Feb 2010 23:04:00 +0000 (15:04 -0800)]
ofproto: Don't leak struct ofproto's port array.

From Jean Tourrilhes <jt@hpl.hp.com>.

14 years agodpif-netdev: Fix validation of VLAN PCP value in userspace datapath.
Ben Pfaff [Thu, 11 Feb 2010 21:51:56 +0000 (13:51 -0800)]
dpif-netdev: Fix validation of VLAN PCP value in userspace datapath.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
14 years agoAllow sFlowCpInterval=0 to disable counter samples, and fix bug in sampler removal.
Neil McKee [Thu, 11 Feb 2010 23:06:11 +0000 (15:06 -0800)]
Allow sFlowCpInterval=0 to disable counter samples, and fix bug in sampler removal.