sliver-openvswitch.git
14 years agowdp-xflow: Copy client_data from old rule to new rule when displacing a rule.
Ben Pfaff [Fri, 14 May 2010 22:01:06 +0000 (15:01 -0700)]
wdp-xflow: Copy client_data from old rule to new rule when displacing a rule.

If client_data is not copied when a new rule displaces an old one, then
the old rule's client data will be leaked and the new rule will have a null
pointer.  This causes a segfault with, e.g.:

    ovs-ofctl add-flow br0 "dl_type=0x800,nw_dst=10.245.7.0/16,actions=output:148"
    ovs-ofctl mod-flows --strict br0 "dl_type=0x800,nw_dst=10.245.7.0/16,actions=output:149"
    ovs-ofctl del-flows --strict br0 "dl_type=0x800,nw_dst=10.245.7.0/16"

Reported by partner.

14 years agoflow: Fix misaligned access.
Ben Pfaff [Fri, 7 May 2010 18:43:18 +0000 (11:43 -0700)]
flow: Fix misaligned access.

The testsuite for the flow extractor triggered this.

With this commit, "make check" passes on SPARC.

14 years agoAdd header for access to potentially unaligned data.
Ben Pfaff [Fri, 7 May 2010 21:31:04 +0000 (14:31 -0700)]
Add header for access to potentially unaligned data.

I had been under the impression that "memcpy" was a valid way to copy
unaligned data into an aligned location for access.  But testing on SPARC
has shown that GCC doesn't always honor that intention.  It seems that, if
GCC can see that there is a pointer of a type that requires alignment to
a given object, then it will access it directly regardless of whether
memcpy() is used to copy it.

This commit adds a new header with functions to access unaligned data.  I
managed to come up with two techniques, one GCC-specific, one generic, that
do avoid the misaligned access in my test case.  The GCC-specific technique
is the same one used by the Linux kernel (although no code has been
literally copied).  The other one seemed obvious but possibly slow
depending on the compiler's ability to optimize.

The following commit adds a user.

14 years agoovsdb-client: Serialize columns in predictable order on "monitor" command.
Ben Pfaff [Fri, 7 May 2010 17:44:01 +0000 (10:44 -0700)]
ovsdb-client: Serialize columns in predictable order on "monitor" command.

The "monitor" command goes to some trouble to write its output in a
predictable order, so that test programs can reliably compare it against
expectations.  This commit fixes up one part that was missing, which is
that the columns were not being ordered predictably (it depended on
hash order, which differs between big-endian and little-endian systems).
It also updates the test suite to expect the new order.

14 years agotests: Fix bug in "ovsdb-tool compact" test.
Ben Pfaff [Fri, 7 May 2010 17:41:06 +0000 (10:41 -0700)]
tests: Fix bug in "ovsdb-tool compact" test.

This test examines the OVSDB database log and checks that it contains what
it should for specified transactions.  However, the database log ordering
differs between big-endian and little-endian architectures because it is
written out in hash order.  We don't want to incur the expense of always
sorting the log as we write it out, so instead this commit fixes the
problem by sorting the log as it reads it, using the "test-json" program.

14 years agotests: Fix bug in "weak references" test.
Ben Pfaff [Fri, 7 May 2010 17:38:13 +0000 (10:38 -0700)]
tests: Fix bug in "weak references" test.

One part of the "weak references" test inserts invalid all-zeros weak
references into two columns and expects to get an error message mentioning
one of them.  Unfortunately the one that actually gets mentioned depends
on hash ordering and thus differs between big-endian and little-endian
machines.  This commit fixes the problem by only putting an invalid
reference in a single column, instead of two of them.

14 years agotests: Fix bug in ovsdb-server test suite.
Ben Pfaff [Fri, 7 May 2010 17:34:35 +0000 (10:34 -0700)]
tests: Fix bug in ovsdb-server test suite.

The formatting of OVSDB syntax errors differed between big-endian and
little-endian systems, which caused the "database multiplexing
implementation" test to fail on SPARC.  This commit fixes the problem by
always outputting JSON in syntax errors in deterministic (sorted) order.

