Ben Pfaff [Mon, 12 Mar 2012 17:23:36 +0000 (10:23 -0700)]
Use `pwd` in place of $PWD, treewide.
The Autoconf manual says:
Posix 1003.1-2001 requires that `cd' and `pwd' must update the
`PWD' environment variable to point to the logical name of the
current directory, but traditional shells do not support this.
This can cause confusion if one shell instance maintains `PWD' but
a subsidiary and different shell does not know about `PWD' and
executes `cd'; in this case `PWD' points to the wrong directory.
Use ``pwd`' rather than `$PWD'.
so this commit replaces all uses of $PWD by `pwd`.
Reported-by: Justin Pettit <jpettit@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Mon, 12 Mar 2012 19:59:47 +0000 (12:59 -0700)]
ofproto: Fix code that keeps track of MTU.
ofport_install() should set the MTU that it finds into the ofport
before calling set_internal_devs_mtu(), because the latter function might
change the MTU and update ofport->mtu and the caller should not incorrectly
overwrite its changes.
Ben Pfaff [Mon, 12 Mar 2012 17:34:22 +0000 (10:34 -0700)]
python: Fix "make distcheck" error on version.py.
The generated version.py has to go in the srcdir and has to be regenerated
based on config.status, which breaks "make distcheck" because it
write-protects the srcdir. However, the contents of version.py only change
when the version number changes, so we can just "touch" it when it doesn't
really need to change.
The same pattern is used elsewhere in the tree for other files in the same
situation, e.g. the various RPM spec files.
Reported-by: Chris Wright <chrisw@sous-sol.org> Acked-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Fri, 9 Mar 2012 23:10:56 +0000 (15:10 -0800)]
ovsdb-doc: Use minus sign in negative numbers in nroff output.
ovs-vswitchd.conf.db.5 has autogenerated text "at least -1" in one place.
This '-' should be a minus sign, but ovsdb-doc was generating it as a
hyphen.
Found by lintian.
Reported-by: Thomas Goirand <zigo@debian.org> Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Fri, 9 Mar 2012 22:50:39 +0000 (14:50 -0800)]
ovsdb-doc: Convert '-' preceding a number as a minus sign, not a hyphen.
ovs-vswitchd.conf.db.5 contains the following sentence:
If the interface cannot be added then Open vSwitch sets this column
to -1.
The '-' in "-1" should be a minus sign, not a hyphen, but the heuristic
in ovsdb-doc wasn't smart enough. This commit improves the heuristic and
fixes the problem.
Found by lintian.
Reported-by: Thomas Goirand <zigo@debian.org> Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Fri, 9 Mar 2012 22:20:54 +0000 (14:20 -0800)]
debian: Avoid unit test failure when doing "unofficial" builds.
The configure option --with-build-number=0 is interpreted differently in
different places. The configure script itself accepts 0 as an actual
build number and puts '#define BUILDNR "+build0"' into config.h. The
code in python/automake.mk treats 0 as "no build number" and puts
'BUILDNR = ""' into version.py.
This commit avoids the problem by not passing 0 as a build number.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Sat, 3 Mar 2012 01:50:59 +0000 (17:50 -0800)]
idl: Convert python daemons to utilize SchemaHelper.
The recently added SchemaHelper class significantly simplifies IDL
instantiation in Python. This commit converts all users of the old
method to the new method, and removes support for the old method.
Pravin B Shelar [Fri, 9 Mar 2012 20:59:58 +0000 (12:59 -0800)]
netdev-linux: Cache error code from get-features.
Following patch adds support for caching error code from ETHTOOL_GSET
call. Since internal device is virtual device device feature does not
make much sense, so netdev_get_features op is removed for internal
devices.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Pravin B Shelar [Fri, 9 Mar 2012 20:57:48 +0000 (12:57 -0800)]
netdev-linux: Cache error code from mtu ioctl.
netdev linux devices uses mtu ioctl to get and set MTU for a device.
By caching error code from ioctl we can reduce number of ioctl calls
for device which is unregistered from system.
netdev notification is used to update mtu which saves get-mtu-ioctl.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Pravin B Shelar [Fri, 9 Mar 2012 20:57:13 +0000 (12:57 -0800)]
netdev-linux: Cache drv-info for net device.
Netdev-linux calls ETHTOOL_GDRVINFO on every netdev_linux_get_status()
which is not optimal as drv-info does not change for given device.
So following patch changes netdev_linux_get_status() to read drv-info at
device initialization and cache it.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
The first makes the module name consistent with upstream, and the latter
is just for internal consistency. This makes tools, and documentation
refer to a common module name regardless if it's coming from upstream
linux or built from datapath/ as part of a local build.
Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Jesse Gross <jesse@nicira.com>
If Open vSwitch has IPSEC tunnel (with certificates) and Interface
table was updated, then ovs-monitor-ipsec daemon would incorrectly
remove and readd all existing IPSEC tunnels.
The root cause for this issue was that "peer_cert_file" key was present in
interfaces dictionary, but it was missing in new_interfaces dictionary.
If Open vSwitch has IPSEC tunnel (with certificates) and Interface
table was updated, then ovs-monitor-ipsec daemon would incorrectly
remove and readd all existing IPSEC tunnels.
The root cause for this issue was that "peer_cert_file" key was present in
interfaces dictionary, but it was not present in new_interfaces dictionary.
Chris Wright [Wed, 7 Mar 2012 20:19:04 +0000 (12:19 -0800)]
datapath: update linux/.gitignore
Remove a couple stale entries:
brc_sysfs_* was renamed to dp_sysfs_* a few years ago
Add some new entries to ignore:
# Untracked file:
# (use "git add <file>..." to include in what will be committed)
# datapath/linux/exthdrs_core.c
# datapath/linux/genl_exec.c
# datapath/linux/net_namespace.c
# datapath/linux/workqueue.c
Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Thu, 8 Mar 2012 18:49:47 +0000 (10:49 -0800)]
ovs-xapi-sync: Rerun processing when a db update arrives during a commit.
The logic in ovs-xapi-sync didn't handle the case where ovsdb-server sends
a database update before it replies to a transaction that ovs-xapi-sync
sent, like this:
Ethan Jackson [Wed, 7 Mar 2012 00:51:44 +0000 (16:51 -0800)]
ofproto-dpif: Log traces when resubmit depth is exceeded.
It can be very difficult to debug xlate_actions() failures due to
excessive resubmit recursion. In an attempt to make it easier,
this patch adds a (severely rate-limited) full ofproto/trace to the
logs.
Suggested-by: Alan Shieh <ashieh@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>
Ethan Jackson [Wed, 7 Mar 2012 23:48:32 +0000 (15:48 -0800)]
python: Make build number format consistent with C.
The C code displays the build number as the empty string when 0,
and as +build<num> otherwise. This commit updates version.py to be
consistent and tests that it is in the unit tests.
Ben Pfaff [Mon, 27 Feb 2012 19:13:00 +0000 (11:13 -0800)]
stream-unix: Do not bind a name for client sockets.
There's no reason for a Unix domain client socket to bind a name. I don't
know why we've always done that. Stevens's "Unix Network Programming"
Unix domain socket client example doesn't do a bind.
Removes the 'unlink_path' parameter from new_fd_stream() since it is now
always passed as NULL.
Ben Pfaff [Wed, 7 Mar 2012 23:41:30 +0000 (15:41 -0800)]
python socket_util: Use correct fatal_signal function on error path.
The correct function to call here is "remove_file_to_unlink". That is,
since the file has already been unlinked there is no need to keep it on
the list of files to unlink.
However, "unlink_file_now" simplifies the code, so we might as well use
that.
Ben Pfaff [Wed, 7 Mar 2012 23:27:52 +0000 (15:27 -0800)]
netdev-linux: Fix build failure with old kernel headers.
The "speed_hi" member was only introduced in 2.6.27, so builds against
older kernel headers failed.
speed_hi is fully backward compatible with older kernels, because older
kernels always set it to 0, so we could easily introduce a compatibility
layer here, but in fact I don't know of any OVS users who have interfaces
faster than 65.5 Gb/s, so it's hardly urgent.
Ethan Jackson [Fri, 2 Mar 2012 20:24:55 +0000 (12:24 -0800)]
lacp: Notify LACP module when carrier changes.
Without this patch, when a slave's carrier goes down, the LACP
module (as evidenced by ovs-appctl lacp/show) would consider the
slave current until it hadn't received LACP PDUs for the requisite
amount of time. It should instead, immediately mark the slave
expired. This shouldn't actually affect the behavior of LACP bonds
because the bond module won't choose to send traffic out a slave
whose carrier is down.
Ben Pfaff [Wed, 7 Mar 2012 22:46:14 +0000 (14:46 -0800)]
ovs-ofctl: Make "barrier" output reproducible for testing.
The "ofproto - asynchronous message control" test had a race in which
the "send: OFPT_BARRIER_REQUEST" message could get printed in different
places because there was nothing to ensure that messages from the switch
were printed before messages sent to the switch, even though the actual
ordering of the messages was predictable. This fixes the problem by not
printing a message at all when the barrier request is sent.
Bug #10049. Signed-off-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Tue, 6 Mar 2012 21:09:13 +0000 (13:09 -0800)]
datapath: Fix checksum update for actions on UDP packets.
When modifying IP addresses or ports on a UDP packet we don't
correctly follow the rules for unchecksummed packets. This meant
that packets without a checksum can be given a incorrect new checksum
and packets with a checksum can become marked as being unchecksummed.
This fixes it to handle those requirements.
Bug #8937
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 7 Mar 2012 22:11:09 +0000 (14:11 -0800)]
datapath: Honor dp_ifindex, when specified, for vport lookup by name.
When OVS_VPORT_ATTR_NAME is specified and dp_ifindex is nonzero, the
logical behavior would be for the vport name lookup scope to be limited
to the specified datapath, but in fact the dp_ifindex value was ignored.
This commit causes the search scope to be honored.
Bug #9889. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Thu, 16 Feb 2012 00:22:18 +0000 (16:22 -0800)]
openflow: Split OFPAT_* into OFPAT10_* and OFPAT11_*.
An upcoming commit will start referring to OpenFlow 1.1 actions, which are
renumbered relative to OpenFlow 1.0 actions, so this commit prepares by
changing all the existing uses of OFPAT_* to instead use OFPAT10_*.
This commit also introduces the OFPAT11_* constants.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 15 Feb 2012 22:23:38 +0000 (14:23 -0800)]
netdev: Abstract "features" interface away from OpenFlow 1.0.
netdev_get_features() and other functions have always used OpenFlow 1.0
"enum ofp_port_features" bits as part of their interface. This commit
switches over to using an internally defined interface that is not tied
directly to any OpenFlow version, making evolution of each side of the
interface easier in the future.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 15 Feb 2012 01:08:03 +0000 (17:08 -0800)]
ofp-util: Add functions for working with OpenFlow 1.1 port numbers.
OpenFlow 1.1 extends port numbers to 32 bits. Initially we plan to support
only port numbers in the 16-bit range in Open vSwitch. However the OF1.1
reserved ports have high-valued fixed numbers that require translation to
high fixed values in the 16-bit range for OF1.0. These new functions
provide this translation.
Nothing uses these functions yet.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 15 Feb 2012 23:28:25 +0000 (15:28 -0800)]
ofp-print: Print OpenFlow version number of message, unless it's 1.0.
The version number is an important part of the OpenFlow message's
meaning, so include it. Version 1.0 is grandfathered in so existing output
parsers don't have to change.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 7 Dec 2011 06:33:49 +0000 (22:33 -0800)]
Begin breaking openflow-1.0.h into common and version-specific definitions.
The intention is that, as each OpenFlow 1.1 and 1.2 feature is added to Open
vSwitch, the corresponding protocol definitions will be broken up this way:
- Definitions that are the same in OF1.0 and OF1.1 will retain the "OFP"
or "ofp" prefix and move to openflow-common.h.
- Definitions that are specific to OF1.0 will be renamed with an "OFP10"
or "ofp10" prefix and stay in openflow-1.0.h.
- Definitions that are specific to OF1.1 or to OF1.1 and OF1.2 will be
renamed with an "OFP11" or "ofp11" prefix and move to openflow-1.1.h.
- Definitions that are specific to OF1.2 will be renamed with an "OFP12"
or "ofp12" prefix and move to openflow-1.2.h.
This commit starts this process with some basic OpenFlow definitions.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Mon, 24 Oct 2011 01:16:03 +0000 (18:16 -0700)]
Move content of openflow.h into openflow-1.0.h.
This prepares for a gradual introduction of definitions from OpenFlow
1.1 and later, by making it clearer that the current definitions are
specific to OpenFlow 1.0.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Fri, 10 Feb 2012 21:30:23 +0000 (13:30 -0800)]
Introduce ofputil_protocol, to abstract the protocol in use on a connection.
Open vSwitch already handles a few different protocol variations, but it
does so in a nonuniform manner:
- OpenFlow 1.0 and NXM flow formats are distinguished using the NXFF_*
constant values from nicira-ext.h.
- The "flow_mod_table_id" feature setting is maintained in ofproto as
part of an OpenFlow connection's (ofconn's) state.
There's no way to easily communicate this state among components. It's
not much of a problem yet, but as more protocol support is added it seems
better to have an abstract, uniform way to represent protocol versions and
variants. This commit implements that by introducing a new type
"enum ofputil_protocol". Each ofputil_protocol value represents a variant
of a protocol version. Each value is a separate bit, so a single enum
can also represent a set of protocols, which is often useful as well.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Tue, 6 Mar 2012 21:20:06 +0000 (13:20 -0800)]
unixctl: Re-enable unit tests.
The transient failure in the unixctl unit tests likely still
exists, but we've added additional instrumentation to our build
tools to help us debug it.
The vm-id external id in the interface table will uniquely identify a VM
that is connected to a bridge through that interface.
In xenserver, this will have the same value as the external id - xs-vm-uuid
and can be overridden by setting the nicira-vm-id key in the other_config
field of VM record of XAPI.
Pravin B Shelar [Mon, 5 Mar 2012 23:42:41 +0000 (15:42 -0800)]
netdev-linux: Make netdev_set_policing coverage counter consistent with other counters.
Most of coverage counters in netdev-linux are counting actual system
calls rather than reads from cached data.
Following patch fixes it by incrementing it after cache check.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Ben Pfaff [Fri, 2 Mar 2012 21:26:35 +0000 (13:26 -0800)]
bridge: Remove unwanted ports at time of ofproto creation.
The reconfiguration code only deleted unwanted ports for bridges that had
been created in previous (re)configurations. In fact, we should run this
step even for bridges that are newly added, e.g. to delete ports that
were added by a previous run of ovs-vswitchd and deleted from the database
between runs.
Before this commit, the following left "int" in datapath br0. After this
commit, "int" is properly deleted:
1. With ovs-vswitchd running:
# ovs-vsctl add-br br0
# ovs-vsctl add-port br0 int -- set interface int type=internal
2. Kill ovs-vswitchd, then:
# ovs-vsctl --no-wait -- del-port br0 int
3. Restart ovs-vswitchd.
Bug #9957. Reported-by: Hiroshi Tanaka <htanaka@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Sat, 3 Mar 2012 03:05:29 +0000 (19:05 -0800)]
unixctl: Skip Python unixctl tests.
The Python unixctl tests introduced a transient build failure that
can't be debugged until more information is collected. Skipping
these tests for now until it's possible to debug them.
Ethan Jackson [Fri, 17 Feb 2012 03:15:01 +0000 (19:15 -0800)]
python: Port unixctl to Python.
Many of the currently implemented Python daemons, and likely many
daemons to be implemented in the future, could benefit from unixctl
support even if only to implement "exit" and "version" commands.
This patch implements unixctl in Python.
Ethan Jackson [Thu, 1 Mar 2012 01:20:03 +0000 (17:20 -0800)]
python: New method to retrieve OVS version at runtime.
Version information is typically fairly useful when debugging Open
vSwitch. This patch adds a new version.py module which python code
can use to report its version to callers.
Ethan Jackson [Fri, 2 Mar 2012 00:21:55 +0000 (16:21 -0800)]
tests: Prefer development Python files over installed ones.
A developer may have Open vSwitch installed, in which case many of
the Python files which are tested will be in both the development
tree and the system Python library. When running unit tests, we
want to test the development tree, so it's better to prefer
importing those files.
Ben Pfaff [Fri, 2 Mar 2012 00:38:27 +0000 (16:38 -0800)]
debian: Move PKI directory to FHS-compliant location.
The PKI directory is mutable state, so it should be in /var, not in /usr.
This commit changes its location and, on systems upgraded from earlier
versions, moves the existing PKI and leaves behind a symlink.
CC: 661090@bugs.debian.org Reported-by: Andreas Beckmann <debian@abeckmann.de> Signed-off-by: Ben Pfaff <blp@nicira.com>
Chris Wright [Thu, 1 Mar 2012 23:25:14 +0000 (15:25 -0800)]
ovsdbmonitor: move to its own data directory
It doesn't have dependencies on any packages that would install into
pkgdatadir, and for Fedora it makes directory ownership work better.
So move ovsdbmonitor python internals to its own data directory.
Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Thu, 1 Mar 2012 02:54:05 +0000 (18:54 -0800)]
xenserver: Restart ovs-xapi-sync on kmod reload.
Some users never restart OVS, they just reload the kernel module on
each new version. Since ovs-xapi-sync is a daemon, a restart is
required to use the new code. Therefore, without this patch, users
could unwittingly use stale versions of ovs-xapi-sync.
Bug #9919. Signed-off-by: Ethan Jackson <ethan@nicira.com> Diagnosed-by: Ben Pfaff <blp@nicira.com>
Pravin B Shelar [Wed, 29 Feb 2012 22:09:05 +0000 (14:09 -0800)]
netdev-linux: Fix stats for ovs internal device.
There is no need to retrieve linux system stats for internal devices
as all relevant stats for virtual device like internal device are
already reported by OVS over vport-stats. As a result it also fixes
error stats for internal-devices as they are not counted twice.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>