Ben Pfaff [Wed, 22 Sep 2010 16:32:58 +0000 (09:32 -0700)]
xenserver: Change license of xsconsole plugin to GPLv2.
This file was under a proprietary license because it was derived from
proprietary XenServer code. That upstream code is now under GPLv2, so
change the downstream code to GPLv2 also.
Acked-by: Ian Campbell <Ian.Campbell@citrix.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 22 Sep 2010 20:14:37 +0000 (13:14 -0700)]
xenserver: Add GPLv2 license text.
xsconsole is being relicensed under GPLv2 so we need to include the text.
It would be more usual to name this file COPYING and to name the LGPLv2.1
that is already named LICENSE as COPYING.LIB, but some of the files pulled
in from XenServer say that their license is in a file named LICENSE. I
don't expect that Citrix would be willing to change that, so it seems
better to keep LGPLv2.1 named LICENSE.
Ben Pfaff [Mon, 20 Sep 2010 17:56:15 +0000 (10:56 -0700)]
ovs-vsctl: Allow "get" commands to create @names also.
This is useful for adding records that refer to other records by UUID, e.g.
ovs-vsctl \
-- set bridge br0 mirrors=@m \
-- --id=@eth0 get port eth0 \
-- --id=@eth0 get port eth1 \
-- --id=@m create mirror name=mymirror select-dst-port=@eth0 \
select-src-port=@eth0 output-port=@eth1
Ben Pfaff [Tue, 21 Sep 2010 21:27:51 +0000 (14:27 -0700)]
tests: Add 5-second timeout to ovs-vsctl tests.
Otherwise some of the tests may not terminate if something goes wrong.
(Formerly, ovs-vsctl had a default timeout of 5 seconds, so this was not
necessary before.)
Ethan Jackson [Fri, 17 Sep 2010 23:05:04 +0000 (16:05 -0700)]
xenserver: reload sends SIGHUP to monitor-external-ids
When the init script's reload function is called it will send a
SIGHUP to monitor-external-ids. This will cause
monitor-external-ids to re-generate everything.
Simon Horman [Tue, 21 Sep 2010 03:06:13 +0000 (12:06 +0900)]
debian: Dont fail init if module cant be inserted
The problem here is that the daemon is started/restarted on
package installation, but the module may not be present at that
time and (as far as I know) its bad form to fail the package installation
in that circumstance.
In keeping with the way ipvsadm handles a similar problem,
exit with a non-error exit status if the module can't be inserted.
The loud error message is still displayed.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Fri, 17 Sep 2010 22:06:17 +0000 (15:06 -0700)]
python: timer_wait_until calculated current time incorrectly
The timer_wait_until function in poller.py was using Time.msec to
figure out the current time. Unfortunately, Time.msec does not in
exist. Changed to use ovs.timeval.msec .
This installs the Python runtime bindings for
Open vSwitch database into
/usr/share/python-support/openvswitch-python/ovs and
/usr/share/python-support/openvswitch-python/ovs/db
Updated FSF address in copyright file
Minor Whitespace re-formatting
Removed prerm, preinst, postinst files for openvswitch-python
Ben Pfaff [Thu, 2 Sep 2010 17:09:09 +0000 (10:09 -0700)]
Avoid shadowing local variable names.
All of these changes avoid using the same name for two local variables
within a same function. None of them are actual bugs as far as I can tell,
but any of them could be confusing to the casual reader.
The one in lib/ovsdb-idl.c is particularly brilliant: inner and outer
loops both using (different) variables named 'i'.
Ben Pfaff [Thu, 2 Sep 2010 17:06:42 +0000 (10:06 -0700)]
ovsdb: Fix bug in "wait" command implementation.
The declaration of "error" that this commit removes shadowed an outer local
declaration of "error", which caused errors detected by this code not to be
propagated up to the outer level.
The number of ovs-vsctl calls required to add a new vif in
monitor-external-ids grew linearly with the number of vifs in the
system. Changed to only do O(1) ovs-vsctl calls per vif addition.
Ben Pfaff [Fri, 17 Sep 2010 21:37:51 +0000 (14:37 -0700)]
ovs-vsctl: Remove default timeout.
On overloaded XenServers the current default timeout of 5 seconds can
occasionally be reached, which causes VM startup to fail. This commit
fixes the problem by removing the default timeout and changing each
invocation of ovs-vsctl within the tree to specify its own timeout,
if appropriate.
Nothing uses it anymore and it causes problems when backported on
some distributions. Kernels we support have net_random(), which
is the same thing so there is no reason to have an entire copy of
the random number generator in our source tree.
Reported-by: Alexey I. Froloff <raorn@altlinux.org> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Wed, 15 Sep 2010 08:51:40 +0000 (01:51 -0700)]
debian: Created a debian equivalent to xen-bugtool
ovs-bugtool creates a tarball of useful information which people
can submit with bug reports. The source is copied from xen-bugtool
with the xen specific removed or changed.
Ethan Jackson [Wed, 15 Sep 2010 08:51:15 +0000 (01:51 -0700)]
debian: Init script should put core dumps in an appropriate place
Before this commit the init script did not change the cwd of
openvswitch processes it started. Thus, core files were created in
root directory. This patch changes the cwd of openvswitch to
a more reasonable location.
brcompat_mod: Check if user has CAP_NET_ADMIN in ioctl handler
This patch checks that the user calling ioctl() to create, delete, or
modify bridges has the CAP_NET_ADMIN capability. This prevents
unpriviledged users from modifying the bridge configuration through
brcompatd. The checks are actually the same performed in
net/bridge/br_ioctl.c by the Linux kernel.
Signed-off-by: Vivien Bernet-Rollande <vbr@soprive.net> Signed-off-by: Jesse Gross <jesse@nicira.com>
flow_actions_alloc() returns an error code in the form of a pointer
but we checked that the pointer was not NULL, which is always true.
This caused oopses on allocation errors when we would write into
an invalid pointer.
NIC-234
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 15 Sep 2010 22:21:03 +0000 (15:21 -0700)]
ovs-ofctl, ovs-controller: Disable flow idle timeout by default.
Until now, flows set up by ovs-ofctl and by "ovs-controller --with-flows"
by default expired after 60 seconds of inactivity. This was surprising,
especially in the latter case where one is normally trying to set up
permanent flows. Even in the former case, however, we can't think of a
good reason that flows added by ovs-ofctl should expire by default. So
this commit make flows permanent by default.
Ben Pfaff [Tue, 14 Sep 2010 20:32:36 +0000 (13:32 -0700)]
datapath: Increase maximum number of actions per flow.
Until now the number of actions in a flow has been limited to what fits in
a page. Each action is 8 bytes, and on 32-bit architectures there is a
12-byte header, so with 4-kB pages that limits flows to 510 actions. We
and Citrix have noticed that OVS stops working properly after about 509
VIFs are added to a bridge. According to log messages this is the reason:
at this point it is no longer possible to flood a packet to all ports.
This commit should help, by increasing the maximum number of actions in a
flow. In the long term, though, we should adopt use of port groups or
otherwise reduce the number of actions needed to flood a packet.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Bug #3573.
NIC-234.
The default MTU on patch ports was 1500, which would cause jumbo frames
to get dropped between the ends of the patch. It also dropped the MTU
of attached bridges to no more that 1500 bytes. This patch increases
the default MTU to 65535. Long term, we should eliminate MTU on patch
ports entirely.
Ben Pfaff [Mon, 13 Sep 2010 16:16:29 +0000 (09:16 -0700)]
REPORTING-BUGS: Rewrite based on experience.
Burying the description of the problem, which is usually the most important
part in my experience, at the bottom of the REPORTING-BUGS file might be
the reason why we don't get good descriptions sometimes. It is certainly
not the reason in other cases, but we might as well prioritize a bit
better.
xenserver: Don't delete pidfile when stopping monitor-external-ids
It's not necessary to explicitly delete the pidfile when stopping
monitor-external-ids through the init script, since the daemon will take
care of that.
xenserver: Don't monitor external-ids until XAPI is up
monitor-external-ids can't complete all its tasks until XAPI is up. The
daemon is usually started before XAPI, so it can miss events. This
commit causes the daemon to block until XAPI is finished initializing.
Ben Pfaff [Wed, 1 Sep 2010 17:17:40 +0000 (10:17 -0700)]
ofproto: Get enough headroom in fail-open when connected to controller.
Since commit 750638bb "ofproto: Avoid ofpbuf_clone() for OFPAT_CONTROLLER
common case," send_packet_in() needs at least DPIF_RECV_MSG_PADDING bytes
of headroom, which ofpbuf_clone() doesn't supply. This commit should fix
that.
This fixes an assertion failure in ofpbuf_prealloc_headroom() via
send_packet_in().
netflow: Send multiple records for byte counts > UINT32_MAX
When a NetFlow record is to be sent for a flow that had more than 2^32
bytes, we used to set the byte count to UINT32_MAX. With this change,
we will send out multiple records to account for all the traffic.
Simon Horman [Tue, 31 Aug 2010 02:47:28 +0000 (11:47 +0900)]
datapath: Include net/udp.h in vport-capwap.c
net/udp.h is currently included indirectly via linux/ipv6.h which is
in turn included indirectly via linux/ip.h. However, this breaks down
if CONFIG_IPV6 is not set, leading to a number of build errors.
Joe Perches [Mon, 30 Aug 2010 07:24:54 +0000 (00:24 -0700)]
treewide: Use pr_fmt and pr_<level>
Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Simon Horman <horms@verge.net.au>
[Jesse: Added missing pr_fmt in vport-gre.c and dp_sysfs_dp.c] Signed-off-by: Jesse Gross <jesse@nicira.com>
Jesse Gross [Mon, 30 Aug 2010 17:56:49 +0000 (10:56 -0700)]
datapath: Add compat functions for pr_*.
In the earliest kernels that we support this family of macros
wasn't defined at all. Later they were defined but did not include
the module name. Finally, pr_warn was made a synonym for pr_warning.
This harmonizes the behavior across all kernels.
Ben Pfaff [Mon, 30 Aug 2010 17:08:06 +0000 (10:08 -0700)]
INSTALL.Linux: Don't discourage building Debian packages.
For a while the Debian packages were not well maintained or regularly used,
but we at Nicira use them all the time now. We now aim to have them
accepted into Debian downstream, so we should at least not discourage
users from trying them out.
Ben Pfaff [Fri, 13 Aug 2010 17:46:12 +0000 (10:46 -0700)]
datapath: Avoid accesses past the end of skbuff data in actions.
Some of the flow actions that modify skbuff data did not check that the
skbuff was long enough before doing so. This commit fixes that problem.
Previously, the strategy for avoiding this was to only indicate the layer-3
nw_proto field in the flow if the corresponding layer-4 header was fully
present, so that if, for example, nw_proto was IPPROTO_TCP, this meant
that a TCP header was present. The original motivation for this patch was
to add corresponding code to only indicate a layer-2 dl_type if the
corresponding layer-3 header was fully present. But I'm now convinced that
this approach is conceptually wrong, because the meaning of a layer-N
header should not be affected by the meaning of a layer-(N+1) header.
This commit switches to a new approach. Now, when a header is missing, its
fields in the flow are simply zeroed and have no effect on the "type" field
for the outer header. Responsibility for ensuring that a header is fully
present is now shifted to the actions that wish to modify that header.
Ben Pfaff [Fri, 27 Aug 2010 19:41:00 +0000 (12:41 -0700)]
datapath: Fix default value of skb transport_header.
This commit started out as simply better documenting flow_extract(),
but then I realized that nothing cares about transport_header in the
non-IP case, so don't bother with it at all.
Ben Pfaff [Thu, 12 Aug 2010 22:37:47 +0000 (15:37 -0700)]
datapath: Avoid pskb_may_pull() checks where not needed.
These calls to pskb_may_pull() can be reduced to checks on skb->len because
in these contexts those headers will already have been pulled into the
skb linear area if it is there at all.
Ben Pfaff [Fri, 27 Aug 2010 19:32:05 +0000 (12:32 -0700)]
datapath: Report memory allocation errors in flow_extract().
Until now flow_extract() has simply returned a bogus flow when memory
allocation errors occurred. This fixes the problem by propagating the
error to the caller.
Ben Pfaff [Tue, 10 Aug 2010 18:23:02 +0000 (11:23 -0700)]
learning-switch: Ignore "packet_in"s caused by OFPP_CONTROLLER actions.
It seems best to ignore "packet_in"s caused by OFPP_CONTROLLER actions in
learning-switch, since someone might be experimenting and it's best not
to interfere with that.
Ben Pfaff [Tue, 10 Aug 2010 18:05:01 +0000 (11:05 -0700)]
ofproto: Avoid ofpbuf_clone() for OFPAT_CONTROLLER common case.
This additionally optimizes the common case of the first packet of a flow
that consists only of an OFPAT_CONTROLLER action, by avoiding an
ofpbuf_clone() call along that path.
Ben Pfaff [Wed, 4 Aug 2010 21:08:26 +0000 (14:08 -0700)]
ofproto: Avoid user->kernel->user round-trip for many controller actions.
When an OpenFlow flow says to send packets to the controller, until now
ofproto has executed that using dpif_execute(), which passes the packet up
to the kernel. The kernel queues the packet into its "action" queue, and
then later ofproto pulls the packet back down from the kernel and sends it
to the controller.
However, this is unnecessary. Open vSwitch can just recognize in advance
that it will get the packet back and handle it directly, skipping the round
trip. This commit implements this optimization.
This generally affects only the first packet in a flow, since generally the
rest come directly down from the kernel. It only optimizes the "easy" case
where the first action in a flow is to send the packet to the controller,
since this seems to be the common case in the flows that I'm looking at
now.
Ben Pfaff [Fri, 20 Aug 2010 18:26:03 +0000 (11:26 -0700)]
configure: Enable OpenSSL support by default.
Years ago some users had broken OpenSSL libraries that didn't actually
work, so we disabled OpenSSL by default. By now, I hope that those users
have fixed their systems.
Ben Pfaff [Tue, 24 Aug 2010 23:00:27 +0000 (16:00 -0700)]
Add Nicira extension to OpenFlow for dropping spoofed ARP packets.
"ARP spoofing" is when a host claims an incorrect association between an
IP address and a MAC address for deceptive purposes. OpenFlow by itself
can prevent a host from sending out ARP replies from an incorrect MAC
address in the Ethernet L2 header, but it cannot control the MAC addresses
inside the ARP L3 packet. This commit adds a new action that can be used
to drop these spoofed packets.
CC: Paul Ingram <paul@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Thu, 26 Aug 2010 16:56:25 +0000 (09:56 -0700)]
vswitchd: Fix 100% CPU usage with bonds and --fake-proc-net.
The current date in milliseconds since the epoch is ~1,282,841,552,000,
which is greater than LONG_MAX of 4,294,967,295 on 32-bit systems, so
no matter what was stored into bond_next_fake_iface_update, it would always
appear to be expired. It really needs to be a 64-bit number. (This was
just a typo really.)
Since XenServer 5.5 requires --fake-proc-net, this probably fixes an
important bug there.
Ben Pfaff [Thu, 12 Aug 2010 22:12:28 +0000 (15:12 -0700)]
datapath: Free up flow_extract() return value for reporting errors.
flow_extract() can fail due to memory allocation errors in pskb_may_pull().
Currently it doesn't return those properly, instead just reporting a bogus
flow to the caller. But its return value is currently in use for reporting
whether the packet was an IPv4 fragment. This commit switches to reporting
that in the skb itself so that the return value can be reused to report
errors.
Justin Pettit [Tue, 24 Aug 2010 21:50:06 +0000 (14:50 -0700)]
xenserver: Add monitor-external-ids daemon
The monitor-external-ids daemon monitors the external_ids columns of the
Bridge and Interface OVSDB tables. Its primary responsibility is to
set the "bridge-id" and "iface-id" keys in the Bridge and Interface
tables, respectively. It also looks for the use of "network-uuids" in
the Bridge table and duplicates its value to the preferred
"xs-network-uuids".
Justin Pettit [Thu, 5 Aug 2010 01:52:17 +0000 (18:52 -0700)]
xenserver: Report the system type and version as external ids
The configuration schema defines the system-type and system-version
external-ids for the Open_vSwitch table. This commit adds support for
reporting them on XenServer.
Justin Pettit [Wed, 4 Aug 2010 06:00:04 +0000 (23:00 -0700)]
vswitch: Break out XenServer-specific external ids
As we move to new platforms, not all external identifiers will be
universally unique, but the "-uuid" suffix seemingly prevents their use.
Create new identifiers without the "-uuid" suffix. Change the existing
XenServer-specific external identifiers to contain a "xs-" prefix. This
also allows a XenServer integrator to define identifiers different from
the XenServer UUIDs, but still leave them in the config database to be
used by other programs.
Ben Pfaff [Sat, 21 Aug 2010 22:39:27 +0000 (15:39 -0700)]
Delete local copy of simplejson.
The previous commit dropped usage of simplejson from the Python
code in the tree, because it did not provide adequate features to
support the JSON-RPC engine. In particular simplejson is not a
"push parser"--you can't give it a byte or a character at a time
and have it tell you when it has read a whole JSON value.
Ben Pfaff [Wed, 25 Aug 2010 17:26:40 +0000 (10:26 -0700)]
Implement initial Python bindings for Open vSwitch database.
These initial bindings pass a few hundred of the corresponding tests
for C implementations of various bits of the Open vSwitch library API.
The poorest part of them is actually the Python IDL interface in
ovs.db.idl, which has not received enough attention yet. It appears
to work, but it doesn't yet support writes (transactions) and it is
difficult to use. I hope to improve it as it becomes clear what
semantics Python applications actually want from an IDL.
Ben Pfaff [Mon, 23 Aug 2010 19:18:05 +0000 (12:18 -0700)]
stream, vconn: Fix comments.
All streams and all vconns are "active", so there's no point in noting that
requirement in comments. (A long time ago, active and passive vconns were
conflated instead of having passive vconns broken out as pvconns. But
active and passive streams have always been distinct.)