sliver-openvswitch.git
14 years agoMerge "next" branch into "master".
Ben Pfaff [Wed, 17 Mar 2010 21:35:56 +0000 (14:35 -0700)]
Merge "next" branch into "master".

14 years agoovsdb: Add tests for transient ovsdb-server.
Ben Pfaff [Tue, 16 Mar 2010 23:31:52 +0000 (16:31 -0700)]
ovsdb: Add tests for transient ovsdb-server.

This variant of the ovsdb execution tests runs each transaction against a
separately started ovsdb-server.  The idea is that this should help to
ferret out any differences between what ovsdb-server has in memory and what
actually gets committed to disk.  There should not be any such differences,
but we need to test for that.

14 years agovswitch: Use weak references in Mirror table.
Ben Pfaff [Mon, 15 Mar 2010 22:23:22 +0000 (15:23 -0700)]
vswitch: Use weak references in Mirror table.

A port mirror seems sufficiently disconnected from the ports that it
mirrors that it seems counterproductive to forbid removing a port if
it is mirrored.  This commit therefore changes the references from
Mirror to Port from strong references to weak references, so that
removing a port automatically removes references to it from the Mirror
table.

Since this could cause the port and VLAN selection for the Mirror to
become empty, which would make the mirror select all packets, at the same
time this commit adds a new column "select_all" to Mirror, to explicitly
allow selecting all packets.

14 years agoovsdb: Add support for weak references.
Ben Pfaff [Mon, 15 Mar 2010 22:41:54 +0000 (15:41 -0700)]
ovsdb: Add support for weak references.

14 years agoovsdb: Check for changed columns only once per transaction commit.
Ben Pfaff [Fri, 12 Mar 2010 01:14:31 +0000 (17:14 -0800)]
ovsdb: Check for changed columns only once per transaction commit.

Until now, each part of a transaction commit that is interested in whether
a column's value has changed has had to do a comparison of the old and new
values itself.  There can be several interested parties per commit
(generally one for file storage and one for each remove OVSDB connection),
so this seems like too much redundancy.  This commit adds a bitmap
to struct ovsdb_txn_row that tracks whether a column's value has actually
changed, to reduce this overhead.

As a convenient side effect of doing these checks up front, it then
becomes easily possible to drop txn_rows (and txn_tables and entire txns)
that become no-ops.  (This probably fixes bug #2400, which reported that
some no-ops actually report updates over monitors.)

14 years agoovsdb: Simplify referential integrity checking commit logic.
Ben Pfaff [Fri, 12 Mar 2010 19:03:44 +0000 (11:03 -0800)]
ovsdb: Simplify referential integrity checking commit logic.

Until now, the commit-time logic for verifying referential integrity
modified row reference counts in-place.  That meant that it had to be
careful to be able to roll back those changes if it did detect a violation.
This commit changes the logic to avoid making any in-place changes.
Instead, the reference counts are tracked outside the rows themselves and
committed only if the transaction as a whole satisfies the constraints.
This eliminates a fair bit of code and paves the way for implementing
weak references as well.

14 years agoovsdb: Introduce for_each_txn_row() iterator function for transactions.
Ben Pfaff [Wed, 17 Mar 2010 18:16:07 +0000 (11:16 -0700)]
ovsdb: Introduce for_each_txn_row() iterator function for transactions.

A number of places in the transaction code want to iterate over all of
the txn_rows and possibly modify them.  It is getting messy to duplicate
the code to do this everywhere.  This commit introduces a new function that
encapsulates the iteration logic, efficiently handling modifications made
by the callback function.

Upcoming commits will add more uses of this iterator function.

14 years agoNew function ovsdb_error_assert() for verifying that no error occurred.
Ben Pfaff [Fri, 12 Mar 2010 18:27:33 +0000 (10:27 -0800)]
New function ovsdb_error_assert() for verifying that no error occurred.

14 years agoovsdb: Centralize and make consistent setting txn_row members of rows.
Ben Pfaff [Fri, 12 Mar 2010 00:56:36 +0000 (16:56 -0800)]
ovsdb: Centralize and make consistent setting txn_row members of rows.

When a transaction modified a row, the "old" row's txn_row member was
not being set to the txn_row.  This commit changes that and factors out
the code to set the txn_row member of the rows within a txn_row.

