sliver-openvswitch.git
11 years agoMerge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch
Giuseppe Lettieri [Tue, 11 Sep 2012 13:36:45 +0000 (15:36 +0200)]
Merge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch

Conflicts:
planetlab/exp-tool/Makefile
planetlab/scripts/sliver-ovs

11 years agouse sliver-ovs to stop stuff as well
Thierry Parmentelat [Tue, 11 Sep 2012 13:01:33 +0000 (15:01 +0200)]
use sliver-ovs to stop stuff as well

11 years agosingle config file - LINKS get defined in conf.mk
Thierry Parmentelat [Tue, 11 Sep 2012 12:32:26 +0000 (14:32 +0200)]
single config file - LINKS get defined in conf.mk
this breaks the feature that lets save current topology but makes
user's - esp. firtst-time user's - life much easier
also an attempt to make the Makefile less cryptic :)

11 years agobugfix - create-port was broken
Thierry Parmentelat [Tue, 11 Sep 2012 12:30:34 +0000 (14:30 +0200)]
bugfix - create-port was broken

11 years agokill pltap-ovs on create-bridge timeout
Giuseppe Lettieri [Tue, 11 Sep 2012 12:27:56 +0000 (14:27 +0200)]
kill pltap-ovs on create-bridge timeout

11 years agoshow subcommand to inspect bridge configuration
Giuseppe Lettieri [Tue, 11 Sep 2012 11:38:29 +0000 (13:38 +0200)]
show subcommand to inspect bridge configuration

11 years agogeneric function for checking subcommand params
Giuseppe Lettieri [Tue, 11 Sep 2012 11:30:43 +0000 (13:30 +0200)]
generic function for checking subcommand params

11 years agofixed parameters for del-port
Giuseppe Lettieri [Tue, 11 Sep 2012 08:36:46 +0000 (10:36 +0200)]
fixed parameters for del-port

11 years agoadd set-remote-endpoint action to sliver-ovs
Giuseppe Lettieri [Tue, 11 Sep 2012 07:56:29 +0000 (09:56 +0200)]
add set-remote-endpoint action to sliver-ovs

Now all makefile targets call a sliver-ovs action.
This is required to centralize checks (is_{switch,db}_running and
possibly more to come) and to make all
sliver-openvwitch configuration variables (DB_SOCK and the like)
available to all actions.

11 years agoadd set-remote-endpoint action to sliver-ovs
Giuseppe Lettieri [Tue, 11 Sep 2012 07:56:29 +0000 (09:56 +0200)]
add set-remote-endpoint action to sliver-ovs

Now all makefile targets call a sliver-ovs action.
This is required to centralize checks (is_{switch,db}_running and
possibly more to come) and to make all
sliver-openvwitch configuration variables (DB_SOCK and the like)
available to all actions.

11 years agoMerge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch
Giuseppe Lettieri [Tue, 11 Sep 2012 07:49:04 +0000 (09:49 +0200)]
Merge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch

Conflicts:
planetlab/scripts/sliver-ovs

11 years agoache/bridge.% needs to contain the ifname
Thierry Parmentelat [Mon, 10 Sep 2012 12:30:10 +0000 (14:30 +0200)]
ache/bridge.% needs to contain the ifname

11 years agomore convenience targets, like
Thierry Parmentelat [Mon, 10 Sep 2012 08:52:16 +0000 (10:52 +0200)]
more convenience targets, like
make showips
and all the family of (assuming MUX is a host id) start.MUX stop.MUX
bridge.MUX and the like

11 years agospecifying the --db option to ovs-vsctl requires the unix: qualifier
Thierry Parmentelat [Mon, 10 Sep 2012 08:51:09 +0000 (10:51 +0200)]
specifying the --db option to ovs-vsctl requires the unix: qualifier

11 years agoadditional checks for running servers
Giuseppe Lettieri [Sat, 8 Sep 2012 16:51:40 +0000 (18:51 +0200)]
additional checks for running servers

- Added some more is_switch_running calls.
- Added new is_db_running. We need at least
  a running ovsdb-server to actually delete
  a port or a bridge.

11 years agoadd timeouts to infinite loops
Thierry Parmentelat [Fri, 7 Sep 2012 07:33:50 +0000 (09:33 +0200)]
add timeouts to infinite loops

