sliver-openvswitch.git
10 years agoMerge commit '559eb2308b4d616590aba34bb8f4dd7f12ae4587'
Giuseppe Lettieri [Fri, 5 Jul 2013 17:36:43 +0000 (19:36 +0200)]
Merge commit '559eb2308b4d616590aba34bb8f4dd7f12ae4587'

Conflicts:
Makefile.am

11 years agonetdev-linux: Mark more static data as "const".
Ben Pfaff [Mon, 29 Apr 2013 21:34:48 +0000 (14:34 -0700)]
netdev-linux: Mark more static data as "const".

This makes this code more obviously thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agohmap: Make HMAP_INITIALIZER a valid initializer for a const hmap.
Ben Pfaff [Fri, 26 Apr 2013 18:10:53 +0000 (11:10 -0700)]
hmap: Make HMAP_INITIALIZER a valid initializer for a const hmap.

Without this change, an initialization such as
    const struct hmap map = HMAP_INITIALIZER(&map);
yields a compiler warning "initialization discards qualifiers from pointer
target type".

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoMake most "struct option" instances "const".
Ben Pfaff [Tue, 23 Apr 2013 23:40:56 +0000 (16:40 -0700)]
Make most "struct option" instances "const".

Reducing non-const static data makes code more obviously thread-safe.
Although option parsing does not normally need to be thread-safe, I
don't know of a drawback to making its data const.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodpif-linux: Make dummy_action const in dpif_linux_init_flow_put().
Ben Pfaff [Tue, 23 Apr 2013 21:06:25 +0000 (14:06 -0700)]
dpif-linux: Make dummy_action const in dpif_linux_init_flow_put().

This makes this code more obviously thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agosystem-stats: Use getmntent_r() for thread-safety.
Ben Pfaff [Thu, 25 Apr 2013 23:59:15 +0000 (16:59 -0700)]
system-stats: Use getmntent_r() for thread-safety.

getmntent_r() is a GNU extension so we test for its existence and just
disable this feature of system stats if it is not present, because this
feature is not very important.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoUse gmtime_r() and localtime_r() instead of non-thread-safe versions.
Ben Pfaff [Fri, 5 Apr 2013 04:31:15 +0000 (23:31 -0500)]
Use gmtime_r() and localtime_r() instead of non-thread-safe versions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-benchmark: improve 'rate' command piped output support.
Andy Zhou [Mon, 29 Apr 2013 21:42:56 +0000 (14:42 -0700)]
ovs-benchmark: improve 'rate' command piped output support.

Add fflush() to the 'rate' command of 'ovs-benchmark'.  On a tty console
the output is line-buffered. However, piped output by default has a
deeper (usually 4KB) buffer, the output won't appear to the other end of
the pipe until this buffer is full.

This patch makes the piped output of the 'rate' command's consistent
with tty console output.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agosocket-util: Use getaddrinfo() instead of gethostbyname() for thread safety.
Ben Pfaff [Thu, 2 May 2013 21:34:45 +0000 (14:34 -0700)]
socket-util: Use getaddrinfo() instead of gethostbyname() for thread safety.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoUse pthread_sigmask() in place of sigprocmask(), for thread safety.
Ben Pfaff [Fri, 5 Apr 2013 17:25:50 +0000 (12:25 -0500)]
Use pthread_sigmask() in place of sigprocmask(), for thread safety.

POSIX says that multithreaded programs must not use sigprocmask() but must
use pthread_sigmask() instead.  This commit makes that replacement.

The actual use of signals in Open vSwitch is still not thread safe
following this commit, but this change is a necessary prerequisite for
fixing the other problems.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoChange sFlow model to reflect per-bridge sampling
Neil Mckee [Wed, 1 May 2013 05:38:53 +0000 (22:38 -0700)]
Change sFlow model to reflect per-bridge sampling

Until now, we were presenting a separate sFlow data-source (sampler) for
each ifIndex-interface.  This caused problems with samples that did not
easily map to an ifIndex being aliased together and breaking the sFlow
containment rules.  This patch changes the model to present a single sFlow
data-source for each bridge.  Now we can still make all reasonable effort
to map packet samples to ingress/egress ifIndex numbers, knowing that the
fallback to "unknown" does not break the sFlow model.  Note that
interface-counter-polling is still handled the same way as before, with
sFlow counter-polling data only being exported for ifIndex-interfaces.

Signed-off-by: Neil Mckee <neil.mckee@inmon.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodatapath: Immediately exit on error in ovs_vport_cmd_set().
Jesse Gross [Thu, 2 May 2013 17:14:54 +0000 (10:14 -0700)]
datapath: Immediately exit on error in ovs_vport_cmd_set().

