openvswitch
13 years agoLog anything that could prevent a daemon from starting.
Ben Pfaff [Thu, 31 Mar 2011 23:23:50 +0000 (16:23 -0700)]
Log anything that could prevent a daemon from starting.

If a daemon doesn't start, we need to know why.  Being able to
consistently consult the log to find out is helpful.

13 years agoutil: New function ovs_fatal_valist().
Ben Pfaff [Thu, 31 Mar 2011 21:50:58 +0000 (14:50 -0700)]
util: New function ovs_fatal_valist().

This commit adds a few initial users but more are coming up.

13 years agosignals: New function signal_name().
Ben Pfaff [Fri, 1 Apr 2011 17:22:51 +0000 (10:22 -0700)]
signals: New function signal_name().

This will acquire a new user in an upcoming commit.

13 years agotype-props: New macro for estimating length of a decimal integer.
Ben Pfaff [Fri, 1 Apr 2011 17:20:17 +0000 (10:20 -0700)]
type-props: New macro for estimating length of a decimal integer.

13 years agoAdd a few more users for ovs_retval_to_string().
Ben Pfaff [Thu, 31 Mar 2011 21:50:20 +0000 (14:50 -0700)]
Add a few more users for ovs_retval_to_string().

13 years agovlog: Use PRINTF_FORMAT macro from compiler.h.
Ben Pfaff [Thu, 31 Mar 2011 21:58:37 +0000 (14:58 -0700)]
vlog: Use PRINTF_FORMAT macro from compiler.h.

PRINTF_FORMAT is more portable than raw __attribute__.  We use it
elsewhere, I don't know why it wasn't used here.

13 years agostream-ssl: Use out_of_memory() to abort due to lack of memory.
Ben Pfaff [Thu, 31 Mar 2011 21:52:36 +0000 (14:52 -0700)]
stream-ssl: Use out_of_memory() to abort due to lack of memory.

This matches what xmalloc() does.  It will be handled better by a monitor
process (created with --monitor), which will restart the child instead of
exiting.

13 years agoxenserver: Fix up iface-id after it changes or disappears too.
Ben Pfaff [Fri, 1 Apr 2011 20:47:51 +0000 (13:47 -0700)]
xenserver: Fix up iface-id after it changes or disappears too.

ovs-xapi-sync is supposed to always keep external-ids:iface-id up to date,
but in fact it would only set it when an interface initially appeared.  If
the interface quickly disappeared and reappeared, then it failed to notice
that iface-id had changed or disappeared.  This happens in practice on
Citrix XenServer, where VM "tap" devices often disappear and then reappear
almost immediately during VM boot.  This commit fixes the problem.

This also fixes the similar problem for external-ids:bridge-id in Bridge
records.  Bridges aren't ordinarily destroyed and re-created quickly, so
this problem might never have manifested in practice for bridges.

Many thanks to Reid Price <reid@nicira.com> for identifying the problem
and supplying an initial fix.

Bug #5239.
Reported-by: Henrik Amren <henrik@nicira.com>
13 years agobridge: Avoid partitioning the dst set.
Ben Pfaff [Thu, 24 Mar 2011 19:46:08 +0000 (12:46 -0700)]
bridge: Avoid partitioning the dst set.

Scanning the dsts twice seems may be a little more efficient than
partitioning it, and it now seems more straightforward to me.

13 years agobridge: Separate mirroring logic from forwarding logic.
Ben Pfaff [Thu, 24 Mar 2011 19:51:14 +0000 (12:51 -0700)]
bridge: Separate mirroring logic from forwarding logic.

In my opinion this is easier to understand than the way that these
two logically separate steps were previously entangled.

13 years agobridge: Change "struct dst" from containing a dp_ifidx to a struct iface *.
Ben Pfaff [Thu, 24 Mar 2011 19:30:51 +0000 (12:30 -0700)]
bridge: Change "struct dst" from containing a dp_ifidx to a struct iface *.

The following commit will need to iterate over a set of "struct
dst"s, obtaining the iface for each.  It could look them up using
the hash table that indexes over dp_ifidx, but it's easier if we
simply store the iface pointer directly.

13 years agobridge: Get rid of 'n_ifaces' member of struct port.
Ben Pfaff [Thu, 24 Mar 2011 17:29:36 +0000 (10:29 -0700)]
bridge: Get rid of 'n_ifaces' member of struct port.

If it doesn't exist then it can't have the wrong value.

13 years agobridge: Break bonding implementation out into library.
Ben Pfaff [Wed, 30 Mar 2011 18:03:16 +0000 (11:03 -0700)]
bridge: Break bonding implementation out into library.

This removes over 1000 lines of code from bridge.c and will make it
easier to moving the bonding implementation into ofproto as part of
future development.