14 years agoutil: Fix GCC false-positive warning for CONTAINER_OF.
Ben Pfaff [Fri, 7 May 2010 00:04:11 +0000 (17:04 -0700)]
util: Fix GCC false-positive warning for CONTAINER_OF.

On sparc, GCC would issue the following warning for every use of
CONTAINER_OF:

    warning: cast increases required alignment of target type

This is a false positive: assuming that the data structure that it is
applied to was allocated properly, the use of CONTAINER_OF to reach it is
valid.  And if it was not allocated properly, then code that accesses it
other ways will have trouble too.

14 years agoMake wdp.h C++ friendly.
Ben Pfaff [Tue, 4 May 2010 19:36:05 +0000 (12:36 -0700)]
Make wdp.h C++ friendly.

From partner.

14 years agoMake more header files C++ compatible.
Ben Pfaff [Tue, 27 Apr 2010 00:01:55 +0000 (17:01 -0700)]
Make more header files C++ compatible.

From partner, with minor changes.

14 years agoxfif: Fix a couple of missed changes from "dpif" to "xfif"
Justin Pettit [Tue, 20 Apr 2010 05:14:43 +0000 (22:14 -0700)]
xfif: Fix a couple of missed changes from "dpif" to "xfif"

14 years agonetdev: Allow recv, recv_wait, drain, send, send_wait to be null.
Ben Pfaff [Fri, 9 Apr 2010 20:54:37 +0000 (13:54 -0700)]
netdev: Allow recv, recv_wait, drain, send, send_wait to be null.

Suggested by partner.

14 years agowdp: Change functions that use wdp_port to avoid awkward memory semantics.
Ben Pfaff [Thu, 8 Apr 2010 19:31:14 +0000 (12:31 -0700)]
wdp: Change functions that use wdp_port to avoid awkward memory semantics.

wdp_port_query_by_number(), wdp_port_query_by_name(), and
wdp_port_list() all had semantics for the data that they returned that
were difficult to describe and easy to get wrong.  This commit changes them
to be easier to understand and to implement.

Suggested by partner.

14 years agonetdev: New function netdev_reopen().
Ben Pfaff [Thu, 8 Apr 2010 18:18:07 +0000 (11:18 -0700)]
netdev: New function netdev_reopen().

In the new wdp layer it is convenient to pass around copies of struct
wdp_port, which contains a struct netdev *.  To make this efficient
it makes sense to maintain a reference count in struct netdev itself, so
that copying and freeing copies of a netdev become just incrementing and
decrementing the reference count.  This commit adds that ability.

14 years agonetdev: Fix typo in comment.
Ben Pfaff [Thu, 8 Apr 2010 18:18:41 +0000 (11:18 -0700)]
netdev: Fix typo in comment.

14 years agoxfif, wdp: Clarify comment.
Ben Pfaff [Thu, 8 Apr 2010 17:30:11 +0000 (10:30 -0700)]
xfif, wdp: Clarify comment.

Suggested by partner.

14 years agowdp: Document function pointers that may be null.
Ben Pfaff [Thu, 8 Apr 2010 17:26:49 +0000 (10:26 -0700)]
wdp: Document function pointers that may be null.

Suggested by partner.

14 years agowdp: Improve comments and a few bits of code noticed while improving them.
Ben Pfaff [Fri, 2 Apr 2010 20:37:25 +0000 (13:37 -0700)]
wdp: Improve comments and a few bits of code noticed while improving them.

14 years agoofproto: Start work to enable datapaths with built-in wildcard support.
Ben Pfaff [Fri, 2 Apr 2010 00:11:46 +0000 (17:11 -0700)]
ofproto: Start work to enable datapaths with built-in wildcard support.

The "xflow" interface assumes that the datapath supports only exact-match
flows.  This seems to be one reasonable way to implement a datapath in
software, but some hardware datapaths have built-in support for flows that
include wildcards.  Until now, OVS has not been able to take advantage of
this feature.  This commit is a beginning of that support.  It works, to
some extent, but it is incomplete in many ways, and should be considered
a prototype.

