sliver-openvswitch.git
14 years agoMerge branch 'master' into next
Justin Pettit [Fri, 5 Feb 2010 23:58:27 +0000 (15:58 -0800)]
Merge branch 'master' into next

Conflicts:
COPYING
datapath/datapath.h
lib/automake.mk
lib/dpif-provider.h
lib/dpif.c
lib/hmap.h
lib/netdev-provider.h
lib/netdev.c
lib/stream-ssl.h
ofproto/executer.c
ofproto/ofproto.c
ofproto/ofproto.h
tests/automake.mk
utilities/ovs-ofctl.c
utilities/ovs-vsctl.in
vswitchd/ovs-vswitchd.conf.5.in
xenserver/etc_init.d_vswitch
xenserver/etc_xensource_scripts_vif
xenserver/opt_xensource_libexec_interface-reconfigure

14 years agotests: Fix memory leaks in test programs.
Ben Pfaff [Mon, 1 Feb 2010 22:57:48 +0000 (14:57 -0800)]
tests: Fix memory leaks in test programs.

This makes it easier to see memory leaks in the code under test.

Found with valgrind.

14 years agoovs-vsctl: Free memory on successful exit.
Ben Pfaff [Tue, 2 Feb 2010 22:27:22 +0000 (14:27 -0800)]
ovs-vsctl: Free memory on successful exit.

This is not important in itself, but it helps to spot real memory leaks.

Found with valgrind.

14 years agoovs-vsctl: Fix memory leaks.
Ben Pfaff [Tue, 2 Feb 2010 22:26:53 +0000 (14:26 -0800)]
ovs-vsctl: Fix memory leaks.

Found with valgrind.

14 years agoovs-vsctl: Free memory on fatal error.
Ben Pfaff [Tue, 2 Feb 2010 22:26:17 +0000 (14:26 -0800)]
ovs-vsctl: Free memory on fatal error.

Freeing memory just before exiting is not important in itself, but it makes
it easier to see real memory leaks.

Found with valgrind.

14 years agoovs-vsctl: Use vsctl_fatal() consistently.
Ben Pfaff [Tue, 2 Feb 2010 22:25:11 +0000 (14:25 -0800)]
ovs-vsctl: Use vsctl_fatal() consistently.

vsctl_fatal() logs its argument as well as printing it on stderr, so it
is preferable within ovs-vsctl.  An upcoming commit will also make
vsctl_fatal() free memory, so using it consistently will also make that
memory freed consistently.

14 years agoovsdb-tool: Fix minor memory leak in "create".
Ben Pfaff [Mon, 1 Feb 2010 22:33:29 +0000 (14:33 -0800)]
ovsdb-tool: Fix minor memory leak in "create".

This leak is not important, since "ovsdb-tool create" is a short-running
command, but we might as well fix it.

Found with valgrind.

14 years agoovsdb-client: Fix memory leaks in "monitor" command.
Ben Pfaff [Tue, 2 Feb 2010 22:09:41 +0000 (14:09 -0800)]
ovsdb-client: Fix memory leaks in "monitor" command.

This is a long-running command so it makes sense to free received messages.
Freeing the schema at exit is not essential but cleans up valgrind
output.

Found with valgrind.

14 years agoovsdb-idl: Fix memory leaks and bad memory references.
Ben Pfaff [Tue, 2 Feb 2010 22:03:18 +0000 (14:03 -0800)]
ovsdb-idl: Fix memory leaks and bad memory references.

Found with valgrind.

14 years agoovsdb-server: Free memory on exit.
Ben Pfaff [Tue, 2 Feb 2010 22:41:00 +0000 (14:41 -0800)]
ovsdb-server: Free memory on exit.

It is not really important to free memory on program exit, but it makes it
easier to see real memory leaks.

Found with valgrind.

14 years agoovsdb-server: Fix various memory leaks.
Ben Pfaff [Tue, 2 Feb 2010 22:40:25 +0000 (14:40 -0800)]
ovsdb-server: Fix various memory leaks.

Some of these are serious leaks, in that they could leak some amount of
memory for every transaction processed by the database server.

Found with valgrind.

14 years agoovs-appctl: Free memory on exit.
Ben Pfaff [Tue, 2 Feb 2010 22:18:01 +0000 (14:18 -0800)]
ovs-appctl: Free memory on exit.

This makes it easier to see real memory leaks.

Found via valgrind.

14 years agotests: Always make ovsdb-server exit cleanly, to better find memory leaks.
Ben Pfaff [Tue, 2 Feb 2010 22:16:06 +0000 (14:16 -0800)]
tests: Always make ovsdb-server exit cleanly, to better find memory leaks.

"ovs-appctl exit" causes a cleaner shutdown than "kill" and in particular
lets ovsdb-server clean up better, which makes it easier to find real
memory leaks.

14 years agostp: Fix memory leak.
Ben Pfaff [Tue, 2 Feb 2010 22:03:36 +0000 (14:03 -0800)]
stp: Fix memory leak.