13 years agobridge: Simplify and clean up bond slave enable/disable.
Ben Pfaff [Wed, 23 Mar 2011 17:47:15 +0000 (10:47 -0700)]
bridge: Simplify and clean up bond slave enable/disable.

The code that enables and disables bond slaves was a bit of a mess:

    * Disabling a slave could recursively enable a different slave.

    * Processing a flow could enable a slave.

This commit gets rid of both of those properties, which made it difficult
to reason about the code paths along which slaves would be enabled and
disabled.

Bug #5121.

13 years agobridge: Drop obsolete comment.
Ben Pfaff [Thu, 24 Mar 2011 19:46:26 +0000 (12:46 -0700)]
bridge: Drop obsolete comment.

It's quite clear that we don't support double tagging now.

13 years agobridge: Improve comment.
Ben Pfaff [Thu, 24 Mar 2011 18:11:32 +0000 (11:11 -0700)]
bridge: Improve comment.

13 years agobridge: Change Ethernet address array from 8 bytes to ETH_ADDR_LEN bytes.
Ben Pfaff [Tue, 29 Mar 2011 18:33:10 +0000 (11:33 -0700)]
bridge: Change Ethernet address array from 8 bytes to ETH_ADDR_LEN bytes.

I don't know why this was declared as 8 bytes long but I only see 6
actually in use, as one would expect of an Ethernet address.

13 years agobridge: Avoid redundant dpif_flow_flush().
Ben Pfaff [Tue, 29 Mar 2011 17:16:43 +0000 (10:16 -0700)]
bridge: Avoid redundant dpif_flow_flush().

ofproto_create() also calls dpif_flow_flush() very soon afterward.  This
seems more clearly in ofproto's domain anyhow.

13 years agolacp: Encapsulate configuration into new structs.
Ben Pfaff [Mon, 21 Mar 2011 21:30:33 +0000 (14:30 -0700)]
lacp: Encapsulate configuration into new structs.

This makes it easier to pass configuration between modules.

13 years agobridge: Drop LACP configuration members from struct iface and struct port.
Ben Pfaff [Mon, 21 Mar 2011 19:49:44 +0000 (12:49 -0700)]
bridge: Drop LACP configuration members from struct iface and struct port.

There's no reason that I can see to maintain this information in struct
port and struct iface.  It's redundant, since the lacp implementation
maintains the same information.

13 years agolacp: Remove unneeded forward references from header file.
Ben Pfaff [Mon, 21 Mar 2011 20:15:53 +0000 (13:15 -0700)]
lacp: Remove unneeded forward references from header file.

13 years agolacp: Fix misleading prototype for lacp_configure().
Ben Pfaff [Mon, 21 Mar 2011 20:15:31 +0000 (13:15 -0700)]
lacp: Fix misleading prototype for lacp_configure().

Only the first 6 bytes (ETH_ADDR_LEN) of the 'sys_id' argument are used,
but the prototype declared it as an array of 8 bytes.  This has no effect
on the generated code--the declared size of an array parameter is
irrelevant--but it is misleading.

Also, add 'const' since the array is not modified.

13 years agovswitch: Improve schema documentation.
Ben Pfaff [Tue, 29 Mar 2011 16:30:04 +0000 (09:30 -0700)]
vswitch: Improve schema documentation.

13 years agotag: New function tag_set_union().
Ben Pfaff [Thu, 24 Mar 2011 18:00:39 +0000 (11:00 -0700)]
tag: New function tag_set_union().

13 years agolist: New functions list_is_singleton(), list_is_short().
Ben Pfaff [Thu, 24 Mar 2011 16:40:07 +0000 (09:40 -0700)]
list: New functions list_is_singleton(), list_is_short().

13 years agopackets: Reserve headroom for VLAN header in eth_compose(), snap_compose().
Ben Pfaff [Tue, 29 Mar 2011 16:28:49 +0000 (09:28 -0700)]
packets: Reserve headroom for VLAN header in eth_compose(), snap_compose().

This allows callers to add a VLAN header to the composed packet and send
it out on a VLAN without copying the whole payload.

13 years agopackets: New function eth_set_vlan_tci(), from dpif-netdev.
Ben Pfaff [Tue, 29 Mar 2011 16:27:47 +0000 (09:27 -0700)]
packets: New function eth_set_vlan_tci(), from dpif-netdev.

This will soon be used in the upcoming bond library.

13 years agopackets: Fix potential use-after-free in compose_benign_packet().
Ben Pfaff [Thu, 24 Mar 2011 20:35:15 +0000 (13:35 -0700)]
packets: Fix potential use-after-free in compose_benign_packet().

The second call to ofpbuf_put_zeros() could cause the 'eth' pointer to
be invalidated.

