sliver-openvswitch.git
12 years agometa-flow: Correctly set destination MAC in mf_set_flow_value(). branch-1.6
Ben Pfaff [Fri, 27 Apr 2012 15:45:10 +0000 (08:45 -0700)]
meta-flow: Correctly set destination MAC in mf_set_flow_value().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoFix memory leaks.
Ben Pfaff [Mon, 23 Apr 2012 20:22:10 +0000 (13:22 -0700)]
Fix memory leaks.

Found by valgrind.

Reported-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Avoid GCC warning.
Ben Pfaff [Wed, 25 Apr 2012 03:19:18 +0000 (20:19 -0700)]
vswitchd: Avoid GCC warning.

GCC 4.4.5 issues the following warning without this patch:

    bridge.c: In function ‘bridge_run’:
    bridge.c:2032: error: ‘database_changed’ may be used uninitialized in
    this function

I think it's unnecessary, but it doesn't hurt to always initialize this
variable.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Clean up iface_create().
Ben Pfaff [Tue, 24 Apr 2012 23:53:01 +0000 (16:53 -0700)]
vswitchd: Clean up iface_create().

iface_create() did its work in an order that meant it had to do a lot more
cleanup on error paths than is otherwise needed.  This commit reorders the
work to avoid this extra cleanup.

bridge_ofproto_port_del() is no longer used after the refactoring so this
commit deletes it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Make reconfiguration update port configuration again.
Ben Pfaff [Tue, 24 Apr 2012 23:47:27 +0000 (16:47 -0700)]
vswitchd: Make reconfiguration update port configuration again.

Commit bae7208e91a0 (bridge: Refactor bridge_reconfigure().) introduced
a regression in bridge reconfiguration.  Previously, reconfiguration would
update the configuration of each bridge port, so that if the controller
(or the admin) changed a port's options, then that change would propagate
to the datapath.  Following that commit, that no longer happened.

This commit restores that feature.

Bug #10972.
Reported-by: Michael Hu <mhu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Make iface_create() return an indication of success.
Ben Pfaff [Tue, 24 Apr 2012 23:39:50 +0000 (16:39 -0700)]
vswitchd: Make iface_create() return an indication of success.

This is the minimal change that gets the job done.  There are much nicer
ways to do this, but I'll leave that refactoring for later in the series.

The return value will have its first user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Factor code to configure netdevs out of iface_create().
Ben Pfaff [Tue, 24 Apr 2012 23:28:18 +0000 (16:28 -0700)]
vswitchd: Factor code to configure netdevs out of iface_create().

An upcoming patch will need the same code in another function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Refactor iface_refresh_type() into iface_get_type().
Ben Pfaff [Tue, 24 Apr 2012 22:59:42 +0000 (15:59 -0700)]
vswitchd: Refactor iface_refresh_type() into iface_get_type().

The calculation that this function does will need to be used in a
context where no "struct iface" is available in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Drop 'need_refresh' member from struct iface.
Ben Pfaff [Tue, 24 Apr 2012 22:43:11 +0000 (15:43 -0700)]
vswitchd: Drop 'need_refresh' member from struct iface.

It's no longer useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Push ofproto_port declaration down to inner blocks.
Ben Pfaff [Tue, 24 Apr 2012 21:56:53 +0000 (14:56 -0700)]
vswitchd: Push ofproto_port declaration down to inner blocks.

Just a tiny code cleanup.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Report actual port number, not -1, in "added interface" message.
Ben Pfaff [Tue, 24 Apr 2012 17:44:54 +0000 (10:44 -0700)]
vswitchd: Report actual port number, not -1, in "added interface" message.

CC: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agobridge: Refactor bridge_reconfigure().
Ethan Jackson [Sat, 21 Apr 2012 02:11:35 +0000 (19:11 -0700)]
bridge: Refactor bridge_reconfigure().

The existing bridge_reconfigure() implementation is suboptimal.
When adding lots of new ports, on every pass through the run loop
it allocates a bunch of "struct iface"s and "struct port"s, only to
destroy them when out of time.  Additionally, when there are errors
adding or deleting ports, it can fail to converge.  Instead it will
attempt and fail to add the same set of ports forever.

This patch rewrites bridge_reconfigure() using a new strategy.
Whenever the database changes, some initial bookkeeping is done,
and a list of future work is compiled.  The bridge begins whittling
down this list, and stops processing database changes until
finished.

Bug #10902.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agovswitchd: Remove unused 'tag' from 'struct iface'.
Ethan Jackson [Fri, 20 Apr 2012 19:57:29 +0000 (12:57 -0700)]
vswitchd: Remove unused 'tag' from 'struct iface'.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoofproto: Fix use-after-free error when ports disappear.
Ben Pfaff [Mon, 23 Apr 2012 16:16:18 +0000 (09:16 -0700)]
ofproto: Fix use-after-free error when ports disappear.

update_port() can delete the port for which it is called, if the underlying
network device has been destroyed, so HMAP_FOR_EACH is unsafe in
ofproto_run().

Less obviously, update_port() can delete unrelated ports.  For example,
suppose that initially device A is port 1 and device B is port 2.  If
update_port("A") runs just after this, then it will ofport_remove() both
ports, then ofport_install() A as the new port 2.

So this commit first assembles a list of ports to update, then updates them
in a separate loop.

Without this commit, running "ovs-dpctl del-dp" while ovs-vswitchd is
running consistently causes a crash for me within a few seconds.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agovswitchd: Make "cfm_fault_status" column ephemeral.
Ben Pfaff [Fri, 20 Apr 2012 18:03:14 +0000 (11:03 -0700)]
vswitchd: Make "cfm_fault_status" column ephemeral.