11 years agoadd global start stop status targets for handling db+switch
Thierry Parmentelat [Fri, 7 Sep 2012 06:46:09 +0000 (08:46 +0200)]
add global start stop status targets for handling db+switch

11 years agospecify DB_SOCKET to ovs-vsctl for consistency
Thierry Parmentelat [Fri, 7 Sep 2012 06:45:10 +0000 (08:45 +0200)]
specify DB_SOCKET to ovs-vsctl for consistency
use /etc/openvswitch instead of /usr/etc/openvswitch

11 years agotweak packaging to use fedora-compliant paths
Thierry Parmentelat [Fri, 7 Sep 2012 06:42:44 +0000 (08:42 +0200)]
tweak packaging to use fedora-compliant paths
remove duplicate sliver-ovs script

11 years agoadd netmask in the example file
Thierry Parmentelat [Fri, 7 Sep 2012 06:11:35 +0000 (08:11 +0200)]
add netmask in the example file

11 years agostores command logs in separate file, not the make target itself
Thierry Parmentelat [Thu, 6 Sep 2012 16:04:19 +0000 (18:04 +0200)]
stores command logs in separate file, not the make target itself

11 years agonew subcommands start stop status
Thierry Parmentelat [Thu, 6 Sep 2012 16:03:47 +0000 (18:03 +0200)]
new subcommands start stop status

11 years agospecify where the switch daemon creates its control socket and pass
Thierry Parmentelat [Thu, 6 Sep 2012 15:38:55 +0000 (17:38 +0200)]
specify where the switch daemon creates its control socket and pass
this to ovs-appctl

11 years agorun sudo with -S is required for f14 (was not on f12)
Thierry Parmentelat [Thu, 6 Sep 2012 14:38:38 +0000 (16:38 +0200)]
run sudo with -S is required for f14 (was not on f12)
rename switchd into just switch, for consistency with sliver-ovs

11 years agoadd stop_* and status commands
Thierry Parmentelat [Thu, 6 Sep 2012 11:25:21 +0000 (13:25 +0200)]
add stop_* and status commands
fix communication between db and switch
all filenames are variables
specify logfiles

11 years agoautomake was whining
Thierry Parmentelat [Thu, 6 Sep 2012 06:32:33 +0000 (08:32 +0200)]
automake was whining

11 years agoMerge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch
Thierry Parmentelat [Thu, 6 Sep 2012 06:25:57 +0000 (08:25 +0200)]
Merge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch

11 years agoadd solve_ip function
Thierry Parmentelat [Thu, 6 Sep 2012 06:25:48 +0000 (08:25 +0200)]
add solve_ip function

11 years agofix dependencies after scripts cleanup
Thierry Parmentelat [Thu, 6 Sep 2012 06:25:32 +0000 (08:25 +0200)]
fix dependencies after scripts cleanup

11 years agomake the separator configurable
Giuseppe Lettieri [Wed, 5 Sep 2012 17:33:01 +0000 (19:33 +0200)]
make the separator configurable

11 years agobugfixes
Thierry Parmentelat [Wed, 5 Sep 2012 14:35:43 +0000 (16:35 +0200)]
bugfixes

11 years agotrash old scripts
Thierry Parmentelat [Wed, 5 Sep 2012 14:10:36 +0000 (16:10 +0200)]
trash old scripts

11 years agocosmetic in usage message
Thierry Parmentelat [Wed, 5 Sep 2012 14:08:23 +0000 (16:08 +0200)]
cosmetic in usage message

11 years agouse sliver-ovs <subcommand> rather than the former scripts
Thierry Parmentelat [Wed, 5 Sep 2012 14:08:10 +0000 (16:08 +0200)]
use sliver-ovs <subcommand> rather than the former scripts

11 years agofirst attempt at a single merged script out of the previous 6
Thierry Parmentelat [Wed, 5 Sep 2012 14:03:16 +0000 (16:03 +0200)]
first attempt at a single merged script out of the previous 6

11 years agotargets shownodes and showslice
Thierry Parmentelat [Wed, 5 Sep 2012 12:51:23 +0000 (14:51 +0200)]
targets shownodes and showslice

11 years agomake room for a private myexp/ dir
Thierry Parmentelat [Wed, 5 Sep 2012 12:51:01 +0000 (14:51 +0200)]
make room for a private myexp/ dir