It appears that this does not fix a real bug because the existing callers
all preallocate 128 bytes of tailroom, but the interface doesn't document
that requirement.

13 years agopackets: New function snap_compose(); rename compose_packet() for consistency.
Ben Pfaff [Thu, 24 Mar 2011 20:34:05 +0000 (13:34 -0700)]
packets: New function snap_compose(); rename compose_packet() for consistency.

The following commit will introduce the first use of snap_compose().

13 years agonetdev-vport: Implement 'send' function.
Ben Pfaff [Fri, 1 Apr 2011 17:17:52 +0000 (10:17 -0700)]
netdev-vport: Implement 'send' function.

The new implementation of the bonding code expects to be able to send
packets on netdevs using netdev_send().  This implements it.

13 years agonetdev-linux: Support 'send' for netdevs opened with NETDEV_ETH_TYPE_NONE.
Ben Pfaff [Fri, 1 Apr 2011 16:22:39 +0000 (09:22 -0700)]
netdev-linux: Support 'send' for netdevs opened with NETDEV_ETH_TYPE_NONE.

The new implementation of the bonding code expects to be able to
send packets using netdev_send().  This makes it possible for
Linux netdevs.

13 years agoovsdb-server: Avoid intermittent test failures due to lockfile log message.
Ben Pfaff [Fri, 1 Apr 2011 22:46:22 +0000 (15:46 -0700)]
ovsdb-server: Avoid intermittent test failures due to lockfile log message.

Sometimes lockfile will emit a message saying that it took a little while
to get the lock, which caused spurious test failures.  This commit
suppresses the message.  With this change, I was able to run these tests
continuously for some time without failures.

This was a bug in the testsuite, not in the code under test.

13 years agocfm: Allow time for CCM reception after cfm_configure();
Ethan Jackson [Fri, 1 Apr 2011 20:10:49 +0000 (13:10 -0700)]
cfm: Allow time for CCM reception after cfm_configure();

Before this (and the previous) patch, whenever cfm_configure was
called it would set the fault_timer to expired.  Thus, the next
call to cfm_run would notice a lack of CCM reception and trigger a
faulted status.  This is a bug in and of itself, but normally would
not be a big deal because cfm_configure should only be called
infrequently (when the database changes).  However due to an
unrelated bug, cfm_configure() was getting called approximately once
per second.  This resulted in all monitors showing faults all of
the time.

This patch fixes the problem by not expiring the timer at
cfm_configure().  Instead it gives it the appropriate
fault_interval amount of time to miss heartbeats.

Bug #5244.

13 years agocfm: cfm_configure() only update when necessary.
Ethan Jackson [Fri, 1 Apr 2011 20:22:44 +0000 (13:22 -0700)]
cfm: cfm_configure() only update when necessary.

Calling cfm_configure often could cause timers to be reset
resulting in unexpected behavior.  This commit only updates when
cfm configuration actually changed.

Bug #5244.

13 years agoovsdb: Truncate bad transactions from database log.
Ben Pfaff [Mon, 28 Mar 2011 20:05:40 +0000 (13:05 -0700)]
ovsdb: Truncate bad transactions from database log.

When ovsdb-server reads a database file that is corrupted at the
transaction level (that is, the transaction is valid JSON and has the
correct SHA-1 hash, but it does not describe a valid database transaction),
then ovsdb-server should truncate it and overwrite it by valid
transactions.  However, until now, it didn't.  Instead, it would keep the
invalid transaction and possibly every transaction in the database file
(depending on in what way the transaction was invalid), which would just
cause the same trouble again the next time the database was read.

This fixes the problem.  An invalid transaction will be deleted from the
database file at the first write to the database.

Bug #5144.
Bug #5149.

13 years agoovsdb: Check that ovsdb-server truncates corrupted database logs.
Ben Pfaff [Mon, 28 Mar 2011 19:57:20 +0000 (12:57 -0700)]
ovsdb: Check that ovsdb-server truncates corrupted database logs.

When ovsdb-server reads a database that is corrupted at the log level
(that is, when ovsdb_log detects the corruption by checking the SHA-1 hash
of the record or JSON parser error reporting), then writing to the database
should discard the corrupted data and thereby fix the problem for future
ovsdb-server runs.

This already worked OK.  This just adds an extra test.

13 years agoovsdb: Raise database corruption log level from warning to error.
Ben Pfaff [Mon, 28 Mar 2011 19:59:18 +0000 (12:59 -0700)]
ovsdb: Raise database corruption log level from warning to error.

If there's database corruption then it indicates that something went wrong,
e.g. the machine was powered-off by power failure.  It's definitely
something that the admin should know about.  This sounds like an error to
me, so use that log level.