There's no need to log this to the on-disk database.

Spotted while examining "ovsdb-tool show-log" output.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agostream: By default disable probing on unix sockets.
Ethan Jackson [Thu, 12 Apr 2012 03:18:34 +0000 (20:18 -0700)]
stream: By default disable probing on unix sockets.

There isn't a lot of value in sending inactivity probes on unix
sockets.  This patch changes the default to disable them.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agopython: Honor zero probe interval in reconnect.py
Ethan Jackson [Thu, 12 Apr 2012 03:42:01 +0000 (20:42 -0700)]
python: Honor zero probe interval in reconnect.py

The python reconnect library attempted to send a probe every 0
milliseconds instead of disabling probing when the probe_interval
was zero.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agolearn: Make it possible to parse "load" actions wider than 64 bits.
Ben Pfaff [Sat, 14 Apr 2012 04:49:12 +0000 (21:49 -0700)]
learn: Make it possible to parse "load" actions wider than 64 bits.

The implementation of the "learn" action now properly implements
specifications such as 0x20010db885a308d313198a2e03707348->NXM_NX_IPV6_DST
but the parser used in ovs-ofctl and elsewhere could not generate such
specifications.  This commit adds that support.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolearn: Fix bugs when learn actions use subfields wider than 64 bits.
Ben Pfaff [Thu, 12 Apr 2012 00:08:13 +0000 (17:08 -0700)]
learn: Fix bugs when learn actions use subfields wider than 64 bits.

Bug #10576.
Reported-by: James Schmidt <jschmidt@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agometa-flow: New functions for reading and writing generalized subfields.
Ben Pfaff [Wed, 11 Apr 2012 21:45:34 +0000 (14:45 -0700)]
meta-flow: New functions for reading and writing generalized subfields.

The existing functions for reading and writing the values of subfields only
handle subfields up to 64 bits wide.  These new functions handle subfields
of any width.

Also update some existing comments.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoutil: New function bitwise_is_all_zeros().
Ben Pfaff [Sat, 14 Apr 2012 04:12:37 +0000 (21:12 -0700)]
util: New function bitwise_is_all_zeros().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoutil: New function bitwise_one().
Ben Pfaff [Wed, 11 Apr 2012 19:07:51 +0000 (12:07 -0700)]
util: New function bitwise_one().

It's the obvious counterpart to bitwise_zero().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agobridge: Rate limit port creations and deletions.
Ethan Jackson [Sat, 7 Apr 2012 01:38:48 +0000 (18:38 -0700)]
bridge: Rate limit port creations and deletions.

In some datapaths, adding or deleting OpenFlow ports can take quite
a bit of time.  If there are lots of OpenFlow ports which needed to
be added in a run loop, this can cause Open vSwitch to lock up and
stop setting up flows while trying to catch up.  This patch lessons
the severity of the problem by only doing a few OpenFlow port adds
or deletions per run loop allowing other work to be done in
between.

Bug #10672.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agobridge: Rate limit default address warnings.
Ethan Jackson [Wed, 11 Apr 2012 01:35:04 +0000 (18:35 -0700)]
bridge: Rate limit default address warnings.

This information is typically not more useful if displayed more
often.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agovswitchd: Remove port from datapath if it becomes non-operational
Ansis Atteka [Sat, 7 Apr 2012 00:52:56 +0000 (17:52 -0700)]
vswitchd: Remove port from datapath if it becomes non-operational

If kernel module rejects config changes then vswitchd sets the ofport
column to -1, but does not remove the non-operational port from the
datapath. This patch fixes this problem.

ovs-vsctl add-br ovsbr
ovs-vsctl add-port ovsbr p1
ovs-vsctl add-port ovsbr p2
ovs-vsctl set Interface p1 options:remote_ip=2.1.1.1 options:key=123 type=gre
ovs-vsctl set Interface p2 options:remote_ip=1.1.1.1 options:key=123 type=gre
ovs-vsctl set Interface p2 options:remote_ip=2.1.1.1 options:key=123 type=gre
ovs-dpctl show #observe that p2 does not appear here anymore

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
12 years agodatapath: Do not send notification if ovs_vport_set_options() failed
Ansis Atteka [Sat, 7 Apr 2012 00:35:12 +0000 (17:35 -0700)]
datapath: Do not send notification if ovs_vport_set_options() failed

There is no need to send a notification if ovs_vport_set_options() failed
and ovs_vport_cmd_set() did not change anything.

Issue#10285

Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
12 years agoovsdb-idl: Fix memory leak writing synthetic rows in ovsdb_idl_txn_write().
Ben Pfaff [Wed, 28 Mar 2012 21:02:57 +0000 (14:02 -0700)]
ovsdb-idl: Fix memory leak writing synthetic rows in ovsdb_idl_txn_write().

This could cause a slow but steady memory leak in ovs-vswitchd.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agopacket: Add additional TCP flags extraction on IPv6.
Jesse Gross [Mon, 26 Mar 2012 19:56:14 +0000 (12:56 -0700)]
packet: Add additional TCP flags extraction on IPv6.

Commit 11460e2316b88f0bd0ea0005d94338d800ea16bd
(flow: Enable retrieval of TCP flags from IPv6 traffic.) updated
one of the TCP flags extraction functions in userspace but missed
the other.  This updates that function and converts the other to
use it to reduce duplication.

Bug #10194

Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agovswitchd: Do not refresh existing iface on new device addition.
Pravin B Shelar [Sat, 24 Mar 2012 00:39:19 +0000 (17:39 -0700)]
vswitchd: Do not refresh existing iface on new device addition.