This is not a bug fix, because nothing previously cared about the txn_row
member of the old version of a row, but it does matter for an upcoming
commit.

14 years agoovsdb-tool: Fix segfault if deleted row doesn't exist.
Ben Pfaff [Mon, 15 Mar 2010 21:50:14 +0000 (14:50 -0700)]
ovsdb-tool: Fix segfault if deleted row doesn't exist.

This "can't happen" normally, but it will if you monkey with the OVSDB
file by hand such that a row that gets deleted never actually existed in
the db.

14 years agodebian: Upgrade database before starting ovsdb-server.
Ben Pfaff [Wed, 17 Mar 2010 18:02:41 +0000 (11:02 -0700)]
debian: Upgrade database before starting ovsdb-server.

The XenServer init script has been upgrading the database before starting
ovsdb-server for some time now, but the corresponding change was never
made to the Debian init script.  This commit fixes that.

14 years agotests: Don't use obsolete names in ovs-vsctl tests of external-ids.
Ben Pfaff [Wed, 17 Mar 2010 16:53:36 +0000 (09:53 -0700)]
tests: Don't use obsolete names in ovs-vsctl tests of external-ids.

The names used in the tests don't matter, but they could potentially
confuse a reader, so use more generic names.

Reported-by: Justin Pettit <jpettit@nicira.com>
14 years agovswitchd: Remove documentation of xs-network-names.
Ben Pfaff [Fri, 12 Mar 2010 22:58:30 +0000 (14:58 -0800)]
vswitchd: Remove documentation of xs-network-names.

The xs-network-names external_id is no longer used or populated, so remove
its documentation.

14 years agovswitchd: Make names of Interface external_ids generic.
Ben Pfaff [Fri, 12 Mar 2010 22:57:59 +0000 (14:57 -0800)]
vswitchd: Make names of Interface external_ids generic.

Until now the names of the external_ids keys used for Interface records
have implied that they are specific to XenServer, because they begin with
"xs-".  They are more generic in intent, however, so this commit removes
the "xs-" prefix and explains them more generically.

The Bridge record's external_ids still need renaming.

14 years agoxenserver: Restore XS5.5 compatibility for vif script.
Ben Pfaff [Fri, 12 Mar 2010 23:08:18 +0000 (15:08 -0800)]
xenserver: Restore XS5.5 compatibility for vif script.

XAPI in XenServer 5.5 does not put the vif-uuid or network-uuid into
XenStore, so the vif script needs to query xapi for those attributes in
that case.