11 years agoremove extraneous sequel from merge
Thierry Parmentelat [Wed, 5 Sep 2012 11:49:06 +0000 (13:49 +0200)]
remove extraneous sequel from merge

11 years agoMerge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch
Giuseppe Lettieri [Wed, 5 Sep 2012 10:36:29 +0000 (12:36 +0200)]
Merge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch

11 years agoMerge branch 'forward-port'
Giuseppe Lettieri [Wed, 5 Sep 2012 10:35:36 +0000 (12:35 +0200)]
Merge branch 'forward-port'

Conflicts:
planetlab/exp-tool/Makefile

11 years agoimprove make nodes
Thierry Parmentelat [Wed, 5 Sep 2012 08:56:39 +0000 (10:56 +0200)]
improve make nodes

11 years agosmall improvements
Thierry Parmentelat [Tue, 4 Sep 2012 16:27:41 +0000 (18:27 +0200)]
small improvements

11 years agoadd -t option to ssh, to second sudo forward-port
Giuseppe Lettieri [Mon, 3 Sep 2012 12:36:12 +0000 (14:36 +0200)]
add -t option to ssh, to second sudo

11 years agoupdate to new netdev interface
Giuseppe Lettieri [Thu, 30 Aug 2012 15:31:00 +0000 (17:31 +0200)]
update to new netdev interface

get/set config now use smap's instead of shash's

11 years agofix warnings about unused paramethers
Giuseppe Lettieri [Thu, 30 Aug 2012 15:28:19 +0000 (17:28 +0200)]
fix warnings about unused paramethers

11 years agoMerge branch 'master' into forward-port
Giuseppe Lettieri [Thu, 30 Aug 2012 14:35:26 +0000 (16:35 +0200)]
Merge branch 'master' into forward-port

Conflicts:
lib/automake.mk
lib/dpif-netdev.c
lib/netdev-provider.h
lib/netdev.c

11 years agolist files that do not go into the distribution
Giuseppe Lettieri [Thu, 30 Aug 2012 14:12:25 +0000 (16:12 +0200)]
list files that do not go into the distribution

The Makefile of Open vSwitch checks that all files in the
git repository are also distributed and stops with an error
otherwise. But we have some files in git that are not meant
to be distributed (i.e., installed on a sliver). These files can now
be listed in .non-distfiles and the new Makefile will ignore them.

11 years agofix obnoxiuos warnings
Giuseppe Lettieri [Thu, 30 Aug 2012 14:11:09 +0000 (16:11 +0200)]
fix obnoxiuos warnings

11 years agofix some warnings
Giuseppe Lettieri [Thu, 30 Aug 2012 13:31:57 +0000 (15:31 +0200)]
fix some warnings

11 years agovswitchd: Respect other_config:stp-enable port setting.
Ethan Jackson [Wed, 29 Aug 2012 23:00:31 +0000 (16:00 -0700)]
vswitchd: Respect other_config:stp-enable port setting.

Commit a699f614 (lib: Utilize smaps in the idl.) broke the
other_config:stp-enable port setting in two ways.  First, it
changed the default if the setting was missing to disabled.
Second, if the setting was present, it did the opposite of what the
user configured.

Bug #13122.
Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agoofproto-dpif: Make OFPP_TABLE send packet-in on miss.
Isaku Yamahata [Tue, 28 Aug 2012 17:19:03 +0000 (02:19 +0900)]
ofproto-dpif: Make OFPP_TABLE send packet-in on miss.

The OpenFlow specification for OFPP_TABLE implies that a miss
should generate a packet-in, but Open vSwitch has never done
that.  This corrects the behavior.

This also prepares for the goto-table instruction, which will
need to generate a table-miss in some circumstances.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
[blp@nicira.com rebased and updated commit message]
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-msgs: Allow encoding and decoding of Open Flow 1.1 & 1.2 Barrier Messages
Simon Horman [Tue, 21 Aug 2012 04:55:38 +0000 (13:55 +0900)]
ofp-msgs: Allow encoding and decoding of Open Flow 1.1 & 1.2 Barrier Messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-ofctl: Use vconn as a parameter of dump_stats_transaction()
Simon Horman [Tue, 21 Aug 2012 04:55:37 +0000 (13:55 +0900)]
ovs-ofctl: Use vconn as a parameter of dump_stats_transaction()