It is an error to try to change the type of a vport using the set
command. However, while we check that this is an error, we still
proceed to allocate memory which then gets freed immediately.
This stops processing after noticing the error, which does not
actually fix a bug but is more correct.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
11 years agodpif-linux: Close channel Netlink sockets when a port number gets recycled.
Ben Pfaff [Thu, 2 May 2013 00:08:20 +0000 (17:08 -0700)]
dpif-linux: Close channel Netlink sockets when a port number gets recycled.

When ovs-vswitchd deletes a port with dpif_linux_port_del(), that function
uses del_channel() to delete the corresponding channel, including closing
its Netlink socket fd.  However, if the vport gets removed by some other
process (e.g. "ip link delete" for veths) then this function never gets
called and thus the channel never gets deleted.

This commit partially fixes the problem.  Now, if a port number gets
reused, add_channel() closes the old Netlink socket assigned to that port
before it installs the new one.

Bug #16784.
Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodpif-linux: Use MAX_PORTS instead of hard-coded 65535.
Ben Pfaff [Wed, 1 May 2013 23:54:18 +0000 (16:54 -0700)]
dpif-linux: Use MAX_PORTS instead of hard-coded 65535.

MAX_PORTS is currently USHRT_MAX (also 65535).  I think that's a
coincidence; I don't remember MAX_PORTS being mentioned when the new
dpif_channel code was written.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoFAQ: Indicate LTS is now the 1.9.x series.
Justin Pettit [Thu, 2 May 2013 07:15:42 +0000 (00:15 -0700)]
FAQ: Indicate LTS is now the 1.9.x series.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agoMake it more obvious that OVS_KEY_ATTR_MPLS may be an array
Simon Horman [Thu, 2 May 2013 01:49:49 +0000 (10:49 +0900)]
Make it more obvious that OVS_KEY_ATTR_MPLS may be an array

Note that OVS_KEY_ATTR_MPLS may be an array of ovs_key_mpls
and that the acceptable length may be restricted by the implementation.

Currently the user-space datapath and proposed kernel datapath
implementation restrict the length to a single element.

Also update the mpls_top_lse name of the element of struct ovs_key_mpls,
as it is an array of LSEs and thus not necessarily just the top LSE.

As requested by Jesse Gross

Cc: Jesse Gross <jesse@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoSet release date for 1.10.0.
Justin Pettit [Wed, 1 May 2013 21:30:38 +0000 (14:30 -0700)]
Set release date for 1.10.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agoovs-sandbox: Use $schema for creating the db.
Duffie Cooley [Wed, 1 May 2013 19:23:36 +0000 (12:23 -0700)]
ovs-sandbox: Use $schema for creating the db.

The code here went to some trouble to properly set $schema and then
ignored it.

Signed-off-by: Duffie Cooley <dcooley@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoRemove spurious IPv4 data from MPLS packet test
Simon Horman [Wed, 1 May 2013 08:05:26 +0000 (17:05 +0900)]
Remove spurious IPv4 data from MPLS packet test

Supplying this data is somewhat misleading as it
is completely ignored and is not included in
the synthesised packet.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoSetting tag sliver-openvswitch-1.10.90-2 sliver-openvswitch-1.10.90-2
Giuseppe Lettieri [Wed, 1 May 2013 13:56:10 +0000 (15:56 +0200)]
Setting tag sliver-openvswitch-1.10.90-2
- fixed several bugs in the external-nodes support in exp-tool/Makefile
- let sliver-ovs return an error if tap device configuration failed

11 years agodpif-netdev: Shorten delay loops.
Ben Pfaff [Tue, 30 Apr 2013 00:49:25 +0000 (17:49 -0700)]
dpif-netdev: Shorten delay loops.

Um, I mean, remove useless code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofproto: Add ipfix-entities.def to gitignore.
Ethan Jackson [Mon, 29 Apr 2013 19:46:45 +0000 (12:46 -0700)]
ofproto: Add ipfix-entities.def to gitignore.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agoofproto-dpif: Fix 'size' argument to fix_sflow_action().
Ben Pfaff [Tue, 30 Apr 2013 18:24:11 +0000 (11:24 -0700)]
ofproto-dpif: Fix 'size' argument to fix_sflow_action().

The sflow action only uses 8 bytes of the total 16 for user_action_cookie,
but fix_sflow_action() was checking for the presence of all 16, so if the
sflow action wasn't followed by a few other actions then 'cookie' would
end up NULL and the assertion would segfault.

Bug #16659.
Reported-by: Dhaval Badiani <dbadiani@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodatapath: Remove unneeded ovs_netdev_get_ifindex()
Thomas Graf [Tue, 30 Apr 2013 15:47:42 +0000 (08:47 -0700)]
datapath: Remove unneeded ovs_netdev_get_ifindex()

The only user is get_dpifindex(), no need to redirect via the port
operations.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoworker: Prevent worker from being responsible for pidfile deletion.
Gurucharan Shetty [Mon, 29 Apr 2013 02:25:55 +0000 (19:25 -0700)]
worker: Prevent worker from being responsible for pidfile deletion.