13 years agoovsdb: Force strong references to non-root tables to be persistent.
Ben Pfaff [Thu, 31 Mar 2011 23:43:43 +0000 (16:43 -0700)]
ovsdb: Force strong references to non-root tables to be persistent.

When a strong reference to a non-root table is ephemeral, the database log
can contain inconsistencies.  In particular, if the column in question is
the only reference to a row, then the row will be created in one logged
transaction but the reference to it will not be logged (because it is
ephemeral).  Thus, any later occurrence of the row later in the log (to
modify it, to delete it, or just to reference it) will yield a transaction
error and reading the database will abort at that point.

This commit fixes the problem by forcing any column with a strong reference
to a non-root table to be persistent.

The change to ovsdb_schema_from_json() looks bigger than it really is: it
just swaps the order of two operations on the schema and updates their
comments.  Similarly for the update to ovs.db.DbSchema.__init__().

Bug #5144.
Reported-by: Sujatha Sumanth <ssumanth@nicira.com>
Bug #5149.
Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
13 years agoovsdb-types: Fix bug in ovsdb_base_type_is_ref().
Ben Pfaff [Mon, 28 Mar 2011 17:48:36 +0000 (10:48 -0700)]
ovsdb-types: Fix bug in ovsdb_base_type_is_ref().

This function only worked properly inside OVSDB itself, because that is
the only place where the 'refTable' member of ovsdb_base_type is set.
Both inside and outside OVSDB, 'refTableName' is set for reference types,
so it's better to check for that.

This doesn't fix any existing bug because this function was only used
inside OVSDB until now.

13 years agoovs-brcompatd: Convert svecs to ssets.
Ben Pfaff [Fri, 25 Mar 2011 22:21:18 +0000 (15:21 -0700)]
ovs-brcompatd: Convert svecs to ssets.

13 years agobridge: Convert svecs to ssets.
Ben Pfaff [Fri, 25 Mar 2011 22:15:33 +0000 (15:15 -0700)]
bridge: Convert svecs to ssets.

13 years agoovs-openflowd: Use sset in place of svec.
Ben Pfaff [Fri, 25 Mar 2011 22:11:05 +0000 (15:11 -0700)]
ovs-openflowd: Use sset in place of svec.

Also deletes svec_split() since this was the only user.

13 years agoofproto: Change string sets in interface from svec to sset.
Ben Pfaff [Fri, 25 Mar 2011 22:04:12 +0000 (15:04 -0700)]
ofproto: Change string sets in interface from svec to sset.

13 years agoovsdb-parser: Use sset instead of svec for detecting unused members.
Ben Pfaff [Fri, 25 Mar 2011 20:20:35 +0000 (13:20 -0700)]
ovsdb-parser: Use sset instead of svec for detecting unused members.

Should be slightly cheaper than sorting a list (O(n) vs. O(n lg n)).

13 years agonetdev: Use sset instead of svec in netdev interface.
Ben Pfaff [Fri, 25 Mar 2011 20:04:47 +0000 (13:04 -0700)]
netdev: Use sset instead of svec in netdev interface.

13 years agodpif: Use sset instead of svec in dpif interface.
Ben Pfaff [Fri, 25 Mar 2011 20:00:13 +0000 (13:00 -0700)]
dpif: Use sset instead of svec in dpif interface.

13 years agoConvert shash users that don't use the 'data' value to sset instead.
Ben Pfaff [Fri, 25 Mar 2011 22:26:30 +0000 (15:26 -0700)]
Convert shash users that don't use the 'data' value to sset instead.

In each of the cases converted here, an shash was used simply to maintain
a set of strings, with the shash_nodes' 'data' values set to NULL.  This
commit converts them to use sset instead.

13 years agosset: New data type for a set of strings.
Ben Pfaff [Wed, 30 Mar 2011 20:44:10 +0000 (13:44 -0700)]
sset: New data type for a set of strings.

Many uses of "shash" or "svec" data structures really call for a "set of
strings" data type.  This commit introduces such a data structure.  Later
commits convert inappropriate uses of shash and svec to use sset instead.

13 years agolearning-switch: Remove dead assignment.
Ethan Jackson [Tue, 29 Mar 2011 19:37:49 +0000 (12:37 -0700)]
learning-switch: Remove dead assignment.

13 years agoovs-ofctl: Remove dead assignment.
Ethan Jackson [Thu, 31 Mar 2011 23:38:56 +0000 (16:38 -0700)]
ovs-ofctl: Remove dead assignment.

13 years agonetdev-linux: Remove dead assignments.
Ethan Jackson [Tue, 29 Mar 2011 19:25:17 +0000 (12:25 -0700)]
netdev-linux: Remove dead assignments.