Found with valgrind.

14 years agodaemon: Fix memory leak in --monitor implementation.
Ben Pfaff [Tue, 2 Feb 2010 22:36:19 +0000 (14:36 -0800)]
daemon: Fix memory leak in --monitor implementation.

This leaked a small amount of memory each time a daemon process was
created.  It is only important if a daemon is otherwise very buggy.

Found with valgrind.

14 years agojson: Fix memory leak when nesting depth is exceeded.
Ben Pfaff [Mon, 1 Feb 2010 22:57:27 +0000 (14:57 -0800)]
json: Fix memory leak when nesting depth is exceeded.

This is probably not an important memory leak, since it is only on a rare
error path, but it is best to fix it anyway.

Found with valgrind.

14 years agostream-ssl: Fix unimportant memory leak.
Ben Pfaff [Mon, 1 Feb 2010 22:35:37 +0000 (14:35 -0800)]
stream-ssl: Fix unimportant memory leak.

This function is generally called only once per program execution, so
leaking a little bit of memory does not matter that much.

Found with valgrind.

14 years agoAdd support for running the testsuite under 'valgrind'.
Ben Pfaff [Mon, 1 Feb 2010 22:26:07 +0000 (14:26 -0800)]
Add support for running the testsuite under 'valgrind'.

14 years agotests: Fix timing dependency in ovsdb-log test.
Ben Pfaff [Tue, 2 Feb 2010 22:31:36 +0000 (14:31 -0800)]
tests: Fix timing dependency in ovsdb-log test.

The "lockfile" module logs a message if locking takes a measurable amount
of time.  Running the tests under valgrind tends to make this message
appear, so we need to disable it to make the output comparison come out
cleanly.

14 years agoRework and simplify the "lcov" support for the testsuite.
Ben Pfaff [Mon, 1 Feb 2010 22:04:25 +0000 (14:04 -0800)]
Rework and simplify the "lcov" support for the testsuite.

14 years agodatapath: Set datapath device MTU to minimum of MTU of ports.
Jesse Gross [Mon, 1 Feb 2010 21:43:44 +0000 (16:43 -0500)]
datapath: Set datapath device MTU to minimum of MTU of ports.

The MTU of the local port should be no larger than the minimum of
the MTUs of the ports attached to the bridge, overwise packets may be
dropped.  We already prevent changes to the MTU that would violate
this constraint but don't actuallly proactively set the MTU.  This
changes makes everything consistent and matches the behavior of
the bridge.

14 years agoxenserver: Add XenServer 5.5.0 updates 1 and 2 to supported versions.
Jesse Gross [Fri, 29 Jan 2010 20:54:47 +0000 (15:54 -0500)]
xenserver: Add XenServer 5.5.0 updates 1 and 2 to supported versions.

Add the file hashes for updates  1  and 2 (the scripts we care about
are the same) to the list of supported versions to prevent a warning
message on install.

14 years agoClean up nicira-ext.h header a bit.
Ben Pfaff [Tue, 26 Jan 2010 19:43:27 +0000 (11:43 -0800)]
Clean up nicira-ext.h header a bit.

14 years agoofproto: Mark NXT_ACT_SET_CONFIG and NXT_ACT_GET_CONFIG obsolete.
Ben Pfaff [Tue, 26 Jan 2010 19:42:56 +0000 (11:42 -0800)]
ofproto: Mark NXT_ACT_SET_CONFIG and NXT_ACT_GET_CONFIG obsolete.

These Nicira-specific requests have not been implemented for some time.
In case we need them later we can always reimplement them.

14 years agoofproto: Remove support for OpenFlow-based management protocol.
Ben Pfaff [Tue, 26 Jan 2010 19:35:38 +0000 (11:35 -0800)]
ofproto: Remove support for OpenFlow-based management protocol.

Older versions of Open vSwitch supported a management protocol based on
OpenFlow message framing.  The current Open vSwitch instead uses the
OVSDB protocol for the same purposes.  We don't plan to support this older
protocol any longer, so this commit deletes support.

This commit also deletes the management_id column from the vswitch's
database schema.  The management_id was used by the older management
protocol to match up OpenFlow switch connections to management connections,
but the current implementation instead matches up connections based on
the datapath IDs exported by the configuration database.  In fact, the
OpenFlow connections had no way to actually export the management ID, so
this just deletes code that was essentially without function anyhow.

14 years agodpif: Allow providers to be managed at runtime.
Jesse Gross [Mon, 1 Feb 2010 16:36:01 +0000 (11:36 -0500)]
dpif: Allow providers to be managed at runtime.

The list of datapath providers was previously staticly defined at
compile time.  This allows new providers to be added and removed
at runtime.

14 years agonetdev: Allow providers to be managed at runtime.
Jesse Gross [Mon, 1 Feb 2010 16:35:54 +0000 (11:35 -0500)]
netdev: Allow providers to be managed at runtime.

The list of netdev providers was previously staticly defined at
compile time.  This allows new providers to be added and removed
at runtime.