Currently we are creating the worker process after creation of the pidfile.
This means that the responsibility of deleting the pidfile after process
termination rests with the worker process.

When we restart openvswitch using the startup scripts, we SIGTERM the main
process and once it is cleaned up, we start ovs-vswitchd again. This results
in a race condition. The new ovs-vswitchd will create a pidfile because it is
unlocked. But, if the old worker process exits after the start of new
ovs-vswitchd, it will simply delete the pidfile underneath the new ovs-vswitchd.
This will eventually result in multiple ovs-vswitchd daemons.

This patch gives the responsibility of deleting the pidfile to the main
process.

Bug #16669.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agovswitchd: Disable system stats collection on a concurrently running daemon.
Gurucharan Shetty [Sun, 28 Apr 2013 02:58:12 +0000 (19:58 -0700)]
vswitchd: Disable system stats collection on a concurrently running daemon.

There are very rare cases (ex: ovs-vswitchd.pid is inadvertantly deleted),
when multiple ovs-vswitchd daemons can end up running at the same time.
In a situation like that one of the daemons can wait on the poll()
with a 0 ms wait time as it would be expecting system stats to be collected.

But system stats are never run for the daemon that does not have the
lock on the database and hence it takes up 100% of the CPU if its state
machine for stats collection previously was S_WAITING.

With this patch, we disable the system stats collection for the daemon that
does not have the database lock. When it eventually gets the lock on the
database, system stats are automatically enabled if other_config:\
enable-statistics=true.

Bug #16669.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agonetlink-socket: Use xmalloc() instead of malloc().
Ben Pfaff [Fri, 26 Apr 2013 21:15:37 +0000 (14:15 -0700)]
netlink-socket: Use xmalloc() instead of malloc().

This was the only obvious use of bare malloc() in the tree, other
than in the implementation of wrapper functions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agonetlink-socket: Minor style fix.
Ben Pfaff [Tue, 9 Apr 2013 18:18:27 +0000 (11:18 -0700)]
netlink-socket: Minor style fix.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotimeval: Remove prototype for unimplemented function.
Ben Pfaff [Fri, 26 Apr 2013 16:46:30 +0000 (09:46 -0700)]
timeval: Remove prototype for unimplemented function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoPrepare for post-1.11.0 (1.11.90).
Justin Pettit [Mon, 29 Apr 2013 21:44:34 +0000 (14:44 -0700)]
Prepare for post-1.11.0 (1.11.90).

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agoPrepare for 1.11.0
Justin Pettit [Mon, 29 Apr 2013 21:46:05 +0000 (14:46 -0700)]
Prepare for 1.11.0

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agodatapath: Use generic struct pcpu_tstats.
Pravin B Shelar [Mon, 29 Apr 2013 21:45:08 +0000 (14:45 -0700)]
datapath: Use generic struct pcpu_tstats.

Rather than defining ovs specific stats struct (vport_percpu_stats),
we can use existing pcpu_tstats to achieve exactly same functionality.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agodpif-netdev: Update max_mtu correctly.
Ben Pfaff [Fri, 26 Apr 2013 18:35:43 +0000 (11:35 -0700)]
dpif-netdev: Update max_mtu correctly.

What a dumb bug.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovxlan: Correct comments and NEWS to reflect IANA port assigment.
Jesse Gross [Mon, 29 Apr 2013 17:01:00 +0000 (10:01 -0700)]
vxlan: Correct comments and NEWS to reflect IANA port assigment.

Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoAdd FAQ entries around the VXLAN support in Open vSwitch.
Kyle Mestery [Fri, 26 Apr 2013 18:30:25 +0000 (14:30 -0400)]
Add FAQ entries around the VXLAN support in Open vSwitch.

Add a section to the FAQ explaining VXLAN with a pointer to the IETF draft.
Add sections detailing how much of the VXLAN protocol is currently supported
in OVS, along with a section explaining the default UDP port and how to change
this when creating VXLAN ports.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoUpdate the default VXLAN destination UDP port to the IANA assigned port
Kyle Mestery [Fri, 26 Apr 2013 18:30:24 +0000 (14:30 -0400)]
Update the default VXLAN destination UDP port to the IANA assigned port

VXLAN was recently assigned UDP port 4789 by IANA. This
comit updates the OVS VXLAN implementation to reflect the new UDP port
number.

Cc: Kenneth Duda <kduda@aristanetworks.com>
Signed-off-by: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agocheck that tap device is actually created
Giuseppe Lettieri [Thu, 25 Apr 2013 15:39:32 +0000 (17:39 +0200)]
check that tap device is actually created

11 years agofixed missing dependency
Giuseppe Lettieri [Thu, 25 Apr 2013 15:38:52 +0000 (17:38 +0200)]
fixed missing dependency

