sliver-openvswitch.git
10 years agodatapath: Add support for Linux 3.12
Pravin Shelar [Fri, 7 Feb 2014 18:46:53 +0000 (10:46 -0800)]
datapath: Add support for Linux 3.12

Bump kernel support for datapath module to include 3.12.
Make use of native ip-tunnel API for Kernel >= 3.12.

Based on patch from James Page.

Signed-off-by: James Page <james.page@ubuntu.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Reviewed-by: Kyle Mestery <mestery@noironetworks.com>
10 years agoupcall: Configure datapath max-idle through ovs-vsctl.
Joe Stringer [Thu, 6 Mar 2014 00:56:05 +0000 (16:56 -0800)]
upcall: Configure datapath max-idle through ovs-vsctl.

This patch adds a new configuration option, "max-idle" to the
Open_vSwitch "other-config" column. This sets how long datapath flows
are cached in the datapath before revalidators expire them.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
10 years agogetrusage-windows: getrusage() for Windows.
Gurucharan Shetty [Thu, 6 Mar 2014 20:55:53 +0000 (12:55 -0800)]
getrusage-windows: getrusage() for Windows.

We use getrusage mainly to get user CPU time and system CPU time.
Windows has a GetProcessTimes and GetThreadTimes that does the
same job. So use them.

We also use getrusage to get page faults. Use GetProcessMemoryInfo()
for that.

We also get number of context switches, block i/o times and use it for
debug information when we wake up from poll_block late. I haven't found
functions for that in Windows. We only use it for debug information, so
it should be okay not implementing it.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Co-authored-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Linda Sun <lsun@vmware.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agotimeval: gettimeofday() for Windows.
Gurucharan Shetty [Mon, 3 Mar 2014 22:13:03 +0000 (14:13 -0800)]
timeval: gettimeofday() for Windows.

Use GetSystemTimePreciseAsFileTime() for gettimeofday().
GetSystemTimePreciseAsFileTime() provides the result that is more
high resolution than just the microsecond that gittimeofday() in
Linux provides. So we need to remove some additional precision.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agotimeval: clock_gettime() for Windows.
Gurucharan Shetty [Mon, 3 Mar 2014 21:27:35 +0000 (13:27 -0800)]
timeval: clock_gettime() for Windows.

QueryPerformanceCounter() retrieves the current value of the performance
counter, which is a high resolution (<1us) time stamp that can be used for
time-interval measurements. So, use it for MONOTONIC clock.

The GetSystemTimePreciseAsFileTime() function retrieves the current system date
and time with the highest possible level of precision (<1us). Use it for
real time clock. This function returns a counter representing the number of
100-nanosecond intervals since January 1, 1601. To make it compatible with
Linux CLOCK_REALTIME, we need to calculate the 100-nanoseconds counter value
till 01/01/1970.

An upcoming commit implements gettimeofday() using the same clock, so,
carve out a function.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoMakefile: Compile Linux-specific files based on __linux__ macro.
Ben Pfaff [Thu, 23 Jan 2014 23:35:22 +0000 (15:35 -0800)]
Makefile: Compile Linux-specific files based on __linux__ macro.