There is no need to refresh status and stats for existing devices
if iface mtu is missing in ovs-db as missing MTU could just mean
error in last MTU read for that device.
So we can refresh stats for devices which are just created.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agoflow: Enable retrieval of TCP flags from IPv6 traffic.
Jesse Gross [Fri, 23 Mar 2012 20:25:31 +0000 (13:25 -0700)]
flow: Enable retrieval of TCP flags from IPv6 traffic.

We currently check that a packet is IPv4 and TCP before fetching the
TCP flags.  This enables fetching from IPv6 packets as well.

Bug #10194

Reported-by: Michael Mao <mmao@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
12 years agoflow: Add length check when retrieving TCP flags.
Jesse Gross [Fri, 23 Mar 2012 20:14:51 +0000 (13:14 -0700)]
flow: Add length check when retrieving TCP flags.

When collecting TCP flags we check that the IP header indicates that
a TCP header is present but not that the packet is actually long
enough to contain the header.  This adds a check to prevent reading
off the end of the packet.

In practice, this is only likely to result in reading of bad data and
not a crash due to the presence of struct skb_shared_info at the end
of the packet.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
12 years agounixctl: Fix bad log message on error path.
Ben Pfaff [Fri, 23 Mar 2012 20:42:12 +0000 (13:42 -0700)]
unixctl: Fix bad log message on error path.

'path' is usually not the right path (often it's NULL).

Introduced in commit bde9f75de (unixctl: New JSON RPC back-end.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Optimize internal device MTU update.
Pravin B Shelar [Fri, 23 Mar 2012 20:31:11 +0000 (13:31 -0700)]
ofproto: Optimize internal device MTU update.

Internal device mtu does not influence mtu of other internal devices.
So skip MTU update to other devices when internal device mtu is
changed.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agoovsdb-idlc: Fix memory leak in "optional bool" columns.
Ben Pfaff [Thu, 22 Mar 2012 20:24:23 +0000 (13:24 -0700)]
ovsdb-idlc: Fix memory leak in "optional bool" columns.

Commit 1bf2c9096858 (idl: Generalize special case boolean exception.)
changed the IDL to do dynamic allocation with (x)malloc() for optional
booleans, but it didn't add the corresponding calls to free().  This
commit fixes the problem.

Bug #10357.
Reported-by: Paul Ingram <paul@nicira.com>
Reported-by: Krishna Miriyala <krishna@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Fix log rotation.
Ben Pfaff [Thu, 22 Mar 2012 17:20:44 +0000 (10:20 -0700)]
debian: Fix log rotation.

Commit 24e81092a1 (debian: Bring Debian packaging in-line with new file
locations) introduced an ambiguous "--t" option invoking ovs-appctl, so
ovs-vswitchd and ovsdb-server were not reopening their log files following
log rotation.  This fixes the problem by correct the option name.

Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoxenserver: Recognize XenServer 5.6-SP2 scripts in RPM %post.
Ben Pfaff [Thu, 22 Mar 2012 00:11:14 +0000 (17:11 -0700)]
xenserver: Recognize XenServer 5.6-SP2 scripts in RPM %post.

Somehow we forgot to put the md5sums for 5.6-SP2 so users were getting
scary error messages.

Bug #10210.
Reported-by: Ronald Lee <rlee@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Move PKI directory to FHS-compliant location.
Ben Pfaff [Fri, 2 Mar 2012 00:38:27 +0000 (16:38 -0800)]
debian: Move PKI directory to FHS-compliant location.

The PKI directory is mutable state, so it should be in /var, not in /usr.
This commit changes its location and, on systems upgraded from earlier
versions, moves the existing PKI and leaves behind a symlink.

CC: 661090@bugs.debian.org
Reported-by: Andreas Beckmann <debian@abeckmann.de>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Fix tag caching for learned flows.
Ben Pfaff [Tue, 20 Mar 2012 22:26:57 +0000 (15:26 -0700)]
ofproto-dpif: Fix tag caching for learned flows.

This code in xlate_table_action() is supposed to tag flows in tables that
have special forms so that changes do not require revalidating every flow.
When rule->tag is nonzero, its value can be used, because we know in this
case that rule->cr.wc is the same as table->other_table->wc and that thus
rule->tag caches the return value of the rule_calculate_tag() expression.
When rule->tag is zero (a "catchall" rule) we need to calculate the tag
manually because we have no way to cache it in that case.

I discovered this bug by running an "hping3" between a couple of VMs plus
the following commands on OVS in the middle:

    ovs-ofctl del-flows br0
    ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, \
              idle_timeout=600, NXM_OF_VLAN_TCI[0..11], \
              NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
              output:NXM_OF_IN_PORT[], fin_idle_timeout=10), resubmit(,1)"
    ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood"

Without this patch, flows don't get properly invalidated upon initial MAC
learning, so one sees warnings like the following:

    in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),
    eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,
    ttl=64,frag=no),tcp(src=13966,dst=0): inconsistency in subfacet
    (actions were: 3,0,1) (correct actions: 1)

This patch fixes the problem and thus avoids these warnings.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Avoid segfault deleting facets that execute LEARN actions.
Ben Pfaff [Wed, 21 Mar 2012 16:01:02 +0000 (09:01 -0700)]
ofproto-dpif: Avoid segfault deleting facets that execute LEARN actions.

"ovs-ofctl del-flows <bridge>" can result in the following call path:

  delete_flows_loose() in ofproto.c
    -> collect_rules_loose() -- uses 'ofproto_node' inside 'struct rule'
    -> rule_destruct() in ofproto-dpif.c
      -> facet_revalidate()
        -> facet_remove()
          -> facet_flush_stats()
            -> facet_account()
              -> xlate_actions()
                -> xlate_learn_action()
                  -> ofproto_flow_mod() back in ofproto.c
                    -> modify_flow_strict()
                      -> collect_rules_strict() -- also uses 'ofproto_node'