In order to form a stats message for the prevailing OpenFlow version
of a vconn the vconn needs to be open at the time the request is
encoded. Thus there is no longer a case where it makes sense to
use dump_stats_transaction() without a vconn already being open and
available to pass as a parameter.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-msgs: Split OFPRAW_OFPST_AGGREGATE_REQUEST
Simon Horman [Tue, 21 Aug 2012 04:55:35 +0000 (13:55 +0900)]
ofp-msgs: Split OFPRAW_OFPST_AGGREGATE_REQUEST

Split OFPRAW_OFPST_AGGREGATE_REQUEST into OpenFlow 1.0 and 1.1+
versions.

This should be sufficient to allow adding encoding and decoding of
Open Flow 1.1 and 1.2 Aggregate Stats Request messages.

Encoding and decoding of Open Flow 1.1 and 1.2 Aggregate Stats Response
messages works using the existing code without modification.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Allow decoding of Open Flow 1.2 Flow Statistics Request Messages
Simon Horman [Tue, 21 Aug 2012 04:55:34 +0000 (13:55 +0900)]
ofp-util: Allow decoding of Open Flow 1.2 Flow Statistics Request Messages

Allow decoding of Open Flow 1.1 and 1.2 flow statistics request messages.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofproto-dpif: refactor rule_dpif_lookup() for table miss whose id > 0
Isaku Yamahata [Tue, 28 Aug 2012 17:19:02 +0000 (02:19 +0900)]
ofproto-dpif: refactor rule_dpif_lookup() for table miss whose id > 0

The refactored function, rule_dpif_miss_rule(), will be used for
handling table miss whose table_id > 0 by goto-table instruction.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotests: Fix autopath tests
Joe Stringer [Wed, 29 Aug 2012 03:09:37 +0000 (15:09 +1200)]
tests: Fix autopath tests

With the deprecation of autopath, some tests were broken. This patch fixes
the test breakages.

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agobridge: Deprecate the null interface type.
Ethan Jackson [Tue, 21 Aug 2012 22:44:58 +0000 (15:44 -0700)]
bridge: Deprecate the null interface type.

It's not entirely clear what problem the null interface type is
trying to solve, nor how it could be of use to any controller.
This patch deprecates it, and schedules its removal for February
2013.  If there are concerns, please email dev@openvswitch.org.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agonicira-ext: Deprecate the autopath action.
Ethan Jackson [Sat, 18 Aug 2012 02:14:02 +0000 (19:14 -0700)]
nicira-ext: Deprecate the autopath action.

The autopath action is an obsolete attempt to replicate
functionality contained in the bundle action.  It is ugly and of
questionable usefulness.  This patch deprecates it and schedules
its removal for February 2013.  If there are concerns, please email
dev@openvswitch.org.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agobond: Deprecate stable bonds.
Ethan Jackson [Sat, 18 Aug 2012 01:47:43 +0000 (18:47 -0700)]
bond: Deprecate stable bonds.

The stable bond mode is an obsolete attempt to replicate the
functionality contained in the bundle action.  They are ugly and of
questionable usefulness.  This patch deprecates them and schedules
their removal for February 2013.  If there are concerns, please
email dev@openvswitch.org.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agolib/ofp-actions: improve ofpact_instruction_name_from_type()
Isaku Yamahata [Tue, 28 Aug 2012 17:19:00 +0000 (02:19 +0900)]
lib/ofp-actions: improve ofpact_instruction_name_from_type()

eliminate unnecessary loop.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodatapath: Fix namespace refcount leak on failed init.
Jesse Gross [Wed, 22 Aug 2012 00:48:54 +0000 (17:48 -0700)]
datapath: Fix namespace refcount leak on failed init.

If a datapath fails to initialze fully (likely due to out-of-memory)
then it's possible that we can take a reference to a network
namespace but never release it.  This fixes the problem by releasing
any resources in the event of an error.

Found by code inspection, it's likely to be extremely rare in practice.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
11 years agostp: port_no counter is off by one
Ansis Atteka [Tue, 21 Aug 2012 23:48:36 +0000 (16:48 -0700)]
stp: port_no counter is off by one

This counter was off by one, because port_num
should be less than STP_MAX_PORTS.

This caused an assert hit later in stp_get_port().