11 years agofix fake shutdown of external nodes
Giuseppe Lettieri [Wed, 24 Apr 2013 08:29:23 +0000 (10:29 +0200)]
fix fake shutdown of external nodes

11 years agoMerge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch
Giuseppe Lettieri [Mon, 22 Apr 2013 10:52:15 +0000 (12:52 +0200)]
Merge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch

11 years agofix dependencies for external nodes
Giuseppe Lettieri [Mon, 22 Apr 2013 10:51:37 +0000 (12:51 +0200)]
fix dependencies for external nodes

11 years agoSetting tag sliver-openvswitch-1.10.90-1 sliver-openvswitch-1.10.90-1
Thierry Parmentelat [Mon, 22 Apr 2013 06:14:50 +0000 (08:14 +0200)]
Setting tag sliver-openvswitch-1.10.90-1
merged with upstream (develoment version 1.10.90)
integrated ALLEGRA contributions for the termination of virtual cables in external nodes.

11 years agoupdate mainstream version number
Thierry Parmentelat [Mon, 22 Apr 2013 06:08:45 +0000 (08:08 +0200)]
update mainstream version number

11 years agobridge: Report PID of yielding process when multiple instances run.
Justin Pettit [Mon, 8 Apr 2013 17:44:50 +0000 (10:44 -0700)]
bridge: Report PID of yielding process when multiple instances run.

Normally, the daemon code will detect when multiple instances are run
and print the conflicting PID.  However, if ovs-vswitchd is not run in
daemon mode or the pidfile is removed, a database lock is checked.  The
message it prints wasn't specific enough about which process was backing
off due to not getting the lock.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agodatapath: Account for RHEL6.4 backports in compat layer
Thomas Graf [Thu, 25 Apr 2013 12:28:16 +0000 (14:28 +0200)]
datapath: Account for RHEL6.4 backports in compat layer

Explicitly check the availability of several kernel API functions
instead of relying on the kernel version to account for Red Hat
Enterprise Linux backports.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Use openvswitch_handle_frame hook in >=RHEL6.4 to live side by side with...
Thomas Graf [Thu, 25 Apr 2013 12:28:15 +0000 (14:28 +0200)]
datapath: Use openvswitch_handle_frame hook in >=RHEL6.4 to live side by side with bridging

Due to the missing register rx_handler API in the kernel RHEL6 is
based on, the datapath currently falls back to using the bridging
hook with the consequence that bridging and OVS cannot be used in
parallel on any RHEL6 release.

For this purpose, >=RHEL6.4 releases provide a special rx frame hook
to be used by OVS. It captures frames at the same location in the
stack as the rx_handler would do in more recent kernel releases. In
order to store the vport pointer, the net_device's ax25_ptr field is
utilized under the assumption that an AX25 device will never be
attached to an OVS bridge.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoFAQ: Explain why VMs on a VLAN can't access the Internet.
Ben Pfaff [Wed, 24 Apr 2013 18:47:36 +0000 (11:47 -0700)]
FAQ: Explain why VMs on a VLAN can't access the Internet.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agomatch: Correct formatting of MPLS
Simon Horman [Wed, 24 Apr 2013 09:02:35 +0000 (18:02 +0900)]
match: Correct formatting of MPLS

1. mpls or mplsm should be included in the formatted match  instead of
   dl_type=0xXXXX if the dl_type of the match is ETH_TYPE_MPLS or
   ETH_TYPE_MPLS_MCAST respectively. This is consistent with the treatment
   of other dl_types in match_format().

2. Add formatting of MPLS TTL to match_format().
   The format is mpls_ttl=YY.

3. Set the mpls_lse mask of a match to all 1's if
   the dl_type of the flow is ETH_TYPE_MPLS or ETH_TYPE_MPLS_MCAST.
   This will cause mpls_label=LLLL,mpls_tc=W,mpls_ttl=YY,mpls_bos=Z to
   be included with the match is formatted.

4. mpls(label:LLLL,tc:W,ttl:TT,bos:Z) and
   mplsm(label:LLLL,tc:W,ttl:TT,bos:Z) should not be included
   in a formatted match as this is not consistent with the
   formatting of other match elements.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoFAQ: Describe how to connect bridges with patch ports.
Ben Pfaff [Tue, 23 Apr 2013 16:30:14 +0000 (09:30 -0700)]
FAQ: Describe how to connect bridges with patch ports.

I keep seeing this question.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotimeval: Check for HAVE_BACKTRACE instead of HAVE_EXECINFO_H.
Ben Pfaff [Tue, 23 Apr 2013 18:07:25 +0000 (11:07 -0700)]
timeval: Check for HAVE_BACKTRACE instead of HAVE_EXECINFO_H.

Other code in the tree uses HAVE_BACKTRACE and then blindly includes
<execinfo.h> if it is present, so this doesn't make anything worse.

Once we do that, HAVE_EXECINFO_H has no further users, so this commit also
removes the check for <execinfo.h>