which goes "boom" when we fall back up the call chain because the nested
use of ofproto_node steps on the outer use of ofproto_node.

This commit fixes the problem by refusing to translate "learn" actions
within facet_flush_stats(), breaking the doubled use.

Another possible approach would be to switch to another way to keep track
of rules in the flow_mod implementations, so that there'd be no fighting
over 'ofproto_node'.  But then "ovs-ofctl del-flows" might still leave some
flows around (ones created by "learn" actions as flows are accounted as
facets get deleted), which would be surprising behavior.  And it seems in
general a bad idea to allow recursive flow_mods; the consequences have not
been carefully thought through.

Before this commit, one can reproduce the problem by running an "hping3"
between a couple of VMs plus the following commands on OVS in the middle.
Sometimes you have to run them a few times:

    ovs-ofctl del-flows br0
    ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, \
              idle_timeout=600, NXM_OF_VLAN_TCI[0..11], \
              NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
              output:NXM_OF_IN_PORT[], fin_idle_timeout=10), resubmit(,1)"
    ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood"

This commit has a side effect that leftover unaccounted packets no longer
update the timeouts in MAC learning actions in some cases, when the facets
that cause updates are deleted.  At most one second of updates should  be
lost.

Bug #10184.
Reported-by: Michael Mao <mmao@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agohmap: New function hmap_contains().
Ben Pfaff [Tue, 20 Mar 2012 22:00:46 +0000 (15:00 -0700)]
hmap: New function hmap_contains().

This is useful in a situation where one knows that an hmap_node is in some
hmap, but it's not certain which one, and one needs to know whether it is
in a particular one.  This is not a very common case; I don't see any
potential users in the current tree, although an upcoming commit will add
one.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Fix return type of rule_calculate_tag().
Ben Pfaff [Wed, 21 Mar 2012 16:03:46 +0000 (09:03 -0700)]
ofproto-dpif: Fix return type of rule_calculate_tag().

tag_type is currently uint32_t but using uint32_t directly is conceptually
wrong.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agolearn: Initialize cookie_mask in constructed flow_mod.
Ben Pfaff [Tue, 20 Mar 2012 18:32:08 +0000 (11:32 -0700)]
learn: Initialize cookie_mask in constructed flow_mod.

Otherwise the "learn" action may not correctly set the cookie in flows that
it creates.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-vsctl: Allow "fake bridges" to be created for VLAN 0.
Ben Pfaff [Fri, 16 Mar 2012 20:12:54 +0000 (13:12 -0700)]
ovs-vsctl: Allow "fake bridges" to be created for VLAN 0.

A fake bridge for VLAN 0 is useful, because it provides a way to create
access ports for VLAN 0.  There is no good reason to prevent it.

NIC-464.
Reported-by: Rob Hoes <Rob.Hoes@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev-linux: Fix use-after-free when netdev_dump_queues() deletes queues.
Ben Pfaff [Mon, 19 Mar 2012 20:47:50 +0000 (13:47 -0700)]
netdev-linux: Fix use-after-free when netdev_dump_queues() deletes queues.

iface_configure_qos() passes a callback to netdev_dump_queues() that can
delete queues.  The netdev-linux implementation of this function was
unprepared for the callback to delete queues, so this could cause a
use-after-free.  This fixes the problem in netdev_linux_dump_queues() and
documents that netdev_dump_queues() implementations must support deletions
in the callback.

Found by valgrind:

==1593== Invalid read of size 8
==1593==    at 0x4A8C43: netdev_linux_dump_queues (hmap.h:326)
==1593==    by 0x4305F7: bridge_reconfigure (bridge.c:3084)
==1593==    by 0x431384: bridge_run (bridge.c:1892)
==1593==    by 0x432749: main (ovs-vswitchd.c:96)
==1593==  Address 0x632e078 is 8 bytes inside a block of size 32 free'd
==1593==    at 0x4C240FD: free (vg_replace_malloc.c:366)
==1593==    by 0x4A4D74: hfsc_class_delete (netdev-linux.c:3250)
==1593==    by 0x42AA59: iface_delete_queues (bridge.c:3055)
==1593==    by 0x4A8C8C: netdev_linux_dump_queues (netdev-linux.c:1881)
==1593==    by 0x4305F7: bridge_reconfigure (bridge.c:3084)
==1593==    by 0x431384: bridge_run (bridge.c:1892)

Bug #10164.
Reported-by: Ram Jothikumar <ram@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agopython: Fix "make distcheck" error on version.py.
Ben Pfaff [Mon, 12 Mar 2012 17:34:22 +0000 (10:34 -0700)]
python: Fix "make distcheck" error on version.py.

The generated version.py has to go in the srcdir and has to be regenerated
based on config.status, which breaks "make distcheck" because it
write-protects the srcdir.  However, the contents of version.py only change
when the version number changes, so we can just "touch" it when it doesn't
really need to change.

The same pattern is used elsewhere in the tree for other files in the same
situation, e.g. the various RPM spec files.

Reported-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Use a different way to avoid failing install without kernel module.
Ben Pfaff [Fri, 16 Mar 2012 21:18:05 +0000 (14:18 -0700)]
debian: Use a different way to avoid failing install without kernel module.

The dh_installinit --error-handler option makes a lot of sense, but after
playing with it for a while I could not figure out a nice way to use it
only for openvswitch-switch without either duplicating the dh_installinit
fragments in postinst and prerm (the actual bug that was reported) or
omitting them for some package.

Also, we forgot to write the error handler function for the prerm.