14 years agoovs-vsctl: Add tests for database commands.
Ben Pfaff [Fri, 29 Jan 2010 00:18:43 +0000 (16:18 -0800)]
ovs-vsctl: Add tests for database commands.

Bug #2396.

14 years agoovs-vsctl: Add --if-exists option to "get" command, for map columns.
Ben Pfaff [Fri, 29 Jan 2010 00:03:52 +0000 (16:03 -0800)]
ovs-vsctl: Add --if-exists option to "get" command, for map columns.

14 years agoovs-vsctl: Improve error reporting.
Ben Pfaff [Fri, 29 Jan 2010 00:03:26 +0000 (16:03 -0800)]
ovs-vsctl: Improve error reporting.

14 years agoovs-vsctl: Alphabetize lists of database column names.
Ben Pfaff [Thu, 28 Jan 2010 23:59:11 +0000 (15:59 -0800)]
ovs-vsctl: Alphabetize lists of database column names.

This makes the "list" command print the database columns in alphabetical
order, which seems more sensible than the semi-random order we had before.

14 years agoovs-vsctl: Make "create" command print new row's UUID.
Ben Pfaff [Thu, 28 Jan 2010 22:00:22 +0000 (14:00 -0800)]
ovs-vsctl: Make "create" command print new row's UUID.

Also, document limitations of other commands regarding UUIDs of new rows.

14 years agoovs-vsctl: Add postprocess step.
Ben Pfaff [Thu, 28 Jan 2010 21:33:24 +0000 (13:33 -0800)]
ovs-vsctl: Add postprocess step.

Nothing uses this new feature yet, so this commit by itself has no visible
effect.

This is a step toward printing the UUIDs of newly inserted rows.

14 years agoovs-vsctl: Refactor in preparation for adding "postprocess" step.
Ben Pfaff [Fri, 29 Jan 2010 00:09:26 +0000 (16:09 -0800)]
ovs-vsctl: Refactor in preparation for adding "postprocess" step.

Until now, all the ovs-vsctl commands have had no need to look at the
results of the database transaction.  However, to print the UUID of newly
inserted database records, they do need to do this.

This commit refactors ovs-vsctl in preparation for adding this ability.

14 years agoNew functions hmap_moved(), shash_moved().
Ben Pfaff [Thu, 28 Jan 2010 22:21:31 +0000 (14:21 -0800)]
New functions hmap_moved(), shash_moved().

To be used in ovs-vsctl in an upcoming commit.

14 years agohmap: Rename hmap_moved() to hmap_node_moved().
Ben Pfaff [Thu, 28 Jan 2010 22:12:56 +0000 (14:12 -0800)]
hmap: Rename hmap_moved() to hmap_node_moved().

This prepares for adding a new function that deals with a "struct hmap"
moving, as opposed to a "struct hmap_node".

Since there was only a single call to this in the whole tree, and its
caller didn't have any callers of its own at all, also move this function
from hmap.h to hmap.c.

14 years agoovsdb-idl: Add interface to find out the permanent IDL of an inserted row.
Ben Pfaff [Thu, 28 Jan 2010 21:23:30 +0000 (13:23 -0800)]
ovsdb-idl: Add interface to find out the permanent IDL of an inserted row.

The ovs-vsctl "create" command, and perhaps other commands, should print
the UUID of the newly created database row, but until now the IDL has not
provided a way to find that out.  This commit adds the ability.

14 years agodynamic-string: New function ds_swap().
Ben Pfaff [Thu, 28 Jan 2010 21:11:39 +0000 (13:11 -0800)]
dynamic-string: New function ds_swap().

14 years agoovsdb-data: Allow spaces around '=' in key-value pairs.
Ben Pfaff [Thu, 28 Jan 2010 18:09:15 +0000 (10:09 -0800)]
ovsdb-data: Allow spaces around '=' in key-value pairs.

This allows a = b, a= b, a =b, etc. whereas before only a=b was accepted.

14 years agoovsdb-data: Allow arbitrary white space as string data delimiters.
Ben Pfaff [Wed, 27 Jan 2010 23:58:32 +0000 (15:58 -0800)]
ovsdb-data: Allow arbitrary white space as string data delimiters.

14 years agoovsdb-data: Make string parsing of negative 0 match JSON parsing.
Ben Pfaff [Wed, 27 Jan 2010 23:38:29 +0000 (15:38 -0800)]
ovsdb-data: Make string parsing of negative 0 match JSON parsing.

14 years agoopenflowd: Update for changes to dpif and netdev.
Jesse Gross [Fri, 22 Jan 2010 19:37:05 +0000 (14:37 -0500)]
openflowd: Update for changes to dpif and netdev.

Openflowd had been a bit neglected as changes were made to the dpif
and netdev interfaces over time.  This brings it up to date with all
the latest changes.

14 years agodpif: Update dpif interface to match netdev.
Jesse Gross [Fri, 22 Jan 2010 19:37:10 +0000 (14:37 -0500)]
dpif: Update dpif interface to match netdev.