Reported-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodeal with platforms where backtrace() is in a different library than libc.
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:00 +0000 (22:20 +0900)]
deal with platforms where backtrace() is in a different library than libc.

execinfo for NetBSD and ubacktrace for uClibc.
i don't know if the latter is relevant to Open vSwitch, though.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodebian: force-reload-kmod while package upgrading.
Gurucharan Shetty [Wed, 10 Apr 2013 22:09:00 +0000 (15:09 -0700)]
debian: force-reload-kmod while package upgrading.

Currently, when we upgrade openvswitch packages, we do a restart
of userspace daemons automatically. This does not replace the
kernel module.

But almost everytime, we want to use the new kernel module
that comes with the new version. This means that we need to
manually do a "force-reload-kmod". This step, reloads the
kernel module and also restarts the userspace daemons. This gives
us a total of two restarts of userspace daemons. This is quite
expensive in a hypervisor with hundreds of VMs sending real traffic.
This also hurts the controller as it gets two reconnections in a short
amount of time.

With this patch, during a package upgrade, if the kernel module
on disk is different than the one that is loaded, we will
automatically do a force-reload-kmod while openvswitch-switch
is installed. If not, we will just do a "restart" like before.

One can install the kernel package first and then install the userspace
packages in 2 separate steps to enforce a single 'force-reload-kmod'.

If anyone wants to just restart the userspace package instead of
force-reload-kmod, they can set the value of OVS_FORCE_RELOAD_KMOD=no
while installing the package.
Ex: OVS_FORCE_RELOAD_KMOD=no dpkg -i openvswitch-switch*

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agoINSTALL.Debian: Update instructions related to package ordering.
Gurucharan Shetty [Wed, 10 Apr 2013 22:08:39 +0000 (15:08 -0700)]
INSTALL.Debian: Update instructions related to package ordering.

If we install the userspace packages first, without a kernel module
present in the correct path, we get an error because package install
automatically tries to start the userspace daemons and we look for
a kernel module to load.

Installing a kernel module package first and then following it by
userspace package sounds like the correct way to do it. This change
in ordering helps my next commit.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agoFAQ: Explain how to drop packets.
Ben Pfaff [Tue, 23 Apr 2013 04:15:25 +0000 (21:15 -0700)]
FAQ: Explain how to drop packets.

This question keeps coming up.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotutorial: Correct typos.
Ben Pfaff [Tue, 23 Apr 2013 04:17:50 +0000 (21:17 -0700)]
tutorial: Correct typos.

Reported-by: Yeming Zhao <zhaoyeming@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoImplement IPFIX export
Romain Lenglet [Mon, 22 Apr 2013 17:01:14 +0000 (10:01 -0700)]
Implement IPFIX export

Define a new NXAST_SAMPLE OpenFlow vendor action and the corresponding
OFPACT_SAMPLE OVS action, to do per-flow packet sampling, translated
into a new SAMPLE "flow_sample" dp action.

Make the userspace action's userdata size vary depending on the union
member used.  Add a new "flow_sample" upcall to do per-flow packet
sampling.  Add a new "ipfix" upcall to do per-bridge packet sampling
to IPFIX collectors.

Extend the OVSDB schema to support configuring IPFIX collector sets.
Add support for configuring multiple IPFIX collectors for per-flow
packet sampling.  Add support for configuring per-bridge IPFIX
sampling.

Automatically generate standard IPFIX entity definitions from the IANA
specs.  Send one IPFIX data record message for every packet sampled by
an OpenFlow sample action or received by a bridge configured with
IPFIX sampling, and periodically send IPFIX template set messages.

Signed-off-by: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoRestore all flow changes by compose_output_action__().
Jarno Rajahalme [Thu, 18 Apr 2013 15:07:41 +0000 (18:07 +0300)]
Restore all flow changes by compose_output_action__().

This makes sure that output actions leave no changes to any flow fields,
while all explicit set_field actions are retained across output actions.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofproto-dpif: Restore flow nw_tos in all cases.
Jarno Rajahalme [Thu, 18 Apr 2013 15:07:40 +0000 (18:07 +0300)]
ofproto-dpif: Restore flow nw_tos in all cases.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoodp-util: Keep base flow in sync with the kernel view.
Jarno Rajahalme [Thu, 18 Apr 2013 15:07:39 +0000 (18:07 +0300)]
odp-util: Keep base flow in sync with the kernel view.

Change the base flow only if a corresponding kernel action is generated
in commit_odp_tunnel_action().

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agouse RT_ROUNDUP on NetBSD
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:12 +0000 (22:20 +0900)]
use RT_ROUNDUP on NetBSD

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoinclude some headers to satisfy header file dependencies on NetBSD-6
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:11 +0000 (22:20 +0900)]
include some headers to satisfy header file dependencies on NetBSD-6