14 years agoRename "odp" to "xflow".
Ben Pfaff [Thu, 1 Apr 2010 23:45:39 +0000 (16:45 -0700)]
Rename "odp" to "xflow".

In an upcoming commit we will have two layers of datapaths: a high-level
datapath that supports wildcards and a low-level datapath that only
supports exact-match flows.  This is confusing enough without the two
layers having similar names.  This commit attempts to fix the naming
problem in advance, by renaming the exact-match only layer from "odp"
to "xflow" (which stands for "exact-match flow").

14 years agotests: Break single classifier test into multiple.
Ben Pfaff [Mon, 22 Mar 2010 18:27:08 +0000 (11:27 -0700)]
tests: Break single classifier test into multiple.

This should make it easier to tell what is failing, if anything does.

14 years agoRenumber ODP actions to avoid gap.
Ben Pfaff [Mon, 22 Mar 2010 19:40:22 +0000 (12:40 -0700)]
Renumber ODP actions to avoid gap.

14 years agoDrop padding from struct odp_flow_key.
Ben Pfaff [Mon, 22 Mar 2010 19:34:02 +0000 (12:34 -0700)]
Drop padding from struct odp_flow_key.

Breaking this out as a separate commit should make it easier to see what
needs to change later, if we need to reintroduce padding at some point.

14 years agoCombine dl_vlan and dl_vlan_pcp.
Ben Pfaff [Thu, 1 Apr 2010 22:51:53 +0000 (15:51 -0700)]
Combine dl_vlan and dl_vlan_pcp.

This allows eliminating padding from odp_flow_key, although actually doing
that is postponed until the next commit.

14 years agoflow: Separate "flow_t" from "struct odp_flow_key".
Ben Pfaff [Thu, 1 Apr 2010 22:27:11 +0000 (15:27 -0700)]
flow: Separate "flow_t" from "struct odp_flow_key".

The "struct odp_flow_key" used in the kernel datapath is conceptually
separate from the "flow_t" used in userspace, but until now we have
used the latter as a typedef for the former for convenience.  This commit
separates them.  This makes it possible in upcoming commits to change
them independently.

14 years agoofproto: Factor out check on rule->send_flow_removed in send_flow_removed().
Ben Pfaff [Fri, 26 Mar 2010 21:37:16 +0000 (14:37 -0700)]
ofproto: Factor out check on rule->send_flow_removed in send_flow_removed().

There's no point in even iterating over the list of OpenFlow connections if
rule->send_flow_removed is false, since we'll never actually do anything
in that case anyway.

14 years agoofproto: Drop "now" argument from send_flow_removed().
Ben Pfaff [Fri, 26 Mar 2010 21:22:08 +0000 (14:22 -0700)]
ofproto: Drop "now" argument from send_flow_removed().

There's no reason that send_flow_removed() itself can't get the current
time, and that means one less parameter for the caller.

14 years agonicira-ext: Fix comments.
Ben Pfaff [Thu, 1 Apr 2010 20:58:30 +0000 (13:58 -0700)]
nicira-ext: Fix comments.

14 years agoxenserver: Add comment to XAPI plugin.
Ben Pfaff [Tue, 30 Mar 2010 21:13:52 +0000 (14:13 -0700)]
xenserver: Add comment to XAPI plugin.

14 years agoopenvswitch-cfg-update: Fix "set-ssl" command arguments.
Ben Pfaff [Tue, 30 Mar 2010 16:02:06 +0000 (09:02 -0700)]
openvswitch-cfg-update: Fix "set-ssl" command arguments.

The SSL certificate and the private key are both in
/etc/xensource/xapi-ssl.pem, so it must be mentioned twice in the set-ssl
command invocation.

Bug accidentally introduced in commit bc391960 "Cleanup default file
locations and XenServer packaging".

Reported-by: Peter Balland <peter@nicira.com>
Tested-by: Peter Balland <peter@nicira.com>
14 years agoxenserver: updated xen-bugtool to XenServer trunk version.
Ben Pfaff [Tue, 30 Mar 2010 16:45:48 +0000 (09:45 -0700)]
xenserver: updated xen-bugtool to XenServer trunk version.