Issue: 13059
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
11 years agoofproto-dpif: Make sure one-packet flows have zero duration (again).
Ben Pfaff [Sat, 18 Aug 2012 06:27:40 +0000 (23:27 -0700)]
ofproto-dpif: Make sure one-packet flows have zero duration (again).

commit 6a0a5bbbc (ofproto-dpif: Make sure one-packet flows have zero
duration.) was supposed to fix failures in the "ofproto-dpif - NetFlow
flow expiration" test, but it didn't fix the whole problem.  That commit
eliminated one reason why a one-packet flow might be shown as having an
nonzero duration, but missed another.

The other reason was that the call to dpif_flow_stats_extract() could
obtain a time later than the time that a new facet was created.  (This
wasn't obvious because dpif_flow_stats_extract() obtained the time
internally instead of taking it from the caller.)  This commit fixes that
problem, by using the facet creation there too for the first packet in
a facet.

This problem has suddenly started showing up in a lot of builds.  I think
it's probably because of the recent change that makes x86-64 skip the timer
optimizations, so that the return value of time_msec() changes every 1 ms,
not just every 100 ms.

I've tested this by running the test in question in a loop for several
minutes, without any failures.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodpif: Add 'used' argument to dpif_flow_stats_extract().
Ben Pfaff [Sat, 18 Aug 2012 06:27:39 +0000 (23:27 -0700)]
dpif: Add 'used' argument to dpif_flow_stats_extract().

The following commit will need to use a value other than a literal
time_msec() in one case.  This commit is just preparation.

Factoring the time_msec() call out of the loop in
handle_flow_miss_without_facet() is a really minor optimization.  It isn't
the main point here.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agobond: Tag flows according to their hash bucket, not just their slave.
Ben Pfaff [Tue, 21 Aug 2012 20:51:01 +0000 (13:51 -0700)]
bond: Tag flows according to their hash bucket, not just their slave.

The bonding code is supposed to tag flows two ways:

    - According to the chosen bond slave, to make it easy to invalidate all
      of the flows assigned to a given slave.

    - According to the hash value for a flow, to make it easy to invalidate
      all of the flows that hash into the same bucket.

However, the code wasn't actually applying the hash-based tags.  This
meant that rebalancing didn't take effect immediately, and so after
rebalancing we could get log messages like this:

   inconsistency in subfacet (actions were: 5) (correct actions: 4)

specifying some flow that was moved by the rebalance.

This commit fixes the problem by applying the hash-based tags.

Bug #12847.
Reported-by: Pratap Reddy <preddy@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
11 years agoofp-actions: Correct copyright statement.
Ethan Jackson [Tue, 21 Aug 2012 20:28:49 +0000 (13:28 -0700)]
ofp-actions: Correct copyright statement.

This patch changes the name of Nicira from "Nicira Networks" which
is incorrect, to "Nicira, Inc." which is correct.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agoofproto-dpif: Kill off test-netflow daemon if test fails.
Ben Pfaff [Mon, 20 Aug 2012 17:30:05 +0000 (10:30 -0700)]
ofproto-dpif: Kill off test-netflow daemon if test fails.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotests: New m4 macro ON_EXIT to add a cleanup action.
Ben Pfaff [Mon, 20 Aug 2012 17:29:39 +0000 (10:29 -0700)]
tests: New m4 macro ON_EXIT to add a cleanup action.

Several of the tests start daemons and then need to make sure that the
daemons get killed when the test completes, even if it completes in the
middle due to an early failure.  Until now, they have been using manual
shell "trap" calls to do this.  This works well enough for simple cases,
but sometimes multiple macros start daemons in a single test, and then
each "trap" has to be carefully written to kill off the daemons for the
previously invoked macros.

This commit introduces a new macro ON_EXIT whose use is composable: each
call appends a new action to the ones already specified.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agobonding: Update bonding documentation in INTERNALS.
Ethan Jackson [Fri, 17 Aug 2012 22:54:01 +0000 (15:54 -0700)]
bonding: Update bonding documentation in INTERNALS.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agoovs-ofctl: Fix memory leak in "check-vlan" test command.
Ben Pfaff [Fri, 17 Aug 2012 20:59:46 +0000 (13:59 -0700)]
ovs-ofctl: Fix memory leak in "check-vlan" test command.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-print: Fix memory leak printing flow stats replies.
Ben Pfaff [Fri, 17 Aug 2012 20:59:15 +0000 (13:59 -0700)]
ofp-print: Fix memory leak printing flow stats replies.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Drop unneeded null pointer tests.
Ben Pfaff [Thu, 16 Aug 2012 19:24:01 +0000 (12:24 -0700)]
ofp-util: Drop unneeded null pointer tests.