This brings over some features that were added to the netdev interface,
most notably the separation between the name and the type.  In addition
to being cleaner, this also avoids problems where it is expected that
the local port has the same name as the datapath.

14 years agoovs-vsctl: Drop redundant {port,iface}-{set,get}-external-ids commands.
Ben Pfaff [Wed, 27 Jan 2010 22:28:30 +0000 (14:28 -0800)]
ovs-vsctl: Drop redundant {port,iface}-{set,get}-external-ids commands.

These commands can be implemented just as well, and in a more
general-purpose way, using the "set", "remove", and "get" commands.

The br-{get,set}-external-ids commands have slightly more specialized
behavior and so we can't drop them (yet).

14 years agoovsdb-idl: Make rows inserted by transaction appear during table iteration.
Ben Pfaff [Wed, 27 Jan 2010 22:12:35 +0000 (14:12 -0800)]
ovsdb-idl: Make rows inserted by transaction appear during table iteration.

14 years agoovs-vsctl: Update --help message.
Ben Pfaff [Wed, 27 Jan 2010 21:49:19 +0000 (13:49 -0800)]
ovs-vsctl: Update --help message.

14 years agoovs-vsctl: Add "destroy" command.
Ben Pfaff [Wed, 27 Jan 2010 21:26:44 +0000 (13:26 -0800)]
ovs-vsctl: Add "destroy" command.

14 years agoovsdb-idl: Export ovsdb_idl_txn_delete() and ovsdb_idl_txn_insert().
Ben Pfaff [Wed, 27 Jan 2010 21:04:56 +0000 (13:04 -0800)]
ovsdb-idl: Export ovsdb_idl_txn_delete() and ovsdb_idl_txn_insert().

ovs-vsctl wants to use these functions directly, so make them available
through the ovsdb-idl public header instead of only through the private
one.

Also, change the prototypes to make them usable without casts.

14 years agoovs-vsctl: Add new "create" command.
Ben Pfaff [Wed, 27 Jan 2010 21:19:46 +0000 (13:19 -0800)]
ovs-vsctl: Add new "create" command.

14 years agoovs-vsctl: Add --force option to database commands to override safety checks.
Ben Pfaff [Wed, 27 Jan 2010 20:48:47 +0000 (12:48 -0800)]
ovs-vsctl: Add --force option to database commands to override safety checks.

14 years agoovs-vsctl: Fix formatting in manpage.
Ben Pfaff [Wed, 27 Jan 2010 19:36:09 +0000 (11:36 -0800)]
ovs-vsctl: Fix formatting in manpage.

The stray .TP was screwing up the right margin for the whole rest of the
manpage.  The .STs were just adding too much vertical space.

14 years agoovs-vsctl: Add "remove" and "clear" commands.
Ben Pfaff [Wed, 27 Jan 2010 19:30:59 +0000 (11:30 -0800)]
ovs-vsctl: Add "remove" and "clear" commands.

14 years agoovs-vsctl: Make parsing functions return error instead of aborting.
Ben Pfaff [Wed, 27 Jan 2010 19:25:20 +0000 (11:25 -0800)]
ovs-vsctl: Make parsing functions return error instead of aborting.

The upcoming "remove" command for ovs-vsctl wants to try parsing an
argument two different ways.  This doesn't work if a parse error always
aborts immediately.  This commit fixes the problem, by making a parsing
failure pass up an error for higher layers to deal with instead of aborting
immediately.

This commit should have no user-visible effect.

14 years agoovs-vsctl: Make the "list" format more uniform.
Ben Pfaff [Wed, 27 Jan 2010 19:23:03 +0000 (11:23 -0800)]
ovs-vsctl: Make the "list" format more uniform.

14 years agoovs-vsctl: Score perfect matches higher than ones that differ in case.
Ben Pfaff [Wed, 27 Jan 2010 19:21:43 +0000 (11:21 -0800)]
ovs-vsctl: Score perfect matches higher than ones that differ in case.

Before, both "xY_z" and "xy-z" were considered equally good matches for
"xy-z", but obviously the latter is a much better match.  This commit fixes
the problem (which was found by inspection).

14 years agoovs-vsctl: Fix uninitialized variable.
Jesse Gross [Wed, 27 Jan 2010 20:08:10 +0000 (15:08 -0500)]
ovs-vsctl: Fix uninitialized variable.

When querying a row we could return an uninitialized variable in
some cases if we can't find what we are looking for.

14 years agobridge: Properly read NetFlow parameters.
Jesse Gross [Wed, 27 Jan 2010 20:08:02 +0000 (15:08 -0500)]
bridge: Properly read NetFlow parameters.

When reading the NetFlow engine type and ID from the config database
we weren't dereferencing the variables.

14 years agodatapath: Fix compilation on newer old-style Xen kernels.
Jesse Gross [Mon, 25 Jan 2010 00:58:40 +0000 (19:58 -0500)]
datapath: Fix compilation on newer old-style Xen kernels.