The version of xen-bugtool include in openvswitch.git was forked long
ago from the xenserver version. Pull up to the version taken from
XenServer's trunk branch just after the integration of 22c75d593 from
openvswitch.git.

I tested that core and log files as well as ovs-dpctl {show,dump-flows}
and ovs-ofctl {show,dump-flows,status} are picked up correctly after the
big vswitch->openvswitch renaming.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agoxenserver: gate all logrotate reopens on presence of a pid file
Ian Campbell [Tue, 30 Mar 2010 08:34:29 +0000 (09:34 +0100)]
xenserver: gate all logrotate reopens on presence of a pid file

This probably only makes a difference in the case where you have vswitch
installed but (deliberately) not running _and_ you happen to have ovs-* logs big
enough to be worth rotating. Very much an edge case.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agoxenserver: Don't reload ovs-brcompatd's log file if it's not running
Justin Pettit [Sat, 27 Mar 2010 00:15:12 +0000 (17:15 -0700)]
xenserver: Don't reload ovs-brcompatd's log file if it's not running

14 years agoxenserver: Update MD5 sums of scripts for 5.5.900-29381p
Justin Pettit [Fri, 26 Mar 2010 23:46:44 +0000 (16:46 -0700)]
xenserver: Update MD5 sums of scripts for 5.5.900-29381p

14 years agoxenserver: Only show ovs-brcompatd status in xsconsole for XS 5.5.0
Justin Pettit [Fri, 26 Mar 2010 23:04:58 +0000 (16:04 -0700)]
xenserver: Only show ovs-brcompatd status in xsconsole for XS 5.5.0

14 years agoxenserver: Correct renaming issue in openvswitch-xapi-update
Justin Pettit [Sat, 27 Mar 2010 02:03:52 +0000 (19:03 -0700)]
xenserver: Correct renaming issue in openvswitch-xapi-update

A recent commit changed references from "vswitch" to "openvswitch".
This included changing the name of "vswitch-xapi-update" to
"openvswitch-xapi-update".  Unfortunately, the contents of the file
did not get similarly updated, so the script had issues.  This commit
fixes that.

14 years agologrotate: Allow logs to be missing
Ian Campbell [Wed, 14 Oct 2009 10:38:40 +0000 (11:38 +0100)]
logrotate: Allow logs to be missing

In particular ovs-brcompatd.log is not present if compatibility mode is
disabled. Without this logrotate attempts to send email to the
administrator.

14 years agoxenserver: Fix init script typos that prevented turning brcompatd back on.
Ian Campbell [Thu, 1 Oct 2009 16:26:22 +0000 (09:26 -0700)]
xenserver: Fix init script typos that prevented turning brcompatd back on.

Commit 723a8c3ca "xenserver: Disable brcompatd" turned off brcompatd by
default but allowed it to be enabled using an option, but the option
didn't work.  This commit fixes that problem.

14 years agoxenserver: Disable brcompatd except on XenServer 5.5.0
Ian Campbell [Fri, 26 Mar 2010 20:24:06 +0000 (13:24 -0700)]
xenserver: Disable brcompatd except on XenServer 5.5.0

The compat layer is now unused in the vswitch branch of XenServer.

Based on change originally by Ian Campbell, cherry-picked from
"xs5.7" branch.  The original change was not conditional on the
XenServer version.

14 years agoEnsure "service vswitch status" returns appropriate error code
Ian Campbell [Wed, 14 Oct 2009 10:37:19 +0000 (11:37 +0100)]
Ensure "service vswitch status" returns appropriate error code

This command was returning success when vswitchd was not running.
Our automated test relies on this command to decide if the host uses
vswitch or not.

If vswitchd is not OK then brcompatd is not checked at all. Since the
return codes apparently have specific meanings I couldn't see a sensible
way to combine multiple failure results.

(Cherry-picked from xs5.7 branch by Ben Pfaff but merge conflicts meant
that the whole thing had to be redone.)

14 years agoxenserver: Correct "service vswitch status" when brcompatd is disabled
Ian Campbell [Fri, 2 Oct 2009 10:32:10 +0000 (11:32 +0100)]
xenserver: Correct "service vswitch status" when brcompatd is disabled