This commit switches to a different way to avoid failing the install when
the kernel module is not available, without using --error-handler.

CC: 663051@bugs.debian.org
Reported-by: Thomas Goirand <zigo@debian.org>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovsdb-doc: Use minus sign in negative numbers in nroff output.
Ben Pfaff [Fri, 9 Mar 2012 23:10:56 +0000 (15:10 -0800)]
ovsdb-doc: Use minus sign in negative numbers in nroff output.

ovs-vswitchd.conf.db.5 has autogenerated text "at least -1" in one place.
This '-' should be a minus sign, but ovsdb-doc was generating it as a
hyphen.

Found by lintian.

Reported-by: Thomas Goirand <zigo@debian.org>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovsdb-doc: Convert '-' preceding a number as a minus sign, not a hyphen.
Ben Pfaff [Fri, 9 Mar 2012 22:50:39 +0000 (14:50 -0800)]
ovsdb-doc: Convert '-' preceding a number as a minus sign, not a hyphen.

ovs-vswitchd.conf.db.5 contains the following sentence:

   If the interface cannot be added then Open vSwitch sets this column
   to -1.

The '-' in "-1" should be a minus sign, not a hyphen, but the heuristic
in ovsdb-doc wasn't smart enough.  This commit improves the heuristic and
fixes the problem.

Found by lintian.

Reported-by: Thomas Goirand <zigo@debian.org>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovsdb-doc: Put NAME section into generated manpage.
Ben Pfaff [Fri, 9 Mar 2012 22:37:31 +0000 (14:37 -0800)]
ovsdb-doc: Put NAME section into generated manpage.

This makes the manpage indexable by standard system tools.

Found by lintian.

Reported-by: Thomas Goirand <zigo@debian.org>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Avoid unit test failure when doing "unofficial" builds.
Ben Pfaff [Fri, 9 Mar 2012 22:20:54 +0000 (14:20 -0800)]
debian: Avoid unit test failure when doing "unofficial" builds.

The configure option --with-build-number=0 is interpreted differently in
different places.  The configure script itself accepts 0 as an actual
build number and puts '#define BUILDNR "+build0"' into config.h.  The
code in python/automake.mk treats 0 as "no build number" and puts
'BUILDNR = ""' into version.py.

This commit avoids the problem by not passing 0 as a build number.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodoc: Fix typo in manpage.
Thomas Goirand [Fri, 9 Mar 2012 22:44:41 +0000 (14:44 -0800)]
doc: Fix typo in manpage.

Found by lintian.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Bump standards-version to 3.9.3.
Thomas Goirand [Fri, 9 Mar 2012 21:53:12 +0000 (13:53 -0800)]
debian: Bump standards-version to 3.9.3.

No other changes necessary.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Remove some useless files from the dkms pacakge.
Thomas Goirand [Fri, 9 Mar 2012 21:49:36 +0000 (13:49 -0800)]
debian: Remove some useless files from the dkms pacakge.

This commit removes useless files from the dkms package that caused
lintian warnings.

(Many of the other files in the dkms package are also useless but do not
cause lintian warnings so they are less important.)

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Clean .pyc files in "clean" target.
Thomas Goirand [Fri, 9 Mar 2012 21:46:18 +0000 (13:46 -0800)]
debian: Clean .pyc files in "clean" target.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Remove po-debconf build dependency.
Thomas Goirand [Fri, 9 Mar 2012 21:45:02 +0000 (13:45 -0800)]
debian: Remove po-debconf build dependency.

Open vSwitch no longer uses Debconf at all, for some time now.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Build-depend on python-all to pull in all Python versions.
Thomas Goirand [Fri, 9 Mar 2012 21:44:10 +0000 (13:44 -0800)]
debian: Build-depend on python-all to pull in all Python versions.

Open vSwitch should support all Python versions in the distribution.  This
is the way to do it.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Add missing ${python:Depends} to openvswitch-test package.
Thomas Goirand [Fri, 9 Mar 2012 21:41:59 +0000 (13:41 -0800)]
debian: Add missing ${python:Depends} to openvswitch-test package.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Improve long descriptions so as to better describe the packages.
Thomas Goirand [Fri, 9 Mar 2012 21:39:59 +0000 (13:39 -0800)]
debian: Improve long descriptions so as to better describe the packages.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Bump debhelper compat level to 8 and make build-depends consistent.
Thomas Goirand [Fri, 9 Mar 2012 21:30:26 +0000 (13:30 -0800)]
debian: Bump debhelper compat level to 8 and make build-depends consistent.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thomas Goirand <zigo@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetlink-socket: Increase Netlink socket receive buffer size.
Ben Pfaff [Fri, 16 Mar 2012 04:15:38 +0000 (21:15 -0700)]
netlink-socket: Increase Netlink socket receive buffer size.

Open vSwitch userspace can set up flows at a high rate, but it is somewhat
"bursty" in opportunities to set up flows, by which I mean that OVS sets up
a batch of flows, then goes off and does some other work for a while, then
sets up another batch of flows, and so on.  The result is that, if a large
number of packets that need flow setups come in all at once, then some of
them can overflow the relatively small kernel-to-user buffers.

This commit increases the kernel-to-user buffers from the default of
approximately 120 kB each to 1 MB each.  In one somewhat synthetic test
case that I ran based on an "hping3" that generated a load of about 20,000
new flows per second (including both requests and replies), this reduced
the packets dropped at the kernel-to-user interface from about 30% to none.
I expect that it will similarly improve packet loss in workloads where
flow arrival is not easily predictable.

(This has little effect on workloads generated by "ovs-benchmark rate"
because that benchmark is effectively "self-clocking", that is, a new flow
is triggered only by a reply to a request made earlier, which means that
the number of buffered packets at any given has a known, constant upper
limit.)