Some ports of Xen (such as Debian Lenny's) use the old style
Xen checksumming fields on newer kernels.  Normally the code that
deals with those fields isn't used at all on newer kernels.  This
updates the checksumming pointer code with some changes from Lenny
Xen since it is cleaner and works well with our existing compatibility
layer.

CC:pspreadborough@comcast.net

14 years agodatapath: Support CHECKSUM_PARTIAL on older kernels.
Jesse Gross [Mon, 25 Jan 2010 00:58:46 +0000 (19:58 -0500)]
datapath: Support CHECKSUM_PARTIAL on older kernels.

On older kernels we would not correctly update partial checksums
because it was difficult to determine the type of checksum.  This
uses some hints to infer the correct type of checksum so that it
can be updated.  It also allows us to correctly define
CHECKSUM_PARTIAL, which is important for other components.

14 years agodatapath: Transport port is not part of psuedoheader.
Jesse Gross [Mon, 25 Jan 2010 00:57:54 +0000 (19:57 -0500)]
datapath: Transport port is not part of psuedoheader.

While updating the checksum after changing the transport port,
we indicated that this was a change to the psuedoheader.  Since
this is not the case, it could produce an incorrect checksum.

14 years agodatapath: Handle packets with precomputed checksums.
Jesse Gross [Fri, 22 Jan 2010 22:26:31 +0000 (17:26 -0500)]
datapath: Handle packets with precomputed checksums.

On older kernels (< 2.6.19) CHECKSUM_HW can mean either that the
checksum has already been computed by hardware or that the checksum
needs to be computed by hardware, depending on whether we are on
the transmit or receive path.  Unfortunately since we are in the
middle of these two paths it is impossible to tell which is the
case.  Code after us assumes that CHECKSUM_HW means that the
checksum needs to be computed and will panic if there already is
a checksum.  On these kernels we mark these packets as CHECKSUM_NONE
before handing them off.

Without this change using certain NICs will cause panics.

14 years agoovs-vsctl: Add missing columns.
Jesse Gross [Tue, 26 Jan 2010 19:37:59 +0000 (14:37 -0500)]
ovs-vsctl: Add missing columns.

bond_updelay and flood_vlans were missing from the list of
configurable columns.

14 years agoFix references to vswitch-idl.ovsschema to refer to vswitch.ovsschema.
Ben Pfaff [Tue, 26 Jan 2010 19:46:43 +0000 (11:46 -0800)]
Fix references to vswitch-idl.ovsschema to refer to vswitch.ovsschema.

14 years agoconfigure: Silence check for broken strtok_r().
Ben Pfaff [Mon, 25 Jan 2010 18:32:39 +0000 (10:32 -0800)]
configure: Silence check for broken strtok_r().

The check for strtok_r() prints a line of text on stdout as part of its
run.  This is noticeable when running "configure", especially with -q.
This commit fixes it.

(The apparent alternative of not printing anything at all seems like a bad
idea because this might encourage the compiler to completely optimize
everything out of main().)

14 years agodaemon: Make --monitor process change its process title.
Ben Pfaff [Tue, 19 Jan 2010 23:00:56 +0000 (15:00 -0800)]
daemon: Make --monitor process change its process title.

When --monitor is used, administrators sometimes become confused about the
presence of two copies of each process.  This commit attempts to clarify
the situation by making the monitoring process change its process name, as
seen in /proc/$pid/cmdline and in "ps", to clearly indicate what is going
on.

CC: Dan Wendlandt <dan@nicira.com>
14 years agoFix "make distcleancheck" by deleting the nicira-ext.h stamp file too.
Ben Pfaff [Tue, 26 Jan 2010 18:47:50 +0000 (10:47 -0800)]
Fix "make distcleancheck" by deleting the nicira-ext.h stamp file too.

14 years agotests: Fix ovsdb tests.
Ben Pfaff [Tue, 26 Jan 2010 18:46:56 +0000 (10:46 -0800)]
tests: Fix ovsdb tests.

This code was updated to use the new name of the schema, but I accidentally
left in the old code to check for the old schema's name.  This worked fine
in my own tests, because I still have a copy of that file sitting around,
but fails on "make distcheck" or a clean source dir.

So this commit deletes the code that checks for the old schema file.

14 years agoxenserver: Update to use upstream XenServer location for dbcache.
Ben Pfaff [Tue, 26 Jan 2010 18:35:11 +0000 (10:35 -0800)]
xenserver: Update to use upstream XenServer location for dbcache.

I thought that this was going to be more difficult (see this email thread:
http://openvswitch.org/pipermail/dev_openvswitch.org/2010-January/001023.html
) but it turned out to be trivial.

14 years agoovsdb: Require column type "min" value be 0 or 1.
Ben Pfaff [Tue, 26 Jan 2010 18:32:33 +0000 (10:32 -0800)]
ovsdb: Require column type "min" value be 0 or 1.

A "min" value greater than 1 is problematic for the database.  There is no
reasonable way to synthesize a default value for such a column: keys in a
set or map must unique, so the database cannot, say, simply set a set of
3 or more integers to [0, 0, 0].

This should have no effect on the vswitch in practice because it does not
have any columns that require more than one element.

14 years agoovs-vsctl: Add commands for low-level database manipulation.
Ben Pfaff [Mon, 25 Jan 2010 18:13:52 +0000 (10:13 -0800)]
ovs-vsctl: Add commands for low-level database manipulation.

The new "get", "list", "set", and "add" commands provide lower-level
access to the vswitch database than the other ovs-vsctl commands, but they
are more convenient than using ovsdb-client directly.

This commit deserves several enhancements, but users are clamoring for
some kind of interface, so this is a starting point.

14 years agoovsdb-datum: Add functions for parsing and formatting atoms, data.
Ben Pfaff [Mon, 25 Jan 2010 18:16:52 +0000 (10:16 -0800)]
ovsdb-datum: Add functions for parsing and formatting atoms, data.

These functions provide an alternative to JSON parsing and formatting that
is more human-friendly (and shorter).

These will be used in an upcoming commit to enhance ovs-vsctl.

14 years agoovsdb-data: Add some more functions for dealing with "struct ovsdb_datum".
Ben Pfaff [Mon, 25 Jan 2010 18:08:57 +0000 (10:08 -0800)]
ovsdb-data: Add some more functions for dealing with "struct ovsdb_datum".

This commit refactors the functions for working with "struct ovsdb_datum",
adding and exposing some more operations for ovs-vsctl to use in an
upcoming commit.

14 years agoovsdb-idl: Allow clients to modify records without using structs.
Ben Pfaff [Mon, 25 Jan 2010 18:15:17 +0000 (10:15 -0800)]
ovsdb-idl: Allow clients to modify records without using structs.

The IDL is intended to allow clients easier access to data in the database
by providing an extra layer of abstraction.  However, ovs-vsctl needs to
also provide generic access to database tables, rows, and columns, and
until now the IDL has not allowed this.  In particular, there was no way
to modify the value of a database column by providing a "struct
ovsdb_datum" with the new value and then have that reflected in the IDL
structs, although the other direction was possible.

This commit fixes that problem, which requires a bit of refactoring of the
IDL layer.  It also exposes the interface for iterating through table
records to clients directly, by moving it from the "private" IDL header to
the public one.

14 years agojson: New function json_to_ds().
Ben Pfaff [Fri, 22 Jan 2010 22:57:18 +0000 (14:57 -0800)]
json: New function json_to_ds().

Some upcoming code wants to serialize JSON into a "struct ds" dynamic
string buffer, so expose an interface to do this.

This commit doesn't change much, but it renames some functions internal
to json.c to make the naming more consistent.

Also, make jsonrpc_log_msg() use this new function, since it is a more
straightforward way to do what it wants.

14 years agojson: Export function to parse an individual JSON string.
Ben Pfaff [Tue, 26 Jan 2010 17:47:54 +0000 (09:47 -0800)]
json: Export function to parse an individual JSON string.

The JSON syntax for strings is very reasonable.  An upcoming commit will
have a need for a string parser, so make the JSON string parser available
for that.

Also, this change improves the error message for strings that end in the
middle of a \u sequence, so update the tests to match.

14 years agoovsdb-idl: Avoid redundant memset.
Ben Pfaff [Thu, 21 Jan 2010 18:59:34 +0000 (10:59 -0800)]
ovsdb-idl: Avoid redundant memset.

14 years agoovsdb-idl: Fix use-after-free error in ovsdb_idl_txn_delete().
Ben Pfaff [Thu, 21 Jan 2010 18:51:37 +0000 (10:51 -0800)]
ovsdb-idl: Fix use-after-free error in ovsdb_idl_txn_delete().

14 years agoCleanly separate IDL annotations from OVSDB schema information.
Ben Pfaff [Thu, 7 Jan 2010 23:52:58 +0000 (15:52 -0800)]
Cleanly separate IDL annotations from OVSDB schema information.

Until now, the OVSDB IDL annotations have been glommed together with the
schema information in a single file, and then we've used ovsdb-idlc to
extract the schema from that file.  This commit reverses the process:
the schema and the annotations are stored separately and then glommed
together as necessary at build time.

This new arrangement has a few advantages:

    - We can now easily have multiple different sets of IDL annotations
      for a single OVSDB schema.  For example, some users may not need
      access to columns that other users do.

    - Bugs in ovsdb-idlc cannot screw up the underlying schema (as shown
      by a recent commit).

14 years agovswitch: Remove redundant "internal" column from Interface table.
Ben Pfaff [Mon, 11 Jan 2010 22:28:48 +0000 (14:28 -0800)]
vswitch: Remove redundant "internal" column from Interface table.

This column's function is now served by the "type" column, which is set
to "internal" to mark an interface as internal.

14 years agovswitch: Fix types of NetFlow columns in db schema.
Ben Pfaff [Thu, 7 Jan 2010 23:26:36 +0000 (15:26 -0800)]
vswitch: Fix types of NetFlow columns in db schema.

This bug was masked by the translation done by ovsdb-idlc, which doesn't
fully validate its input.  In particular, it ignores fields that it doesn't
know about and drops them when it does translation, so nothing later can
find the problem.

An upcoming commit will ensure that it can't happen again, by dropping the
ovsdb-idlc translation step.

14 years agoovsdb-idlc: With "doc" command, output tables and columns alphabetically.
Ben Pfaff [Tue, 26 Jan 2010 17:32:38 +0000 (09:32 -0800)]
ovsdb-idlc: With "doc" command, output tables and columns alphabetically.

Until this commit, tables and columns in output were output in random
order (according to the ordering of Python's internal hash table).
Alphabetical order makes more sense.

Thanks to Reid Price for useful Python tips.

14 years agotests: Prefer $(VAR) over @VAR@ in Makefiles.
Ben Pfaff [Thu, 14 Jan 2010 19:32:00 +0000 (11:32 -0800)]
tests: Prefer $(VAR) over @VAR@ in Makefiles.

The Autoconf documentation recently started recommending $(VAR) over @VAR@,
so adopt this style.

14 years agoRelease Open vSwitch 0.99.1 v0.99.1
Justin Pettit [Tue, 26 Jan 2010 07:09:58 +0000 (23:09 -0800)]
Release Open vSwitch 0.99.1

This is an "unstable" release.

14 years agoMerge "sflow" into "master".
Ben Pfaff [Mon, 25 Jan 2010 18:52:28 +0000 (10:52 -0800)]
Merge "sflow" into "master".

No conflicts, but lib/dpif.c needed a few changes since struct dpif's
member "class" was renamed to "dpif_class" in master since sflow was
branched off.

14 years agoAdd build checks for portable OpenFlow structure padding and alignment.
Ben Pfaff [Mon, 25 Jan 2010 18:49:31 +0000 (10:49 -0800)]
Add build checks for portable OpenFlow structure padding and alignment.

This causes the build to fail with an error message if openflow.h contains
a structure whose members are not aligned in a portable way.

14 years agoxenserver: Update interface-reconfigure and vif integration scripts.
Ian Campbell [Fri, 22 Jan 2010 20:55:37 +0000 (12:55 -0800)]
xenserver: Update interface-reconfigure and vif integration scripts.

This patch updates the versions of the host integration scripts to
what is present in the recent XCP update and the next release of
XenServer (5.6). I think it probably works on 5.5 as well but I
haven't verified that.

These new versions support runtime selection of the Linux bridging vs
vswitch through the toolstack. The patch includes the necessary
reconfiguration (rewriting /etc/xensource/network.conf) to enable
vswitch in the RPM %post stage.

The RPM spec file integration is only lightly tested, seems to work
for me.

This commit is as provided by Ian Campbell, with a few minor tweaks:

    - Updated xenserver/automake.mk to distribute the added files.

    - Updated RPM spec file not to complain if the added files do
      not already exist (since they do not exist on XenServer 5.5.0).

    - Change location of dbcache back to /var/lib/openvswitch/dbcache
      so that this can coexist with our other internal builds.
      (Undoubtedly we will have to adopt the new location chosen by Ian
      eventually, however.)

14 years agodatapath: Clean up vswitch_skb_checksum_setup().
Ben Pfaff [Wed, 20 Jan 2010 21:07:47 +0000 (13:07 -0800)]
datapath: Clean up vswitch_skb_checksum_setup().

vswitch_skb_checksum_setup() can be defined in datapath.h as a no-op
when defined(CONFIG_XEN) && defined(HAVE_PROTO_DATA_VALID) is false.

Also, skb_checksum_setup(), which was defined similarly, can be dropped
now, since it was unused.

14 years agonetdev: Rename "class" members to "netdev_class" for C++ compatibility.
Ben Pfaff [Fri, 22 Jan 2010 23:13:26 +0000 (15:13 -0800)]
netdev: Rename "class" members to "netdev_class" for C++ compatibility.

From partner.

14 years agohmap: Rename "new" to "new_node" for C++ header compatibility.
Ben Pfaff [Fri, 22 Jan 2010 23:10:07 +0000 (15:10 -0800)]
hmap: Rename "new" to "new_node" for C++ header compatibility.

From partner.

14 years agodpif: Rename "class" member to "dpif_class" for C++ compatibility.
Ben Pfaff [Fri, 22 Jan 2010 23:14:01 +0000 (15:14 -0800)]
dpif: Rename "class" member to "dpif_class" for C++ compatibility.

From partner.

14 years agosflow: Fix sFlow sampling structure.
Ben Pfaff [Wed, 20 Jan 2010 21:52:42 +0000 (13:52 -0800)]
sflow: Fix sFlow sampling structure.

According to Neil McKee, in an email archived at
http://openvswitch.org/pipermail/dev_openvswitch.org/2010-January/000934.html:

    The containment rule is that a given sflow-datasource (sampler or
    poller) should be scoped within only one sflow-agent (or
    sub-agent).  So the issue arrises when you have two
    switches/datapaths defined on the same host being managed with
    the same IP address: each switch is a separate sub-agent, so they
    can run independently (e.g. with their own sequence numbers) but
    they can't both claim to speak for the same sflow-datasource.
    Specifically, they can't both represent the <ifindex>:0
    data-source.  This containment rule is necessary so that the
    sFlow collector can scale and combine the results accurately.

    One option would be to stick with the <ifindex>:0 data-source but
    elevate it to be global across all bridges, with a global
    sample_pool and a global sflow_agent.  Not tempting.  Better to
    go the other way and allow each interface to have it's own
    sampler, just as it already has it's own poller.  The ifIndex
    numbers are globally unique across all switches/datapaths on the
    host, so the containment is now clean.  Datasource <ifindex>:5
    might be on one switch, whille <ifindex>:7 can be on another.
    Other benefits are that 1) you can support the option of
    overriding the default sampling-rate on an interface-by-interface
    basis, and 2) this is how most sFlow implementations are coded,
    so there will be no surprises or interoperability issues with any
    sFlow collectors out there.