The functions being called already do nothing if passed a null pointer.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoDo not include zeroed metadata fields in NXM/OXM packet-in messages.
Ben Pfaff [Wed, 15 Aug 2012 17:16:49 +0000 (10:16 -0700)]
Do not include zeroed metadata fields in NXM/OXM packet-in messages.

NXM and OpenFlow 1.2+ allow including the values of arbitrary flow metadata
in "packet-in" messages.  Open vSwitch has until now always included all
the values of the metadata fields that it implements in NXT_PACKET_IN
messages.

However, this has at least two disadvantages:

    - Most of the metadata fields tend to be zero most of the time, which
      wastes space in the message.

    - It means that controllers must be very liberal about accepting
      fields that they know nothing about in packet-in messages, since any
      switch upgrade could cause new fields to appear even if the
      controller does nothing to give them nonzero values.  (Controllers
      have to be prepared to tolerate unknown fields in any case, but this
      property makes unknown fields more likely to appear than otherwise.)

This commit changes Open vSwitch so that metadata fields whose values are
zero are not reported in packet-ins, fixing both problems.  (This is
explicitly allowed by OpenFlow 1.2+.)

This commit mainly fixes a sort of internal conceptual dissonance centering
around struct flow_metadata.  This structure is supposed to report the
metadata for a given flow.  If you look at a flow, it has particular
metadata values; it doesn't have masks, and the idea of a mask for a
particular flow doesn't really make sense.  However, struct flow_metadata
did have masks.  This led to internal confusion; one can see this in, for
example, the following code removed by this commit in ofproto-dpif.c to
handle misses in the OpenFlow flow table:

    /* Registers aren't meaningful on a miss. */
    memset(pin.fmd.reg_masks, 0, sizeof pin.fmd.reg_masks);

What this code was really trying to say is that on a flow miss, the
registers are zero, so they shouldn't be included in the packet-in message.
It did manage to omit the registers, by marking them as "wild", but it is
conceptually more correct to simply omit them because they are zero (and
that's one effect of this commit).

Bug #12968.
Reported-by: Igor Ganichev <iganichev@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoman-pages: Add missing entry for matching metadata
Joe Stringer [Fri, 17 Aug 2012 08:06:29 +0000 (20:06 +1200)]
man-pages: Add missing entry for matching metadata

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotests: Put AT_CAPTURE_FILE on its own line.
Ben Pfaff [Thu, 16 Aug 2012 22:54:16 +0000 (15:54 -0700)]
tests: Put AT_CAPTURE_FILE on its own line.

This is a harmless typo, but the file is more readable with AT_CAPTURE_FILE
on its own line.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
11 years agotests: Invoke daemons with --no-chdir so core files appear in test dir.
Ben Pfaff [Tue, 14 Aug 2012 20:18:03 +0000 (13:18 -0700)]
tests: Invoke daemons with --no-chdir so core files appear in test dir.

The OVS daemons "cd" to / as a normal part of their startup, since this is
traditional for daemons under Unix.  But this also means that, if the
daemons happen to terminate with a core in the unit tests, then the core
file won't be written because / has too-restrictive permissions.  (Unless
you run the unit tests as root, or you've got cores configured to go to a
non-standard location.)

This commit fixes the problem by invoking most daemons with --no-chdir so
that the core files go to a test-specific directory.  I didn't change
invocations of the Python daemons, since Python doesn't normally terminate
with a core.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
11 years agotests: Factor "seq" shell function out into common infrastructure.
Ben Pfaff [Fri, 10 Aug 2012 22:15:24 +0000 (15:15 -0700)]
tests: Factor "seq" shell function out into common infrastructure.

An upcoming patch will introduce a second user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovswitch.xml: balance-tcp can be rebalanced too.
Ben Pfaff [Tue, 14 Aug 2012 20:26:16 +0000 (13:26 -0700)]
vswitch.xml: balance-tcp can be rebalanced too.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovswitch.xml: Generalize "carrier" to cover miimon also.
Ben Pfaff [Tue, 14 Aug 2012 20:25:32 +0000 (13:25 -0700)]
vswitch.xml: Generalize "carrier" to cover miimon also.