Bug #10210.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agometa-flow: Don't dereference NULL sf->field in mf_format_subfield().
Ben Pfaff [Thu, 15 Mar 2012 21:06:54 +0000 (14:06 -0700)]
meta-flow: Don't dereference NULL sf->field in mf_format_subfield().

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agofail-open: Use connmgr_send_packet_in() instead of connmgr_broadcast().
Ben Pfaff [Mon, 12 Mar 2012 21:27:25 +0000 (14:27 -0700)]
fail-open: Use connmgr_send_packet_in() instead of connmgr_broadcast().

Otherwise even controllers that should not receive any packet-ins (via
enable-async-messages=false) still receive the packet-ins that probe for
a controller being up when we're in fail-open.

Bug #9964.
Reported-by: James Schmidt <jschmidt@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: connmgr_send_packet_in() doesn't need buffer_id and total_len.
Ben Pfaff [Mon, 12 Mar 2012 21:35:35 +0000 (14:35 -0700)]
ofproto: connmgr_send_packet_in() doesn't need buffer_id and total_len.

Trying to add a new caller for connmgr_send_packet_in(), I wasn't sure
what to put in these members.  Investigating, I saw that the function
didn't really need them, so this commit clears that up.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoconnmgr: Drop 'flow' parameter from connmgr_send_packet_in().
Ben Pfaff [Mon, 12 Mar 2012 21:09:37 +0000 (14:09 -0700)]
connmgr: Drop 'flow' parameter from connmgr_send_packet_in().

Only 'flow->in_port' was used, which was redundant with pin->fmd.in_port.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Skip "strings at least 2 characters long" test for narrow Python.
Ben Pfaff [Mon, 12 Mar 2012 21:46:56 +0000 (14:46 -0700)]
tests: Skip "strings at least 2 characters long" test for narrow Python.

Narrow Python can't handle Unicode characters outside the BMP, so skip the
test.

Reported-by: Michael Shigorin <mike@osdn.org.ua>
Tested-by: Michael Shigorin <mike@osdn.org.ua>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto: Fix code that keeps track of MTU.
Ben Pfaff [Mon, 12 Mar 2012 19:59:47 +0000 (12:59 -0700)]
ofproto: Fix code that keeps track of MTU.

ofport_install() should set the MTU that it finds into the ofport
before calling set_internal_devs_mtu(), because the latter function might
change the MTU and update ofport->mtu and the caller should not incorrectly
overwrite its changes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev-linux: Cache error code from do_get_ifindex().
Pravin B Shelar [Fri, 9 Mar 2012 21:53:57 +0000 (13:53 -0800)]
netdev-linux: Cache error code from do_get_ifindex().

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agonetdev-linux: Cache error code from get-features.
Pravin B Shelar [Fri, 9 Mar 2012 21:53:11 +0000 (13:53 -0800)]
netdev-linux: Cache error code from get-features.

Following patch adds support for caching error code from ETHTOOL_GSET
call. Since internal device is virtual device device feature does not
make much sense, so netdev_get_features op is removed for internal
devices.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agonetdev-linux: Cache error code from set-policing.
Pravin B Shelar [Fri, 9 Mar 2012 21:33:17 +0000 (13:33 -0800)]
netdev-linux: Cache error code from set-policing.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agonetdev-linux: Cache error code from ether-addr ioctl.
Pravin B Shelar [Fri, 9 Mar 2012 21:32:50 +0000 (13:32 -0800)]
netdev-linux: Cache error code from ether-addr ioctl.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agonetdev-linux: Cache error code from mtu ioctl.
Pravin B Shelar [Fri, 9 Mar 2012 21:32:10 +0000 (13:32 -0800)]
netdev-linux: Cache error code from mtu ioctl.

netdev linux devices uses mtu ioctl to get and set MTU for a device.
By caching error code from ioctl we can reduce number of ioctl calls
for device which is unregistered from system.
netdev notification is used to update mtu which saves get-mtu-ioctl.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agonetdev-linux: Cache drv-info for net device.
Pravin B Shelar [Fri, 9 Mar 2012 21:31:38 +0000 (13:31 -0800)]
netdev-linux: Cache drv-info for net device.

Netdev-linux calls ETHTOOL_GDRVINFO on every netdev_linux_get_status()
which is not optimal as drv-info does not change for given device.
So following patch changes netdev_linux_get_status() to read drv-info at
device initialization and cache it.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agoovs-monitor-ipsec: Detect correctly IPSEC configuration changes
Ansis Atteka [Fri, 9 Mar 2012 02:58:09 +0000 (18:58 -0800)]
ovs-monitor-ipsec: Detect correctly IPSEC configuration changes

If Open vSwitch has IPSEC tunnel (with certificates) and Interface
table was updated, then ovs-monitor-ipsec daemon would incorrectly
remove and readd all existing IPSEC tunnels.

The root cause for this issue was that "peer_cert_file" key was present in
interfaces dictionary, but it was missing in new_interfaces dictionary.

v2: Do not fail buildtests

Issue#10096

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
Reported-by: Niklas Andersson <nandersson@nicira.com>
12 years agonetdev-linux: Use "read", not "recv", for tap devices.
Ben Pfaff [Thu, 8 Mar 2012 22:27:35 +0000 (14:27 -0800)]
netdev-linux: Use "read", not "recv", for tap devices.

"recv" only works for sockets, but tap devices aren't sockets.

Makes the userspace switch work again.