I don't think it makes sense to report brcompatd's status when it is
explicitly disabled. Doing so causes service status to return an error
when brcompatd is deliberately disabled.

Also fix up a tab vs. spaces whitespace snafu.

14 years agoCleanup default file locations and XenServer packaging
Justin Pettit [Fri, 26 Mar 2010 05:38:13 +0000 (22:38 -0700)]
Cleanup default file locations and XenServer packaging

This commit cleans up the locations of a number of files and directories
used.  These include:

    - Config file lives in /etc/openvswitch/conf.db
    - Logs go into /var/log/openvswitch
    - ovsdb-server socket is /var/run/openvswitch/db.sock
    - Schema goes into /usr/share/openvswitch/vswitch.ovsschema
    - PID files go in /var/run/openvswitch

For XenServer, these additional changes are made:

    - Cores go in /var/xen/openvswitch
    - OVS binaries run in /var/xen/openvswitch

In addition, it attempts to cleanup the XenServer packaging.  This
includes referring to the project as "openvswitch" as opposed to the
somewhat presumptuous "vswitch".

Note: Changes to the Debian packaging will be forthcoming.

14 years agoxenserver: Ensure that Bridge.other-config:hwaddr and Interface.MAC are set as approp...
Ian Campbell [Fri, 26 Mar 2010 16:35:32 +0000 (09:35 -0700)]
xenserver: Ensure that Bridge.other-config:hwaddr and Interface.MAC are set as appropriate.

Otherwise bridges can end up with a generated MAC address using Nicira OID
which has an impact when using DHCP on that devices.

tests/interface-reconfigure.at updated by Ben Pfaff.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoxenserver: Add ovsdb-server status to xsconsole vswitch overview
Justin Pettit [Tue, 23 Mar 2010 01:41:44 +0000 (18:41 -0700)]
xenserver: Add ovsdb-server status to xsconsole vswitch overview

14 years agoMerge "citrix" branch into "master".
Ben Pfaff [Thu, 25 Mar 2010 19:30:05 +0000 (12:30 -0700)]
Merge "citrix" branch into "master".

This merge is long overdue, simply because I forgot that there were
outstanding changes on "citrix" that had not yet been merged.

The important fix here is the addition of mlockall.  This fixes some
bugs seen under stressful conditions in XenServer.

14 years agotimeval: Always log true poll interval instead of rounding off.
Ben Pfaff [Thu, 25 Mar 2010 18:34:01 +0000 (11:34 -0700)]
timeval: Always log true poll interval instead of rounding off.

This code triggers when a trip through the process's main loop takes much
longer than expected.  The code for calculating the expected time rounds
down to a maximum of 10000 ms to avoid overflow.  But there is no reason
that the correct time should not be displayed in the log message, and
furthermore displaying the correct time may help tracking down the
underlying issue, since it lets the administrator find out exactly when
the trip through the main loop started.  So this commit displays the exact
time without rounding down.

14 years agoINSTALL.bridge: Update.
Ben Pfaff [Thu, 25 Mar 2010 16:46:31 +0000 (09:46 -0700)]
INSTALL.bridge: Update.

The instructions did not assume the default /usr/local install location,
which is confusing.

Also, the instructions partially replicated those in INSTALL.Linux, but it
seems better to only give the additional steps that are necessary, so do
that too.

Reported-by: Jeongkeun Lee <jklee@hp.com>
14 years agodpif-linux: Fix file descriptor leak.
Tetsuo NAKAGAWA [Thu, 25 Mar 2010 14:54:15 +0000 (10:54 -0400)]
dpif-linux: Fix file descriptor leak.

get_major() opens /proc/devices to get the openvswitch major number
but never closes the FD.

14 years agoofproto: Don't optimize out updating flow cookie.
Ben Pfaff [Fri, 19 Mar 2010 18:44:31 +0000 (11:44 -0700)]
ofproto: Don't optimize out updating flow cookie.

The OFPFC_MODIFY and OFPFC_MODIFY_STRICT optimizes out modifying the
actions if the actions didn't change, but it also skipped updating the
flow cookie in that case, which seems wrong.  This commit fixes the
problem.