We want to conditionally compile several files based on whether we're
building for a Linux host, so we need some Automake conditional for that.
Previously this was based on whether Netlink is available and we're not
on ESX (since ESX has Netlink but isn't Linux), but it's more
straightforward to just test for Linux directly.

CC: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoUse __linux__ instead of LINUX_DATAPATH in C code.
Ben Pfaff [Thu, 23 Jan 2014 23:33:25 +0000 (15:33 -0800)]
Use __linux__ instead of LINUX_DATAPATH in C code.

The LINUX_DATAPATH C preprocessor symbol was originally meant to be used as
a signal for whether the Linux datapath module could be used, but it was
used as a proxy for a lot of other stuff that is really just Linux
specific.  This commit switches all of these users to just test for
__linux__, which is more straightforward and should have the same result.

CC: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoMakefile: Remove unnecessary includes of SSL_LIBS.
Gurucharan Shetty [Tue, 4 Mar 2014 21:23:53 +0000 (13:23 -0800)]
Makefile: Remove unnecessary includes of SSL_LIBS.

SSL_LIBS are needed for libopenvswitch and we include that
in lib/automake.mk. It is not necessary to include it
for every executable.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agotimeval: localtime_r, gmtime_r for Windows.
Gurucharan Shetty [Tue, 4 Mar 2014 00:13:46 +0000 (16:13 -0800)]
timeval: localtime_r, gmtime_r for Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Add xpthread_barrier_*() wrappers.
Joe Stringer [Tue, 4 Mar 2014 21:15:41 +0000 (13:15 -0800)]
ovs-thread: Add xpthread_barrier_*() wrappers.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotunnel: Do not set padding bits in tunnel mask.
Ben Pfaff [Sun, 2 Mar 2014 01:15:00 +0000 (17:15 -0800)]
tunnel: Do not set padding bits in tunnel mask.

On most architectures other than 32-bit x86, struct flow_tnl ends with 4
padding bytes.  Until now, tnl_xlate_init() set those bytes to nonzero
values in the wildcard mask.  When the wildcard mask passed through Netlink
attributes and back to userspace, the padding bytes of course became zero
again, which caused a wildcard mask mismatch and premature deletion of the
flow in revalidation.  This commit fixes the problem.

Bug #1192516.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoodp-util: Include tun_id when nonzero even if "key" flag not set.
Ben Pfaff [Sun, 2 Mar 2014 01:11:02 +0000 (17:11 -0800)]
odp-util: Include tun_id when nonzero even if "key" flag not set.

When a flow_tnl is being translated to Netlink attributes, the tun_id field
was included only if the FLOW_TNL_F_KEY flag was set.  This meant that for
a mask, where one would not necessarily expect that flag to be set even if
there were a key, the tun_id could be omitted even if it were nonzero.
This led to kernel flows that did not match on a field that was required
to be matched (possibly causing incorrect treatment of packets) and
premature deletion of kernel flows due to mask mismatch.  This commit
fixes the problem.

Bug #1192516.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agovconn: Fix vconn_get_status() return value when connection in progress.
Ben Pfaff [Sat, 1 Mar 2014 00:20:17 +0000 (16:20 -0800)]
vconn: Fix vconn_get_status() return value when connection in progress.

When a connection takes a few rounds of the state machine to complete,
'error' gets filled with EAGAIN until that completes.  This didn't match
the vconn_get_status() documentation, which says that it only returns a
positive errno value if there was an error.  One could fix the problem
by updating the documentation (and the callers) or by updating the
implementation.  I decided that the latter was the way to go because
the distinction between the TCP connection being in progress or complete
isn't visible to the client; what is visible to the client is the OpenFlow
negotiation being complete.

This problem is difficult to find in the unit tests because TCP connections
to localhost complete immediately.

Bug introduced by commit accaecc419cc57d (rconn: Discover errors in
rconn_run() even if rconn_recv() is never called.)

Reported-by: Anuprem Chalvadi <achalvadi@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosparse: add defintions to include/sparse/netinet/in.h
Andy Zhou [Thu, 27 Feb 2014 02:51:54 +0000 (18:51 -0800)]
sparse: add defintions to include/sparse/netinet/in.h

Fixed sparse undefined symbol warnings.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agolib: make wevent static
Andy Zhou [Thu, 27 Feb 2014 02:51:04 +0000 (18:51 -0800)]
lib: make wevent static

Fixed sparse non static symbol warning.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agolib: simplify flow_extract() API
Andy Zhou [Thu, 27 Feb 2014 02:08:04 +0000 (18:08 -0800)]
lib: simplify flow_extract() API

Change the flow_extract() API to accept struct pkt_metadata,
instead of individual metadata fields. It will make the API more
logical and easier to maintain when we need to expand metadata
down the road.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>¬
10 years agodatapath: Correctly report flow used times for first 5 minutes after boot.
Ben Pfaff [Fri, 28 Feb 2014 21:12:04 +0000 (13:12 -0800)]
datapath: Correctly report flow used times for first 5 minutes after boot.

The kernel starts out its "jiffies" timer as 5 minutes below zero, as
shown in include/linux/jiffies.h:

  /*
   * Have the 32 bit jiffies value wrap 5 minutes after boot
   * so jiffies wrap bugs show up earlier.
   */
  #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))

The loop in ovs_flow_stats_get() starts out with 'used' set to 0, then
takes any "later" time.  This means that for the first five minutes after
boot, flows will always be reported as never used, since 0 is greater than
any time already seen.

Bug #1192516.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
10 years agoman: Document common options in ovs-vsctl and vtep-ctl.
Justin Pettit [Thu, 27 Feb 2014 00:30:29 +0000 (16:30 -0800)]
man: Document common options in ovs-vsctl and vtep-ctl.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agovtep-ctl: Print schema version when called with "--version".
Justin Pettit [Thu, 27 Feb 2014 00:29:49 +0000 (16:29 -0800)]
vtep-ctl: Print schema version when called with "--version".

Issue #16648

Suggested-by: Anupam Chanda <achanda@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vsctl: Print schema version when called with "--version".
Justin Pettit [Thu, 27 Feb 2014 00:29:00 +0000 (16:29 -0800)]
ovs-vsctl: Print schema version when called with "--version".

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdb-idlc: Make schema version available.
Justin Pettit [Thu, 27 Feb 2014 00:18:33 +0000 (16:18 -0800)]
ovsdb-idlc: Make schema version available.

Future patches will make use of the ability to retrieve the schema
version against which they were compiled.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdb-doc: Include schema version in generated man pages.
Justin Pettit [Wed, 26 Feb 2014 21:50:47 +0000 (13:50 -0800)]
ovsdb-doc: Include schema version in generated man pages.

Suggested-by: Bruce Davie <bdavie@vmware.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agovtep: Include OVS version number in VTEP man page.
Justin Pettit [Wed, 26 Feb 2014 21:49:39 +0000 (13:49 -0800)]
vtep: Include OVS version number in VTEP man page.

Suggested-by: Bruce Davie <bdavie@vmware.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodpif: New function flow_dump_next_may_destroy_keys().
Joe Stringer [Thu, 27 Feb 2014 22:13:10 +0000 (14:13 -0800)]
dpif: New function flow_dump_next_may_destroy_keys().

This new function allows callers to determine whether previously
returned keys will be modified or reallocated on the next call to
dpif_flow_dump_next(). This will be used in a future commit to allow
batched flow deletion by revalidator threads.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif: Don't synchronize flow_dump_next() status.
Joe Stringer [Thu, 27 Feb 2014 22:13:09 +0000 (14:13 -0800)]
dpif: Don't synchronize flow_dump_next() status.

Recent changes to the flow_dump_next() interface have made it the
responsibility of the dpif implementation to track error status over a
flow dump operation.

This patch removes status tracking from 'struct dpif_flow_dump', allowing
multiple threads to call dpif_flow_dump_next() and track their status
independently. Even if one thread finishes processing flows for a given
iterator and state, it will not prevent other callers from processing
the remaining flows in their buffers.

After this patch, the error code that dpif_flow_dump_next() returns is
only significant for the current state and buffer. As before, the status
of the entire flow dump operation can be obtained by calling
dpif_flow_dump_done().

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif: Make dpif_flow_dump_next() thread-safe.
Joe Stringer [Thu, 27 Feb 2014 22:13:08 +0000 (14:13 -0800)]
dpif: Make dpif_flow_dump_next() thread-safe.

This patch makes it the caller's responsibility to initialize a
per-thread 'state' object and pass it down to the dpif_flow_dump_next()
implementation. The implementation can expect to be called from multiple
threads with the same 'iter' and different 'state' objects.

When flow_dump_next() returns non-zero, the implementation must ensure
that subsequent calls with the same arguments also return non-zero.
Subsequent calls with the same 'iter' and different 'state' may return
zero, but should make progress towards returning non-zero.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif: Separate local and shared flow dump state.
Joe Stringer [Thu, 27 Feb 2014 22:13:07 +0000 (14:13 -0800)]
dpif: Separate local and shared flow dump state.

This patch separates the structures for thread-local flow dump state
("state") from the shared flow dump state ("iter") in dpif-linux and
dpif-netdev. Future patches will make use of this to allow multiple
threads to dump flows from the same flow dump operation.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetlink: Make nl_dump_next() thread-safe.
Joe Stringer [Thu, 27 Feb 2014 22:13:06 +0000 (14:13 -0800)]
netlink: Make nl_dump_next() thread-safe.

This patch modifies 'struct nl_dump' and nl_dump_next() to allow
multiple threads to share the same nl_dump. These changes are targeted
around synchronizing dump status between multiple callers, and
allowing callers to fully process their existing buffers before
determining whether to stop fetching flows.

The 'status' field of 'struct nl_dump' becomes atomic, so that multiple
threads may check and/or update it to communicate when there is an error
or the netlink dump is finished. The low bit holds whether the final
message was seen, while the higher bits hold an errno value.

nl_dump_next() will now read all messages from the given buffer before
checking the shared error status and attempting to fetch more. Multiple
threads may call this with the same nl_dump, but must provide
independent buffers. As previously, the final dump status can be
determined by calling nl_dump_done() from a single thread.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetlink: Remove buffer from 'struct nl_dump'.
Joe Stringer [Thu, 27 Feb 2014 22:13:05 +0000 (14:13 -0800)]
netlink: Remove buffer from 'struct nl_dump'.

This patch makes all of the users of 'struct nl_dump' allocate their own
buffers to pass down to nl_dump_next(). This paves the way for allowing
multithreaded flow dumping.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif.at: Avoid races in MPLS tests
YAMAMOTO Takashi [Thu, 27 Feb 2014 06:36:59 +0000 (15:36 +0900)]
ofproto-dpif.at: Avoid races in MPLS tests

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agorconn: Discover errors in rconn_run() even if rconn_recv() is never called.
Ben Pfaff [Thu, 27 Feb 2014 19:06:30 +0000 (11:06 -0800)]
rconn: Discover errors in rconn_run() even if rconn_recv() is never called.

rconn_recv() calls vconn_recv(), which will report a connection error and
cause rconn_recv() to disconnect the rconn.  Most rconn users regularly
call rconn_recv(), so that disconnection happens promptly.  However,
the lswitch code only calls rconn_recv() after the connection negotiates an
OpenFlow version, so a connection that failed before negotiation would
never be detected as failed.  This commit fixes the problem by making
rconn_run() also detect and handle connection errors.

The lswitch code is only used by the test-controller program, so this is
not an important bug fix.

Reported-by: Vasu Dasari <vdasari@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Re-fix a race.
Ben Pfaff [Thu, 27 Feb 2014 19:18:31 +0000 (11:18 -0800)]
tests: Re-fix a race.

Patch bf06c4fe (tests/ofproto-dpif.at: Workaround a race.), fixed a
race condition which patch 0a8763f (ofproto-dpif-upcall: Hardcode
max_idle to 1500ms.) unfixed.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-lib: allow non-root users to check service status
Flavio Leitner [Thu, 27 Feb 2014 12:16:34 +0000 (09:16 -0300)]
ovs-lib: allow non-root users to check service status

It tries to log the status operation, so although non-root
users can see the current status, the lack of permission
to write to the log results in an error message.

This changes to log only if the user has the permission to
write to the log file.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agodpif-linux: Lookup netdev to get netdev type string.
Joe Stringer [Wed, 26 Feb 2014 21:22:35 +0000 (13:22 -0800)]
dpif-linux: Lookup netdev to get netdev type string.

When creating tap ports in dpif-linux, the "tap" type is treated the
same as "system", and the type is discarded. When dumping datapath
port types, this would cause "tap" type to be reported as a "system"
type.

Each time we see a port of the wrong type in bridge_reconfigure(), we
remove it and add a port with the correct configuration. This would
always occur for tap ports, causing deletion and re-creation of all tap
ports each time the bridge was reconfigured.

This patch makes dpif-linux use netdev to look up port types if the
datapath reports that they are of type OVS_VPORT_TYPE_NETDEV.

Bug #1196289.

Reported-by: James Schmidt <jschmidt@vmware.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agovswitchd: Limit fake bridge MAC selection to ports in the same VLAN
Helmut Schaa [Wed, 19 Feb 2014 10:59:33 +0000 (11:59 +0100)]
vswitchd: Limit fake bridge MAC selection to ports in the same VLAN

Limit fake bridge MAC address selection to only consider ports
that use the same VLAN as the fake bridge itself.

This prevents OVS from selecting a MAC address that was not really
present in the VLAN of the fake bridge before.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovswitchd: Split pick_local_hw_addr
Helmut Schaa [Wed, 19 Feb 2014 10:59:32 +0000 (11:59 +0100)]
vswitchd: Split pick_local_hw_addr

This allows to reuse find_local_hw_addr for fake bridges.
Preparation for upcoming MAC address inheritance for fake bridges.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agofatal-signal: SIGPIPE for Windows.
Gurucharan Shetty [Wed, 26 Feb 2014 18:44:46 +0000 (10:44 -0800)]
fatal-signal: SIGPIPE for Windows.

Windows does not have a SIGPIPE. We ignore SIGPIPE for
Linux. To compile on Windows, carve out a new function
to ignore SIGPIPE on Linux.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agofatal-signal: Handle SIGINT for Windows.
Gurucharan Shetty [Wed, 26 Feb 2014 17:37:19 +0000 (09:37 -0800)]
fatal-signal: Handle SIGINT for Windows.

Ctrl+C signals are a special case for Windows and can
be handled by registering a handle through
SetConsoleCtrlHandler() routine. This is only useful
when we run it directly on console and not as services in
the background.

Once we get a Ctrl+C signal, we call the cleanup functions
and then exit.

One thing to know here is that MinGW terminal handles
Ctrl+C signal differently (and looks a little buggy. I see
it exiting the handler midway with some sort of timeout).
So this implementation is only useful when run on Windows
terminal. Since we only use MinGW for compilation and
eventually to run unit tests, it should be okay. (The unit
tests would ideally use windows services and not expect
Ctrl+C)

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: pipe for Windows.
Gurucharan Shetty [Wed, 26 Feb 2014 16:47:37 +0000 (08:47 -0800)]
socket-util: pipe for Windows.

Windows does have pipes (the interface is a little different).
We mostly use pipes in Linux to synchronize between parent and
children and also to handle fatal signals and then wake from poll_loop().

For Windows, we are using events for the same purpose. So don't
implement pipes for Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosignals: Don't compile for Windows.
Gurucharan Shetty [Wed, 26 Feb 2014 16:45:58 +0000 (08:45 -0800)]
signals: Don't compile for Windows.

There are no users in Windows for any of the
function in signals.c

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agofatal-signal: Fatal signal handling for Windows.
Gurucharan Shetty [Wed, 26 Feb 2014 16:25:42 +0000 (08:25 -0800)]
fatal-signal: Fatal signal handling for Windows.

Windows does not have a SIGHUP or SIGALRM. It does have
a SIGINT and SIGTERM. The documentation at msdn says that
SIGINT is not supported for win32 applications because
WIN32 operating systems generate a new thread to specifically
handle Ctrl+C.

This commit handles SIGTERM for Windows. The documentation also
states that nothing generates SIGTERM in Windows, but one can
use raise(SIGTERM) to manage it. The idea for handling SIGTERM
for Windows is to just have a place holder if there is need to
raise() a signal for some other purpose.

We use SIGALRM in timeval.c if we wake up from a sleep after
'deadline'. For Windows, print an error message and then
use SIGTERM.

There is an atexit() function for Windows, so we can call cleanup
functions during exit.

An upcoming commit separately handles Ctrl+C so that we can call
clean up functions for that use case.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agocccl: Remove the seemingly wrong "lib" prefix.
Gurucharan Shetty [Fri, 14 Feb 2014 20:40:56 +0000 (12:40 -0800)]
cccl: Remove the seemingly wrong "lib" prefix.

I have not seen a use case where the "lib" prefix is needed.
In my tests, I see that adding the additional "lib" prefix
causes libraries to not be recognized.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoINSTALL: Mention that building a kernel module is optional.
Ben Pfaff [Wed, 26 Feb 2014 20:27:42 +0000 (12:27 -0800)]
INSTALL: Mention that building a kernel module is optional.

It used to be essentially required, but now it's reasonable to use the
kernel's builtin module.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Flavio Leitner <fbl@redhat.com>
10 years agometa-flow: Remove duplicate break statements.
Joe Stringer [Tue, 25 Feb 2014 02:20:22 +0000 (02:20 +0000)]
meta-flow: Remove duplicate break statements.

Commit 8bfd0fda mistakenly introduced duplicate "break;" statements to
MFF_MPLS_BOS handling. This patch removes them.

Found by inspection.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto: Send port status message for port-mods, right away.
Ben Pfaff [Wed, 26 Feb 2014 19:12:57 +0000 (11:12 -0800)]
ofproto: Send port status message for port-mods, right away.

Until now, when it processes OFPT_PORT_MOD message, Open vSwitch has waited
for ports to notify it that their status has changed before it sends a
port status update to controllers.

Also, Open vSwitch never sent port config updates at all for port
modifications other than OFPPC_PORT_DOWN.  I guess that this is a relic
from the era when there was only one controller, since presumably the
controller already knew that it changed the port configuration.  But in the
multi-controller world, it makes sense to send such port status updates,
and I couldn't quickly find anything in OF1.3 or OF1.4 that said they
shouldn't be sent.

EXT-338.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Kmindg G <kmindg@gmail.com>
10 years agosocket-util: Fix set_dscp for IPv6
YAMAMOTO Takashi [Mon, 24 Feb 2014 02:46:59 +0000 (11:46 +0900)]
socket-util: Fix set_dscp for IPv6

Try IPPROTO_IPV6/IPV6_TCLASS socket option as well as IPPROTO_IP/IP_TOS
so that this can work for IPv6 sockets.

IPPROTO_IP/IP_TOS socket option is, as it's SOL indicates, for IPv4.
What happens when it's used for IPv6 sockets?  On Linux, it seems to
be forwarded to IPv4 code and affects IPv4 part of the socket.
(e.g. non-V6ONLY case)  But it doesn't seem to be the intention of
this function.  On other platforms including NetBSD, it just fails
with ENOPROTOOPT.

Probably this function should take the address family but passing
it around lib/*stream*.c would be a bigger change.

Cc: Arun Sharma <arun.sharma@calsoftinc.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Fix "sFlow packet sampling" tests on BSDs
YAMAMOTO Takashi [Mon, 24 Feb 2014 02:46:22 +0000 (11:46 +0900)]
ofproto-dpif: Fix "sFlow packet sampling" tests on BSDs

The name of loopback interface is "lo0" on BSDs.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: Avoid using the identical message for different errors
YAMAMOTO Takashi [Mon, 24 Feb 2014 02:46:21 +0000 (11:46 +0900)]
socket-util: Avoid using the identical message for different errors

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Sort output from dump-flows to avoid hash order dependency.
Ben Pfaff [Wed, 26 Feb 2014 00:24:38 +0000 (16:24 -0800)]
tests: Sort output from dump-flows to avoid hash order dependency.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: Fix null dereference in push_dump_ops().
Ben Pfaff [Wed, 26 Feb 2014 00:23:29 +0000 (16:23 -0800)]
ofproto-dpif-upcall: Fix null dereference in push_dump_ops().

revalidator_sweep__() does not provide udumps, so push_dump_ops() can't
look them up.

This is my fault: I introduced it during review.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoupcall: Remove datapath flows when setting n-threads.
Joe Stringer [Tue, 11 Feb 2014 21:55:36 +0000 (13:55 -0800)]
upcall: Remove datapath flows when setting n-threads.

Previously, we would delete all ukeys when changing the number of
threads, but leave all flows in the datapath. This would cause
double-counting of stats for any flows that remain in the datapath. This
patch fixes the issue by ensuring that all flows are deleted from the
datapath before changing the number of threads.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoupcall: Delete flows that were not recently dumped.
Joe Stringer [Tue, 11 Feb 2014 21:55:35 +0000 (13:55 -0800)]
upcall: Delete flows that were not recently dumped.

Previously, we would clean up the ukeys whose flow was not seen in the
most recent dump, while leaving the flow in the datapath. In the
unlikely case that the datapath fails to dump a flow that still exists
in the datapath, this would cause double-counting of those flow stats.

This is currently very rare to see due to batching of datapath flow
deletion, but is more easily observable with upcoming patches which
modify the batch size based on dpif implementation.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoupcall: Refactor ukey creation and dump handling
Joe Stringer [Tue, 11 Feb 2014 21:55:34 +0000 (13:55 -0800)]
upcall: Refactor ukey creation and dump handling

This splits out functions for re-use by later patches, and compacts the
udump revalidation code.

Co-authored-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoupcall: Defer ukey deletion until after pushing stats.
Joe Stringer [Tue, 11 Feb 2014 21:55:33 +0000 (13:55 -0800)]
upcall: Defer ukey deletion until after pushing stats.

It is possible for a datapath to dump the same flow twice, for instance
if the flow is the last in a batch of flows to be dumped, then a new
flow is inserted into the same bucket before the flow dumper fetches
another batch.

In this case, datapath flow stats may be duplicated: The revalidator
records the stats from the first flow, using the ukey to get the stats
delta. The ukey is deleted, then the revalidator reads the second
(duplicate) flow and cannot lookup the ukey for the delta. As such, it
will push the stats as-is.

This patch reduces the likelihood of such stats duplications by
deferring ukey deletion until after stats are pushed for deleted flows.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Test flow stats reporting.
Joe Stringer [Tue, 11 Feb 2014 21:55:32 +0000 (13:55 -0800)]
ofproto-dpif: Test flow stats reporting.

Basic test to check that the datapath reports the correct number of
packets seen, after a delay of 1 second.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoWindows implementation of stream-fd.
Linda Sun [Mon, 24 Feb 2014 19:12:25 +0000 (11:12 -0800)]
Windows implementation of stream-fd.

Use send/recv for socket stream instead of read/write.
Use event handle for polling on socket stream.
Check windows specific return code.

Signed-off-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoofproto-dpif: Complete all packet translations before freeing an ofproto.
Ben Pfaff [Tue, 25 Feb 2014 16:01:01 +0000 (08:01 -0800)]
ofproto-dpif: Complete all packet translations before freeing an ofproto.

The following scenario can occur:

   1. Handler thread grabs a pointer to an ofproto in handle_upcalls().

   2. Main thread removes ofproto and destroys it in destruct().

   3. Handler thread uses pointer to ofproto and accesses freed memory.
      BOOM!

Each individual step above happens under the xlate_rwlock, but the ofproto
pointer is retained from step 1 to step 3, hence the problem.  This commit
fixes the problem by ensuring that after an ofproto is removed but before
it is destroyed, all packet translations get pushed all the way through
the upcall handler pipeline.  (No new packet translations can get a pointer
to the removed ofproto.)

Bug #1200351.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agosocket-util: drain_rcvbuf() for Windows.
Gurucharan Shetty [Mon, 24 Feb 2014 17:58:35 +0000 (09:58 -0800)]
socket-util: drain_rcvbuf() for Windows.

Netlink sockets are created as blocking sockets. So, we can't
afford to remove MSG_DONTWAIT for Linux.

drain_rcvbuf() is currently called from netlink-socket.c and
netdev-linux.c. As of now, I don't see it being used for Windows.

Bug #1200865.
Reported-by: Len Gao <leng@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agolib/process, socket-util: Update necessary headers
YAMAMOTO Takashi [Sat, 22 Feb 2014 01:33:44 +0000 (10:33 +0900)]
lib/process, socket-util: Update necessary headers

Fix the regression introduced by commit 4f57ad10.
("socket-util: Move get_max_fds() to process.c")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agosignals: Remove unused functions.
Gurucharan Shetty [Thu, 20 Feb 2014 23:02:06 +0000 (15:02 -0800)]
signals: Remove unused functions.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vswitchd: Don't register for SIGHUP.
Gurucharan Shetty [Thu, 20 Feb 2014 22:58:36 +0000 (14:58 -0800)]
ovs-vswitchd: Don't register for SIGHUP.

We are registering an interest in SIGHUP to reopen
log files. But there is an 'ovs-appctl vlog/reopen'
command that does the same and is used in the
logrotate config for the distributions.

So remove the redundant functionality.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Use fair (but nonrecursive) rwlocks on glibc.
Ben Pfaff [Fri, 21 Feb 2014 18:53:49 +0000 (10:53 -0800)]
ovs-thread: Use fair (but nonrecursive) rwlocks on glibc.

glibc supports two kinds of rwlocks:

    - The default kind of rwlock always allows recursive read-locks to
      succeed, but threads blocked on acquiring the write-lock are treated
      unfairly, causing them to be delayed indefinitely as long as new
      readers continue to come along.

    - An alternative "writer nonrecursive" rwlock allows recursive
      read-locks to succeed only if there are no threads waiting for the
      write-lock.  Otherwise, recursive read-lock attempts deadlock in
      the presence of blocking write-lock attempts.  However, this kind
      of rwlock is fair to writer.

POSIX allows the latter behavior, which essentially means that any portable
pthread program cannot try to take read-locks recursively.  Since that's
true, we might as well use the latter kind of rwlock with glibc and get the
benefit of fairness of writers.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoofproto-dpif-xlate: Avoid recursively taking read side of ofgroup rwlock.
Ben Pfaff [Sat, 22 Feb 2014 00:27:00 +0000 (16:27 -0800)]
ofproto-dpif-xlate: Avoid recursively taking read side of ofgroup rwlock.

With glibc, rwlocks by default allow recursive read-locking even if a
thread is blocked waiting for the write-lock.  POSIX allows such attempts
to deadlock, and it appears that the libc used in NetBSD, at least, does
deadlock.  ofproto-dpif-xlate could take the ofgroup rwlock recursively if
an ofgroup's actions caused the ofgroup to be executed again.  This commit
avoids that issue by preventing recursive translation of groups (the same
group or another group).  This is not the most user friendly solution,
but OpenFlow allows this restriction, and we can always remove the
restriction later (probably requiring more complicated code) if it
proves to be a real problem to real users.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agosocket-util: Move get_null_fd() to daemon.c.
Gurucharan Shetty [Fri, 21 Feb 2014 18:52:18 +0000 (10:52 -0800)]
socket-util: Move get_null_fd() to daemon.c.

get_null_fd() is only called from daemon.c.
It does not need thread safety features anymore as
it is called either through daemonize_start() or
indirectly through daemonize_complete() once.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: poll() for Windows.
Gurucharan Shetty [Tue, 18 Feb 2014 20:52:01 +0000 (12:52 -0800)]
socket-util: poll() for Windows.

Also, Windows does not have a MSG_DONTWAIT. Get rid of it
as we always use non-blocking sockets.

Co-authored-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoReplace inet_aton() with inet_pton().
Gurucharan Shetty [Fri, 21 Feb 2014 17:18:35 +0000 (09:18 -0800)]
Replace inet_aton() with inet_pton().

Windows does not have inet_aton(), but does have a inet_pton().
inet_aton() is not defined in POSIX. But inet_pton() is.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: Move get_max_fds() to process.c.
Gurucharan Shetty [Fri, 21 Feb 2014 16:46:31 +0000 (08:46 -0800)]
socket-util: Move get_max_fds() to process.c.

get_max_fds() is used only from process.c. Move it there
along with rlim_is_finite(). Since process_start() can only
be called before any additional threads are created, we
no longer need the thread safety checks in get_max_fds().

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: Unix socket related calls for non-windows platform.
Gurucharan Shetty [Tue, 18 Feb 2014 22:39:47 +0000 (14:39 -0800)]
socket-util: Unix socket related calls for non-windows platform.

Don't try to compile Unix socket related functions for Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agodpif-netdev: Fix memory leak.
Alex Wang [Fri, 21 Feb 2014 22:03:51 +0000 (14:03 -0800)]
dpif-netdev: Fix memory leak.

In dpif_netdev_flow_del() and dp_netdev_port_input(), the
referenced 'netdev_flow' is not un-referenced.  This causes
the leak of the struct's memory.

This commit fixes the above issue by calling dp_netdev_flow_unref()
after using the reference.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Call ovs_refcount_destroy() before free().
Alex Wang [Fri, 21 Feb 2014 22:03:50 +0000 (14:03 -0800)]
dpif-netdev: Call ovs_refcount_destroy() before free().

This commit makes dp_netdev_flow_unref() and dp_netdev_actions_unref()
invoke the ovs_refcount_destroy() before freeing the corresponding
pointer.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Fix segfault removing port when STP is enabled.
Ben Pfaff [Fri, 21 Feb 2014 20:40:00 +0000 (12:40 -0800)]
ofproto-dpif: Fix segfault removing port when STP is enabled.

Reported-by: Sridhar Samudrala <samudrala.sridhar@gmail.com>
Tested-by: Sridhar Samudrala <samudrala.sridhar@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Get rid of obsolete sparse wrappers.
Ben Pfaff [Fri, 21 Feb 2014 18:50:56 +0000 (10:50 -0800)]
ovs-thread: Get rid of obsolete sparse wrappers.

These were useful back when we were trying to use the sparse lock balance
annotations, but we removed those in commit 47b52c71232c0 (sparse: Remove
support for thread-safety annotations.) and so they serve no purpose any
longer.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoFAQ: Describe how to add new OpenFlow messages.
Ben Pfaff [Fri, 21 Feb 2014 16:45:03 +0000 (08:45 -0800)]
FAQ: Describe how to add new OpenFlow messages.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agosocket-util: af_inet_ioctl() for Windows.
Gurucharan Shetty [Wed, 19 Feb 2014 20:41:04 +0000 (12:41 -0800)]
socket-util: af_inet_ioctl() for Windows.

There is no direct mapping for the ioctl function in
Windows.  As of now, af_inet_ioctl() is being used for Linux
and BSD. So, don't try to compile it for Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: Describe fd for Windows.
Gurucharan Shetty [Wed, 19 Feb 2014 19:33:09 +0000 (11:33 -0800)]
socket-util: Describe fd for Windows.

In windows there is no clear way to distinguish between a
socket fd and a file fd.

We use the function, describe_fd() mostly for debugging.
For now, return a generic statement.

Co-authored-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: getsockopt for Windows.
Gurucharan Shetty [Wed, 19 Feb 2014 17:11:04 +0000 (09:11 -0800)]
socket-util: getsockopt for Windows.

Windows defines the 'optval' argument as char * instead of void *.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: fsync directory for Windows.
Gurucharan Shetty [Wed, 19 Feb 2014 16:47:56 +0000 (08:47 -0800)]
socket-util: fsync directory for Windows.

There is no corresponding function for Windows.
open() does not work on directories.
There is a function _commit(fd), but that is only meant
for files.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: closesocket() for Windows.
Gurucharan Shetty [Tue, 18 Feb 2014 23:09:18 +0000 (15:09 -0800)]
socket-util: closesocket() for Windows.

For Windows sockets, one has to call closesocket() to
close the sockets.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: getaddrinfo return values for Windows.
Gurucharan Shetty [Tue, 18 Feb 2014 17:26:27 +0000 (09:26 -0800)]
socket-util: getaddrinfo return values for Windows.

Couple of return values need changes.
* EAI_NODATA is the same as EAI_NONAME. So we prevent duplicate cases.
* Windows does not have a EAI_SYSTEM.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: set_nonblocking for Windows.
Gurucharan Shetty [Tue, 18 Feb 2014 15:43:26 +0000 (07:43 -0800)]
socket-util: set_nonblocking for Windows.

Co-authored-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: Move sock_errno() to socket-util.
Gurucharan Shetty [Tue, 18 Feb 2014 18:25:13 +0000 (10:25 -0800)]
socket-util: Move sock_errno() to socket-util.

And add more users.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Update only OFPUTIL_PS_LINK_DOWN (not STP) from netdev state.
Ben Pfaff [Thu, 20 Feb 2014 20:13:26 +0000 (12:13 -0800)]
ofproto: Update only OFPUTIL_PS_LINK_DOWN (not STP) from netdev state.

When a netdev indicates that its state or configuration has changed,
update_port() updates the OpenFlow port to match the changes.  However,
this was being taken too far: a netdev does not have an STP state, and a
state change was resetting the STP state of the port.  This fixes the
problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Vasu Dasari <vdasari@gmail.com>
Tested-by: Vasu Dasari <vdasari@gmail.com>
10 years agoofp-util: Avoid gcc warning on NetBSD
YAMAMOTO Takashi [Thu, 20 Feb 2014 02:11:00 +0000 (11:11 +0900)]
ofp-util: Avoid gcc warning on NetBSD

Avoid the following warning caused by the combination
of NetBSD's htons implementation and gcc bug.
Now --enable-Werror build succeeds on NetBSD-6.

    lib/ofp-util.c: In function 'ofputil_match_from_ofp10_match':
    lib/ofp-util.c:174:15: error: integer overflow in expression

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests/run-ryu: Correct logfile reporting
Simon Horman [Thu, 20 Feb 2014 04:48:10 +0000 (13:48 +0900)]
tests/run-ryu: Correct logfile reporting

$logfile is already prefixed by "$sandbox/" and suffixed by ".log"
so do not duplicate this prefix and suffix combination when appending
$logfile to $logs.

Cc: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev: Change netdev_class_rwlock to recursive mutex, for POSIX safety.
Ben Pfaff [Wed, 15 Jan 2014 20:59:16 +0000 (12:59 -0800)]
netdev: Change netdev_class_rwlock to recursive mutex, for POSIX safety.

With glibc, rwlocks by default allow recursive read-locking even if a
thread is blocked waiting for the write-lock.  POSIX allows such attempts
to deadlock, and it appears that the libc used in NetBSD, at least, does
deadlock.  The netdev_class_rwlock is in fact acquired recursively in this
way, which is a bug.  This commit fixes the problem by switching to a
recursive mutex.  This allows for less parallelism, but according to an
existing comment that doesn't matter here anyway.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoofproto-provider: Update documentation.
Joe Stringer [Tue, 18 Feb 2014 17:39:12 +0000 (09:39 -0800)]
ofproto-provider: Update documentation.

This wording was in ofproto.c, but missing from ofproto-provider.h.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoFAQ: Mention hairpinning under actions=in_port.
Joe Stringer [Wed, 12 Feb 2014 19:20:29 +0000 (11:20 -0800)]
FAQ: Mention hairpinning under actions=in_port.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix build failure.
Pravin [Wed, 19 Feb 2014 22:29:39 +0000 (14:29 -0800)]
datapath: Fix build failure.

Defines RCU_INIT_POINTER() for compatibility.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoipfix: add SCTP, ICMP, and ICMPv6 flow reporting
Romain Lenglet [Wed, 19 Feb 2014 22:23:39 +0000 (14:23 -0800)]
ipfix: add SCTP, ICMP, and ICMPv6 flow reporting

Signed-off-by: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoprocess: Make changes for Windows.
Gurucharan Shetty [Fri, 14 Feb 2014 22:07:34 +0000 (14:07 -0800)]
process: Make changes for Windows.

As of now, we are using the process subsystem in
ovsdb-server to handle the "--run" command line
option. That particular option is not used often
and till deemed necessary, make it unsupported on
Windows platform.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vswitchd: Get rid of call to process_init().
Gurucharan Shetty [Fri, 14 Feb 2014 19:12:41 +0000 (11:12 -0800)]
ovs-vswitchd: Get rid of call to process_init().

It is not needed as we don't use any other process_* calls.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoipfix: fix upcall cookie size checks to support 8 byte cookies
Romain Lenglet [Tue, 11 Feb 2014 23:21:08 +0000 (15:21 -0800)]
ipfix: fix upcall cookie size checks to support 8 byte cookies

Commit 96ed775f resizes all userspace metadata to be 8 bytes minimum.
Fix the upcall size checks accordingly.

Signed-off-by: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agopackets: Always set ethertype in push_mpls()
Simon Horman [Wed, 12 Feb 2014 01:13:02 +0000 (10:13 +0900)]
packets: Always set ethertype in push_mpls()

There are two different MPLS ethertypes, 0x8847 and 0x8848 and a push MPLS
action applied to an MPLS packet may cause the ethertype to change from one
to the other. To ensure that this happens update the ethertype in
push_mpls() regardless of if the packet is already MPLS or not.

Test based on a similar test by Joe Stringer.

Cc: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Add MPLS push on MPLS test.
Joe Stringer [Wed, 12 Feb 2014 01:13:01 +0000 (10:13 +0900)]
tests: Add MPLS push on MPLS test.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Co-Authored-By: Simon Horman <horms@verge.net.au>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vsctl: reconnect to the database if connection was dropped
Ansis Atteka [Tue, 18 Feb 2014 21:19:36 +0000 (13:19 -0800)]
ovs-vsctl: reconnect to the database if connection was dropped

If ovs-vsctl has to wait for ovs-vswitchd to reconfigure itself
according to the new database, then sometimes ovs-vsctl could
end up stuck in the event loop if OVSDB connection was dropped
while ovs-vsctl was still running.

This patch fixes this problem by letting ovs-vsctl to reconnect
to the OVSDB, if it has to wait cur_cfg field to be updated.

Issue: 1191997
Reported-by: Spiro Kourtessis <spiro@nicira.com>
Signed-Off-By: Ansis Atteka <aatteka@nicira.com>
10 years agoconfigure: Fix bug report email address.
Ben Pfaff [Sat, 18 Jan 2014 01:49:55 +0000 (17:49 -0800)]
configure: Fix bug report email address.

Reported-by: Arun Sharma <arun.sharma@calsoftinc.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agopacket: Make set_ethertype() static
Simon Horman [Wed, 12 Feb 2014 07:31:03 +0000 (16:31 +0900)]
packet: Make set_ethertype() static

Make set_ethertype() static as it is not used outside of packet.c

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Remove 'force-miss-model' configuration.
Joe Stringer [Wed, 19 Feb 2014 18:26:31 +0000 (10:26 -0800)]
ofproto: Remove 'force-miss-model' configuration.

This configuration item was introduced to assist testing of upcall
handling behaviour with and without facets. Facets were removed in
commit e79a6c833e0d7237, so this patch removes the configuration item.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-actions: Correct pop MPLS ethtype as consistency test
Simon Horman [Wed, 19 Feb 2014 12:27:16 +0000 (21:27 +0900)]
ofp-actions: Correct pop MPLS ethtype as consistency test

Correct pop MPLS ethtype consistency check to verify that
the packet has an MPLS ethtype before the pop action rather than after:
an MPLS ethtype is a pre-condition but not a post-condition of pop MPLS.

With this change the consistency check in ofpact_check__()
becomes consistent with that in ofpact_from_nxast().

This was found using Ryu tests via the new make check-ryu target.
It allows all of the "POP_MPLS"[1] tests to pass where they previously
failed.

[1] http://osrg.github.io/ryu-certification/switch/ovs

Cc: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests/run-ryu: Fix setup for Ryu tests
YAMAMOTO Takashi [Mon, 17 Feb 2014 08:14:17 +0000 (17:14 +0900)]
tests/run-ryu: Fix setup for Ryu tests

Tweak our configuration to match with Ryu tests' single-bridge assumption.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Tested-by: Simon Horman <horms@verge.net.au>