while this change don't seem to be necessary on NetBSD-current,
NetBSD-6 is the latest release at this point.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agosome ctype related casts to suppress gcc warnings on NetBSD
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:10 +0000 (22:20 +0900)]
some ctype related casts to suppress gcc warnings on NetBSD

where it can't be EOF, cast a value to unsigned char before passing it
to ctype functions to avoid unintended sign extension.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agobe compilable even when _SC_PHYS_PAGES is not available
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:09 +0000 (22:20 +0900)]
be compilable even when _SC_PHYS_PAGES is not available

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agochange the type of popcount unsigned
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:08 +0000 (22:20 +0900)]
change the type of popcount unsigned

it's a natural choice and compatible with a version found in NetBSD libc.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoinvoke perl as ${PERL}
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:07 +0000 (22:20 +0900)]
invoke perl as ${PERL}

as suggested by Ben Pfaff.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoexplicitly invoke perl for uuidfilt.pl (rather than via shebang)
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:06 +0000 (22:20 +0900)]
explicitly invoke perl for uuidfilt.pl (rather than via shebang)

depending on a platform, perl might not be /usr/bin/perl.
eg. on NetBSD it's usually /usr/pkg/bin/perl.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-pki: Add NetBSD case for test
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:05 +0000 (22:20 +0900)]
ovs-pki: Add NetBSD case for test

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoinclude strings.h for strcasecmp
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:04 +0000 (22:20 +0900)]
include strings.h for strcasecmp

while this is not the only place strcasecmp is used without an
explicit inclusion of the header, it's the only place gcc complains
on my environment.  for other places, probably the header is included
indirectly via other headers, i guess.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoremove remaining pkg-config references
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:03 +0000 (22:20 +0900)]
remove remaining pkg-config references

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agouse ax_check_openssl.m4 instead of a direct use of pkg-config.
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:02 +0000 (22:20 +0900)]
use ax_check_openssl.m4 instead of a direct use of pkg-config.

on some platforms, including NetBSD-6, openssl is available but
its pkg-config files (*.pc) are not.  according to Ed Maste,
this is the case for FreeBSD as well.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoadd ax_check_openssl.m4
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:20:01 +0000 (22:20 +0900)]
add ax_check_openssl.m4

this file is obtained from:
http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_openssl.m4;hb=5a7260331c7d13263126e35c5743fdc35cbc2894

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agofix an obvious mistake in a test of IFM_ETHER
YAMAMOTO Takashi [Mon, 22 Apr 2013 13:19:59 +0000 (22:19 +0900)]
fix an obvious mistake in a test of IFM_ETHER

fix a bug in FreeBSD code.  the fix is suggested by Ed Maste.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoAdd a tutorial for advanced Open vSwitch features.
Ben Pfaff [Fri, 19 Apr 2013 23:25:56 +0000 (16:25 -0700)]
Add a tutorial for advanced Open vSwitch features.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodatapath: Fix struct vport comment.
Pravin B Shelar [Thu, 18 Apr 2013 23:06:33 +0000 (16:06 -0700)]
datapath: Fix struct vport comment.

Removes remaining part of comment about `linkname` vport member.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Fix inconsistency in upstream and out of tree ovs module.
Pravin B Shelar [Thu, 18 Apr 2013 23:00:48 +0000 (16:00 -0700)]
datapath: Fix inconsistency in upstream and out of tree ovs module.

There is a inconsistent ordering in function ovs_vport_cmd_set()
between upstream and out of tree ovs module. Following patch
fixes it by releasing lock before calling ovs_notify.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agoovsdb-server: Announce bound listening ports as status:bound_port.
Ben Pfaff [Thu, 18 Apr 2013 23:37:05 +0000 (16:37 -0700)]
ovsdb-server: Announce bound listening ports as status:bound_port.

The administrator can request that OVSDB bind any available TCP port, but
in that case there is no easy way to find out what port it has bound.  This
commit adds that information as the "bound_port" key in the "status"
column.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotests: Avoid race conditions, by letting the kernel choose ports to bind.
Ben Pfaff [Wed, 3 Apr 2013 18:30:18 +0000 (13:30 -0500)]
tests: Avoid race conditions, by letting the kernel choose ports to bind.

An occasionally occurring problem with "make check", especially when
parallel tests are enabled, is that multiple tests try to bind the same
TCP port and, of course, fail.  This happens because the code to select
a TCP port to bind just generates random numbers until it finds a port that
is not currently in use and uses the first one, which is of course prone
to races.

This commit changes the tests to let the kernel directly choose an
available port, which should avoid this type of failure.

Also, some of the tests that generated a random free TCP port actually
used the port number to bind a UDP socket, which of course doesn't work
well.  This commit fixes that problem too as a side effect.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agosocket-util: Log kernel-chosen bound ports in inet_open_passive().
Ben Pfaff [Wed, 3 Apr 2013 18:24:27 +0000 (13:24 -0500)]
socket-util: Log kernel-chosen bound ports in inet_open_passive().