I believe that saying "carrier" here excludes the miimon case, which we'd
like to include also.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovswitch.xml: Document that active-backup works OK with multiple switches.
Ben Pfaff [Tue, 14 Aug 2012 20:23:59 +0000 (13:23 -0700)]
vswitch.xml: Document that active-backup works OK with multiple switches.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovswitch.xml: active-backup and balance-slb bonds must be one-sided.
Ben Pfaff [Tue, 14 Aug 2012 20:23:22 +0000 (13:23 -0700)]
vswitch.xml: active-backup and balance-slb bonds must be one-sided.

It doesn't work to hook up an active-backup bond on one switch to an
active-backup bond on another switch, because they might pick different
active interfaces and therefore not pass any traffic.

The same is true of balance-slb because multicast and broadcast
traffic is dropped on ingress to any interface other than the active
interface.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofproto-dpif: Avoid dereferencing possibly null or wild pointer.
Ben Pfaff [Thu, 16 Aug 2012 18:33:21 +0000 (11:33 -0700)]
ofproto-dpif: Avoid dereferencing possibly null or wild pointer.

If ofpacts_len is 0 then ofpacts->type is a bad reference.

(An early draft of ofpacts used an OFPACT_END sentinel so that there was
always data there in this function, but in review the sentinel got deleted
and I did not notice that this function needed an update.)

Found by valgrind.

Bug #12847.
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoAdd Nicira vendor extension action NXAST_DEC_TTL_CNT_IDS.
Mehak Mahajan [Thu, 16 Aug 2012 21:25:07 +0000 (14:25 -0700)]
Add Nicira vendor extension action NXAST_DEC_TTL_CNT_IDS.

