Ben Pfaff [Mon, 7 Dec 2009 21:02:37 +0000 (13:02 -0800)]
vswitchd: Avoid segfault when local port is required but missing.
Connecting to a controller requires the vswitch to have a local port
(typically named the same as the bridge itself). Before the introduction
of ovsdb ovs-vswitchd simply added the local port itself if it was missing.
This was not properly implemented with the ovsdb transition, and a segfault
resulted. This commit avoids the segfault, although it should possibly
be improved to also add the local port, as before.
Jesse Gross [Sun, 6 Dec 2009 02:49:37 +0000 (18:49 -0800)]
gre: Temporary workarounds for GRE on Xen.
Two issues exist that prevent GRE tunnels from working properly on
Xen: iptables rules and brcompatd. The first issue is that GRE
traffic is not permitted by the default iptables rules. The second
is that brcompatd removes ports from the configuration that it
believes do not exist, which causes GRE ports to be deleted before
they are created.
This commit avoids these issues though not in the most optimal way.
Better fixes will be forthcoming in the near future.
Jesse Gross [Sun, 6 Dec 2009 00:01:06 +0000 (16:01 -0800)]
gre: Add userspace GRE support.
This implements the userspace portion of GRE on Linux. It communicates
with the kernel module to setup tunnels using either Netlink or ioctls
as appropriate based on the kernel version.
Significant portions of this commit were actually written by
Justin Pettit.
Jesse Gross [Sun, 6 Dec 2009 23:10:35 +0000 (15:10 -0800)]
gre: Add kernel GRE support.
This implements the kernel portion of GRE on Linux. It consists
of a backported module that provides the GRE capabilities of 2.6.32
plus bug fixes to kernels 2.6.18+.
Jesse Gross [Thu, 3 Dec 2009 02:56:36 +0000 (18:56 -0800)]
gre: Compatibility with older Linux kernel versions.
The upcoming GRE kernel module compiles on a range (2.6.18+) of
Linux kernel versions. The module expects the kernel headers to
look like newer versions. Where older and newer versions of the
kernel differ this commit implements shims to paper over the changes.
Jesse Gross [Mon, 7 Dec 2009 05:37:57 +0000 (21:37 -0800)]
netflow: Correctly set active timeout value.
This fixes a bug originally introduced in commit 763435 "vswitchd:
Initial conversion to database-based configuration." The bug
reversed a less than operator when setting the active timeout field.
Also add a warning if the timeout is set to an invalid value.
Ben Pfaff [Thu, 3 Dec 2009 18:59:09 +0000 (10:59 -0800)]
vswitchd: Remove vestigial spanning tree protocol (STP) support.
ovs-vswitchd has never supported spanning tree protocol, but there was
nevertheless a considerable amount of code that provided a framework for
supporting it.
This commit deletes this code, since we have no plans to introduce STP
support soon.
Ben Pfaff [Thu, 3 Dec 2009 18:35:45 +0000 (10:35 -0800)]
ovsdb-idl: Fix resolution of references from one table to another.
Our tests only checked references from a table to itself, so of course
there were bugs in references from one table to another. This fixes the
obvious one and adds a test.
Ben Pfaff [Thu, 3 Dec 2009 18:34:26 +0000 (10:34 -0800)]
ovsdb-idlc: C code generation improvements.
This eliminates many casts from the IDL's generated C code and reduces the
number of levels of indirection for simple cases of optional string or
pointer columns.
Justin Pettit [Tue, 1 Dec 2009 09:14:33 +0000 (01:14 -0800)]
netdev: Allow explicit creation of netdev objects
This change adds netdev_create() and netdev_destroy() functions to allow
the creation of network devices through the netdev library. Previously,
network devices had to already exist or be created on demand through
netdev_open(). This caused problems such as not being able to specify
TAP devices as ports in ovs-vswitchd, which this patch fixes.
This also lays the groundwork for adding GRE and VDE support.
Justin Pettit [Tue, 24 Nov 2009 01:24:58 +0000 (17:24 -0800)]
ovsdb-idlc: Remove "sha" deprecation warning
The "sha" module was deprecated in Python 2.5 and calling ovsd-idlc prints
a warning in Python 2.6. The module is not actually being used, so this
just removes the offending import.
Ben Pfaff [Tue, 24 Nov 2009 00:07:36 +0000 (16:07 -0800)]
ovsdb: Add ovsdb IDL compiler to build system.
This first stab at any interface definition language and compiler for OVSDB
will give other developers a chance to look at it and try to integrate it.
The IDL is not actually implemented yet; I am working on that.
Ben Pfaff [Mon, 23 Nov 2009 19:09:19 +0000 (11:09 -0800)]
dpif: New function dpif_create_and_open().
This function combines what dpif_create() and dpif_open() do. It allows
us to factor a tiny amount of code out of the vswitch, but more importantly
this function is also useful in the following commit.
Ben Pfaff [Mon, 23 Nov 2009 20:18:59 +0000 (12:18 -0800)]
socket-util: Generalize tcp_open_*() to UDP, as inet_open_*().
The tcp_open_active() and tcp_open_passive() functions don't really have
any strong dependencies on TCP. With a couple of simple changes they
can be used for UDP also. Since this is useful for Netflow, this commit
does so.
Ben Pfaff [Thu, 19 Nov 2009 21:44:49 +0000 (13:44 -0800)]
socket-util: Make TCP open function support no default port.
Until now, tcp_open_active() and tcp_open_passive() have only been used
in situations where there is a reasonable default port, e.g. OFP_TCP_PORT.
But for NetFlow there is no universal default, so enhance these functions
so that they can require the user to specify a port explicitly.
Crossported from the 'db' branch, where this is useful for JSON-RPC, which
also has no widely known port.
Ben Pfaff [Thu, 19 Nov 2009 21:25:42 +0000 (13:25 -0800)]
Move C compiler warning (-W) flags from CFLAGS to AM_CFLAGS.
C compiler warning options added by the "configure" script have until
now been put into CFLAGS. However that option is supposed to be reserved
for the user under Automake rules, so move them to AM_CFLAGS.
Besides increased adherence to Automake rules, this is useful because
AM_CFLAGS can be overridden on a per-target (e.g. program or library)
basis, whereas CFLAGS cannot. In turn, building the sFlow library (which
will be added in an upcoming commit) requires overriding the compiler
flags to avoid some warning messages. (By modifying the warning flags, we
avoid the need to modify the sFlow library in any way.)
Ben Pfaff [Thu, 19 Nov 2009 00:27:55 +0000 (16:27 -0800)]
acinclude.m4: Fix inconsistency.
Both ; and : are valid shell commands here, but one branch of the "if"
uses one and the other branch uses the other. Use the same one, for
consistency's sake.
Ben Pfaff [Fri, 20 Nov 2009 00:48:12 +0000 (16:48 -0800)]
ovsdb: Require database, table, column names to be valid identifiers.
Database, table, and column names have always been required by the OVSDB
specification to be identifiers (e.g. valid C identifiers), but this has
never been enforced.
This commit adds enforcement and fixes one instance of an invalid column
name in the vswitch schema.
Ben Pfaff [Thu, 19 Nov 2009 19:06:14 +0000 (11:06 -0800)]
netdev: Really set output values to 0 on failure in netdev_get_features().
The comment on netdev_get_features() claimed that all of the passed-in
values were set to 0 on failure, but the implementation didn't live up
to the promise.
Ian Campbell [Thu, 19 Nov 2009 18:20:49 +0000 (10:20 -0800)]
datapath: Use HAVE_PROTO_DATA_VALID when defining vswitch_skb_checksum_setup
The purpose of the non-empty variant of vswitch_skb_checksum_setup is to
synchronise the proto_data_valid and proto_csum_blank fields into the
standard skb csum/ip_summed fields, therefore it is more correct to key
off of HAVE_PROTO_DATA_VALID.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Ben Pfaff [Wed, 18 Nov 2009 23:56:57 +0000 (15:56 -0800)]
datapath: Fix warning building datapath on pre-2.6.24 kernels.
The Linux 'min' macro checks that its arguments have the same type, and
if not the compiler reports a message about incompatible pointer types.
On pre-2.6.24 kernels skb_headroom() returns int, so this code was
firing a warning:
unsigned headroom = max(min_headroom, skb_headroom(skb));
This commit makes skb_headroom() return an unsigned int regardless of
kernel version.
Ben Pfaff [Wed, 18 Nov 2009 23:19:50 +0000 (15:19 -0800)]
datapath: Check for proto_data_valid member instead of kernel version.
Commit 5ef800a69 "datapath: Copy Xen's checksumming fields when doing
skb_copy" should copy proto_data_valid between sk_buffs when that field
is present. However the check for CONFIG_XEN plus kernel version 2.6.18
isn't sufficient, because SLES 11 kernels are version 2.6.27 but do have
this field.
This commit adds a configure-time check for the presence of the member
instead of attempting to guess based on the kernel version.
Thanks to Ian Campbell for reporting this problem.
Jesse Gross [Wed, 18 Nov 2009 03:03:27 +0000 (19:03 -0800)]
datapath: Allow minimum headroom to be set when copying buffers.
If we need to copy an sk_buff in order to make it writable, allow
the minimum headroom to be specified. This ensures that if we
need to add additional data, such as a VLAN tag, we will not have
to make a second copy.
Jesse Gross [Wed, 18 Nov 2009 01:28:00 +0000 (17:28 -0800)]
datapath: Copy Xen's checksumming fields when doing skb_copy.
Two fields that control checksumming were added to sk_buff in
Xen: proto_data_valid and proto_csum_blank. These fields are copied
when doing a skb_clone but not in other functions such as skb_copy,
which can lead to checksum errors in TCP and UDP when offloading is
enabled in the guest. To fix this we manually copy these fields,
though ideally this should be fixed upstream in Xen.
Ben Pfaff [Wed, 18 Nov 2009 19:05:00 +0000 (11:05 -0800)]
datapath: Fix build with kernel header layout recently adopted by Debian.
Recent Debian kernel-header packages divide kernel headers into two
directories: the "common" headers that are not architecture-specific,
which go in a directory named like
/usr/src/kernel-headers-2.6.31-1-common,
and architecture-specific headers in a directory named, e.g.
/usr/src/kernel-headers-2.6.31-1-686.
OVS needs to look at the ones in the "common" directory as part of its
configuration process, but the build directory provided on --with-l26 is
the architecture-specific directory. We also need the
architecture-specific directory, since it is the one that we use as part
of the "make", so we can't simply make the user specify the common
directory on --with-l26. Furthermore, there is no easy-to-see link
between the two directories, except as part of the text in a Makefile,
which is not the easiest language to parse.
This commit attempts to kluge around the problem by using the Debian
directory naming. If the build directory does not contain the headers,
then we replace the last component of its name by "-common" and check
for the headers there. This is not ideal, but it does solve the actual
problem at hand.
Tested with Debian's linux-headers-2.6.31-1-686 and with a few older
sets of headers that do not use this scheme.
Justin Pettit [Tue, 17 Nov 2009 01:58:26 +0000 (17:58 -0800)]
ovs-ofctl: Add support for transport and network modification actions
Add support to ovs-ofctl for modifying the network source and destination
IP address with the "mod_nw_src" and "mod_nw_dst" actions, respectively.
And support modifying the TCP/UDP source and destination ports with the
"mod_tp_src" and "mod_tp_dst" actions, respectively.
Justin Pettit [Tue, 17 Nov 2009 02:08:12 +0000 (18:08 -0800)]
ofproto: Support missing set_nw_dst and set_tp_dst translations
The function that translates OpenFlow actions into datapath actions was
missing definitions for OFPAT_SET_NW_DST and OFPAT_SET_TP_DST. This
meant those actions would not occur in the datapath.
Justin Pettit [Tue, 17 Nov 2009 01:51:31 +0000 (17:51 -0800)]
datapath: Calculate proper checksum for set_tp_src/dst action
When the set_tp_src or set_tp_dst action is used, the calculation for
where the checksum is located was wrong. This caused the checksum to
not be updated and packet corruption in the bad offset.
Justin Pettit [Tue, 17 Nov 2009 00:36:21 +0000 (16:36 -0800)]
ovs-appctl: Fix shadow variable that could cause segfault
The variable "socket_name" contains the name of the unix domain socket
to be used for communicating with the OVS process. If the target does
not begin with a "/", the socket name is determined based on a pidfile.
A shadow copy of "socket_name" was kept in the block that looks at the
pidfile, which would cause the function-level one to not be set. This
removes that shadow copy.
Ben Pfaff [Tue, 17 Nov 2009 00:18:02 +0000 (16:18 -0800)]
ovsdb-server: Ignore replies to echo requests.
Until this commit, ovsdb-server would send off echo requests when the
connection became idle, but then it would terminate the connection when
the reply arrived, because it didn't recognize that it was a reply to its
own request (!).
Ben Pfaff [Mon, 16 Nov 2009 23:09:50 +0000 (15:09 -0800)]
ovsdb-server: Maintain the database lock with --detach.
Before this commit, "ovsdb-server --detach" would detach after it opened
the database file, which meant that the child process did not hold the
file lock on the database file (because a forked child process does not
inherit its parents' locks). This commit fixes the problem by making
ovsdb-server open the database only after it has detached. This fix, in
turn, required that daemonize() not chdir to /, because this would break
databases whose names are given relative to the current directory, and so
this commit also changes ovsdb-server to do so later.
Ben Pfaff [Fri, 13 Nov 2009 21:37:55 +0000 (13:37 -0800)]
ovsdb: Add replication support and refactor files in terms of replication.
An upcoming commit will add support for replicating tables across JSON-RPC
connection. As a prerequisite ovsdb itself must support basic replication.
This commit adds that support and then reimplements the ovsdb file storage
in terms of that replication.
Justin Pettit [Sat, 14 Nov 2009 02:53:28 +0000 (18:53 -0800)]
ofproto: Update time of super-rule to match sub-rule
Rules keep track of their creation and last used time. When a sub-rule
is updated, it wasn't updating the time of its super-rule. This commit
fixes that behavior.
Thanks to Jesse Gross for the help tracking this down.
Justin Pettit [Fri, 13 Nov 2009 23:51:44 +0000 (15:51 -0800)]
ovs-openflowd: Setup default listener
By default, ovs-openflowd was not listening for any management
connections. Tools such as ovs-ofctl attempt to use a default location
based on the datapath name. This change creates that default listener.
We were reporting flow expirations for the hidden exact match flows
with the stats set to zero. These are an implementation detail and
can confuse controllers, so don't report them.
Jesse Gross [Thu, 12 Nov 2009 23:58:18 +0000 (15:58 -0800)]
ofproto: Distinguish stats from before and after action changes.
When a rule is revalidated and the actions change don't lump all
the stats together. This will clear the stats in the datapath
and send a NetFlow expiration message. This could already happen
before in certain circumstances so this change makes it more
consistent.
Ian Campbell [Tue, 10 Nov 2009 09:23:51 +0000 (09:23 +0000)]
xenserver: interface-reconfigure and vif hotplug relicensing.
As part of the Open Sourcing of xapi (the XenServer toolstack) via the
XenCloud project (announcement in [0]). The upstream versions of
interface-reconfigure and the vif hotplug script have been re-licensed
under an LGPL v2.1 + exception license. The exception applies to other
files in the upstream repository and doesn't particularly make sense for
these scripts but it is included to maintain the uniformity of the
license for the upstream repository.
This patch synchronises the licenses headers on those scripts with the
upstream version. Since those headers refer to a file called LICENSE in
the upstream repository I have included a copy here, slightly modified
to indicate precisely which files it applies to.
Git shows[1] that only myself and Nicira employees have made
modifications to these scripts in the openvswitch repository. The
licensing change has been okayed by Keith Amidon on behalf of Nicira.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
[0]
http://lists.xensource.com/archives/html/xen-devel/2009-11/msg00117.html
Jesse Gross [Thu, 12 Nov 2009 20:44:44 +0000 (12:44 -0800)]
ofproto: Correctly credit stats for displaced rules.
When a rule displaces another, we are supposed to credit the stats
for packets that have already been processed to the displaced rule
before we eject it from the datapath. However, we were instead
crediting the new rule.