Usually, for passive sockets, one wishes to bind a particular well-known
port, so that clients can easily connect.  But automated tests cannot
necessarily bind a well-known port, because that would cause multiple
concurrent tests to interfere with each other or with a real instance of
the service running on the system.  They could bind to a randomly selected
port chosen by the user (the Open vSwitch automated tests currently do this)
but this leads to occasional "false negative" test failures when the port
selected happens to be in use.

The best alternative for automated tests is to let the kernel choose a
port that is not otherwise in use, which can be accomplished by specifying
port 0.  But in that case there is no easy way for other software to know
what port the kernel chose.  This commit fixes that problem one way by
logging the bound port when it is chosen by the kernel.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotests: Make test-netflow, test-sflow accept all logging options.
Ben Pfaff [Wed, 3 Apr 2013 16:36:53 +0000 (11:36 -0500)]
tests: Make test-netflow, test-sflow accept all logging options.

An upcoming patch will start using the --log-file option with these test
programs, so they need to support it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodatapath: Fix stale comment in flow.c.
Pravin B Shelar [Thu, 18 Apr 2013 21:35:26 +0000 (14:35 -0700)]
datapath: Fix stale comment in flow.c.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agosparse: Support recent distributions
Andy Zhou [Fri, 5 Apr 2013 23:56:52 +0000 (16:56 -0700)]
sparse: Support recent distributions

sparse support seems to be broken on some recent Linux distributions.
For example, ubuntu 12.04 with Linux 3.5 kernel, and Debian latest test
distribution, running Linux 3.2 kernel.

On both systems that sparse was broken, It was not able find the header files
in the  default system include directories.  GCC finds them by default.

This patch adds the required GCC default search path when running sparse.

Tested on:

Ubuntu 12.04 - w/ linux 3.5 kernel
Debian-6 March test distribution - w/ linux 3.2 kernel

Signed-off-by: Andy Zhou <azhou@nicira.com>
[blp@nicira.com also tested on Debian squeeze and wheezy (testing)]
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agopython: fix a typo error in python/ovs/socket_util.py.
Alex Wang [Thu, 18 Apr 2013 00:35:04 +0000 (17:35 -0700)]
python: fix a typo error in python/ovs/socket_util.py.

The commit 89d7ffa9 (python: Workaround UNIX socket path
length limits), fixes most failed tests. But it has a
typo and the typo causes the failure of test <unixctl
server errors - Python> when the path length is very
long (e.g. more than 90 characters).

This patch fixes the above issue.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoCorrectly implement the OpenFlow 1.2+ OXM_OF_IP_DSCP field.
Ben Pfaff [Thu, 18 Apr 2013 16:40:48 +0000 (09:40 -0700)]
Correctly implement the OpenFlow 1.2+ OXM_OF_IP_DSCP field.

NXM puts the DSCP value in bits 2-7 of NXM_OF_IP_TOS.
OXM puts the DSCP value in bits 0-6 of OXM_OF_IP_DSCP.