Currently, if a controller having a nonzero id registers to get a
OFPR_INVALID_TTL async message, it will not receive it.  This is because
compose_dec_ttl() only sent the invalid ttl packets to the default controller
id.  NXAST_DEC_TTL_CNT_IDS is a new action that accepts a list of controller
ids, each separated by `,', to which the OFPR_INVALID_TTL packets must be sent.
The earlier requirement of the controller having to explicitly register to
receive these asynchronous messages is retained.
The syntax of this action is:
    dec_ttl(id1,id2)
where id1, id2 are valid controller ids.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
11 years agoofproto-dpif: Increase recursion limit.
Ethan Jackson [Thu, 16 Aug 2012 21:16:06 +0000 (14:16 -0700)]
ofproto-dpif: Increase recursion limit.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agobond: Correct comment.
Ben Pfaff [Tue, 14 Aug 2012 20:41:01 +0000 (13:41 -0700)]
bond: Correct comment.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodpif-netdev: Eliminate two malloc() calls per packet sent to "userspace".
Ben Pfaff [Wed, 15 Aug 2012 23:05:31 +0000 (16:05 -0700)]
dpif-netdev: Eliminate two malloc() calls per packet sent to "userspace".

This is easy enough, so it seems worthwhile now that FreeBSD is starting
to make more use of the "userspace switch".

CC: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodpif-netdev: Fix memory leak.
Ben Pfaff [Wed, 15 Aug 2012 22:19:18 +0000 (15:19 -0700)]
dpif-netdev: Fix memory leak.

upcall->packet is allocated with malloc(), via ofpbuf_new(), but nothing
ever frees it.

Found by valgrind.

CC: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofproto-dpif: Fix typo in comment.
Ben Pfaff [Thu, 16 Aug 2012 16:31:23 +0000 (09:31 -0700)]
ofproto-dpif: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovsdb-idl: Fix memory leak.
Ben Pfaff [Wed, 15 Aug 2012 23:19:47 +0000 (16:19 -0700)]
ovsdb-idl: Fix memory leak.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofproto-dpif: Make sure one-packet flows have zero duration.
Ben Pfaff [Mon, 13 Aug 2012 16:41:59 +0000 (09:41 -0700)]
ofproto-dpif: Make sure one-packet flows have zero duration.

A Nicira internal build recently failed the "ofproto-dpif - NetFlow flow
expiration" test because of the following difference in output:

     header: v5, seq 0, engine 2,1
    -rec: [...], 1 pkts, 60 bytes, ICMP 8:0, time <moment>
    +rec: [...], 1 pkts, 60 bytes, ICMP 8:0, time <range>

Looking at the actual output, it is:
    rec: 192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 60 bytes,
    ICMP 8:0, time 8...9

That is, a one-packet flow was shown to have more than a momentary
duration, which doesn't make sense.

This commit fixes the problem by making sure that creating a facet and then
its initial subfacet only checks the current time once.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofproto-dpif: Avoid searching all subfacets when creating first in a facet.
Ben Pfaff [Mon, 13 Aug 2012 16:30:26 +0000 (09:30 -0700)]
ofproto-dpif: Avoid searching all subfacets when creating first in a facet.

When we create the first subfacet within a facet, we know that there
cannot be an existing subfacet with the same key, so we can skip the search
through the ofproto's table of subfacets.

This is a small optimization, but it should not affect the flow setup rate
in most benchmarks, because in the stressful situations that benchmarks
create, OVS does not set up flows.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agonetdev: Map to OpenFlow port for flow lookup
Ed Maste [Wed, 15 Aug 2012 22:00:34 +0000 (22:00 +0000)]
netdev: Map to OpenFlow port for flow lookup

In the flow hash special ports are stored using OpenFlow constants.
For example the "local port" is stored as 0xfffe (OFPP_LOCAL).

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agobridge: Write certain statistics to the database instantly.
Ethan Jackson [Tue, 14 Aug 2012 21:08:09 +0000 (14:08 -0700)]
bridge: Write certain statistics to the database instantly.

Traditionally the bridge has written interface and port statistics
to the database in a rate limited fashion.  This makes a lot of
sense for statistics which are either constantly changing, or are
expensive to collect.  However, some statistics were rate limited
which have neither of these properties.  Furthermore some of these
statistics (most notably carrier) could be very useful to a
controller if updated promptly.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agoCorrect number of bytes to allocated for slaves in bundle action.
Mehak Mahajan [Wed, 15 Aug 2012 18:19:35 +0000 (11:19 -0700)]
Correct number of bytes to allocated for slaves in bundle action.

The size of each slave is a uint16_t.  This means that each slave needs 2 bytes
at the end of nx_action_bundle.  Earlier, the size of each slave was not being
factored in when allocating space.  This commit corrects that by allocating 2
bytes for each slave when calculating the total number of bytes to be allocated
at the end of nx_action_bundle.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
11 years agoofp-actions/instruction: helper functions for intructions
Isaku Yamahata [Wed, 1 Aug 2012 15:24:10 +0000 (00:24 +0900)]
ofp-actions/instruction: helper functions for intructions

This patch introduces helper functions
- to cast
- to convert from/to text

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-actions: sort OVSINST_OFPIT11_xxx value in execution order
Isaku Yamahata [Wed, 1 Aug 2012 15:24:09 +0000 (00:24 +0900)]
ofp-actions: sort OVSINST_OFPIT11_xxx value in execution order

This order is used by parser from text string to check if the instruction
is given in this order.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-actions: export OVSINST_OFPIT11_xxx
Isaku Yamahata [Wed, 1 Aug 2012 15:24:08 +0000 (00:24 +0900)]
ofp-actions: export OVSINST_OFPIT11_xxx

They will be used by ofp-parser.c.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotests: Add delay in NetFlow unit tests before killing processes.
Jesse Gross [Tue, 7 Aug 2012 22:26:33 +0000 (15:26 -0700)]
tests: Add delay in NetFlow unit tests before killing processes.

At the end of the NetFlow unit tests we warp time to force any
remaining flows to expire and then immediately kill OVS and the
collector.  However, this creates a race where sometimes these
processes are killed before the last records are sent or collected.
It's possible to force OVS to go through the run loop one last time
before exiting but it's harder to enforce that the collector receives
the packet.  This simply avoids the problem by adding a 1 second delay
before killing the processes, which should be more than enough time.

Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agocfm: Expose remote CFM opstate in the database.
Ethan Jackson [Fri, 10 Aug 2012 23:14:45 +0000 (16:14 -0700)]
cfm: Expose remote CFM opstate in the database.

A controller may want to know the remote CFM opstate of a given CFM
enabled interface.  This patch makes this data available in the
database.

Signed-off-by: Ethan Jackson <ethan@nicira.com>