2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-29 15:28:56 +00:00
Commit Graph

1441 Commits

Author SHA1 Message Date
Ben Pfaff
487ec65f15 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>
2010-05-27 09:34:23 -07:00
Ben Pfaff
5153ef3da7 datapath: Add missing #include to datapath/flow.h.
This caused a problem on builds under 2.6.26 (and possibly other versions).
2010-05-27 09:24:11 -07:00
Ben Pfaff
e75e8930d3 vswitchd: Build ovs-brcompatd only on Linux systems.
This feature is Linux-specific.
2010-05-26 15:36:58 -07:00
Ben Pfaff
bfb1f2d5cb 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.
2010-05-26 15:36:58 -07:00
Ben Pfaff
7089685a9e Build ovs-wdt or nlmon utilities only on Linux.
These utilities are Linux-specific.
2010-05-26 15:36:58 -07:00
Ben Pfaff
c83cdd3072 lib: Disable Linux-specific libraries on non-Linux systems. 2010-05-26 15:36:58 -07:00
Ben Pfaff
b90fa799b9 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.
2010-05-26 15:32:34 -07:00
Ben Pfaff
b662d24bd4 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.
2010-05-26 15:27:01 -07:00
Ben Pfaff
0ec6cfb13b socket-util: Tolerate missing RLIM_SAVED_CUR and RLIM_SAVED_MAX.
POSIX requires these macros, but FreeBSD 8.0 doesn't have them.
2010-05-26 15:27:01 -07:00
Ben Pfaff
3762274e63 Add some missing "#include"s.
These are required to build on FreeBSD 8.0.
2010-05-26 15:27:01 -07:00
Ben Pfaff
9d82ec478d 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.
2010-05-26 15:27:01 -07:00
Ben Pfaff
a36919566a tests: Remove incorrect OVS_UNUSED from declaration. 2010-05-26 15:24:43 -07:00
Ben Pfaff
70d3fbe765 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.
2010-05-26 15:24:13 -07:00
Ben Pfaff
3223e977ca 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.
2010-05-26 15:23:58 -07:00
Ben Pfaff
a238d75e35 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>
2010-05-26 12:52:55 -07:00
Ben Pfaff
7cf8b2660f 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.
2010-05-26 11:46:59 -07:00
Ben Pfaff
8bf4bbe390 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.
2010-05-26 11:46:59 -07:00
Ben Pfaff
3c44261983 unixctl: Sort list of commands output by "help".
Feature #2873.
2010-05-25 15:49:26 -07:00
Ben Pfaff
65d9d5f8b8 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."
2010-05-25 15:42:48 -07:00
Ben Pfaff
4d9c0a1e25 Revert "Add definition of AS_ECHO for compatibility with Autoconf before 2.62."
This reverts commit d0a5f97842.

Partner corrected earlier report that the reverted commit helped.  It
didn't.
2010-05-25 15:35:20 -07:00
Ben Pfaff
d0a5f97842 Add definition of AS_ECHO for compatibility with Autoconf before 2.62.
Requested and tested by partner.
2010-05-24 09:56:59 -07:00
Wei Yongjun
4433166640 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>
2010-05-24 09:54:47 -07:00
Justin Pettit
10dcf8deec dpif: Include stat.h header 2010-05-20 13:27:55 -07:00
Todd Deshane
6cdd6a87ac Add instructions for using Open vSwitch with KVM. 2010-05-20 10:03:40 -07:00
Jesse Gross
4d10512c91 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.
2010-05-19 14:12:27 -07:00
Ben Pfaff
137fea8de4 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.
2010-05-19 13:23:01 -07:00
Jesse Gross
6f4709828b 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.
2010-05-19 12:33:33 -07:00
Jesse Gross
2158888d8d 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.
2010-05-18 12:57:25 -07:00
Jesse Gross
43694e2a8d 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'.
2010-05-18 12:57:25 -07:00
Jesse Gross
777ece0952 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.
2010-05-18 12:57:25 -07:00
Jesse Gross
4fe6488610 datapath: Add 'patch' vport.
Adds a new 'patch' vport that acts like a virtual patch cable to
connect together two datapaths.
2010-05-18 12:57:25 -07:00
Jesse Gross
b19e8815ad 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.
2010-05-18 12:55:42 -07:00
Justin Pettit
488a9d1703 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.
2010-05-17 15:07:10 -07:00
Justin Pettit
9cbd4a4ee0 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.
2010-05-17 15:06:33 -07:00
Justin Pettit
3b2dd1619c datapath: Add stddef.h compat header to list of files in distributions
Older kernels won't compile without a definition of the bool values.
2010-05-17 13:48:02 -07:00
Wei Yongjun
ca247927bd 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>
2010-05-17 09:46:50 -07:00
Wei Yongjun
100e95db24 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>
2010-05-17 09:46:46 -07:00
Wei Yongjun
6fce448724 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>
2010-05-17 09:46:42 -07:00
Ben Pfaff
85444c3f79 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.
2010-05-17 09:35:31 -07:00
Ben Pfaff
4aa13c0c34 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.
2010-05-17 09:35:31 -07:00
Justin Pettit
7c284ac400 Release Open vSwitch 1.0.0 v1.0.0 2010-05-15 00:31:36 -07:00
Jesse Gross
7183d1ecce 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>
2010-05-14 15:10:45 -07:00
Jesse Gross
9dca7bd50a 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.
2010-05-14 15:10:45 -07:00
Jesse Gross
8819fac72b 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.
2010-05-14 15:10:45 -07:00
Jesse Gross
1c075d0aff 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.
2010-05-14 15:10:45 -07:00
Jesse Gross
1d7241c729 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.
2010-05-14 15:10:44 -07:00
Ben Pfaff
3d47699cdf 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>
2010-05-13 16:08:14 -07:00
Ben Pfaff
3fbd517acf 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.
2010-05-13 15:29:51 -07:00
Ben Pfaff
776f10ce0f 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>
2010-05-13 15:29:50 -07:00
Ben Pfaff
44e05ecafe 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.
2010-05-13 15:29:49 -07:00