Before this commit, Open vSwitch incorrectly implemented OXM_OF_IP_DSCP
with the same format as NXM_OF_IP_TOS.  This commit fixes the problem and
adds a test (previously missing but I don't know why).

Reported-by: Hiroshi Miyata <miyahiro.dazu@gmail.com>
Tested-by: Hiroshi Miyata <miyahiro.dazu@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoINSTALL.XenServer: Add a note for tunnel firewall rules.
Gurucharan Shetty [Mon, 15 Apr 2013 18:09:01 +0000 (11:09 -0700)]
INSTALL.XenServer: Add a note for tunnel firewall rules.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agorhel: Remove the firewall hole that we create for GRE.
Gurucharan Shetty [Fri, 12 Apr 2013 19:58:27 +0000 (12:58 -0700)]
rhel: Remove the firewall hole that we create for GRE.

Till now, by default, we add firewall holes for
gre traffic. There may be users that do not use GRE tunnels
and they may be surprised with this behavior. So, don't add
the firewall rules by default and update the documentation
to mention the same.

This patch does not remove the default GRE firewall rule for
xenserver because xenserver has a feature called "Cross-Host
Internal Networks" (CHIN) that uses GRE.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agoRevert "rhel, xenserver: Punch holes through firewall for VXLAN."
Gurucharan Shetty [Fri, 12 Apr 2013 19:53:59 +0000 (12:53 -0700)]
Revert "rhel, xenserver: Punch holes through firewall for VXLAN."

This reverts commit 5902b4ed6.

For end users that do not plan to use tunnels or use only selected
tunnels, it probably is a bad idea to punch firewall holes by default.
Opening holes like this may surprise the user.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agolist: Style fixes.
Ben Pfaff [Mon, 15 Apr 2013 21:45:17 +0000 (14:45 -0700)]
list: Style fixes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agopython/ovs/poller.py: workaround an eventlet bug
YAMAMOTO Takashi [Tue, 16 Apr 2013 06:56:31 +0000 (15:56 +0900)]
python/ovs/poller.py: workaround an eventlet bug

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodebian: build with debugging symbol
Ben Pfaff [Mon, 15 Apr 2013 17:19:36 +0000 (10:19 -0700)]
debian: build with debugging symbol

Signed-off-by: Zang MingJie <zealot0630@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoINSTALL: Admit that only GNU make works.
Ben Pfaff [Thu, 7 Mar 2013 20:50:57 +0000 (12:50 -0800)]
INSTALL: Admit that only GNU make works.

I promised some time ago to take a look at fixing the behavior of the
Makefiles with non-GNU make, but it doesn't realistically seem that I will.

CC: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodatapath: Remove vport->linkname
Pravin B Shelar [Fri, 12 Apr 2013 23:13:32 +0000 (16:13 -0700)]
datapath: Remove vport->linkname

This field is no longer used in datapath.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Simplify datapath locking.
Pravin B Shelar [Fri, 12 Apr 2013 22:57:09 +0000 (15:57 -0700)]
datapath: Simplify datapath locking.

Currently OVS uses combination of genl and rtnl lock to protect
datapath state.  This was done due to networking stack locking.
But this has complicated locking and there are few lock ordering
issues with new tunneling protocols.
Following patch simplifies locking by introducing new ovs mutex
and now this lock is used to protect entire ovs state.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Add workqueue API to ovs compat workqueue.
Pravin B Shelar [Fri, 12 Apr 2013 22:56:14 +0000 (15:56 -0700)]
datapath: Add workqueue API to ovs compat workqueue.

Add work-queue api which are required for next commit.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agoovs-vsctl: Fix a segfault.
Gurucharan Shetty [Wed, 10 Apr 2013 18:55:06 +0000 (11:55 -0700)]
ovs-vsctl: Fix a segfault.

The following two commands results in a ovs-vsctl segfault.
ovs-vsctl -vfatal_signal:off --timeout=0 wait-until \
Open_vswitch . external_ids:blah="1"
/etc/init.d/openvswitch-switch restart

This patch fixes the segfault by properly setting the global
varibale, the_idl_txn to NULL when the underlying memory is
freed.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agoovs-ctl.in: Merge a single line function.
Gurucharan Shetty [Wed, 10 Apr 2013 18:53:40 +0000 (11:53 -0700)]
ovs-ctl.in: Merge a single line function.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
11 years agotests: Add test for ovs-vswitchd regression with empty db.
Ben Pfaff [Thu, 11 Apr 2013 21:08:01 +0000 (14:08 -0700)]
tests: Add test for ovs-vswitchd regression with empty db.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoAUTHORS: Add Ansis Atteka.
Ben Pfaff [Thu, 11 Apr 2013 23:28:47 +0000 (16:28 -0700)]
AUTHORS: Add Ansis Atteka.

I do not understand how this omission has gone on so long.

CC: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agobridge: Complete initial configuration even with empty database.
Ben Pfaff [Thu, 11 Apr 2013 22:47:08 +0000 (15:47 -0700)]
bridge: Complete initial configuration even with empty database.

If the database was empty, that is, it did not even contain an Open_vSwitch
top-level configuration record, at ovs-vswitchd startup time, then
OVS failed to detach and used 100% CPU.  This commit fixes the problem.

This problem was introduced by commit 63ff04e82623e765 (bridge: Only
complete daemonization after db commits initial config.).

This problem did not manifest if the initscripts supplied with Open vSwitch
were used, because those initscripts always initialize the database before
starting ovs-vswitchd, so this problem affects only users with hand-rolled
local OVS startup scripts.

Bug #16090.
Reported-by: Pravin Shelar <pshelar@nicira.com>
Tested-by: Pravin Shelar <pshelar@nicira.com>
Reported-by: Paul Ingram <paul@nicira.com>
Reported-by: Amre Shakimov <ashakimov@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
11 years agomemory: Avoid 100% CPU when there is nothing to report.
Ben Pfaff [Thu, 11 Apr 2013 22:05:32 +0000 (15:05 -0700)]
memory: Avoid 100% CPU when there is nothing to report.

Commit b9de4087685 (memory: Avoid an empty log message if there's nothing
to log.) introduced a 100% CPU usage condition when there is nothing to
log.  This fixes the problem.

Reported-by: Ansis Atteka <aatteka@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agonetlink-socket: Don't bother logging SO_RCVBUFFORCE failure
Ansis Atteka [Thu, 11 Apr 2013 18:33:24 +0000 (11:33 -0700)]
netlink-socket: Don't bother logging SO_RCVBUFFORCE failure

This patch fixes tests when they are run with "fakeroot debian/rules binary"
command.

The problem was that under fakeroot setsockopt() call could still return
EPERM and lead to a warning message being logged.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>