Ben Pfaff [Mon, 2 Aug 2010 22:21:27 +0000 (15:21 -0700)]
xenserver: Add "reload" and "force-reload" support to init script.
I can't easily find anything that documents what commands Fedora init
scripts should support, but many of them support "reload" and
"force-reload". This commit adds support for them to the XenServer init
scripts. (The Debian init scripts already had support.)
Debian does document that reload and force-reload should be supported:
http://www.debian.org/doc/debian-policy/ch-opersys.html#s-writing-init
Reported-by: Reid Price <reid@nicira.com>
Bug #3266.
Jesse Gross [Mon, 2 Aug 2010 18:43:22 +0000 (11:43 -0700)]
datapath: Remove netdev_alloc_skb_ip_align() compat code.
We don't actually use this function anymore so there isn't a
point in having a configure test for it.
Alexey I. Froloff [Mon, 2 Aug 2010 10:20:37 +0000 (14:20 +0400)]
datapath: Fix build with backported netdev_alloc_skb_ip_align()
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
Justin Pettit [Sun, 1 Aug 2010 00:09:31 +0000 (17:09 -0700)]
datapath: Clean-up previous undefined symbol commit
The previous commit still had some issues with the
"set_normalized_timespec" symbol being undefined. Here we just replace
it. We can search for a more elegant solution later if necessary.
Justin Pettit [Sat, 31 Jul 2010 23:05:20 +0000 (16:05 -0700)]
datapath: Fix undefined symbol "set_normalized_timespec"
The commit "datapath: Don't query time for every packet." (
6bfafa55)
introduced the use of "set_normalized_timespec". Unfortunately, older
kernels don't export the symbol. This implements the function on those
older kernels.
Justin Pettit [Fri, 16 Jul 2010 06:37:35 +0000 (23:37 -0700)]
vswitchd: Don't act as learning switch in secure mode with no controllers
Don't act as a learning switch when the fail-mode is "secure" and no
controllers are defined. This allows the bridge to come up in a state
where it won't pass any traffic until a controller has told it to do so.
Justin Pettit [Fri, 16 Jul 2010 03:56:43 +0000 (20:56 -0700)]
vswitchd: Move fail-mode config to Bridge table
Configuration of the fail-mode was an attribute of the Controller table.
However, it makes more sense as an attribute of the Bridge table, since
the behavior defines what a bridge should do if it can't connect to
*any* controller. This commit makes the move.
Justin Pettit [Thu, 15 Jul 2010 21:53:36 +0000 (14:53 -0700)]
vswitchd: Remove default controller config from Open_vSwitch table
An OpenFlow controller is normally associated with a bridge. It was
possible to define a default controller in the Open_vSwitch table that
would be used if one was not associated with a bridge. This was seldom
used and mostly just caused confusion. This commit removes that
support, so an OpenFlow controller must always be associated with a
bridge.
Ben Pfaff [Fri, 30 Jul 2010 21:51:35 +0000 (14:51 -0700)]
learning-switch: Avoid violating C aliasing rules initializing actions.
The C standard says that an object that is declared of one particular type
must not be accessed through a pointer to another type, with a few notable
exceptions. This code was violating those rules, and GCC 4.4 complains
about it. This commit fixes the problem by using one of the exceptions:
it's always OK to access an object as an array of character type (which is
what memcpy() does implicitly).
Reported-by: Justin Pettit <jpettit@nicira.com>
Ben Pfaff [Fri, 30 Jul 2010 21:47:29 +0000 (14:47 -0700)]
sflow: Avoid "unused parameter" warnings from GCC 4.4.
With GCC -Wno-unused by itself isn't enough to avoid "unused parameter"
warnings, since we also use -Wunused-parameter. We also need to check for
and use -Wno-unused-parameter.
Ben Pfaff [Fri, 30 Jul 2010 22:39:56 +0000 (15:39 -0700)]
ovs-ofctl: Add support for OpenFlow enqueue action.
Jesse Gross [Thu, 29 Jul 2010 22:59:36 +0000 (15:59 -0700)]
vport-internal: Set vport to NULL when detaching.
'struct net_device' is refcounted and can stick around for quite a
while if someone is still holding a reference to it. However, we
free the vport that it is attached to in the next RCU grace period
after detach. This assigns the vport to NULL on detach and adds
appropriate checks.
Jesse Gross [Thu, 29 Jul 2010 22:59:31 +0000 (15:59 -0700)]
vport: Make dp_port->vport always valid.
When we detached a vport we would assign NULL to dp_port->vport
before calling synchronize_rcu(). However, since vports have a
longer lifetime than dp_ports there were no checks before
dereferencing dp_port->vport. This changes the behavior to
match the assumption by not assigning NULL during detach. This
avoids a potential NULL pointer dereference in do_output() among
other places.
Jesse Gross [Thu, 29 Jul 2010 21:42:17 +0000 (14:42 -0700)]
datapath: Remove dead code.
Several blocks of code were either no longer being called or had
been "#if 0"'d out for a long time. This removes them.
Jesse Gross [Fri, 30 Jul 2010 02:01:02 +0000 (19:01 -0700)]
datapath: Remove redundant checks on SKBs.
On vport ingress we already check for shared SKBs but then later
warn in several other places. In a similar vein, we check every
packet to see if it is LRO but only certain vports can produce
these packets. Remove and consolidate checks to the places where
they are needed.
Justin Pettit [Wed, 28 Jul 2010 22:18:25 +0000 (15:18 -0700)]
ovs-controller: Add ability to define default flows
Add support for the --with-flows option, which allows default flows to
be read from a file and pushed to connecting switches.
Justin Pettit [Wed, 28 Jul 2010 22:18:14 +0000 (15:18 -0700)]
learning-switch: Add ability to define default flows
Add an argument to the function to create a learning switch, which
defines default flows to be pushed down to connecting switches. It does
nothing to enforce that they remain intact. It only pushes flows on
switch connection.
Justin Pettit [Wed, 28 Jul 2010 22:14:28 +0000 (15:14 -0700)]
ofp-parse: Break string-to-openflow parsing into library functions
An upcoming commit will add the ability to load OpenFlow rules into
ovs-controller. Break out string-to-openflow parsing so that
ovs-ofctl and ovs-controller can use the same code.
Jesse Gross [Fri, 30 Jul 2010 01:15:14 +0000 (18:15 -0700)]
datapath: Catch missed formatting changes.
A few functions were missed in the change to move the return type
onto the same line as the arguments.
Jesse Gross [Fri, 16 Jul 2010 02:22:07 +0000 (19:22 -0700)]
datapath: Don't query time for every packet.
Rather than actually query the time every time a packet comes through,
just store the current jiffies and convert it to actual time when
requested. GRE is the primary beneficiary of this because the traffic
travels through the datapath twice. This change reduces CPU utilization
3-4% with GRE.
Ben Pfaff [Fri, 23 Jul 2010 22:27:38 +0000 (15:27 -0700)]
vlog: Fix logic error in update_min_level().
Commit
480ce8ab "vlog: Make the vlog module catalog program-specific."
accidentally inverted the logic in this function, which broke the "-v"
to various OVS programs as well as other mechanisms to set logging to
non-default levels.
Ben Pfaff [Fri, 16 Jul 2010 17:53:14 +0000 (10:53 -0700)]
vlog: Make the vlog module catalog program-specific.
Until now, the collection of vlog modules supported by a given OVS program
was not specific to that program. That means that, for example, even
though ovs-dpctl does not have anything to do with jsonrpc, it still has
a vlog module for it. This is confusing, at best.
This commit fixes the problem on some systems, in particular on ones that
use GCC and the GNU linker. It uses the feature of the GNU linker
described in its manual as:
If an orphaned section's name is representable as a C identifier then
the linker will automatically see PROVIDE two symbols: __start_SECNAME
and __end_SECNAME, where SECNAME is the name of the section. These
indicate the start address and end address of the orphaned section
respectively.
Systems that don't support these features retain the earlier behavior.
This commit also fixes the annoyance that modifying lib/vlog-modules.def
causes all sources files that #include "vlog.h" to recompile.
Ben Pfaff [Fri, 16 Jul 2010 18:02:49 +0000 (11:02 -0700)]
vlog: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.
Adding a macro to define the vlog module in use adds a level of
indirection, which makes it easier to change how the vlog module must be
defined. A followup commit needs to do that, so getting these widespread
changes out of the way first should make that commit easier to review.
Ben Pfaff [Fri, 16 Jul 2010 18:11:44 +0000 (11:11 -0700)]
vlog: Remove explicit calls to vlog_init().
This is no longer necessary.
Ben Pfaff [Fri, 16 Jul 2010 18:23:31 +0000 (11:23 -0700)]
vlog: Make vlog initialize itself when necessary.
It's more convenient if clients don't have to initialize modules
explicitly.
The most important part of this change is to initialize the default
log levels statically. Previously, by initializing log levels only
from vlog_init(), all the log levels appeared to be VLL_EMER (0) if
vlog_init() was accidentally not called at all. This was not intended
behavior, so this commit fixes it.
This commit also fixes up a few test programs whose tests accidentally
depended on this behavior, by making them explicitly turn off log
messages that were implicitly turned off before.
Ben Pfaff [Wed, 21 Jul 2010 22:42:22 +0000 (15:42 -0700)]
timeval: Make time_init() static and remove calls to it.
Since the timeval module now initializes itself on-demand, there is no
longer any need to initialize it explicitly, or to provide an interface to
do so.
Ben Pfaff [Wed, 21 Jul 2010 22:43:30 +0000 (15:43 -0700)]
timeval: Make timeval module initialize itself.
It's more convenient if clients don't have to initialize modules
explicitly.
Ben Pfaff [Fri, 16 Jul 2010 17:41:16 +0000 (10:41 -0700)]
timeval: Integrate CLOCK_MONOTONIC detection into time_init().
I don't see a reason that set_up_monotonic() should be separate from
time_init(). Doing all the time initialization in one place seems
reasonable, so this commit makes that change.
Ben Pfaff [Wed, 21 Jul 2010 22:38:23 +0000 (15:38 -0700)]
debian: Check for accurate Debian changelog version at build time too.
When we increment the Open vSwitch version number, we tend to forget to
update it in debian/changelog at the same time. Right now this gets
fixed up automatically at "make dist" time, but it's even better if we can
always have it be correct in the repository. This commit should help with
that, by making both "make" and "make dist" refuse to proceed if the
version number is out of sync.
Ben Pfaff [Thu, 15 Jul 2010 17:50:33 +0000 (10:50 -0700)]
tests: Disable profiling for "wait-until must wait" test.
This test tends to break when run with lcov profiling since the lcov
wrapper script can't synchronize access to profiling data across all the
ovs-vsctl instances running in parallel.
Ben Pfaff [Fri, 16 Jul 2010 22:50:57 +0000 (15:50 -0700)]
netdev-linux: Avoid minor number 0 in traffic control.
Linux traffic control handles with minor number 0 refer to qdiscs, not
to classes. This commit deals with this by using a conversion function:
OpenFlow queue 0 maps to minor 1, queue 1 to minor 2, and so on.
Ben Pfaff [Fri, 16 Jul 2010 22:47:23 +0000 (15:47 -0700)]
netdev-linux: Dump all queues, not just direct children of the root.
A netdev-linux traffic control implementation has to dump all of a port's
traffic classes in a couple of different situations. start_queue_dump()
is supposed to do that. But it was specifying TC_H_ROOT as tcm_parent,
which only dumped classes that were direct children of the root. This
commit changes tcm_parent to 0, which obtains all traffic classes
regardless of parent.
Ben Pfaff [Fri, 16 Jul 2010 22:39:40 +0000 (15:39 -0700)]
dpif-linux: Translate queues to priorities correctly.
The TC_H_MAKE macro does not shift the major number into position.
Ben Pfaff [Tue, 20 Jul 2010 18:23:21 +0000 (11:23 -0700)]
dpif: Abstract translation from OpenFlow queue ID into ODP priority value.
When the QoS code was integrated, I didn't yet know how to abstract the
translation from a queue ID in an OpenFlow OFPAT_ENQUEUE action into a
priority value for an ODP ODPAT_SET_PRIORITY action. This commit is a
first attempt that works OK for Linux, so far. It's possible that in fact
this translation needs the 'netdev' as an argument too, but it's not needed
yet.
Ben Pfaff [Fri, 16 Jul 2010 22:30:09 +0000 (15:30 -0700)]
Add pretty-printers for QoS related OpenFlow and ODP actions.
Ben Pfaff [Fri, 16 Jul 2010 00:08:17 +0000 (17:08 -0700)]
ovs-controller: Add support for OpenFlow queues.
Before, ovs-controller always sent packets using OFPAT_OUTPUT, which always
uses the default OpenFlow queue. To help me debug the Open vSwitch QoS
implementation, I want to be able to send packets on other queues, so
this commit adds that feature.
Ben Pfaff [Tue, 20 Jul 2010 18:18:24 +0000 (11:18 -0700)]
learning-switch: Add support for OpenFlow queues.
Before, an lswitch always sent packets using OFPAT_OUTPUT, which always
uses the default OpenFlow queue. To help me debug the Open vSwitch QoS
implementation, I want to be able to send packets on other queues, so
this commit adds that feature.
Ben Pfaff [Tue, 20 Jul 2010 18:10:45 +0000 (11:10 -0700)]
learning-switch: Break packet-in processing into two steps.
Ben Pfaff [Thu, 15 Jul 2010 23:20:37 +0000 (16:20 -0700)]
learning-switch: Refactor wildcards calculation.
There's no need to calculate the wildcards to use for each flow, since it
is a constant across every flow. In my opinion this also makes
process_packet_in() a little easier to understand, since it deletes a few
lines of code from a relatively complicated function.
Ben Pfaff [Thu, 15 Jul 2010 23:02:46 +0000 (16:02 -0700)]
learning-switch: Reserved addresses are destinations, not sources.
A switch is not supposed to forward packets directed to MAC addresses
01:80:c2:00:00:0x. This code was instead dropping packets *from* those
addresses.
(This code is only used by ovs-controller, so the bug is not a big deal.)
Jesse Gross [Fri, 16 Jul 2010 01:04:10 +0000 (18:04 -0700)]
ovs-vsctl: Fix unitialized variables.
The compiler pointed out two variables that it thought were used
without being initialized. The first was just a spurious warning
but the second could result in an unitialized pointer being freed.
This fixes both of those issues.
Ben Pfaff [Thu, 15 Jul 2010 00:04:22 +0000 (17:04 -0700)]
ovs-vsctl: Do not allow record names to be abbreviated.
It's pretty risky to allow record names to be abbreviated. If eth1 through
eth20 all exist, and then someone deletes eth1, then until now an ovs-vsctl
command that mentioned eth1 would actually use eth10. This is too much of
a caveat to let loose on unsuspecting scripts, so this commit removes that
functionality.
Ben Pfaff [Fri, 16 Jul 2010 16:22:23 +0000 (09:22 -0700)]
xenserver: Kill bond slaves' dhclients when bringing up bond
This fixes the converse of the problem addressed by commit
fe19e820
"xenserver: Kill bond master's dhclient when bringing up bond slave". In
that commit's log message, I claimed that the converse was not a problem,
but I was wrong. I must have screwed up in testing, because it really is
a problem. This commit fixes it.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Dominic Curran <dominic.curran@citrix.com>
Reported-by: Michael Mao <mmao@nicira.com>
Bug #2668.
Jesse Gross [Thu, 15 Jul 2010 20:47:59 +0000 (13:47 -0700)]
doc: Make explicit that ovs-vswitchd is the preferred switch.
Many people who are looking for an OpenFlow switch assume that
the only way to do it is using ovs-openflowd. Sometimes they also
run ovs-vswitchd at the same time. Try to clarify that neither
of these are necessary and ovs-vswitchd can handle OpenFlow by
itself and is the preferred method of doing so.
Jesse Gross [Thu, 15 Jul 2010 03:15:53 +0000 (20:15 -0700)]
datapath: Don't update flow key when applying actions.
Currently the flow key is updated to match an action that is applied
to a packet but these field are never looked at again. Not only is
this a waste of time it also makes optimizations involving caching
the flow key more difficult.
Jesse Gross [Thu, 15 Jul 2010 02:42:57 +0000 (19:42 -0700)]
datapath: Don't set tunnel_id in a function.
We don't need a function to set a variable. In practice it will
almost certainly get inlined but this makes it easier to read.
Jesse Gross [Thu, 15 Jul 2010 01:45:45 +0000 (18:45 -0700)]
gre: Use struct for parsing GRE header.
GRE is a somewhat annoying protocol because the header is variable
length. However, it does have a few fields that are always present
so we can make the parsing seem less magical by using a struct for
those fields instead of building it up field by field.
Jesse Gross [Thu, 15 Jul 2010 01:35:58 +0000 (18:35 -0700)]
gre: Wait for an RCU grace period before freeing port.
We currently remove ports from the GRE hash table and then immediately
free the ports. Since received packets could be using that port this
can lead to a crash (the port has already been detached from the
datapath so this can't happen for transmitted packets). As a result
we need to wait for an RCU grace period to elapse before actually
freeing the port.
In an ideal world we would actually remove the port from the hash
table in a hypothetical gre_detach() function since this is one of
the purposes of detaching. However, we also use the hash table to
look for collisions in the lookup criteria and don't want to allow
two identical ports to exist. It doesn't matter though because we
aren't blocking on the freeing of resources.
Jesse Gross [Thu, 15 Jul 2010 02:59:41 +0000 (19:59 -0700)]
vport: Use DEFINE_PER_CPU instead of dynamically allocating loop counter.
DEFINE_PER_CPU is simpler and faster than alloc_percpu() so use it
for the loop counter, which is already statically defined.
Jesse Gross [Thu, 15 Jul 2010 02:27:18 +0000 (19:27 -0700)]
datapath: Put return type on same line as arguments for functions.
In some places we would put the return type on the same line as
the rest of the function definition and other places we wouldn't.
Reformat everything to match kernel style.
Jesse Gross [Thu, 15 Jul 2010 02:02:10 +0000 (19:02 -0700)]
vport: Use EBUSY to represent already attached device.
We currently use EEXIST to represent both a device that is already
attached and for GRE devices that are the same as another one.
Instead use EBUSY for already attached devices to disambiguate the
two situations.
Jesse Gross [Thu, 15 Jul 2010 02:46:23 +0000 (19:46 -0700)]
datapath: Make checksum offsets unsigned.
The offsets for checksum offsets should always be positive so make
that explicit by using unsigned ints. This helps bug checks that
test if the offsets are greater than their upper limits.
Ben Pfaff [Wed, 14 Jul 2010 23:36:42 +0000 (16:36 -0700)]
ovs-vsctl: Make --help capitalization and spelling more consistent.
Reported-by: Reid Price <reid@nicira.com>
Bug #3175.
Ben Pfaff [Wed, 14 Jul 2010 23:29:33 +0000 (16:29 -0700)]
Tests: Fix nonportable \" escape in printf(1) invocation.
The \" escape is not part of POSIX, but it is a common extension. The
dash shell's built-in "printf" implementation does not include this
extension, which caused the testsuite to be generated incorrectly if it
is used as the default shell (as it is on newer versions of Debian and
Ubuntu).
However, there's no reason to use a backslash here at all, so just omit
it.
Ben Pfaff [Wed, 14 Jul 2010 17:05:53 +0000 (10:05 -0700)]
ofpbuf: Implement unsupported feature in ofpbuf_trim().
Until now, ofpbuf_trim() has not handled the case where the ofpbuf has
nonzero headroom. This causes an assertion failure when pinsched_send()
queues a packet to be sent later, because such packets have been
guaranteed to have nonzero headroom since commit
43253595 "ofproto: Avoid
buffer copy in OFPT_PACKET_IN path." This commit fixes the problem by
implementing the until-now unsupported case.
This commit factors code out of ofpbuf_prealloc_tailroom() into two new
functions, ofpbuf_rebase__() and ofpbuf_resize_tailroom__(), and uses the
latter to implement both ofpbuf_prealloc_tailroom() and ofpbuf_trim().
ofpbuf_rebase__() isn't used on its own at all, but it seems potentially
useful so I made it an independent function.
Reported-by: Tom Everman <teverman@google.com>
Jesse Gross [Mon, 12 Jul 2010 23:02:12 +0000 (16:02 -0700)]
datapath: Make our checksumming more closely match skb_checksum_help().
Our code that handles checksumming does essentially the same thing
as skb_checksum_help() except it folds the process into copying to
userspace. This makes the two functions more closely resemble
each other in structure, including adding a couple of BUG() checks.
This should have no functional change but makes comparision easier
when debugging.
Jesse Gross [Tue, 13 Jul 2010 00:40:38 +0000 (17:40 -0700)]
gre: Fix headroom calculation.
If we need to make a copy we add a little bit extra to the headroom
that we think we need in order to avoid future copies. Previously we
would always just allocate max(headroom, 64) which is generally
enough space. However, if we are using IPsec our expected headroom
is large and there is no extra. Instead, it is better to just tack on
a few extra bytes so we'll always have a cushion.
Jesse Gross [Mon, 12 Jul 2010 20:27:57 +0000 (13:27 -0700)]
datapath: Move over-MTU checking into vport_send().
We currently check for packets that are over the MTU in do_output().
There is a one-to-one correlation between this function and
vport_send() so move the MTU check there for consistency with
other error checking.
Jesse Gross [Mon, 12 Jul 2010 20:13:17 +0000 (13:13 -0700)]
datapath: Add loop checking.
New types of vports such as patch and GRE make it possible to
connect multiple (or the same) datapaths together, which introduces
the possibility of loops on a single machine. Local loops are
even worse than network loops because they will quickly crash the
machine once the kernel stack is exhausted. This adds loop
checking within the OVS datapath that will drop packets that have
been seen more than 5 times.
CC: Paul Ingram <paul@nicira.com>
Ben Pfaff [Fri, 2 Jul 2010 17:10:04 +0000 (10:10 -0700)]
configure: Add --with-l26-source option to specify source dir explicitly.
OVS can usually find the kernel source itself, but when it can't it's
handy if the user can just specify it on the "configure" command line.
Signed-off-by: Ian Campbell <Ian.Campbell@citrix.com>.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Jad Naous <jnaous@gmail.com>
Ben Pfaff [Thu, 17 Jun 2010 22:31:56 +0000 (15:31 -0700)]
vswitch: Distinguish mirrors by UUID, not by name.
A "feature" that ovs-vswitchd inherited from its previous form of
configuration is that every mirror has a name. Names are not necessarily
meaningful, and there is no reason that they should be unique. But the
existing implementation depends on them being unique within a given
bridge, and if they are not drops one of the duplicates.
This commit drops the uniqueness requirement. Instead, it distinguishes
mirrors based on UUID alone.
This commit does not drop the concept of names for mirrors. There is no
technical reason to retain them, but it is possible that users find them
useful for management reasons. The names appear in log messages related
to mirrors, which may make the messages easier to understand.
Bug #2416.
Ben Pfaff [Thu, 17 Jun 2010 22:32:09 +0000 (15:32 -0700)]
vswitch: Fix memory leak in mirror code.
Ben Pfaff [Thu, 17 Jun 2010 22:43:27 +0000 (15:43 -0700)]
vswitch: Use ovsrec_qos_get_queues() to avoid open-coding binary search.
Surely this is a better approach.
Ben Pfaff [Wed, 16 Jun 2010 22:56:15 +0000 (15:56 -0700)]
ovsdb-idlc: Add "get" accessor functions to generated code.
It can be useful to get direct access to the "struct ovsdb_datum"s that
underlie the "cooked" data structures maintained by the IDL code. This
commit provides a convenient interface through the IDL.
Ben Pfaff [Wed, 16 Jun 2010 22:57:22 +0000 (15:57 -0700)]
vswitch: Use ovsdb_idl_get() to avoid O(n) in get_ovsrec_key_value().
Ben Pfaff [Wed, 16 Jun 2010 21:35:48 +0000 (14:35 -0700)]
ovsdb-idl: Transition to better interfaces for reading table columns.
The existing ovsdb_idl_txn_read() was somewhat difficult and expensive to
use, because it always made a copy of the data in the column. This was
necessary at the time it was introduced, because there was no way for it
to return a "default" value for columns that had not yet been populated
without allocating data and hence requiring the caller to free it.
Now that ovsdb_datum_default() exists, this is no longer required. This
commit introduces a pair of new functions, ovsdb_idl_read() and
ovsdb_idl_get(), that return a pointer to existing data and do not do any
copying. It also transitions all of ovsdb_idl_txn_read()'s callers to
the new interfaces.
Ben Pfaff [Wed, 16 Jun 2010 21:08:49 +0000 (14:08 -0700)]
ovsdb-idlc: Check and restore ovsdb_datum invariants when setting data.
ovsdb_datum has an important invariant (documented in the large comment
on the declaration of struct ovsdb_datum) that a lot of code relies upon:
keys must be unique and in sorted order. Most code that creates or
modifies ovsdb_datum structures maintains this invariant. However, the
"set" functions generated by ovsdb-idlc.in do not check or restore it.
This commit adds that checking.
This might fix an actual bug or two--none have been reported--but mostly it
is just to add some additional checking to avoid future subtle bugs.
Ben Pfaff [Wed, 16 Jun 2010 20:44:08 +0000 (13:44 -0700)]
ovsdb: New functions ovsdb_datum_sort_unique(), ovsdb_datum_from_json_unique().
These new functions are more forgiving than the corresponding functions
without "_unique". The goal is to be more tolerant of data provided by
IDL clients, which will happen in a followup patch.
Ben Pfaff [Mon, 12 Jul 2010 17:05:16 +0000 (10:05 -0700)]
ovsdb: New functions ovsdb_atom_default(), ovsdb_datum_default().
Having access to const copies of default atoms and data will allow OVSDB
code to avoid memory allocations and reduce copying in upcoming commits.
Ben Pfaff [Mon, 12 Jul 2010 17:03:33 +0000 (10:03 -0700)]
ovsdb: Document some ovsdb-data.[ch] functions.
Ben Pfaff [Thu, 1 Jul 2010 16:47:46 +0000 (09:47 -0700)]
ovsdb: Extend "monitor" to select different operations in a single table.
Until now, "monitor" has only allowed the client to choose the kinds of
changes that will be monitored on a per-table basis. However, it makes
sense to be able to choose operations on a per-column basis. The
immediate need for this is to make sure that the final statistics of
deleted Interface records are known at time of deletion, even though the
intermediate values of the statistics are not important.
CC: Jeremy Stribling <strib@nicira.com>
Ben Pfaff [Wed, 30 Jun 2010 19:44:17 +0000 (12:44 -0700)]
tests: Add OVSDB tests for monitors that select only certain operations.
This has been supported as long as table monitoring has been supported, but
until now there were no tests, so this commit adds some.
Ben Pfaff [Wed, 30 Jun 2010 19:43:24 +0000 (12:43 -0700)]
ovsdb-client: Fix "selects" argument to "monitor" command.
This code assumed that the types of operations that were selected were
default-off, so it only added JSON to the query to turn on the ones that
were wanted, but in fact they are default-on, so this commit changes it
to add JSON for each possible operation type.
Ben Pfaff [Wed, 30 Jun 2010 21:35:02 +0000 (14:35 -0700)]
ovsdb: Document in SPECS how OVS uses JSON.
CC: Jeremy Stribling <strib@nicira.com>
Ben Pfaff [Wed, 30 Jun 2010 20:57:24 +0000 (13:57 -0700)]
json: Better handle JSON objects with duplicate names.
RFC 4627 (which defines JSON) says:
The names within an object SHOULD be unique.
In my view, this means that the treatment of duplicate names within a
JSON object is more or less up to the implementation. Until now, the OVS
JSON parser has dealt with duplicates fairly badly: they all get shoved
into the hash table and you get one or the other value semi-randomly
(typically the one added later). This commit makes the behavior
predictable: old values are deleted and replaced by newer values.
Ben Pfaff [Wed, 30 Jun 2010 20:26:42 +0000 (13:26 -0700)]
shash: New function shash_replace().
To be used in an upcoming commit.
Ben Pfaff [Wed, 30 Jun 2010 20:22:28 +0000 (13:22 -0700)]
shash: Refactor shash_add_nocopy(), shash_find().
By breaking out the hash calculation we can enable operations that need
to do both to avoid duplicating the hash calculations. A following commit
will add such an operation.
Ben Pfaff [Wed, 30 Jun 2010 20:28:22 +0000 (13:28 -0700)]
Simplify shash_find() followed by shash_add() into shash_add_once().
This is just a cleanup.
Ben Pfaff [Tue, 29 Jun 2010 21:58:05 +0000 (14:58 -0700)]
ovs-pki: Allow generating certificates with duplicate subjects.
Without this setting, the certificate authorities that ovs-pki creates will
not allow two switches or two controllers to have the same name. This
causes problem in testing, since it's often convenient to test with short,
common names like "tmp".
(If you need to fix a PKI that you already created, in addition to
modifying ca.cnf you will need to make the same change to index.txt.attr.)
CC: Pierre Ettori <pettori@nicira.com>
Ben Pfaff [Tue, 29 Jun 2010 21:29:40 +0000 (14:29 -0700)]
doc: Change "-" to "\-" in appropriate places.
The newer manpages tend to get this right more often than the old ones,
but there were lots of places that needed to be corrected.
Ben Pfaff [Tue, 29 Jun 2010 19:32:16 +0000 (12:32 -0700)]
daemon: Clarify documentation.
CC: Yu Zhiguo <yuzg@cn.fujitsu.com>
Ben Pfaff [Tue, 29 Jun 2010 16:54:10 +0000 (09:54 -0700)]
ovs-vsctl: Add "wait-until" command.
The "wait-until" command causes ovs-vsctl to wait until a specified
condition becomes true.
Requested-by: Sajjad Lateef <slateef@nicira.com>
Ben Pfaff [Thu, 24 Jun 2010 18:16:03 +0000 (11:16 -0700)]
ovs-vsctl: Make partial matches on record names optional.
The wait-until command to be added to ovs-vsctl in an upcoming commit
doesn't really want to wait for partial matches: if I'm waiting for br1
to be created I really don't want to be fooled by br10. So this commit
adds infrastructure to avoid such partial matches.
Ben Pfaff [Tue, 29 Jun 2010 00:20:15 +0000 (17:20 -0700)]
ovs-vsctl: Prepare for more flexible database argument parsing.
The wait-until command to be added in an upcoming commit needs to support
!=, <, >, <=, and >= operators in addition to =, so this commit adds that
infrastructure.
Ben Pfaff [Thu, 24 Jun 2010 18:01:53 +0000 (11:01 -0700)]
ovs-vsctl: Allow commands to tell ovs-vsctl to try again later.
The "wait-until" command to be introduced in an upcoming commit needs to
be able to tell the ovs-vsctl main loop to try again later, since the
condition that it is looking for has not yet been satisfied. This commit
adds the infrastructure for this. (It's being broken out into a separate
commit because it modifies scattered code in ovs-vsctl.c and thus might
be easier to review this way.)
Justin Pettit [Mon, 28 Jun 2010 20:43:10 +0000 (13:43 -0700)]
debian: Correct naming in init scripts
A number of the init scripts assumed that the package name was the same
as the binary, which is not always true. This fixes those issues as
well as some incorrect names in usage messages.
Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
Ben Pfaff [Thu, 24 Jun 2010 22:02:46 +0000 (15:02 -0700)]
ovs-ofctl: Warn about flows not in normal form.
Lots of people get this wrong.
Bug #185.
Ben Pfaff [Thu, 24 Jun 2010 21:20:45 +0000 (14:20 -0700)]
ofproto: Log changes made by flow normalization.
Open vSwitch has always "normalized" flows, that is, zeroed out fields that
are wildcarded or that otherwise cannot affect whether a packet actually
matches the flow. But until now it has done so silently, which prevents
the authors of controllers from learning what is happening and makes it
less likely that they will update code on their end. This commit makes
OVS log when normalization changes a flow.
Suggested by partner.
Ben Pfaff [Fri, 25 Jun 2010 20:57:22 +0000 (13:57 -0700)]
xenserver: Avoid errors from ovs-vsctl at system shutdown.
Commit
823c5699 "interface-reconfigure: callout to datapath backend class
method on rewrite" changed "interface-reconfigure rewrite" to update
bridge external-ids in the vswitch database. But this had the side effect
of causing errors at system shutdown, since ovsdb-server gets shut down
before the rewrite action is called. This commit fixes the problem by
skipping the update if the database socket does not exist. (It's just
fine to skip the update, since the external-ids will be re-set the next
time the system boots anyhow.)
This commit fixed the problem on 5.6.810-34773p for me. I don't see the
problem at all on 5.5.0. Presumably system shutdown order has changed.
NIC-136.
CC: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Mon, 28 Jun 2010 17:34:10 +0000 (10:34 -0700)]
xenserver: Kill bond master's dhclient when bringing up bond slave.
interface-reconfigure is never explicitly called to down a bond master.
However, when it is called to up a slave it is implicit that we are
destroying the master. The "bridge" version of interface-reconfigure
always "ifdown"s the bond master in such a case, but until now the
"vswitch" version has not done so. Usually, it doesn't matter, because
the bond master network device disappears when the slave is brought up,
but one case was missed: for a bond master with an IP address obtained
via DHCP, the dhclient process needs to be killed, and we were not doing
it. This commit starts doing it (by invoking ifdown on the bond master).
The dhclient process that hangs around doesn't cause problems until the
bond master is brought back up, at which point "ifup" fails because it
refuses to start another dhclient for the same interface.
The converse behavior is also important; that is, when a bond PIF is
brought up, interface-reconfigure is expected to implicitly take down its
slave PIFs. My testing (on 5.5.0) shows that this behavior is already
correct. At any rate, this commit does not change that behavior.
Bug #2668.
Bug #2734.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Thu, 24 Jun 2010 18:35:27 +0000 (11:35 -0700)]
timeval: Hide "memory leak" from Valgrind.
In glibc, "timer_t" is a "void *" that appears to point into malloc()'d
memory. By throwing it away entirely, we leak it, which makes valgrind
complain. We really don't ever care to use the timer object again, but
we can't destroy it without stopping the periodic timer. So make it
static to avoid a warning from Valgrind.
Ben Pfaff [Fri, 25 Jun 2010 16:39:33 +0000 (09:39 -0700)]
Add AUTHORS file.
Suggested-by: Martin Casado <casado@nicira.com>
Yu Zhiguo [Fri, 25 Jun 2010 09:33:07 +0000 (17:33 +0800)]
datapath: fix header file include
linux/highmem.h should be included rather than asm/highmem.h,
otherwise openvswitch_mod cannot resolve kmap and kunmap on some arch.
Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
Ben Pfaff [Thu, 24 Jun 2010 23:06:07 +0000 (16:06 -0700)]
ovs-vsctl: Make "ovs-vsctl get <table> <record> _uuid" work.
Requested-by: Sean Brady <sbrady@gtfservices.com>
Jesse Gross [Thu, 24 Jun 2010 22:45:04 +0000 (15:45 -0700)]
docs: Correct DB init instructions in INSTALL.Linux.
We tell people to run "ovs-vsctl init" before starting
ovs-vswitchd but this causes it to hang until it times
out so add "--no-wait" as well.
Jesse Gross [Thu, 24 Jun 2010 22:31:18 +0000 (15:31 -0700)]
ovsdb-idl: Check if row->written is valid.
Commit cde3f1 "ovsdb-idl: Drop unnecessary allocation from
ovsdb_idl_txn_insert()." does lazy allocation of row->written
on the assumption that ovsdb_idl_txn_write() will handle it.
However, this isn't the case for empty rows created by something
like "ovs-vsctl init" so add a check before reading the bitfield.
Ben Pfaff [Wed, 23 Jun 2010 16:41:09 +0000 (09:41 -0700)]
vswitchd: Add entity-relationship diagram to ovs-vswitchd.conf.db.5.
I've updated http://openvswitch.org/ovs-vswitchd.conf.db.5.pdf with
example output.
Ben Pfaff [Wed, 23 Jun 2010 19:29:45 +0000 (12:29 -0700)]
tests: Tolerate ignored SIGPIPE in daemon tests.
I noticed that when I run "make check" inside an Emacs compile-mode buffer,
the "daemon --detach closes standard fds" and "daemon --detach --monitor closes
standard fds" tests failed. Investigation showed that Emacs ignores
SIGPIPE in the compile subprocess, which caused the "yes" process in these
tests to emit the message "yes: Broken pipe" and exit with status 1 instead
of dying from SIGPIPE.
This commit changes these tests to allow either behavior.
Ben Pfaff [Wed, 23 Jun 2010 16:59:49 +0000 (09:59 -0700)]
ovs-vsctl: Add details to documentation for "emer-reset" command.
Someone asked me what emer-reset really does and I had to look in the
source code to find out. It's kinder just to document it.
Ben Pfaff [Thu, 24 Jun 2010 19:56:30 +0000 (12:56 -0700)]
ovsdb-server: Implement unixctl command to reconnect JSON-RPC connections.
This feature may be useful for debugging.
Feature #2222.