Tested with XenServer 5.5.0 update 1 and XenServer 5.5.9 build 29381
(the latter just to make sure I didn't break anything).

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Must pass --no-wait to ovs-vsctl before starting ovs-vswitchd.
Ben Pfaff [Wed, 17 Mar 2010 16:48:05 +0000 (09:48 -0700)]
xenserver: Must pass --no-wait to ovs-vsctl before starting ovs-vswitchd.

Otherwise ovs-vsctl pauses until it times out waiting for ovs-vswitchd to
reload its configuration.

14 years agodatapath: Consistently maintain flow key.
Jesse Gross [Fri, 12 Mar 2010 21:36:58 +0000 (16:36 -0500)]
datapath: Consistently maintain flow key.

After executing an action that changes a packet sometimes we update
the flow key and sometimes we don't.  This is potentially problematic
because we sometimes use the key for checks later on.  This consistently
maintains the key.

14 years agodatapath: Validate ToS when flow is added.
Jesse Gross [Fri, 12 Mar 2010 21:05:25 +0000 (16:05 -0500)]
datapath: Validate ToS when flow is added.

Check that the ToS is valid when the flow is added, not every time
it is used.

14 years agodatapath: Use constants instead of actual values.
Jesse Gross [Thu, 4 Mar 2010 22:55:44 +0000 (17:55 -0500)]
datapath: Use constants instead of actual values.

Use the appropriate constants instead of the values for masks, shifts,
etc.

14 years agobridge: Remove leftover from config file.
Jesse Gross [Fri, 12 Mar 2010 19:10:13 +0000 (14:10 -0500)]
bridge: Remove leftover from config file.

The 'pfx' variable is no longer used now that the config file is
gone and its only purpose in life is to be freed so get rid of it.

14 years agovconn-stream: Copy stream's IP and port info into vconn at creation time.
Tetsuo NAKAGAWA [Mon, 15 Mar 2010 17:16:02 +0000 (10:16 -0700)]
vconn-stream: Copy stream's IP and port info into vconn at creation time.

This fixes in-band control, which depends on knowing the local and remote
IP and port.

14 years agovconn-stream: Fix listening on ptcp: and pssl: without specifying a port.
Ben Pfaff [Mon, 15 Mar 2010 17:13:51 +0000 (10:13 -0700)]
vconn-stream: Fix listening on ptcp: and pssl: without specifying a port.

This function was adding an extra ":", which made pstream_open() unhappy.

14 years agoofp-print: Cleanup typos in print OpenFlow Flow Stats Reply
Justin Pettit [Thu, 11 Mar 2010 15:49:20 +0000 (07:49 -0800)]
ofp-print: Cleanup typos in print OpenFlow Flow Stats Reply

14 years agoAdd "external_ids" column to Open_vSwitch table, add "system-uuid" on Xen.
Justin Pettit [Sat, 6 Mar 2010 02:41:16 +0000 (18:41 -0800)]
Add "external_ids" column to Open_vSwitch table, add "system-uuid" on Xen.

Software that interfaces to Open vSwitch needs a way to identify the
host that the switch is running on.  This commit adds such a way.

Cleaned up version of original implementation by Ben Pfaff.

14 years agoofproto: Avoid extra call to time_msec().
Ben Pfaff [Tue, 9 Mar 2010 18:03:29 +0000 (10:03 -0800)]
ofproto: Avoid extra call to time_msec().

compose_flow_removed() already has the current time conveniently provided
as a parameter, so there is no need to call time_msec() directly.

Also squashes an annoying GCC warning about an unused parameter.

14 years agoovs-brcompatd: Fix stupid merge error.
Ben Pfaff [Tue, 9 Mar 2010 00:31:55 +0000 (16:31 -0800)]
ovs-brcompatd: Fix stupid merge error.

Apparently I can no longer rely on myself to look for compiler warnings
before I push.

Introduced in commit 4b3a0009 "ovs-brcompatd: Delete what Bridge
references when deleting a Bridge."

14 years agoovsdb-tool: Do not lock source db for compacting or converting to new db.
Ben Pfaff [Mon, 8 Mar 2010 22:01:16 +0000 (14:01 -0800)]
ovsdb-tool: Do not lock source db for compacting or converting to new db.

"ovsdb-tool compact SRC DST" and "ovsdb-tool convert SRC SCHEMA DST" do not
need to lock SRC, because they do not modify it.

Reported-by: Justin Pettit <jpettit@nicira.com>
14 years agolockfile: Occasionally log a warning when waiting for a lockfile.
Ben Pfaff [Mon, 8 Mar 2010 21:52:43 +0000 (13:52 -0800)]
lockfile: Occasionally log a warning when waiting for a lockfile.

Waiting for a lockfile can cause mysterious pauses for users.  Logging a
warning to the console every so often gives them feedback on what is
happening.

Reported-by: Justin Pettit <jpettit@nicira.com>
14 years agoRaise minimum Autoconf version to 2.64.
Ben Pfaff [Fri, 26 Feb 2010 20:19:58 +0000 (12:19 -0800)]
Raise minimum Autoconf version to 2.64.

Our configure scripts were actually using Autoconf features introduced in
version 2.64 (e.g. AT_SKIP_IF, AT_CHECK_UNQUOTED), so we should not
claim 2.63 as prerequisite.

Reported-by: Andy Southgate <andy.southgate@citrix.com>
14 years agoovs-brcompatd: Delete what Bridge references when deleting a Bridge.
Ben Pfaff [Mon, 8 Mar 2010 22:23:42 +0000 (14:23 -0800)]
ovs-brcompatd: Delete what Bridge references when deleting a Bridge.

A Bridge record can reference a number of other records: Port, Mirror,
NetFlow, sFlow, and Controller records.  When the Bridge is deleted, we
should also delete those records that it references.  This commit does
that.

Bug #2425.

14 years agoovsdb-idl: Make ovsdb_idl_txn_add_comment() take a printf() format string.
Ben Pfaff [Mon, 8 Mar 2010 22:18:44 +0000 (14:18 -0800)]
ovsdb-idl: Make ovsdb_idl_txn_add_comment() take a printf() format string.

All of the callers were calling xasprintf() and then passing the result
to ovsdb_idl_txn_add_comment(), so this slightly simplifies the callers.

14 years agocsum: Fix rare error cases in checksum computation.
Ben Pfaff [Mon, 8 Mar 2010 21:33:13 +0000 (13:33 -0800)]
csum: Fix rare error cases in checksum computation.

Occasionally the checksum test on "make check" would fail.  This commit
fixes the problem, which was that the partial checksum may need more than
one reduction step to obtain a final checksum.  Now running checksum tests
in a continuous loop yields no failures.

14 years agoxenserver: Add ovs-vswitchd.conf.db.5.gz to packaged files in RPM.
Ben Pfaff [Mon, 8 Mar 2010 17:12:34 +0000 (09:12 -0800)]
xenserver: Add ovs-vswitchd.conf.db.5.gz to packaged files in RPM.

14 years agoovsdb: Remove "comment" support from OVSDB schemas.
Ben Pfaff [Sat, 6 Mar 2010 01:05:43 +0000 (17:05 -0800)]
ovsdb: Remove "comment" support from OVSDB schemas.

Using a separate XML file to document a schema is much more flexible.
You end up with two files (a schema and documentation for it), each of
which is readable and maintainable, instead of a single schema file that
is almost illegible.

14 years agoAdd documentation for the vswitch database schema.
Ben Pfaff [Wed, 3 Mar 2010 22:47:46 +0000 (14:47 -0800)]
Add documentation for the vswitch database schema.

We can do better than this (I already have some comments) but this is
still much better than what we had.

14 years agoofproto: Fix stupid typo that broke the build.
Ben Pfaff [Sat, 6 Mar 2010 00:35:23 +0000 (16:35 -0800)]
ofproto: Fix stupid typo that broke the build.

14 years agoAdd extern "C" to more header files.
Jesse Gross [Fri, 5 Mar 2010 23:32:40 +0000 (18:32 -0500)]
Add extern "C" to more header files.

From partner.

14 years agoofproto: Fix OpenFlow flow statistics result.
Ben Pfaff [Fri, 5 Mar 2010 00:57:08 +0000 (16:57 -0800)]
ofproto: Fix OpenFlow flow statistics result.

It made no sense to sum the rule and subrule counters and then throw them
away.

Seemingly caused by a bad merge in commit 3f355f4 'Merge "citrix" into
"master".'

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
14 years agogre: Add support for path MTU discovery.
Jesse Gross [Mon, 1 Mar 2010 16:59:07 +0000 (11:59 -0500)]
gre: Add support for path MTU discovery.

This allows path MTU discovery to properly work when used with
bridging.  While there was previously support for PMTUD it used
the kernel's IP stack.  This works fine for routing but when
bridging it is possible that a complete network is operating over
the bridge that the kernel has no knowledge of and the ICMP
fragmentation needed packets are lost.

When a packet arrives that is above the MTU of the tunnel, an
ICMP message is synthesized and send back on the device that the
original packet came from.  This does not rely on the kernel IP
stack and is therefore independent of the routing table.  Both
IPv4 and IPv6 are supported, including over VLANs.  Other types
of packets that are over the MTU are encapsulated and the outer
packets are fragmented.

This entire functionality is a layer violation since bridging
operates at layer 2 and fragmentation is a function of layer 3.
For this reason it is possible to disable PMTUD, which will
provide complete transparency but will cause the outer IP packets
to be fragmented.

14 years agogre: Correctly account for hardware header length.
Jesse Gross [Fri, 19 Feb 2010 14:42:43 +0000 (09:42 -0500)]
gre: Correctly account for hardware header length.

On recent kernels there are two fields that we can use to keep track
of the overhead due to tunneling: hard_header_len and needed_headroom.
On older kernels everything got shoved into hard_header_len and the
actual header length got lost, which caused MTU calculations to be
incorrect.  Since we know the device type we can figure out what the
header length should be.

14 years agogre: Add functions to determine address type to compat layer.
Jesse Gross [Thu, 18 Feb 2010 16:43:29 +0000 (11:43 -0500)]
gre: Add functions to determine address type to compat layer.

Allows older kernels to classify IPv4/IPv6 addresses as loopback,
broadcast, etc.  The IPv6 functions actually exist in all supported
kernels but add a dependency on the IPv6 code on older kernels (they
are always available on more recent kernels).  This allows us to
process IPv6 packets without dragging in the entire IPv6 subsystem
if it is compiled as a module (such as on Xen).  This is only done
for packets that are passing through the system and does not use
the IPv6 core if it is not configured.

14 years agogre: Allow ToS on outer packet to be configured.
Jesse Gross [Thu, 4 Mar 2010 22:02:57 +0000 (17:02 -0500)]
gre: Allow ToS on outer packet to be configured.

When creating a GRE tunnel, it is now possible to either set the
ToS of the outer packet to a fixed value or copy it from the inner
packet.

14 years agogre: Allow IPv6 ToS bits to be propagated to tunnel packets.
Jesse Gross [Thu, 4 Mar 2010 22:02:37 +0000 (17:02 -0500)]
gre: Allow IPv6 ToS bits to be propagated to tunnel packets.

The IPv6 ToS bits should have the same meaning as in IPv4, so
allow them to be copied from the inner packet to the tunnel packet
if enabled.

14 years agogre: Always set TTL on outer packet to 64.
Jesse Gross [Thu, 18 Feb 2010 16:42:36 +0000 (11:42 -0500)]
gre: Always set TTL on outer packet to 64.

Currently the TTL is copied from the inner packet of the tunnel to
the outer packet if the inner packet is IP.  This is good if your
GRE packets might make it into the input of your device but bad
if you want to be fully transparent.

This also resolves an inconsistency between tunnels set up using
the ioctl and using Netlink.  The ioctl version would force PMTUD
on if a fixed TTL is set as a backup way to prevent loops but it
never made it over to the newer Netlink code so obviously no one
cares too much about it.  This removes it to provide consistency
and transparency.

Basically, don't create loops and you will be happy.

14 years agogre: Disable tx queue.
Jesse Gross [Mon, 22 Feb 2010 22:04:41 +0000 (17:04 -0500)]
gre: Disable tx queue.

GRE is a software device that processes packets synchronously and
doesn't need a queue.  Currently we are using the default for
Ethernet devices but that is unnecessary.

14 years agogre: Check that the IP header is actually there before using it.
Jesse Gross [Tue, 23 Feb 2010 23:05:02 +0000 (18:05 -0500)]
gre: Check that the IP header is actually there before using it.

GRE is nominally operating at layer 2 but it has some special
features for IP packets.  This checks that the IP header is present
before trying to read it.  If it is not there, we just disable the
special features but still process the packet.

14 years agodatapath: Disable large receive offload.
Jesse Gross [Fri, 19 Feb 2010 21:54:19 +0000 (16:54 -0500)]
datapath: Disable large receive offload.

LRO can play fast and loose with the packets that it merges, which
isn't very polite when you are bridging packets for other operating
systems.  This disables LRO on any underlying devices that are added
to the datapath, which is the same as what the bridge does.

Note that this does not disable GRO, which has a more strict set of
rules about what is merged and is therefore safe for bridging.  Both
are typically done in software anyways.

14 years agodatapath: Update hardware computed checksum on VLAN change.
Jesse Gross [Thu, 4 Mar 2010 21:39:57 +0000 (16:39 -0500)]
datapath: Update hardware computed checksum on VLAN change.

The checksum computed by hardware on receive stored in skb->csum
when skb->ip_summed == CHECKSUM_COMPLETE is supposed to reflect
the contents of the packet starting at skb->data, which includes
the VLAN tag if there is one.  However, when we manipulate the
VLAN tag we don't update the checksum.  This leads to all kinds
of nasty warnings about broken hardware, not to mention we can't
take advantage of the checksum that was already computed.

This also fixes some issues with our private checksum type value
on some different kernels and after GSO.

14 years agobrcompat: Print warning when kernel times out waiting for userspace
Justin Pettit [Wed, 3 Mar 2010 20:48:15 +0000 (12:48 -0800)]
brcompat: Print warning when kernel times out waiting for userspace

14 years agoveth: Remove obvious debug printk's
Justin Pettit [Wed, 3 Mar 2010 20:49:12 +0000 (12:49 -0800)]
veth: Remove obvious debug printk's

14 years agoUpdate userspace datapath documentation.
Jesse Gross [Thu, 4 Mar 2010 06:14:29 +0000 (01:14 -0500)]
Update userspace datapath documentation.

14 years ago++WARNING++: Delete this file.
Ben Pfaff [Thu, 4 Mar 2010 00:57:48 +0000 (16:57 -0800)]
++WARNING++: Delete this file.

This branch is now stable enough to eliminate this scary warning.

14 years agoxenserver: Include the vswitch database contents in bugtool reports.
Ben Pfaff [Thu, 4 Mar 2010 00:56:47 +0000 (16:56 -0800)]
xenserver: Include the vswitch database contents in bugtool reports.

/etc/ovs-vswitchd.conf no longer exists, but /etc/ovs-vswitchd.conf.db
does.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoUpdate Open vSwitch documentation.
Ben Pfaff [Thu, 4 Mar 2010 00:54:00 +0000 (16:54 -0800)]
Update Open vSwitch documentation.

14 years agoofproto: Don't shadow global variable name.
Ben Pfaff [Thu, 4 Mar 2010 18:05:18 +0000 (10:05 -0800)]
ofproto: Don't shadow global variable name.

There was already a file scope variable named 'rl', so don't use it as
a local variable name too.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
14 years agoovs-brcompatd: Add comments to config db transactions
Justin Pettit [Wed, 3 Mar 2010 14:02:46 +0000 (06:02 -0800)]
ovs-brcompatd: Add comments to config db transactions

The ovsdb-tool show-log command is very useful for debugging, since it
shows changes to the database over time.  The bridge compatibility code
was not commenting on the changes it was making, so it was difficult to
determine what a system was doing when bridge ioctls were involved.
This commit adds that annotation.

14 years agoovs-brcompatd: Add rate-limit argument to rate-limited log call
Justin Pettit [Wed, 3 Mar 2010 14:05:37 +0000 (06:05 -0800)]
ovs-brcompatd: Add rate-limit argument to rate-limited log call

14 years agobrcompatd: Make bridge ioctls synchronous again.
Ben Pfaff [Wed, 3 Mar 2010 22:27:53 +0000 (14:27 -0800)]
brcompatd: Make bridge ioctls synchronous again.

Before OVSDB was adopted in the vswitch, bridge ioctls were synchronous.
That is, an operation that, say, creates a new bridge was guaranteed to
have completed before brcompatd returned a success result to the kernel.

When OVSDB was adopted, however, we failed to maintain this property.
Instead, bridge creation (etc.) only happened some time after the return
value was passed back to the kernel.  This causes a race condition against
software that creates or deletes bridges or ports and expects that the
operation is completed synchronously.

This commit restores the synchronous behavior.

Bug #2443.

14 years agoovsdb-idl: New function ovsdb_idl_txn_commit_block().
Ben Pfaff [Wed, 3 Mar 2010 20:55:39 +0000 (12:55 -0800)]
ovsdb-idl: New function ovsdb_idl_txn_commit_block().

This commit factors out common code from multiple callers of
ovsdb_idl_txn_commit() into a new function ovsdb_idl_txn_commit_block().

14 years agoxenserver: Add "Vendor" to generated RPM.
Ben Pfaff [Wed, 3 Mar 2010 18:24:36 +0000 (10:24 -0800)]
xenserver: Add "Vendor" to generated RPM.

Reported-by: Henrik Amren <henrik@nicira.com>
14 years agoovsdb-idl: Improve check in ovsdb_idl_row_is_orphan().
Ben Pfaff [Wed, 3 Mar 2010 17:54:43 +0000 (09:54 -0800)]
ovsdb-idl: Improve check in ovsdb_idl_row_is_orphan().

When a transaction is in progress, newly inserted rows have NULL 'old'
values.  These rows are not orphans, so ovsdb_idl_row_is_orphan() should
not treat them as such.

I do not believe that this changes behavior at all, because I have not been
able to find a case where ovsdb_idl_row_is_orphan() is called while a
transaction is in progress.  It is a code cleanup.

14 years agoovsdb-idl: Fix iteration over rows in IDL tables.
Ben Pfaff [Wed, 3 Mar 2010 17:59:47 +0000 (09:59 -0800)]
ovsdb-idl: Fix iteration over rows in IDL tables.

The IDL was returning rows that had existed in the database and were
deleted by the current transaction (that is, row->old && !row->new).
This commit fixes the problem.

The condition used by next_real_row() was just blatantly wrong and
illogical.  The correct condition is row->new != NULL.  The old condition
only got one case wrong (the one mentioned above), even though it didn't
make much sense.

This fixes an ovs-vsctl call that assert-failed in a "set" command that
iterated through a table from which a previous ovs-vsctl command (in the
same invocation) had deleted a row.

14 years agoxenserver: Implement missing interface-reconfigure settings.
Ben Pfaff [Tue, 2 Mar 2010 22:52:05 +0000 (14:52 -0800)]
xenserver: Implement missing interface-reconfigure settings.

These settings are supported by the bridge, and they were supported
earlier by the vswitch, but support regressed when OVSDB was initially
introduced because at first ovs-vsctl did not support these settings.
This commit restores support.

Related to bug #2430, #2442.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Suppress error message for expected non-error condition.
Ben Pfaff [Tue, 2 Mar 2010 21:52:33 +0000 (13:52 -0800)]
xenserver: Suppress error message for expected non-error condition.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agojson: Fix typo in error message.
Ben Pfaff [Tue, 2 Mar 2010 21:38:47 +0000 (13:38 -0800)]
json: Fix typo in error message.

14 years agoxenserver: Various fixes for vif script
Justin Pettit [Tue, 2 Mar 2010 08:15:40 +0000 (00:15 -0800)]
xenserver: Various fixes for vif script

14 years agoProperly escape quotes in process_escape_args() library function
Justin Pettit [Tue, 2 Mar 2010 01:52:12 +0000 (17:52 -0800)]
Properly escape quotes in process_escape_args() library function

14 years agoovs-brcompatd: Don't delete bridge twice.
Ben Pfaff [Tue, 2 Mar 2010 22:19:13 +0000 (14:19 -0800)]
ovs-brcompatd: Don't delete bridge twice.

Somehow I totally goofed when I wrote commit dcdf169e "ovs-brcompatd:
Delete Bridge record when deleting a bridge."  In fact, del_bridge()
already deleted the Bridge record, and I missed that, and so I added a
*second* call to ovsrec_bridge_delete(br).  Obviously that's bad.

This commit removes the first call to delete the bridge.  It is a slight
improvement over simply reverting the buggy commit in that it doesn't
refer to 'br' (just as a pointer equality comparison) after deleting it.

Bug #2448.

14 years agoxenserver: Remove dump-vif-details script.
Ben Pfaff [Fri, 26 Feb 2010 22:11:09 +0000 (14:11 -0800)]
xenserver: Remove dump-vif-details script.

It is no longer used.

Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Fix vNetManager internal network compatibility with XS 5.5.0.
Ben Pfaff [Tue, 2 Mar 2010 20:20:43 +0000 (12:20 -0800)]
xenserver: Fix vNetManager internal network compatibility with XS 5.5.0.

The previous commit depends on XAPI to add "xs-network-uuids" external IDs
for internal networks.  Only recent XAPI builds do this and in particular
the version in XenServer 5.5.0 does not.  This commit restores support
for these older XenServer versions.

The xs-network-names field is no longer set.  We plan to avoid the need for
it in the software that once used it.  It was always a bit of a kluge
anyhow.

CC: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agovswitch: do not access XenAPI from VIF hotplug script
Ian Campbell [Fri, 26 Feb 2010 21:25:09 +0000 (13:25 -0800)]
vswitch: do not access XenAPI from VIF hotplug script

XenAPI accesses must go through the pool master which introduces a
scalability issue.  All but one of the required values are already
present in xenstore for this reason

The only exception is the network UUID for an internal network. Rather
than working around the lack of callout to interface-reconfigure for
these networks simply pass the network uuid when creating calling out
to create the bridge.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agodatapath: Consistently maintain checksum offloading state.
Jesse Gross [Sun, 28 Feb 2010 17:17:16 +0000 (12:17 -0500)]
datapath: Consistently maintain checksum offloading state.

When adding a VLAN tag it is necessary for us to setup checksum
pointers for offloaded packets manually.  However, this process
clobbers some of the fields that other components need to determine
the current status.  Here we mark the packet with its status upon
ingress in our own format that does not get clobbered and is
consistent across kernel versions.

Bug #2436

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 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 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