13 years agoofproto: Use new timer library.
Ethan Jackson [Thu, 31 Mar 2011 20:55:23 +0000 (13:55 -0700)]
ofproto: Use new timer library.

13 years agocfm: Use new timer library.
Ethan Jackson [Thu, 31 Mar 2011 20:54:44 +0000 (13:54 -0700)]
cfm: Use new timer library.

13 years agolacp: Use new timer library.
Ethan Jackson [Thu, 31 Mar 2011 20:54:15 +0000 (13:54 -0700)]
lacp: Use new timer library.

13 years agolib: Create new timer library.
Ethan Jackson [Thu, 31 Mar 2011 20:46:04 +0000 (13:46 -0700)]
lib: Create new timer library.

Scattered throughout the code base we use long integers to
implement timers.  When the result of timer_msec() is greater than
the time stored, we preform some action.

This commit creates a new timer library intended to replace these
manually managed timers.  Code using the timer library will be more
obviously correct, and more consistent with other code using the
library.

13 years agocfm: Fix appctl negative report.
Ethan Jackson [Thu, 31 Mar 2011 23:12:01 +0000 (16:12 -0700)]
cfm: Fix appctl negative report.

When the cfm module has never received a bad CCM message, it would
report a negative time.

13 years agobridge: Destroy ofproto before deleting dpif.
Ben Pfaff [Thu, 31 Mar 2011 21:12:57 +0000 (14:12 -0700)]
bridge: Destroy ofproto before deleting dpif.

Otherwise the ofproto's attempt to flush flows from the dpif will fail with
an error, causing a spurious log message.

13 years agoconnmgr: Fix wild pointer dereference in connmgr_broadcast().
Ben Pfaff [Thu, 31 Mar 2011 21:13:36 +0000 (14:13 -0700)]
connmgr: Fix wild pointer dereference in connmgr_broadcast().

Fixes a segfault when fail-open goes into effect.

13 years agoofproto: Fix order of destruction in ofproto_destroy().
Ben Pfaff [Thu, 31 Mar 2011 21:11:57 +0000 (14:11 -0700)]
ofproto: Fix order of destruction in ofproto_destroy().

ofproto_flush_flows() calls into the connmgr (via connmgr_flushed()) so
it must be called before destroying the connmgr to avoid a use-after-free
error.

Bug #5231.
Reported-by: Krishna Miriyala <krishna@nicira.com>
13 years agodatapath: Update for changes in 2.6.39-rc1
Simon Horman [Thu, 31 Mar 2011 07:32:07 +0000 (16:32 +0900)]
datapath: Update for changes in 2.6.39-rc1

Update for flowi4 and ip_route_output_flow() changes
in 2.6.39-rc1.

Signed-off-by: Simon Horman <horms@verge.net.au>
[Jesse: drop redundant unlikely() from IS_ERR()]
Signed-off-by: Jesse Gross <jesse@nicira.com>
13 years agoofpbuf: Make ofpbufs initialized with ofpbuf_use_stack() not expandable.
Ben Pfaff [Wed, 2 Mar 2011 21:39:59 +0000 (13:39 -0800)]
ofpbuf: Make ofpbufs initialized with ofpbuf_use_stack() not expandable.

My original intent for ofpbufs initialized with ofpbuf_use_stack() was that
the caller was providing enough space on the stack for the common case,
with dynamic allocation as a fallback.  But in practice, none of the
clients actually do this.  Instead, all of them actually know that the
stack-allocated buffer is big enough and, since they don't want to bother
with having to call ofpbuf_delete(), they instead assert that the buffer
wasn't reallocated.

Since this is a bit of a pain, this commit changes the semantics of
ofpbuf_use_stack() to be that the stack-allocated buffer cannot be
reallocated at all.  This is more convenient for the existing clients.

13 years agoodp-util: Replace ODPUTIL_FLOW_KEY_U32S by new struct odputil_keybuf.
Ben Pfaff [Wed, 2 Mar 2011 21:25:10 +0000 (13:25 -0800)]
odp-util: Replace ODPUTIL_FLOW_KEY_U32S by new struct odputil_keybuf.

This seems to me to better encapsulate the inherent ugliness.

13 years agodatapath: Fix mysterious GRE-over-IPSEC problems.
Ben Pfaff [Wed, 30 Mar 2011 21:54:26 +0000 (14:54 -0700)]
datapath: Fix mysterious GRE-over-IPSEC problems.

We've noticed that packets that go up to userspace and then back down to
the kernel and then enter an GRE tunnel that is then ESP encapsulated
by IPSEC end up with a bad ESP "next header" value: it ends up as zero
instead of 0x2f (IPPROTO_GRE).  Just putting packets from userspace into
a freshly allocated skb fixes the problem.

