Ben Pfaff [Tue, 8 Jun 2010 16:51:41 +0000 (09:51 -0700)]
PORTING: Fix some typos.
Reported-by: Justin Pettit <jpettit@nicira.com>
Justin Pettit [Tue, 8 Jun 2010 05:51:56 +0000 (22:51 -0700)]
Open vSwitch: Be more definitive about fixing wdp issues in PORTING
Ben Pfaff [Mon, 7 Jun 2010 21:05:56 +0000 (14:05 -0700)]
Add guide to porting Open vSwitch.
Ian Campbell [Fri, 4 Jun 2010 15:47:20 +0000 (16:47 +0100)]
xenserver: call "interface-reconfigure rewrite" instead of refresh-network-uuids
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Ian Campbell [Fri, 4 Jun 2010 15:39:10 +0000 (16:39 +0100)]
interface-reconfigure: callout to datapath backend class method on rewrite
Use this mechanism to allow the vswitch backend to update the vswitch
configuration's mapping from datapath to XenAPI datamodel Network
UUIDs. The vswitch needs a mechanism to update these when they change
(i.e. on pool join and eject).
Refactor the DatapathFactory method to return the class which the
caller can instantiate or not as the require.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Ben Pfaff [Thu, 3 Jun 2010 18:41:43 +0000 (11:41 -0700)]
ovs-xenserverd: Fix time-delay logic.
network_uuid_refresh_run() needs to update pool_conf_mtime as soon as it
notices a change. Otherwise it thinks that the mtime has changed every
time it is called and therefore never actually runs the refresh script.
Bug #2097.
Ben Pfaff [Fri, 4 Jun 2010 17:02:15 +0000 (10:02 -0700)]
xenserver: Update network UUIDs whenever XAPI restarts.
XAPI calls the "update" method of the vswitch-cfg-update plugin whenever it
starts or restarts. Thus, this is a good place to trigger updating network
UUIDs. This commit implements that behavior. This should fix the problem
of network UUIDs not being updated on pool join, since XAPI restarts when
it joins a pool.
When XenServer 5.5 support is no longer interesting, we should integrate
the refresh-network-uuids script into the XAPI plugin.
Lightly tested, works for me on 5.6.810-31078p.
See-also: http://openvswitch.org/pipermail/dev_openvswitch.org/2010-June/002216.html
Suggested-by: Rob Hoes <rob.hoes@citrix.com>
Bug #2097.
Jesse Gross [Wed, 2 Jun 2010 23:26:46 +0000 (16:26 -0700)]
bridge: Filter some gratuitous ARPs on bond slaves.
Normally we filter out packets received on a bond if we have
learned the source MAC as belonging to another port to avoid packets
sent on one slave and reflected back on another. The exception to
this is gratuitous ARPs because they indicate that the host
has moved to another port. However, this can result in an additional
problem on the switch that the host moved to if the gratuitous ARP is
reflected back on a bond slave. In this case, we incorrectly relearn
the slave as the source of the MAC address. To solve this, we lock the
learning entry for 5 seconds after receiving a gratuitous ARP against
further updates caused by gratuitous ARPs on bond slaves.
Bug #2516
Reported-by: Ian Campbell <ian.campbell@citrix.com>
Ian Campbell [Thu, 3 Jun 2010 14:35:51 +0000 (15:35 +0100)]
xenserver: make ovs-xenserverd startup configurable and disable it for 5.6.0 onwards.
In my testing with XenServer 5.6.810 without ovs-xenserverd the
vswitch bridge external-id network-uuid field was always kept up to
date over both pool join and pool eject. I believe this is because
xapi is restarted on both pool join and pool eject and on restart all
PIFs are plugged again. This causes the vswitch field to be updated,
either via a call to interface reconfigure or via an explicit
ovs-vsctl call in the case of internal networks.
I think the only reason this daemon would still be required with
XenServer 5.5 is that the explicit call to ovs-vsctl for internl
networks is not present there.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Ben Pfaff [Wed, 2 Jun 2010 22:35:15 +0000 (15:35 -0700)]
datapath: Fix mutual exclusion with bridge module.
Mutual exclusion with the Linux bridge module has always been a problem.
But I think that this new approach should work reliably. It is also
simpler.
Jesse Gross [Tue, 1 Jun 2010 21:20:59 +0000 (14:20 -0700)]
netdev: Remove may_create/may_open flags.
The most recent revision of the netdev library added may_create
and may_open flags to explicitly state the intent of the caller as
to whether the device should already be in use. This was simply
a sanity check for users of the netdev library and the configuration.
At this point the netdev library and its users are well behaved and
should no longer need to be checked. Additional checks have also
been added for incorrect configuration that mean the netdev library
is no longer the primary line of defense.
These flags themselves create problems because it is not always
easy for a library to know what the state of devices should be.
This is particularly a problem for ovs-openflowd, which expects
ports to be added by ovs-dpctl. Fixing this either requires that
the checks are so permissive to be useless or ugly hacks to get
around them. Since they are no longer needed, just remove the
checks.
This commit restores the previous behavior of ovs-openflowd to
not require that ports be specified on the command line or
cleaned up after use.
Bug #2652
CC: Natasha Gude <natasha@nicira.com>
CC: Jean Tourrilhes <jt@hpl.hp.com>
CC: 蒲彦 <yan.p.bjtu@gmail.com>
Jesse Gross [Tue, 1 Jun 2010 22:27:26 +0000 (15:27 -0700)]
netdev-linux: Give tap FD to first opener.
Tap devices can have two FDs that allow transmit and receive from
different perspectives. We previously would always share one of
the FDs among all openers. However, this is confusing to some
users (primarily the DHCP client) which expect tap devices to behave
like any other device. Now we give the tap FD to the first opener,
which knows that it has opened a tap device, and a normal system FD
to everyone else for consistency.
Jesse Gross [Tue, 1 Jun 2010 21:20:46 +0000 (14:20 -0700)]
netdev-linux: Fix tap device stats.
For tap and internal devices we swap the transmit and receive stats
to appear consistent with other devices. However, the check whether
to store the stats in a temporary location before the swap did not
include tap devices, which lead to the use of uninitialized memory
when the swap occured.
Justin Pettit [Tue, 1 Jun 2010 05:31:07 +0000 (22:31 -0700)]
Release Open vSwitch 1.0.1
Jesse Gross [Thu, 27 May 2010 23:35:45 +0000 (16:35 -0700)]
debian: Fix version number check for changelog.
The test to see if the current version is present in the Debian
changelog wasn't properly quoted so we would add a new entry every
time configure was run.
Ben Pfaff [Thu, 27 May 2010 22:29:29 +0000 (15:29 -0700)]
datapath: Check for skb_cow_head(), not skb_cow().
skb_cow() has been present since 2.6.12 or earlier, but skb_cow_head() was
added only in 2.6.23, so we were checking for the wrong identifier here.
Ben Pfaff [Thu, 27 May 2010 21:11:01 +0000 (14:11 -0700)]
datapath: <linux/if_vlan.h> needs <linux/skbuff.h> on some kernels.
Otherwise this fails to build on 2.6.18.
Ben Pfaff [Thu, 27 May 2010 21:40:25 +0000 (14:40 -0700)]
configure: Deep-six "5".
Perhaps you've noticed that whenever you run "configure" you end up with
a file named "5" in your current directory. This commit fixes that
problem.
Ben Pfaff [Thu, 27 May 2010 20:03:45 +0000 (13:03 -0700)]
datapath: Fix VLAN insertion behavior on Linux 2.6.27 and 2.6.28.
The behavior of __vlan_put_tag() has changed over time:
- In 2.6.26 and earlier, it adjusted both MAC and network header
pointers. (The latter didn't make any sense.)
- In 2.6.27 and 2.6.28, it did not adjust any header pointers at all.
- In 2.6.29 and later, it adjusts the MAC header pointer only.
The behavior in 2.6.26 and earlier, and in 2.2.29 and later, works OK for
Open vSwitch. The 2.6.27 and 2.6.28 behavior *almost* works OK, with a few
subtle problems. If an action that sets a VLAN tag is followed by an
action that strips a VLAN tag, the "strip" action silently fails. This is
because vlan_pull_tag() in datapath/actions.c sees the encapsulated
protocol, not the 802.1Q protocol, because the MAC header was not adjusted
and does not point to the 802.1Q header. If multiple set-VLAN actions
occur in a single flow, the second and later actions will fail for the same
reason.
This commit fixes the problem by ensuring that __vlan_put_tag() always
behaves as in 2.6.29 and later.
Reported-by: Reid Price <reid@nicira.com>
Bug #2867.
Ben Pfaff [Thu, 27 May 2010 17:00:03 +0000 (10:00 -0700)]
Add dist-hook to ensure that every file gets distributed.
It's easy to add a file to the repository and forget to make sure that it
is distributed. This commit adds a hook target to the main Makefile that
causes "make dist" to fail if the tree is being built from a Git repository
and some files are not distributed.
Ben Pfaff [Wed, 26 May 2010 21:05:23 +0000 (14:05 -0700)]
Distribute files that had been overlooked.
In general, every file in the Git repository should be distributed, except
for files that are specific to Git, such as the .gitignore files. But we
had overlooked several of them. This commit makes sure that they get
distributed.
Ben Pfaff [Wed, 26 May 2010 21:03:38 +0000 (14:03 -0700)]
Remove unused files from source tree.
config-linux-2.6.23-rc9-kvm is an antique that I doubt anyone cares about.
I'd forgotten it was there.
ovsdbmonitor.py.in is an oversight. It isn't used. The file that is used,
which is also in the source tree, is ovsdbmonitor.in.
Ben Pfaff [Thu, 27 May 2010 17:06:36 +0000 (10:06 -0700)]
vswitchd: Treat gratuitous ARP requests like gratuitous ARP replies.
vswitchd has long used a gratuitous ARP reply as an indication that a VM
has migrated, because traditional xen.org Linux DomUs send such packets out
when they complete migration. Relatively recently, however, we realized
that upstream Linux does not do this. Ian Campbell tracked this down to
two separate issues:
1. A bug prevented gratuitous ARPs from being sent.
2. When this was fixed, the gratuitous ARPs that were sent were
requests, not replies, although kernel documentation sent that
replies were to be sent.
Ian submitted patches to fix both bugs. #1 is in process of revision for
acceptance. #2 was rejected: according to Dave Miller, the documentation
is wrong, not the implementation, because ARP replies would unnecessarily
fill up the ARP tables of devices on the network.
OVS has not until now treated gratuitous ARP requests specially, only
replies. Now that Linux will be using ARP requests to indicate migration,
OVS should also treat them as such.! This commit does so.
See http://marc.info/?l=linux-netdev&m=
127367215620212&w=2 for Ian's
original patch and http://marc.info/?l=linux-netdev&m=
127468303701361&w=2
for Dave Miller's response.
CC: Ian Campbell <Ian.Campbell@citrix.com>
NIC-74.
Ben Pfaff [Wed, 26 May 2010 22:53:57 +0000 (15:53 -0700)]
debian: Attempt to keep debian/changelog up-to-date.
Invariably we forget to update the version number in debian/changelog as
we change OVS's own version number. This is embarrassing.
This commit introduces two different times to automatically update the
debian/changelog version number: whenever boot.sh runs and whenever
"make dist" runs. In the latter case, only the version number in the
distributed tarball is updated, but that seems OK.
Reported by Joan Cirer <joan@ev0.net> most recently, and by others over
the last year or so too.
Ben Pfaff [Wed, 26 May 2010 22:40:15 +0000 (15:40 -0700)]
debian: Update changelog to reflect current OVS version.
Ben Pfaff [Wed, 26 May 2010 20:37:57 +0000 (13:37 -0700)]
ofproto: Avoid null pointer dereference if in_band_create() fails.
in_band_create() can fail if something goes wrong with the network device
that represents the local port. In that case update_in_band_remotes()
should not call in_band_set_remotes(), but it did anyway. This commit fixes
it.
Reported-by: Tom Everman <teverman@google.com>
Ben Pfaff [Thu, 27 May 2010 16:34:23 +0000 (09:34 -0700)]
ofproto: Fix treatment of out-of-band controllers.
This code was treated every controller as in-band, but obviously that's not
correct.
Reported-by: Jan Medved <jmedved@juniper.net>
Ben Pfaff [Thu, 27 May 2010 16:24:11 +0000 (09:24 -0700)]
datapath: Add missing #include to datapath/flow.h.
This caused a problem on builds under 2.6.26 (and possibly other versions).
Ben Pfaff [Wed, 26 May 2010 17:35:20 +0000 (10:35 -0700)]
vswitchd: Build ovs-brcompatd only on Linux systems.
This feature is Linux-specific.
Ben Pfaff [Wed, 26 May 2010 17:34:51 +0000 (10:34 -0700)]
proc-net-compat: Stub out on non-Linux.
/proc/net is Linux-specific, so there is no need to implement it on
non-Linux systems.
Ben Pfaff [Wed, 26 May 2010 17:25:19 +0000 (10:25 -0700)]
Build ovs-wdt or nlmon utilities only on Linux.
These utilities are Linux-specific.
Ben Pfaff [Wed, 26 May 2010 17:38:52 +0000 (10:38 -0700)]
lib: Disable Linux-specific libraries on non-Linux systems.
Ben Pfaff [Wed, 26 May 2010 22:32:34 +0000 (15:32 -0700)]
datapath: Make datapath-protocol.h portable to non-Linux systems.
datapath-protocol.h is not a very clean interface. I originally intended
it to be solely a Linux-kernel specific interface. Over time it became
a general-purpose interface to dpifs. This is not a good situation,
because clearly the header is still Linux-specific.
In the long run, the correct solution is to separate the generic and
Linux-specific bits. This is not that patch. Instead, this patch modifies
datapath-protocol.h enough that it can be used on non-Linux hosts. In
particular I tested that it works OK with FreeBSD 8.0.
Ben Pfaff [Wed, 26 May 2010 17:09:56 +0000 (10:09 -0700)]
datapath: Make gre.h safe to include by itself.
gre.h is Linux-specific, and it uses Linux-specific types, so it has to
#include <linux/types.h>. We probably got away with it until now because
it was always included after some other header that had already included
that one.
Ben Pfaff [Wed, 26 May 2010 17:07:22 +0000 (10:07 -0700)]
socket-util: Tolerate missing RLIM_SAVED_CUR and RLIM_SAVED_MAX.
POSIX requires these macros, but FreeBSD 8.0 doesn't have them.
Ben Pfaff [Wed, 26 May 2010 17:37:39 +0000 (10:37 -0700)]
Add some missing "#include"s.
These are required to build on FreeBSD 8.0.
Ben Pfaff [Wed, 26 May 2010 17:05:19 +0000 (10:05 -0700)]
Always #include <sys/socket.h> before <net/if.h>.
FreeBSD 8.0's <net/if.h> requires <sys/socket.h> to be included first,
even though I don't see any such requirement in POSIX.
Ben Pfaff [Wed, 26 May 2010 19:52:06 +0000 (12:52 -0700)]
tests: Remove incorrect OVS_UNUSED from declaration.
Ben Pfaff [Wed, 26 May 2010 22:24:13 +0000 (15:24 -0700)]
tests: Speed up classifier test.
Many of the classifier tests take time exponential in the number of fields,
because the existing compare_classifiers() iterates over 2^n_fields
possibilities. This is very slow.
This commit fixes the problem by only testing a fixed number of random
possibilities instead of all of them. This makes it much, much faster.
Ben Pfaff [Wed, 26 May 2010 19:48:32 +0000 (12:48 -0700)]
tests: Break monolithic classifier test into subtests.
This makes it easier to see which tests are taking up a lot of time, and
to see which ones actually fail if any of them do.
Ben Pfaff [Wed, 26 May 2010 16:53:08 +0000 (09:53 -0700)]
tests: Avoid nonportable \x escapes in printf(1) invocation.
The \x 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).
This commit fixes the problem by using standard octal escapes instead.
Reported-by: Joan Cirer <joan@ev0.net>
Ben Pfaff [Wed, 12 May 2010 19:53:07 +0000 (12:53 -0700)]
poll-loop: New function poll_timer_wait_until().
Many of poll_timer_wait()'s callers actually want to wait until a specific
time, so it's convenient for them to offer a function that does this.
Ben Pfaff [Wed, 12 May 2010 17:56:45 +0000 (10:56 -0700)]
poll-loop: Change poll_timer_wait() parameter from "int" to "long long".
Every so often I get concerned because OVS does most of its time arithmetic
in "long long int" but poll_timer_wait() takes an "int", so there is
potential for truncating a large value to a small value or a positive value
to a negative value. That would cause excessive wakeups and possibly 100%
CPU usage.
This commit therefore changes poll_timer_wait()'s parameter type from "int"
to "long long int". The file-scope 'timeout' variable remains type "int"
because that is the type of poll()'s timeout argument.
Factoring poll_timer_wait() into two functions is not necessary here but it
comes in handy in the following patch.
Ben Pfaff [Tue, 25 May 2010 22:49:26 +0000 (15:49 -0700)]
unixctl: Sort list of commands output by "help".
Feature #2873.
Ben Pfaff [Tue, 25 May 2010 22:42:44 +0000 (15:42 -0700)]
datapath: Fix ODP_PORT_GROUP_GET implementation.
The final argument to do_get_port_group() is supposed to be a user pointer
to the number of ports, to be updated with put_user(), but it was actually
a kernel pointer, so "ovs-dpctl dump-groups" and anything else that used
this ioctl would always fail with -EFAULT. This commit fixes it.
Bug introduced in commit
44e05eca "datapath: Prepare to support 32-bit
compatibility ioctls" for normal ioctls and for compat ioctls at their
introduction in commit
3fbd517acf"datapath: Add 32-bit compatibility
ioctls."
Ben Pfaff [Tue, 25 May 2010 22:35:20 +0000 (15:35 -0700)]
Revert "Add definition of AS_ECHO for compatibility with Autoconf before 2.62."
This reverts commit
d0a5f97842ef1598d07a6e3f10bab1543a38aa4d.
Partner corrected earlier report that the reverted commit helped. It
didn't.
Ben Pfaff [Mon, 24 May 2010 16:56:30 +0000 (09:56 -0700)]
Add definition of AS_ECHO for compatibility with Autoconf before 2.62.
Requested and tested by partner.
Wei Yongjun [Mon, 24 May 2010 02:20:10 +0000 (10:20 +0800)]
datapath: introduce a method to install kernel modules
After we choose to build the Linux kernel module, install
them using make modules_install.
% ./configure --with-l26=/lib/modules/`uname -r`/build
% make
% cd datapath/linux-2.6/
% make modules_install
the openswitch kernel modules will be installed to dir
/lib/modules/`uname -r`/extra/
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Justin Pettit [Thu, 20 May 2010 20:26:48 +0000 (13:26 -0700)]
dpif: Include stat.h header
Todd Deshane [Thu, 20 May 2010 17:03:11 +0000 (10:03 -0700)]
Add instructions for using Open vSwitch with KVM.
Jesse Gross [Wed, 19 May 2010 21:12:27 +0000 (14:12 -0700)]
netdev-linux: Quiet down ingress policing.
If we attempt to remove ingress policing and receive "invalid
argument" it means that policing isn't compiled into the kernel.
If it isn't compiled in then accept that policing has been
successfully removed.
Ben Pfaff [Wed, 19 May 2010 16:43:50 +0000 (09:43 -0700)]
netflow: Use macro for constant instead of static const int.
It's just bizarre to put a static const int in a header file, at least in
C.
Jesse Gross [Wed, 19 May 2010 00:30:42 +0000 (17:30 -0700)]
gre: Check whether IPv6 is compiled into the kernel.
Add guards to check whether IPv6 is supported by the kernel instead
of causing the module to fail to load. If IPv6 is not supported
these packets can still be encapsulated but they will not receive any
special treatment such as path MTU discovery.
Jesse Gross [Fri, 14 May 2010 20:54:16 +0000 (13:54 -0700)]
patch: Remove veth driver.
Now that we have a new patch implementation, remove the veth driver
and its userspace components. Then rename 'patchnew' to 'patch'.
The new implementation is a drop-in replacement for the old one.
Jesse Gross [Fri, 14 May 2010 20:49:43 +0000 (13:49 -0700)]
netdev: Add 'patch' userspace implementation.
Add a netdev to talk to the 'patch' vport in the kenerl. Since
there is currently a 'patch' implementation using the veth driver,
this one is temporarily called 'patchnew'.
Jesse Gross [Mon, 17 May 2010 22:04:10 +0000 (15:04 -0700)]
netdev: Extract netdev vport functions.
All devices implemented as vports have a common interface, so
pull out ioctl code from the GRE netdev so it can be used in
other places as well.
Jesse Gross [Mon, 10 May 2010 20:07:28 +0000 (13:07 -0700)]
datapath: Add 'patch' vport.
Adds a new 'patch' vport that acts like a virtual patch cable to
connect together two datapaths.
Jesse Gross [Tue, 11 May 2010 00:40:22 +0000 (17:40 -0700)]
vport: Extract common functions for virtual devices.
Pull some generic implementations of vport functions out of the
GRE vport so they can be used by others.
Also move the code to set the MTUs of internal devices to the minimum
of attached devices to the generic vport_set_mtu layer.
Justin Pettit [Mon, 17 May 2010 21:13:32 +0000 (14:13 -0700)]
datapath: Fix build with backported dev_get_stats().
An upcoming backport adds dev_get_stats() to a pre-2.6.29 Linux kernel, so we
have to check for the presence of an dev_get_stats() definition instead of for
the particular kernel version.
Justin Pettit [Mon, 17 May 2010 20:57:29 +0000 (13:57 -0700)]
Don't define "skb_dst_drop" if other skb_dst accessor funcs are defined
When "skb_dst" is included in the kernel sources, don't redefine
"skb_dst_drop", which is defined in dst.h.
Justin Pettit [Mon, 17 May 2010 20:06:59 +0000 (13:06 -0700)]
datapath: Add stddef.h compat header to list of files in distributions
Older kernels won't compile without a definition of the bool values.
Wei Yongjun [Mon, 17 May 2010 07:15:44 +0000 (15:15 +0800)]
tests: fix compile warning of tests/test-ovsdb.c
This patch fixed the following compile warning:
tests/test-ovsdb.c: In function 'do_evaluate_conditions':
tests/test-ovsdb.c:744: warning: format '%2d' expects type 'int', but argument 2 has type 'size_t'
tests/test-ovsdb.c: In function 'do_execute_mutations':
tests/test-ovsdb.c:850: warning: format '%2d' expects type 'int', but argument 2 has type 'size_t'
tests/test-ovsdb.c: In function 'do_query':
tests/test-ovsdb.c:972: warning: format '%2d' expects type 'int', but argument 2 has type 'size_t'
tests/test-ovsdb.c: In function 'do_query_distinct':
tests/test-ovsdb.c:1105: warning: format '%2d' expects type 'int', but argument 2 has type 'size_t'
tests/test-ovsdb.c: In function 'parse_uuids':
tests/test-ovsdb.c:1600: warning: format '%d' expects type 'int', but argument 2 has type 'size_t'
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Wei Yongjun [Mon, 17 May 2010 07:14:55 +0000 (15:14 +0800)]
ofproto: fix compile warning of ofproto/ofproto.c
This patch fixed the following compile warning:
ofproto/ofproto.c: In function 'handle_role_request':
ofproto/ofproto.c:3543: warning: format '%zu' expects type 'size_t', but argument 5 has type 'int'
ofproto/ofproto.c: In function 'handle_vendor':
ofproto/ofproto.c:3593: warning: format '%zu' expects type 'size_t', but argument 5 has type 'int'
ofproto/ofproto.c:3602: warning: format '%zu' expects type 'size_t', but argument 5 has type 'int'
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Wei Yongjun [Mon, 17 May 2010 07:08:17 +0000 (15:08 +0800)]
ovsdb-idl: fix compile warning of lib/ovsdb-idl.c
This patch fixed the following compile warning:
lib/ovsdb-idl.c: In function 'ovsdb_idl_txn_process_inc_reply':
lib/ovsdb-idl.c:1524: warning: format '%u' expects type 'unsigned int', but argument 5 has type 'size_t'
lib/ovsdb-idl.c:1538: warning: format '%ld' expects type 'long int', but argument 5 has type 'long long int'
lib/ovsdb-idl.c:1550: warning: format '%u' expects type 'unsigned int', but argument 5 has type 'size_t'
lib/ovsdb-idl.c: In function 'ovsdb_idl_txn_process_insert_reply':
lib/ovsdb-idl.c:1579: warning: format '%u' expects type 'unsigned int', but argument 5 has type 'size_t'
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Ben Pfaff [Fri, 14 May 2010 22:44:39 +0000 (15:44 -0700)]
datapath: Fix build with backported skb_dst().
An upcoming backport adds skb_dst() to a pre-2.6.31 Linux kernel, so we
have to check for the presence of an skb_dst() definition instead of for
the particular kernel version.
Ben Pfaff [Fri, 14 May 2010 22:39:48 +0000 (15:39 -0700)]
acinclude.m4: Reorganize checks for kernel identifiers.
These were getting to be hard to read, so I put them into alphabetical
groups by file and then sorted by identifier within a file.
Justin Pettit [Sat, 15 May 2010 07:23:50 +0000 (00:23 -0700)]
Release Open vSwitch 1.0.0
Jesse Gross [Thu, 13 May 2010 23:52:14 +0000 (16:52 -0700)]
datapath: Use per_cpu_ptr instead of percpu_ptr.
percpu_ptr was removed in 2.6.30, so update the one remaining user
and take out the compatibility code.
Suggested-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Wed, 12 May 2010 20:45:49 +0000 (13:45 -0700)]
datapath: Hold rcu_read_lock where we claim to.
Many of the vport operations require that either RTNL lock or
rcu_read_lock be held. However, operations from userspace often
hold a different lock so grab rcu_read_lock as well.
Jesse Gross [Wed, 12 May 2010 19:40:45 +0000 (12:40 -0700)]
datapath: Don't expect bottom-halves to be disabled.
We currently document that BHs need to be disabled when handling
received packets. However, this isn't actually generally the
case (usually preemption is disabled but not BHs). Only one place
actually relies on BHs being disabled so fix that and update the
documentation of our expectations.
Jesse Gross [Wed, 12 May 2010 18:40:58 +0000 (11:40 -0700)]
datapath: Disable bottom-halves where necessary.
Places that update per-cpu stats without locking need to have bottom
halves disabled. Otherwise we can be running in process context and
in the middle of an operation and be interrupted by a softirq.
Jesse Gross [Wed, 12 May 2010 18:26:55 +0000 (11:26 -0700)]
datapath: Use spin_lock_bh() consistently.
We are never called in hardirq context - only process or softirq.
Therefore it is not necessary to disable interrupts with
spin_lock_irqsave(), so use spin_lock_bh() everywhere.
Ben Pfaff [Thu, 13 May 2010 23:08:14 +0000 (16:08 -0700)]
stream-ssl: Flush OpenSSL error queue after calling SSL_shutdown().
The OpenSSL manpage for SSL_get_error() says this:
In addition to ssl and ret, SSL_get_error() inspects the current
thread's OpenSSL error queue. Thus, SSL_get_error() must be used in
the same thread that performed the TLS/SSL I/O operation, and no other
OpenSSL function calls should appear in between. The current thread's
error queue must be empty before the TLS/SSL I/O operation is
attempted, or SSL_get_error() will not work reliably.
We weren't taking this advice literally enough, which meant that this
would happen:
1. Call SSL_shutdown() on one connection.
2. Call SSL_read() on another connection, returning 0 bytes. (This is
normal. It just means that no more data has arrived yet.)
3. Call SSL_get_error() for that second connection to check whether
the 0-byte return value was a real error. (This should return
SSL_ERROR_WANT_READ to indicate that more data is needed.)
4. Actually get some other error indicating that the SSL_shutdown()
call returned an error.
This commit fixes the problem by flushing the OpenSSL error queue after
calling SSL_shutdown().
Without this commit, starting an ovsdb-server with two active SSL remotes,
running two ovsdb-clients listening for connections from the ovsdb-server
remotes, then killing one of the ovsdb-clients (with e.g. Control+C), will
cause ovsdb-server to drop the other ovsdb-client connnection the next time
that SSL_read() is called on it. With this commit, this scenario works
correctly (e.g. ovsdb-server keeps the remaining connection up).
CC: Jeremy Stribling <strib@nicira.com>
Ben Pfaff [Thu, 13 May 2010 22:25:27 +0000 (15:25 -0700)]
datapath: Add 32-bit compatibility ioctls.
When a 32-bit userspace program runs on a 64-bit kernel, data structures
that contain members whose sizes or alignments change from 32- to 64-bit
must be translated when they are passed to ioctls. This commit adds such
support for openvswitch_mod.
We should really reconsider some parts of the Open vSwitch ioctl interface
to avoid needing as much translation as we do.
Lightly tested with 32-bit userspace on sparc64.
Ben Pfaff [Thu, 13 May 2010 20:18:22 +0000 (13:18 -0700)]
datapath: Avoid __copy_to/from_user(), __get/put_user() functions.
The advantages of the double-underscore variants of copy_to_user(),
copy_from_user(), get_user(), and put_user() are pretty marginal, at best,
in the places where we are using them, and it's not always obvious that we
are making the right calls to access_ok() beforehand. So switch to the
safe variants without double underscores.
Suggested-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Thu, 13 May 2010 20:21:33 +0000 (13:21 -0700)]
datapath: Prepare to support 32-bit compatibility ioctls.
This commit prepares the core of datapath.c and vport.c to reduce the
amount of new code duplication when the following commit adds support for
32-bit compatibility ioctls. It breaks a number of functions apart into
pairs of functions: one that copies data to and from userspace and another
that does the real work.
This change is a pure refactoring that should not change behavior.
Ben Pfaff [Thu, 13 May 2010 18:04:56 +0000 (11:04 -0700)]
datapath: Avoid possibility of negative 'n_ports' in struct odp_portvec.
'n_ports' should never be negative so it's better to use an unsigned type.
Suggested-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Mon, 10 May 2010 20:53:26 +0000 (13:53 -0700)]
datapath: Avoid possibility of negative 'n_flows' in struct odp_flowvec.
do_flowvec_ioctl() was checking for too-big 'n_flows' but not negative
'n_flows'. We could add that check too, but 'n_flows' should never be
negative so it's better to just use an unsigned type.
Andy Southgate [Tue, 11 May 2010 18:46:52 +0000 (11:46 -0700)]
Add ovsdbmonitor GUI tool by Andy Southgate, contributed by Citrix.
With Makefiles and Autoconfiscation by Ben Pfaff.
Signed-off-by: Thomas Lacroix <thomas.lacroix@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 12 May 2010 17:02:23 +0000 (10:02 -0700)]
daemon: Throttle max respawning rate.
If a monitored daemon dies quickly at startup, the system can waste a lot
of CPU time continually restarting it. This commit prevents a given
daemon from restarting more than once every 10 seconds.
Ben Pfaff [Tue, 11 May 2010 17:56:10 +0000 (10:56 -0700)]
daemon: Allow monitored daemon to dump core no more than once.
If the monitored daemon dumps core frequently, then this can quickly
exhaust the host's disk space. This commit limits core dumps to at most
one per monitored session (typically, once per boot).
Ben Pfaff [Thu, 13 May 2010 16:43:33 +0000 (09:43 -0700)]
ofproto: Prefer "master" and "other" connections for snooping over "slave".
This makes "ovs-ofctl snoop" and anything else that connects to the
switch's "snoop" socket typically more useful in the presence of multiple
controllers, since the "master" connection is the one with the most
interesting traffic.
Suggested-by: Justin Pettit <jpettit@nicira.com>
Ben Pfaff [Fri, 7 May 2010 16:29:02 +0000 (09:29 -0700)]
ofproto-sflow: Maintain table of ports even when clearing configuration.
When ofproto_sflow_set_options() fails, it calls ofproto_sflow_clear() to
deconfigure the ofproto_sflow object. But ofproto_sflow_clear() deletes
all of the object's record of datapath ports. That means that the next
call to ofproto_sflow_set_options(), if it succeeds, will believe that the
datapath has no ports.
This commit fixes the problem by only clearing ofproto_sflow's record of
datapath ports when it is destroyed, not just when a configuration error
occurs.
Reported-by: Neil McKee <neil.mckee@inmon.com>
Ben Pfaff [Tue, 11 May 2010 19:44:58 +0000 (12:44 -0700)]
ovs-ofctl: Add "snoop" command.
The "snoop" command does roughly the same thing as "monitor", but it is
easier to use in the common case where one just wants to look at the
OpenFlow controller connection for a bridge. Instead of, for example,
ovs-ofctl monitor unix:/var/run/openvswitch/br0.snoop
one merely types
ovs-ofctl snoop br0
Ben Pfaff [Thu, 6 May 2010 00:08:28 +0000 (17:08 -0700)]
ofproto: Don't send async messages on transient connections by default.
ofproto supports listening for "transient connections" from clients such
as ovs-ofctl. These OpenFlow connections are not supposed to receive
asynchronous messages by default, unless they ask for them by setting an
nonzero packet-in send length. This feature got broken some time back.
This commit fixes it.
Ben Pfaff [Tue, 11 May 2010 19:42:00 +0000 (12:42 -0700)]
ofproto: Fix segfault sending packet_ins on transient connections.
Ben Pfaff [Tue, 11 May 2010 19:22:17 +0000 (12:22 -0700)]
ovs-ofctl: "monitor" command takes no more than 2 arguments
The "monitor" command would accept 3 arguments and ignore the third one.
Reject such usage instead.
Ben Pfaff [Thu, 6 May 2010 00:06:10 +0000 (17:06 -0700)]
ovs-ofctl: Fix usage message for "monitor" command.
The "monitor" command takes at most two arguments, and the second one is
optional, so express that correctly.
Ben Pfaff [Wed, 5 May 2010 17:31:44 +0000 (10:31 -0700)]
Diagnose attempts to connect the wrong protocol to a network port.
Sometimes, when a user asks me to help debug a problem, it turns out that
an SSL connection was being made on a TCP port, or vice versa, or that an
OpenFlow connection was being made on a JSON-RPC port, or vice versa, and
so on. This commit adds log messages that diagnose this kind of problem,
e.g. "tcp:127.0.0.1:6633: received JSON-RPC data on OpenFlow channel".
Ben Pfaff [Mon, 10 May 2010 22:01:25 +0000 (15:01 -0700)]
vconn-stream: Refactor vconn_stream_recv() for readability.
Backward "goto" statement are rarely a good idea, so this rewrites that
code for readability.
Jesse Gross [Mon, 10 May 2010 23:16:33 +0000 (16:16 -0700)]
vport: Record and free packets on unattached ports.
We throw away packets that are received on vports not attached to
a datapath but we are actually leaking them. This records that an
error took place and frees the skb.
Jesse Gross [Tue, 11 May 2010 01:23:18 +0000 (18:23 -0700)]
flow: Zero tun_id if wildcarded.
Normally match fields are zeroed if they are wildcarded in
normalize_match(). However, tun_id isn't part of struct ofp_match
so do it when we convert to a flow instead.
Jesse Gross [Sat, 8 May 2010 01:50:23 +0000 (18:50 -0700)]
gre: Include route headers in headroom calculation.
When calculating the amount of headroom required include the route,
which avoids a copy later when doing transforms like IPsec.
Jesse Gross [Mon, 10 May 2010 20:34:41 +0000 (13:34 -0700)]
bridge: Add iface to hash table before calling iface_is_internal().
When creating an interface we need to check whether it is internal.
However, the function iface_is_internal() does a lookup on the
interface name but we haven't added it to the hash table yet. This
adds the interface to the table early on in iface_create.
NIC-78
Ben Pfaff [Mon, 10 May 2010 17:55:29 +0000 (10:55 -0700)]
bridge: Fix double-free bug in port_reconfigure().
Reported-by: Peter Balland <peter@nicira.com>
Bug #2794
Ben Pfaff [Fri, 7 May 2010 18:43:18 +0000 (11:43 -0700)]
flow: Fix misaligned access.
The testsuite for the flow extractor triggered this.
With this commit, "make check" passes on SPARC.
Ben Pfaff [Fri, 7 May 2010 21:31:04 +0000 (14:31 -0700)]
Add header for access to potentially unaligned data.
I had been under the impression that "memcpy" was a valid way to copy
unaligned data into an aligned location for access. But testing on SPARC
has shown that GCC doesn't always honor that intention. It seems that, if
GCC can see that there is a pointer of a type that requires alignment to
a given object, then it will access it directly regardless of whether
memcpy() is used to copy it.
This commit adds a new header with functions to access unaligned data. I
managed to come up with two techniques, one GCC-specific, one generic, that
do avoid the misaligned access in my test case. The GCC-specific technique
is the same one used by the Linux kernel (although no code has been
literally copied). The other one seemed obvious but possibly slow
depending on the compiler's ability to optimize.
The following commit adds a user.
Ben Pfaff [Fri, 7 May 2010 17:44:01 +0000 (10:44 -0700)]
ovsdb-client: Serialize columns in predictable order on "monitor" command.
The "monitor" command goes to some trouble to write its output in a
predictable order, so that test programs can reliably compare it against
expectations. This commit fixes up one part that was missing, which is
that the columns were not being ordered predictably (it depended on
hash order, which differs between big-endian and little-endian systems).
It also updates the test suite to expect the new order.
Ben Pfaff [Fri, 7 May 2010 17:41:06 +0000 (10:41 -0700)]
tests: Fix bug in "ovsdb-tool compact" test.
This test examines the OVSDB database log and checks that it contains what
it should for specified transactions. However, the database log ordering
differs between big-endian and little-endian architectures because it is
written out in hash order. We don't want to incur the expense of always
sorting the log as we write it out, so instead this commit fixes the
problem by sorting the log as it reads it, using the "test-json" program.
Ben Pfaff [Fri, 7 May 2010 17:38:13 +0000 (10:38 -0700)]
tests: Fix bug in "weak references" test.
One part of the "weak references" test inserts invalid all-zeros weak
references into two columns and expects to get an error message mentioning
one of them. Unfortunately the one that actually gets mentioned depends
on hash ordering and thus differs between big-endian and little-endian
machines. This commit fixes the problem by only putting an invalid
reference in a single column, instead of two of them.