14 years agojsonrpc: Fix potential memory leak.
Ben Pfaff [Wed, 24 Mar 2010 00:20:42 +0000 (17:20 -0700)]
jsonrpc: Fix potential memory leak.

This is unlikely to occur very often in practice, because s->stream
usually gets stuffed into s->rpc before long, but it is still a good idea
to fix it.

14 years agofatal-signal: Initialize library upon any call to public function.
Ben Pfaff [Tue, 23 Mar 2010 22:27:44 +0000 (15:27 -0700)]
fatal-signal: Initialize library upon any call to public function.

Not calling fatal_signal_init() means that the signal handlers don't get
registered, so the process won't clean up on fatal signals.  Furthermore,
signal_fds[0] is then 0, which means that fatal-signal_wait() waits on
stdin, so if you are testing a program interactively and accidentally type
something on stdin then that program's CPU usage jumps to 100%.

Since poll_block() calls fatal_signal_wait() this seems like the most
reliable solution.

14 years agoovsdb: Fix ovsdb-server crash when specifying nonexistent file.
Ben Pfaff [Tue, 23 Mar 2010 22:38:37 +0000 (15:38 -0700)]
ovsdb: Fix ovsdb-server crash when specifying nonexistent file.

ovsdb_file_open__() can call (NULL) in its error exit
path, but ovsdb_schema_destroy() didn't tolerate a null pointer argument.

Bug #2538.

14 years agostream-ssl: Only re-read certificates and keys if they change.
Ben Pfaff [Wed, 24 Mar 2010 20:15:41 +0000 (13:15 -0700)]
stream-ssl: Only re-read certificates and keys if they change.

Commit 415f6c0b1 "stream-ssl: Make no-op reconfiguration cheap" caused
ovsdb-server to re-read its certificates and keys every 60 seconds just
in case they changed.  However, doing this causes OpenSSL to drop its
connections.  This commit solves the problem by making stream-ssl re-read
certificates and keys only if the files changed.

Bug #2535.
Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
14 years agovswitchd: Make names of Bridge external_ids generic.
Ben Pfaff [Thu, 18 Mar 2010 16:37:31 +0000 (09:37 -0700)]
vswitchd: Make names of Bridge external_ids generic.

Until now the names of the external_ids keys used for Bridge 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.

This finishes the renaming process started in commit c0f9490 "vswitchd:
Make names of Interface external_ids generic."

CC: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoINSTALL.Linux: Consistently assume installation in /usr/local.
Ben Pfaff [Wed, 24 Mar 2010 21:41:32 +0000 (14:41 -0700)]
INSTALL.Linux: Consistently assume installation in /usr/local.

The documentation was inconsistent about assuming whether the installation
was to / or to /usr/local.  Since the default is /usr/local, use that.

Reported-by: Jeongkeun Lee <jklee@hp.com>
14 years agoINSTALL.Linux: Document "ovs-vsctl init" step to installation.
Ben Pfaff [Wed, 24 Mar 2010 21:42:23 +0000 (14:42 -0700)]
INSTALL.Linux: Document "ovs-vsctl init" step to installation.

If the database is not initialized then other programs will complain.

Reported-by: Jeongkeun Lee <jklee@hp.com>
14 years agodatapath: Support 2.6.33 kernel layout in build system.
Ben Pfaff [Tue, 23 Mar 2010 16:27:08 +0000 (09:27 -0700)]
datapath: Support 2.6.33 kernel layout in build system.

The 2.6.33 kernel moves generated header files to include/generated, so
we need to look for autoconf.h there.

Reported-by: Brandon Heller <brandonh@stanford.edu>
14 years agoxenserver: Fix "ovs-vsctl get" call in vswitch-cfg-update.
Ben Pfaff [Tue, 23 Mar 2010 16:40:26 +0000 (09:40 -0700)]
xenserver: Fix "ovs-vsctl get" call in vswitch-cfg-update.

The ovs-vsctl arguments were being passed as a single string instead of
broken up as if the shell had performed word splitting.  This fixes the
problem.