The underlying problem that this works around is still unknown.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #4769.

13 years agomac-learning: Fix mac_entry_is_grat_arp_locked().
Ben Pfaff [Wed, 30 Mar 2011 20:01:36 +0000 (13:01 -0700)]
mac-learning: Fix mac_entry_is_grat_arp_locked().

The lock is asserted if its expiration time has not arrived yet, not the
reverse.

13 years agoofproto: Get rid of send_port_status() trivial wrapper function.
Ben Pfaff [Tue, 15 Mar 2011 23:51:46 +0000 (16:51 -0700)]
ofproto: Get rid of send_port_status() trivial wrapper function.

13 years agoofp-util: Remove flow_stats_iterator, flows_stats_first(), flow_stats_next()
Ben Pfaff [Tue, 15 Mar 2011 21:56:09 +0000 (14:56 -0700)]
ofp-util: Remove flow_stats_iterator, flows_stats_first(), flow_stats_next()

Nothing uses these anymore.  ofputil_decode_flow_stats_reply() is a better
alternative.

13 years agotimeval: Only log poll intervals longer than 50 ms.
Ben Pfaff [Mon, 28 Mar 2011 20:43:32 +0000 (13:43 -0700)]
timeval: Only log poll intervals longer than 50 ms.

When poll interval-based logging was introduced a long time, we were
actively interested in looking at almost every long poll interval.  But
these days, with OVS working rather well, with pretty good latency, most
of the messages are red herrings that bother some administrators and
provoke false reports.  So this commit suppresses all but the most
egregious long poll intervals that may in fact be worth looking at.

NIC-366.

13 years agoAUTHORS: Add Gaetano Catalli <gaetano.catalli@gmail.com>.
Ben Pfaff [Wed, 30 Mar 2011 18:21:28 +0000 (11:21 -0700)]
AUTHORS: Add Gaetano Catalli <gaetano.catalli@gmail.com>.

13 years agoFix compilation of openvswitch-1.1.0pre2 on FreeBSD-8.1
Gaetano Catalli [Wed, 30 Mar 2011 15:25:36 +0000 (17:25 +0200)]
Fix compilation of openvswitch-1.1.0pre2 on FreeBSD-8.1

13 years agoofproto: Factor OpenFlow connection management into new "connmgr".
Ben Pfaff [Tue, 29 Mar 2011 19:24:28 +0000 (12:24 -0700)]
ofproto: Factor OpenFlow connection management into new "connmgr".

This removes a lot of code from ofproto.c and makes the ofproto code
easier to understand.

13 years agoofproto: New function ofconn_pktbuf_retrieve().
Ben Pfaff [Thu, 10 Feb 2011 21:16:56 +0000 (13:16 -0800)]
ofproto: New function ofconn_pktbuf_retrieve().

This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.

13 years agoofproto: Add functions to get and set ofconn type and role.
Ben Pfaff [Thu, 10 Feb 2011 21:11:07 +0000 (13:11 -0800)]
ofproto: Add functions to get and set ofconn type and role.

This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.

13 years agoofproto: Add ofconn_get_miss_send_len(), ofconn_set_miss_send_len().
Ben Pfaff [Thu, 10 Feb 2011 20:37:02 +0000 (12:37 -0800)]
ofproto: Add ofconn_get_miss_send_len(), ofconn_set_miss_send_len().

This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.

13 years agoofproto: Add ofconn_get_flow_format(), ofconn_set_flow_format().
Ben Pfaff [Thu, 10 Feb 2011 19:26:16 +0000 (11:26 -0800)]
ofproto: Add ofconn_get_flow_format(), ofconn_set_flow_format().

This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.

13 years agoofproto: Use ofconn_send_reply() for sending OpenFlow replies.
Ben Pfaff [Thu, 10 Feb 2011 19:22:03 +0000 (11:22 -0800)]
ofproto: Use ofconn_send_reply() for sending OpenFlow replies.

This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.

13 years agoofproto: Introduce ofconn_get_ofproto() accessor function.
Ben Pfaff [Tue, 22 Mar 2011 16:14:59 +0000 (09:14 -0700)]
ofproto: Introduce ofconn_get_ofproto() accessor function.

This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.

13 years agoofproto: Move hton_ofp_phy_port() to ofp-util.
Ben Pfaff [Tue, 15 Mar 2011 17:08:54 +0000 (10:08 -0700)]
ofproto: Move hton_ofp_phy_port() to ofp-util.

This removes some code from ofproto.c that doesn't really seem to
belong there to begin with.

13 years agoofproto: Break packet_in encoding out of ofproto into ofp-util.
Ben Pfaff [Tue, 22 Mar 2011 16:13:02 +0000 (09:13 -0700)]
ofproto: Break packet_in encoding out of ofproto into ofp-util.