This commit implements the approach suggested by Neil.

This commit uses an atomic_t to represent the sampling pool.  This is
because we do want access to it to be atomic, but we expect that it will
"mostly" be accessed from a single CPU at a time.  Perhaps this is a bad
assumption; we can always switch to another form of synchronization later.

CC: Neil McKee <neil.mckee@inmon.com>
14 years agoovs-vsctl: Prevent uninitialized variable warning.
Jesse Gross [Wed, 20 Jan 2010 19:19:47 +0000 (14:19 -0500)]
ovs-vsctl: Prevent uninitialized variable warning.

The compiler warns about next_cfg being uninitialized but in the cases
where it is unset we will never reach the point where it is used.  This
just sets next_cfg to 0 to stop the whining.

14 years agohash: Prevent warnings about strict aliasing rules.
Jesse Gross [Wed, 20 Jan 2010 18:50:48 +0000 (13:50 -0500)]
hash: Prevent warnings about strict aliasing rules.

Some versions of GCC complain about violations of strict aliasing
rules due to a cast between different pointer types.  This avoids
any aliasing by copying the value first.

14 years agomac-learning: Rename "non-learning VLANs" to "flood VLANs".
Ben Pfaff [Tue, 19 Jan 2010 18:41:46 +0000 (10:41 -0800)]
mac-learning: Rename "non-learning VLANs" to "flood VLANs".