Without this commit, "unknown command 'get Open_vSwitch . managers';
use --help for help" appears in the system log.  Adding the commit
suppresses that message.

NIC-72.
Reported-by: Andy Southgate <andy.southgate@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
14 years agoovsdb-server: Fix build when configuring without --enable-ssl.
Ben Pfaff [Mon, 22 Mar 2010 16:40:13 +0000 (09:40 -0700)]
ovsdb-server: Fix build when configuring without --enable-ssl.

Reported-by: Andy Southgate <andy.southgate@citrix.com>
14 years agovswitch: Limit SSL table to a single row.
Ben Pfaff [Fri, 19 Mar 2010 00:09:42 +0000 (17:09 -0700)]
vswitch: Limit SSL table to a single row.

Only a single row in the SSL can be useful currently.  This should help to
prevent confusion since ovsdb-server will choose an SSL configuration
randomly if there is more than one.

14 years agoovsdb-server: Obtain SSL configuration from database.
Ben Pfaff [Fri, 19 Mar 2010 00:12:02 +0000 (17:12 -0700)]
ovsdb-server: Obtain SSL configuration from database.

ovsdb-server should be able to obtain its SSL configuration from the
database that it is serving out, instead of having to specify it on the
command line.  This commit makes it so.

14 years agodocs: Fix ovsdb-server manpage.
Ben Pfaff [Fri, 19 Mar 2010 00:00:02 +0000 (17:00 -0700)]
docs: Fix ovsdb-server manpage.

The description of --remote=db:table,column got accidentally dropped a
number of commits back, so restore it.  Also, document that ovsdb-server
supports SSL bootstrapping.

14 years agodocs: Move PKI section heading into individual manpages.
Ben Pfaff [Thu, 18 Mar 2010 23:59:04 +0000 (16:59 -0700)]
docs: Move PKI section heading into individual manpages.

The ovsdb-server manpage needs a paragraph between the heading and the
first option description, so the heading can't go into the common fragment.

14 years agodocs: Make SSL manpage fragments less specific to OpenFlow.
Ben Pfaff [Fri, 19 Mar 2010 00:12:27 +0000 (17:12 -0700)]
docs: Make SSL manpage fragments less specific to OpenFlow.

These manpage fragments are used in OVSDB manpages as well, so their text
should try to avoid referring to OpenFlow-specific concepts.

14 years agostream-ssl: Make no-op reconfiguration cheap.
Ben Pfaff [Thu, 18 Mar 2010 23:40:35 +0000 (16:40 -0700)]
stream-ssl: Make no-op reconfiguration cheap.

Until now, the stream_ssl functions for configuring private keys,
certificates, and CA certificates have always called into OpenSSL to read
a file.  This commit instead makes them do that only if the file name
changed (or it has been 60 seconds since we last tried, in case someone
installed the file behind our backs).

This allows us to factor some code out of vswitchd.  In an upcoming commit
we will want to do essentially the same thing from ovsdb-server, so this
avoid code redundancy.

14 years agostream-ssl: Permit race in bootstrapping CA certificate.
Ben Pfaff [Thu, 18 Mar 2010 23:08:32 +0000 (16:08 -0700)]
stream-ssl: Permit race in bootstrapping CA certificate.

If two processes were both configured to bootstrap the CA certificate, then
one of them would succeed in writing it to a file and use it, and the other
one would fail to use it because the file was created behind its back.
This commit fixes the problem by making the bootstrap code accept a CA
certificate file that exists at the time that bootstrapping tries to create
it.

14 years agoclassifer: Fix test classifier to match real classifier.
Jesse Gross [Fri, 19 Mar 2010 17:54:36 +0000 (13:54 -0400)]
classifer: Fix test classifier to match real classifier.

The trivial test classifier had the same bug as the real classifier
when replacing matching flows.  This caused it to not find the
original bug and then break when the bug was fixed.

14 years agoclassifier: Check all rules of equal priority when inserting.
Jesse Gross [Fri, 19 Mar 2010 16:08:16 +0000 (12:08 -0400)]
classifier: Check all rules of equal priority when inserting.