This removes some code from ofproto.c.

13 years agoofproto: Factor building of flow_removed messages out into ofp-util.
Ben Pfaff [Tue, 15 Mar 2011 16:49:14 +0000 (09:49 -0700)]
ofproto: Factor building of flow_removed messages out into ofp-util.

This removes some code from ofproto.c.

13 years agoovs-vsctl: Remove dead assignment.
Ethan Jackson [Tue, 29 Mar 2011 17:58:45 +0000 (10:58 -0700)]
ovs-vsctl: Remove dead assignment.

Noticed this last night while playing around with the clang static
analyzer.

13 years agoovs-vsctl: Remove dead code.
Ethan Jackson [Tue, 29 Mar 2011 00:46:43 +0000 (17:46 -0700)]
ovs-vsctl: Remove dead code.

Coverity #10710.

13 years agobridge: Always wait for MAC learning table and ports.
Ben Pfaff [Tue, 29 Mar 2011 17:08:16 +0000 (10:08 -0700)]
bridge: Always wait for MAC learning table and ports.

The test ofproto_has_primary_controller() is meaningless, since OFPP_NORMAL
can cause the MAC learning table and port bonding to be in use even when
there is a controller.

I see that this bug has been here since early 2009, when the OFPP_NORMAL
feature was introduced in the bridge.  (Obviously it's not a severe
problem.)

13 years agoxenserver: Wait for ovs-xapi-sync to exit in "stop" command.
Ben Pfaff [Mon, 28 Mar 2011 23:22:59 +0000 (16:22 -0700)]
xenserver: Wait for ovs-xapi-sync to exit in "stop" command.

It seems possible that "restart" or a quick application of "stop" then
"start" could kill ovs-xapi-sync without starting it again, if
ovs-xapi-sync takes a little while to die, long enough for the next
instance of it to see that its pidfile is still open and locked.

I hope that this fixes some odd races that we've noticed in the "restart"
command.

Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agodaemon: Avoid redundant code in already_running().
Ben Pfaff [Tue, 29 Mar 2011 16:44:55 +0000 (09:44 -0700)]
daemon: Avoid redundant code in already_running().

This function substantially duplicated read_pidfile(), so reuse that
code instead.

13 years agodaemon: Write "already running" message to log also.
Ben Pfaff [Tue, 29 Mar 2011 17:09:23 +0000 (10:09 -0700)]
daemon: Write "already running" message to log also.

Otherwise it's hard to diagnose later if the daemon failed to start because
it thinks that it is already running.

13 years agocfm: No longer keep track of bad remote MPs and MAIDS.
Ethan Jackson [Mon, 28 Mar 2011 20:10:12 +0000 (13:10 -0700)]
cfm: No longer keep track of bad remote MPs and MAIDS.

Ben pointed out that an attacker could cause OVS to use infinite
memory by sending a series of CCMs with different MAIDs.  Each
message would cause a remote_maid to be allocated and stored for
several seconds.

Since Commit 1c2e2d2fc8 (cfm: Don't report unexpected remote
endpoints) no longer reports unexpected remote MAIDS and MPs in the
database, the only reason to keep track of this information is for
debugging purposes.  In my judgment, it provides negligible useful
debugging information at the expense of significantly increased
code complexity.  This commit rips it out entirely.

13 years agoovsdb-tool: Fix cut-and-paste error in manpage.
Ben Pfaff [Mon, 28 Mar 2011 20:35:32 +0000 (13:35 -0700)]
ovsdb-tool: Fix cut-and-paste error in manpage.

Reported-by: Paul Ingram <paul@nicira.com>
13 years agoovs-brcompatd: Delete write-only variable.
Ben Pfaff [Fri, 25 Mar 2011 22:22:10 +0000 (15:22 -0700)]
ovs-brcompatd: Delete write-only variable.

13 years agocfm: Create new cfm/show appctl command.
Ethan Jackson [Fri, 25 Mar 2011 22:30:33 +0000 (15:30 -0700)]
cfm: Create new cfm/show appctl command.

This will be useful for debugging CFM problems in the future.

13 years agobridge: Write CFM updates more quickly.
Ethan Jackson [Fri, 25 Mar 2011 20:36:43 +0000 (13:36 -0700)]
bridge: Write CFM updates more quickly.

This commit causes updates to CFM status to be written immediately.
A rate limit of 1 second is introduced to avoid performance
problems.

13 years agocfm: Reduce missed CCM detection time.
Ethan Jackson [Fri, 25 Mar 2011 21:26:53 +0000 (14:26 -0700)]
cfm: Reduce missed CCM detection time.