Reported-by: Ravi Kerur <Ravi.Kerur@telekom.com>
Reported-by: 胡靖飞 <hujingfei914@msn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agotests: Suppress "role reply" that can appear in async message test.
Ben Pfaff [Thu, 8 Mar 2012 00:38:28 +0000 (16:38 -0800)]
tests: Suppress "role reply" that can appear in async message test.

Another race condition in this test, *sigh*.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-xapi-sync: Rerun processing when a db update arrives during a commit.
Ben Pfaff [Thu, 8 Mar 2012 18:49:47 +0000 (10:49 -0800)]
ovs-xapi-sync: Rerun processing when a db update arrives during a commit.

The logic in ovs-xapi-sync didn't handle the case where ovsdb-server sends
a database update before it replies to a transaction that ovs-xapi-sync
sent, like this:

ovs-xapi-sync              ovsdb-server
-------------              ------------

                      .
                      .
                      .
transaction request  --->
                     <---  database contents update
                     <---  transaction reply
                      .
                      .
                      .

The update was not lost but ovs-xapi-sync would not process it until the
database changed again.

Bug #10082.
Reported-by: Krishna Miriyala <krishna@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agounixctl: Re-enable unit tests.
Ethan Jackson [Tue, 6 Mar 2012 21:20:06 +0000 (13:20 -0800)]
unixctl: Re-enable unit tests.

The transient failure in the unixctl unit tests likely still
exists, but we've added additional instrumentation to our build
tools to help us debug it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoofproto-dpif: Log traces when resubmit depth is exceeded.
Ethan Jackson [Wed, 7 Mar 2012 00:51:44 +0000 (16:51 -0800)]
ofproto-dpif: Log traces when resubmit depth is exceeded.

It can be very difficult to debug xlate_actions() failures due to
excessive resubmit recursion.  In an attempt to make it easier,
this patch adds a (severely rate-limited) full ofproto/trace to the
logs.

Suggested-by: Alan Shieh <ashieh@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agounixctl: New JSON RPC back-end.
Ethan Jackson [Wed, 15 Feb 2012 04:53:59 +0000 (20:53 -0800)]
unixctl: New JSON RPC back-end.

The unixctl library had used the vde2 management protocol since the
early days of Open vSwitch.  As Open vSwitch has matured, several
Python daemons have been added to the code base which would benefit
from a unixctl implementations.  Instead of implementing the old
unixctl protocol in Python, this patch changes unixctl to use JSON
RPC for which we already have an implementation in both Python and
C.  Future patches will need to implement a unixctl library in
Python on top of JSON RPC.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agojsonrpc: Don't swallow errors in jsonrpc_transact_block().
Ethan Jackson [Thu, 16 Feb 2012 03:38:27 +0000 (19:38 -0800)]
jsonrpc: Don't swallow errors in jsonrpc_transact_block().

If a server returned an error in response to a request,
jsonrpc_transact_block() would ignore it.  This patch changes the
behavior and updates its callers to gracefully handle the
possibility.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agobond: Incorrectly reported an error in appctl.
Ethan Jackson [Tue, 21 Feb 2012 05:57:20 +0000 (21:57 -0800)]
bond: Incorrectly reported an error in appctl.

The bond/enable-slave and bond/disable-slave ovs-appctl commands
incorrectly reported the 501 error code upon success.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agosocket-util: Unlink Unix domain sockets that bind but fail to connect.
Ben Pfaff [Mon, 27 Feb 2012 18:58:45 +0000 (10:58 -0800)]
socket-util: Unlink Unix domain sockets that bind but fail to connect.

The error handling path here failed to clean up bound sockets, by removing
them.  This fixes the problem.

It was easy to observe this bug by running "ovs-vsctl" without
"ovsdb-server" running.

Bug #9811.
Bug #9769.
Reported-by: Michael <mhu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ofctl: Make "barrier" output reproducible for testing.
Ben Pfaff [Wed, 7 Mar 2012 22:46:14 +0000 (14:46 -0800)]
ovs-ofctl: Make "barrier" output reproducible for testing.

The "ofproto - asynchronous message control" test had a race in which
the "send: OFPT_BARRIER_REQUEST" message could get printed in different
places because there was nothing to ensure that messages from the switch
were printed before messages sent to the switch, even though the actual
ordering of the messages was predictable.  This fixes the problem by not
printing a message at all when the barrier request is sent.

Bug #10049.
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Fix checksum update for actions on UDP packets.
Jesse Gross [Tue, 6 Mar 2012 21:09:13 +0000 (13:09 -0800)]
datapath: Fix checksum update for actions on UDP packets.

When modifying IP addresses or ports on a UDP packet we don't
correctly follow the rules for unchecksummed packets.  This meant
that packets without a checksum can be given a incorrect new checksum
and packets with a checksum can become marked as being unchecksummed.
This fixes it to handle those requirements.

Bug #8937

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Honor dp_ifindex, when specified, for vport lookup by name.
Ben Pfaff [Wed, 7 Mar 2012 22:11:09 +0000 (14:11 -0800)]
datapath: Honor dp_ifindex, when specified, for vport lookup by name.

When OVS_VPORT_ATTR_NAME is specified and dp_ifindex is nonzero, the
logical behavior would be for the vport name lookup scope to be limited
to the specified datapath, but in fact the dp_ifindex value was ignored.
This commit causes the search scope to be honored.

Bug #9889.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoovs-ofctl: Avoid segfault upon receive error for "monitor", "snoop".
Ben Pfaff [Wed, 7 Mar 2012 21:52:55 +0000 (13:52 -0800)]
ovs-ofctl: Avoid segfault upon receive error for "monitor", "snoop".