When adding a new classifier rule we check if there is a rule
of the same priority first and overwrite it before inserting a
new rule.  Previously we would stop looking if we found one rule
in the correct bucket with the same priority, even if it didn't
match.  This keeps going until we either find a matching rule or
we run out of equal priority rules.

Reported-by: Tetsuo NAKAGAWA <nakagawa@mxc.nes.nec.co.jp>
14 years agoxenserver: Make OVS xsconsole plugin configure management channel
Justin Pettit [Sat, 13 Mar 2010 14:11:47 +0000 (06:11 -0800)]
xenserver: Make OVS xsconsole plugin configure management channel

Previously, the xsconsole plugin configured a single OpenFlow controller
configuration across all bridges.  With the management channel, we can
now have the manager configure the bridges' controllers individually.
This changes the plugin to only set that management IP.

14 years agoxenserver: Remove support for setting different controllers for datapaths
Justin Pettit [Sat, 13 Mar 2010 12:41:20 +0000 (04:41 -0800)]
xenserver: Remove support for setting different controllers for datapaths

A hack was put in a while back to support setting different controllers for
different datapaths by defining a "for-bridges" value in the
"vSwitchController" key.  It is no longer necessary to do that with the
management protocol, since the manager can directly set controllers for
each datapath.

14 years agoxenserver: Add ovsdb-server logs to xen-bugtool
Justin Pettit [Sat, 13 Mar 2010 14:24:47 +0000 (06:24 -0800)]
xenserver: Add ovsdb-server logs to xen-bugtool

14 years agovswitch: Limit Open_vSwitch table to a single record.
Ben Pfaff [Wed, 17 Mar 2010 00:09:44 +0000 (17:09 -0700)]
vswitch: Limit Open_vSwitch table to a single record.

This table has always been limited to a single record.  This commit makes
the database itself enforce that limit.

14 years agoovsdb: Allow constraining the number of rows in a table.
Ben Pfaff [Wed, 17 Mar 2010 00:08:06 +0000 (17:08 -0700)]
ovsdb: Allow constraining the number of rows in a table.

14 years agoovsdb: Fix error message when parsing an operation fails.
Ben Pfaff [Wed, 17 Mar 2010 00:07:22 +0000 (17:07 -0700)]
ovsdb: Fix error message when parsing an operation fails.

Otherwise you get errors with text like "ovsdb operation 2 of 1", which
is confusing.

14 years agoovsdb: Compact databases online automatically and on-demand.
Ben Pfaff [Thu, 18 Mar 2010 18:24:55 +0000 (11:24 -0700)]
ovsdb: Compact databases online automatically and on-demand.

If the database grows fairly large, and we've written a fair number of
transactions to it, and it's been a while since the database was compacted,
then (after the next commit) compact the database.

Also, compact the database online if the "ovsdb-server/compact" command is
issued via unixctl.  I suspect that this feature will rarely if ever be
used in practice, but it's easier to test than compacting automatically.

Bug #2391.

14 years agoovsdb: Rename ovsdb_file_replica to ovsdb_file.
Ben Pfaff [Tue, 16 Mar 2010 22:13:42 +0000 (15:13 -0700)]
ovsdb: Rename ovsdb_file_replica to ovsdb_file.

This is in preparation for exposing ovsdb_file to clients outside this
translation unit.  These clients don't care that the ovsdb_file is an
ovsdb replica--that's an implementation detail--and so it makes sense to
rename it from their point of view.

This is just a search-and-replace plus reindenting where appropriate.

14 years agoutil: New functions get_cwd(), abs_file_name().
Ben Pfaff [Tue, 16 Mar 2010 22:06:11 +0000 (15:06 -0700)]
util: New functions get_cwd(), abs_file_name().

These will be used further in an upcoming commit.

14 years agoovsdb: Always set *dbp to null on failure in ovsdb_file_open__().
Ben Pfaff [Tue, 16 Mar 2010 19:42:40 +0000 (12:42 -0700)]
ovsdb: Always set *dbp to null on failure in ovsdb_file_open__().

Found via inspection.  I do not know that this fixes a real bug.

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.