The specification says that a fault should be signaled when 3.5 *
ccm_interval milliseconds have passed.  This commit respects that
requirement, possibly increasing the responsiveness of fault
detection slightly.

13 years agocfm: Don't report unexpected remote endpoints.
Ethan Jackson [Fri, 25 Mar 2011 01:36:56 +0000 (18:36 -0700)]
cfm: Don't report unexpected remote endpoints.

Before this patch, CFM would report unexpected remote maintenance
points in the database.  This commit no longer exposes this
information.

Information about precisely why a link is faulty is more interesting
to a system administrator debugging a problem than a controller
which will generally only care about whether or not a link is
faulty.  For simplicity sake, this commit removes this information
from the database where it was somewhat awkwardly placed.  In the
future it may be valuable to report the information through
ovs-appctl commands for debugging purposes.

13 years agocfm: Immediately signal fault on bad CCM reception.
Ethan Jackson [Fri, 25 Mar 2011 02:04:21 +0000 (19:04 -0700)]
cfm: Immediately signal fault on bad CCM reception.

Commit af5739857a (cfm: Immediately signal a fault upon receiving
an unexpected MPID.) caused the CFM library to immediately signal a
fault upon reception of an unexpected remote MPID.  This commit
does the same for MAIDs, and remote maintenance points with invalid
CCM intervals.

13 years agopackets: Move CFM related packet information to cfm header file.
Ethan Jackson [Fri, 25 Mar 2011 20:57:21 +0000 (13:57 -0700)]
packets: Move CFM related packet information to cfm header file.

13 years agoschema: Monitor's remote_mps is not ephemeral.
Ethan Jackson [Fri, 25 Mar 2011 00:53:16 +0000 (17:53 -0700)]
schema: Monitor's remote_mps is not ephemeral.

The remote_mps column of the Monitor table is a configuration
parameter and should not be ephemeral.

13 years agodatapath: Avoid memory leak in odp_packet_cmd_execute().
Ben Pfaff [Fri, 25 Mar 2011 00:06:58 +0000 (17:06 -0700)]
datapath: Avoid memory leak in odp_packet_cmd_execute().

The error path needs to free 'packet'.

Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agocfm: cfm_run() return ccm instead of packet.
Ethan Jackson [Tue, 22 Mar 2011 23:57:43 +0000 (16:57 -0700)]
cfm: cfm_run() return ccm instead of packet.

It doesn't really make sense for the CFM code to be composing
packets.  Its caller is better placed to compose the appropriate
L2 header.  This commit pulls that logic out of the CFM library.

13 years agopackets: Create new compose_packet() function.
Ethan Jackson [Wed, 23 Mar 2011 19:59:40 +0000 (12:59 -0700)]
packets: Create new compose_packet() function.

This commit generalizes compose_lacp_packet() into new
compose_packet() function.  This new function will be used to send
CCM messages in future patches.

13 years agocfm: Move destination address to cfm.h
Ethan Jackson [Tue, 22 Mar 2011 21:28:22 +0000 (14:28 -0700)]
cfm: Move destination address to cfm.h

Future patches will require the use of this information globally.

13 years agodatapath: Add compatibility with sk_buff's vlan_tci before 2.6.33.
Ben Pfaff [Wed, 23 Mar 2011 17:34:37 +0000 (10:34 -0700)]
datapath: Add compatibility with sk_buff's vlan_tci before 2.6.33.

Between 2.6.27 and 2.6.32, the vlan_tci member of struct sk_buff was the
raw value of the 802.1Q header's TCI field, without the CFI bit being set.
In 2.6.33 and later, the CFI bit is always set if an 802.1Q header is
present, correcting a corner case.

Until now, OVS has not consistently dealt with this.  If a packet arrived
at a datapath from a network device directly, or if it was set with an
ODP_ACTION_ATTR_SET_DL_TCI action, then the CFI bit would not be set in
vlan_tci.  In flow_extract(), OVS copies vlan_tci directly to dl_tci in the
flow structure (via vlan_get_tci()), so the CFI bit would also not be set
in dl_tci.  But if OVS had to send a packet up to userspace (converting the
vlan_tci back to an 802.1Q header along the way) and got it back, then it
would set the VLAN CFI bit in dl_tci when it parsed the 802.1Q header in
parse_vlan().  This had the effect that a flow set up by userspace (with
the CFI bit set) would never be matched by a packet arriving from a network
device, because they would have different dl_tci values.

This fixes the problem, by making the vlan_get_tci() and vlan_set_tci()
interface consistent across kernel versions.  Now, they always accept or
return a value where the VLAN CFI bit is set if an 802.1Q header is
present.

Build-tested only.

Problem isolated by Ethan Jackson <ethan@nicira.com>

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
Bug #4915.