Bug #10062.
Reported-by: James Schmidt <jschmidt@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoxenserver: Add vm-id to the external_ids.
Gurucharan Shetty [Mon, 5 Mar 2012 18:20:00 +0000 (10:20 -0800)]
xenserver: Add vm-id to the external_ids.

The vm-id external id in the interface table will uniquely identify a VM
that is connected to a bridge through that interface.

In xenserver, this will have the same value as the external id - xs-vm-uuid
and can be overridden by setting the nicira-vm-id key in the other_config
field of VM record of XAPI.

Bug #10020.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
12 years agonetdev-linux: Make netdev_set_policing coverage counter consistent with other counters.
Pravin B Shelar [Mon, 5 Mar 2012 23:44:30 +0000 (15:44 -0800)]
netdev-linux: Make netdev_set_policing coverage counter consistent with other counters.

Most of coverage counters in netdev-linux are counting actual system
calls rather than reads from cached data.
Following patch fixes it by incrementing it after cache check.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agovswitchd: Document behavior of 802.1p priorities with VLAN splinters.
Ben Pfaff [Mon, 5 Mar 2012 17:52:36 +0000 (09:52 -0800)]
vswitchd: Document behavior of 802.1p priorities with VLAN splinters.

Reported-by: likunyun <kunyunli@hotmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agobridge: Remove unwanted ports at time of ofproto creation.
Ben Pfaff [Fri, 2 Mar 2012 21:26:35 +0000 (13:26 -0800)]
bridge: Remove unwanted ports at time of ofproto creation.

The reconfiguration code only deleted unwanted ports for bridges that had
been created in previous (re)configurations.  In fact, we should run this
step even for bridges that are newly added, e.g. to delete ports that
were added by a previous run of ovs-vswitchd and deleted from the database
between runs.

Before this commit, the following left "int" in datapath br0.  After this
commit, "int" is properly deleted:

1. With ovs-vswitchd running:
      # ovs-vsctl add-br br0
      # ovs-vsctl add-port br0 int -- set interface int type=internal
2. Kill ovs-vswitchd, then:
      # ovs-vsctl --no-wait -- del-port br0 int
3. Restart ovs-vswitchd.

Bug #9957.
Reported-by: Hiroshi Tanaka <htanaka@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agounixctl: Skip Python unixctl tests.
Ethan Jackson [Sat, 3 Mar 2012 03:05:29 +0000 (19:05 -0800)]
unixctl: Skip Python unixctl tests.

The Python unixctl tests introduced a transient build failure that
can't be debugged until more information is collected.  Skipping
these tests for now until it's possible to debug them.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agoconnmgr: Make "enable-async-messages" work for primary controllers too.
Ben Pfaff [Fri, 2 Mar 2012 22:09:58 +0000 (14:09 -0800)]
connmgr: Make "enable-async-messages" work for primary controllers too.

I only tested this feature with service controllers.

Bug #9964.
Reported-by: James Schmidt <jschmidt@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev: Fix typo in error message.
Ben Pfaff [Fri, 2 Mar 2012 22:18:21 +0000 (14:18 -0800)]
netdev: Fix typo in error message.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agopython: Port unixctl to Python.
Ethan Jackson [Fri, 17 Feb 2012 03:15:01 +0000 (19:15 -0800)]
python: Port unixctl to Python.

Many of the currently implemented Python daemons, and likely many
daemons to be implemented in the future, could benefit from unixctl
support even if only to implement "exit" and "version" commands.
This patch implements unixctl in Python.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agotests: Add code coverage for Python.
Ethan Jackson [Wed, 29 Feb 2012 00:28:08 +0000 (16:28 -0800)]
tests: Add code coverage for Python.

Adds support for Ned Batchelder's code coverage tool to the
test suite. http://nedbatchelder.com/code/coverage/

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agopython: New method to retrieve OVS version at runtime.
Ethan Jackson [Thu, 1 Mar 2012 01:20:03 +0000 (17:20 -0800)]
python: New method to retrieve OVS version at runtime.

Version information is typically fairly useful when debugging Open
vSwitch.  This patch adds a new version.py module which python code
can use to report its version to callers.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agopython: Add ovs_error() helper function to Python.
Ethan Jackson [Thu, 1 Mar 2012 01:20:14 +0000 (17:20 -0800)]
python: Add ovs_error() helper function to Python.

The ovs_error() and ovs_fatal() helper functions are useful enough
to be ported to Python.  A user will be added in a future commit.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agojsonrpc.py: Don't swallow errors in transact_block().
Ethan Jackson [Fri, 17 Feb 2012 04:26:35 +0000 (20:26 -0800)]
jsonrpc.py: Don't swallow errors in transact_block().

If a server returned an error in response to a request,
transact_block() would ignore it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agopython: Implement new SchemaHelper class.
Ethan Jackson [Thu, 1 Mar 2012 02:24:07 +0000 (18:24 -0800)]
python: Implement new SchemaHelper class.

The new SchemaHelper class makes it easier to prune database
schemas intended for the Python IDL.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
12 years agotimeval: Add "time/stop" unixctl command, for use in unit tests.
Ben Pfaff [Tue, 28 Feb 2012 22:57:13 +0000 (14:57 -0800)]
timeval: Add "time/stop" unixctl command, for use in unit tests.

Although we try to avoid it, some unit tests are necessarily
timing-sensitive.  The new "time/stop" command that this commit adds should
help with that, by preventing time from advancing from the viewpoint of
the OVS "timeval" functions except when "time/warp" explicitly advances
the current time.  This should allow the unit tests that need it to become
reproducible regardless of the speed at which the tests run.

This commit adds one use of "time/stop" to the unit test suite, in the one
timing-sensitive test of which I am currently aware.

Bug #9782.
Reported-by: Tim Chen <tchen@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>