Usually positive names are better than negative ones.

14 years agoReimplement port mirroring configuration for database.
Ben Pfaff [Tue, 19 Jan 2010 18:40:36 +0000 (10:40 -0800)]
Reimplement port mirroring configuration for database.

Tested only to the extent that it doesn't obviously break anything else.

14 years agosflow: Fix printf format specifier in log message.
Ben Pfaff [Tue, 19 Jan 2010 18:12:05 +0000 (10:12 -0800)]
sflow: Fix printf format specifier in log message.

"65536 / sizeof *actions" has type size_t, so use %zu.

Reported-by: Neil McKee <neil.mckee@inmon.com>
14 years agodpif-linux: Always set *fnp in make_openvswitch_device().
Ben Pfaff [Tue, 19 Jan 2010 18:10:52 +0000 (10:10 -0800)]
dpif-linux: Always set *fnp in make_openvswitch_device().

Some versions of GCC warn about this.  Always initializing it seems like
the right thing to do, since we "almost always" initialized it before.

Reported-by: Neil McKee <neil.mckee@inmon.com>
14 years agonetdev: Compare full arguments instead of hash for reconfigure.
Jesse Gross [Mon, 18 Jan 2010 22:26:02 +0000 (17:26 -0500)]
netdev: Compare full arguments instead of hash for reconfigure.

We only reconfigure netdevs if the arguments have changed, which
was previously detected based on a hash.  This stores and compares
the full argument list to avoid any chance of missing changes due
to collisions.

14 years agonetdev-linux: Use the netdev list of devices instead of cachemap.
Jesse Gross [Mon, 18 Jan 2010 20:05:58 +0000 (15:05 -0500)]
netdev-linux: Use the netdev list of devices instead of cachemap.

We previously maintained a list of open devices inside of the
linux netdev.  Since the netdev library now maintains this list,
it is better to use that list instead of our own.

14 years agonetdev-linux: Avoid potential issues with unset FD.
Jesse Gross [Sat, 16 Jan 2010 00:24:53 +0000 (19:24 -0500)]
netdev-linux: Avoid potential issues with unset FD.

Never close the file descriptor if it is 0, since it is never a
valid FD in this context.  Also initialize the FD to -1 so that
it is never set to a valid but incorrect value.