]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
7 years agoofproto: Update access rules for 'flow_cookie'.
Ben Pfaff [Tue, 6 Dec 2016 21:48:50 +0000 (13:48 -0800)]
ofproto: Update access rules for 'flow_cookie'.

The 'flow_cookie' member of struct rule is read during flow translation
without holding a mutex, breaking the documented OVS_GUARDED access rule.
However, the flow_cookie member is actually never modified after a rule is
initialized, so this commit changes the access rules to reflect that.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
7 years agoovs-vsctl: Print error when add-port fails.
Daniele Di Proietto [Wed, 21 Dec 2016 01:50:06 +0000 (17:50 -0800)]
ovs-vsctl: Print error when add-port fails.

When the add-port command fails, vsctl reports the failure and just
suggests to check the logs for more details.

ovs-vswitchd fills the error column in the Interface table with a
description of the error, so it might be helpful to print that.

This is useful especially for dpdk devices, because the port naming
change could use a better error reporting.

I'm planning another patch to make sure that ovs-vswitch writes
appropriates information in the error column, after the dpdk port naming
changes are merged.

CC: Ben Pfaff <blp@ovn.org>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agohash: Update murmurhash repo link in comments
Cian Ferriter [Wed, 21 Dec 2016 16:39:16 +0000 (16:39 +0000)]
hash: Update murmurhash repo link in comments

The MurmurHash code repo has moved from code.google to github. Update
the link to reflect this.

Signed-off-by: Cian Ferriter <cian.ferriter@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-controller: Log chassis claiming lport only when changes occur.
Mickey Spiegel [Tue, 20 Dec 2016 21:23:46 +0000 (13:23 -0800)]
ovn-controller: Log chassis claiming lport only when changes occur.

With recent OVN commits, the logic for a chassis to claim
or release a logical port was consolidated.  This is a
good thing.  However, there was a logic change that
resulted in VLOG_INFO being generated every time on the
ovn-controller.  This patch changes the logic so that
VLOG_INFO is only generated when there is a change, for
example when the chassis claims an lport the first time.

Signed-off-by: Mickey Spiegel <mickeys.dev@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb-idlc: Initialize nonnull string columns for inserted rows.
Ben Pfaff [Wed, 21 Dec 2016 00:17:31 +0000 (16:17 -0800)]
ovsdb-idlc: Initialize nonnull string columns for inserted rows.

When a schema column has type "exactly one string", the corresponding
struct member has type "char *" and the documented and expected behavior
is that the string should always be nonnull.  (The code generator even
adds a comment /* Always nonnull. */ in the struct definition.)  In the
case where a value is not available, the string is supposed to be
initialized to "" instead of to NULL.

However, the IDL code for inserting a new row did not properly initialize
the column to "", instead leaving it NULL.  This could cause null pointer
dereferences in corner cases.

This commit fixes the problem.

Reported-by: Lance Richardson <lrichard@redhat.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2016-December/326500.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Lance Richardson <lrichard@redhat.com>
7 years agotests: Regenerate atlocal when running tests.
Ben Pfaff [Tue, 20 Dec 2016 21:15:51 +0000 (13:15 -0800)]
tests: Regenerate atlocal when running tests.

A previous patch fixed double rebuilds when running tests in some cases.
That patch removed dependencies from targets in tests/automake.mk that
were redundant because the "all" target already depended on them.  A
dependency on tests/atlocal was also removed in the belief that "all"
depended on tests/atlocal.  This belief was incorrect, which meant that
tests/atlocal would not get regenerated if it was removed or out of date.
This commit fixes the problem.

Reported-by: Joe Stringer <joe@ovn.org>
Fixes: a8cb456227b0 ("tests: Fix double-rebuild of testsuite for "check-valgrind" and similar.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
7 years agoWindows: document multiple NIC support setup
Alin Serdean [Tue, 20 Dec 2016 19:42:36 +0000 (19:42 +0000)]
Windows: document multiple NIC support setup

This patch updates the documentation on how to set up OVS with multiple
NICs.

Also update the documentation to show users how new internal ports are
created

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Paul Boca <pboca@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Add multiple switch internal ports
Alin Serdean [Tue, 20 Dec 2016 19:42:19 +0000 (19:42 +0000)]
datapath-windows: Add multiple switch internal ports

This patch adds multiple internal ports support to the windows datapath.
All tunnels types have been updated to accommodate this new functionality.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Co-authored-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Paul Boca <pboca@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoWindows: Add internal switch port per OVS bridge
Alin Serdean [Tue, 20 Dec 2016 19:41:22 +0000 (19:41 +0000)]
Windows: Add internal switch port per OVS bridge

This patch updates the following commands in the vswitch:
 ovs-vsctl add-br br-test
 ovs-vsctl del-br br-test

ovs-vsctl add-br br-test:
    This command will now create an internal port on the MSFT virtual switch
  using the WMI interface from Msvm_VirtualEthernetSwitchManagementService
  leveraging the method AddResourceSettings.
    Before creating the actual port, the switch will be queried to see if there
  is not a port already created (good for restarts when restarting the
  vswitch daemon). If there is a port defined it will return success and log
  a message.
    After checking if the port already exists the command will also verify
  if the forwarding extension (windows datapath) is enabled and on a single
  switch. If it is not activated or if it is activated on multiple switches
  it will return an error and a message will be logged.
    After the port was created on the switch, we will disable the adapter on
  the host and rename to the corresponding OVS bridge name for consistency.
    The user will enable and set the values he wants after creation.

ovs-vsctl del-br br-test
    This command will remove an internal port on the MSFT virtual switch
  using the Msvm_VirtualEthernetSwitchManagementService class and executing
  the method RemoveResourceSettings.

Both commands will be blocking until the WMI job is finished, this allows us
to guarantee that the ports are created and their name are set before issuing
a netlink message to the windows datapath.

This patch also includes helpers for normal WMI retrievals and initializations.
Appveyor and documentation has been modified to include the libraries needed
for COM objects.

This patch was tested individually using IMallocSpy and CRT heap checks
to ensure no new memory leaks are introduced.

Tested on the following OS's:
Windows 2012, Windows 2012r2, Windows 2016

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Paul Boca <pboca@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodocs: Document nc dependency for kernel tests.
Joe Stringer [Fri, 16 Dec 2016 19:10:12 +0000 (11:10 -0800)]
docs: Document nc dependency for kernel tests.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
7 years agodatapath-windows: Conntrack - Enable FTP support
Sairam Venugopal [Fri, 16 Dec 2016 22:28:12 +0000 (14:28 -0800)]
datapath-windows: Conntrack - Enable FTP support

Enable the support for tracking FTP connections in the Connection tracker.
This checks an incoming ftp control connection to extract the related data
connection. When a matching data connection arrives, it would then update
the connection entry to point to the original control connection.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Conntrack - Introduce support for tracking related connections
Sairam Venugopal [Fri, 16 Dec 2016 22:28:11 +0000 (14:28 -0800)]
datapath-windows: Conntrack - Introduce support for tracking related connections

Introduce a new table to track related connections. This table will be
used to track FTP data connections based on the control connection. There
is a new Conntrack-ftp.c to parse incoming FTP messages to determine the
related data ports. It creates a new entry in the related connections
tracker table. If there is a matching FTP data connection, then the state
for that connection is marked as RELATED.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Cleanup Conntrack definitions and introduce related entries
Sairam Venugopal [Fri, 16 Dec 2016 22:28:10 +0000 (14:28 -0800)]
datapath-windows: Cleanup Conntrack definitions and introduce related entries

Consolidate the reusable structs and includes. Introduce the new
OVS_CT_REL_ENTRY to track related connections.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Conntrack - Fix OvsGetTcpPayloadLength()
Sairam Venugopal [Fri, 16 Dec 2016 22:28:09 +0000 (14:28 -0800)]
datapath-windows: Conntrack - Fix OvsGetTcpPayloadLength()

Move the OvsGetTcpPayloadLength() to common header. Update the code to
check for null references and the correct size of the TCP header.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agowindows: Incorrect check while fetching adapter addresses
Alin Serdean [Tue, 13 Dec 2016 18:52:35 +0000 (18:52 +0000)]
windows: Incorrect check while fetching adapter addresses

Checking for ERROR_INSUFFICIENT_BUFFER is incorrect per
MSFT documentation:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365915(v=vs.85).aspx

Also, the initial call to GetAdaptersAddresses was wrong. In the case
of a successful return 'all_addr' was not allocated leading to a crash.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-by: Lior Baram <lior.baram@hpe.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoovn-controller: Fix conntrack zone in gateway routers.
Guru Shetty [Mon, 19 Dec 2016 12:12:17 +0000 (04:12 -0800)]
ovn-controller: Fix conntrack zone in gateway routers.

The gateway router was using the ct_next action to
reassemble packets.  But ct_next action by default would
use the zone allocated for a logical port and in case of
gateway routers that value was zero.  This would make
the flow use the default zone of zero.  This had some
unintended consequences as the zone used to track packets
and the zone used to eventually commit it (DNAT zone)
was different.  As a result, a packet would never have ct.est set.

With this commit, when ct_next action is used in a gateway
router, we use the DNAT zone.  This is similar to the
strategy used in commit c2e954a117a8 (ovn-controller: Datapath
based conntrack zone for load-balancing.)

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-controller: Monitor only necessary southbound rows.
Ben Pfaff [Tue, 20 Dec 2016 03:25:59 +0000 (19:25 -0800)]
ovn-controller: Monitor only necessary southbound rows.

Until now, ovn-controller has replicated all of the southbound database
(through the IDL).  This is inefficient, especially in a large OVN setup
where many logical networks are not present on an individual hypervisor.
This commit improves on the situation somewhat, by making ovn-controller
replicate (almost) only the port bindings, logical flows, and multicast
groups that are actually relevant to the particular hypervisor on which
ovn-controller is running.  This is easily possible by replicating the
patch ports from the Port_Binding table and using these relationships to
determine connections between datapaths.

This patch is strongly influenced by earlier work from the CCed developers.
I am grateful for their assistance.

CC: Darrell Ball <dlu998@gmail.com>
CC: Liran Schour <LIRANS@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Liran Schour <lirans@il.ibm.com>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agoovsdb-idl: Change interface to conditional monitoring.
Ben Pfaff [Tue, 20 Dec 2016 04:55:35 +0000 (20:55 -0800)]
ovsdb-idl: Change interface to conditional monitoring.

Most users of OVSDB react to whatever is currently in their view of the
database, as opposed to keeping track of changes and reacting to those
changes individually.  The interface to conditional monitoring was
different, in that it expected the client to say what to add or remove from
monitoring instead of what to monitor.  This seemed reasonable at the time,
but in practice it turns out that the usual approach actually works better,
because the condition is generally a function of the data visible in the
database.  This commit changes the approach.

This commit also changes the meaning of an empty condition for a table.
Previously, an empty condition meant to replicate every row.  Now, an empty
condition means to replicate no rows.  This is more convenient for code
that gradually constructs conditions, because it does not need special
cases for replicating nothing.

This commit also changes the internal implementation of conditions from
linked lists to arrays.  I just couldn't see an advantage to using linked
lists.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Liran Schour <lirans@il.ibm.com>
7 years agoovn-controller: Rename all_lports to local_lports.
Ben Pfaff [Sat, 17 Dec 2016 18:51:49 +0000 (10:51 -0800)]
ovn-controller: Rename all_lports to local_lports.

This sset has always just contained the names of logical ports that are
local to the current hypervisor, but the name 'all_lports' implied that it
contained the name of every logical port.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agoovn-controller: Drop most uses of OVS patch ports.
Ben Pfaff [Mon, 19 Dec 2016 22:53:18 +0000 (14:53 -0800)]
ovn-controller: Drop most uses of OVS patch ports.

Until now, ovn-controller has implemented OVN logical patch ports and
l3gateway ports in terms of OVS patch ports.  It is a hassle to create and
destroy ports, and it is also wasteful compared to what the patch ports
actually buy us: the ability to "save and restore" a packet around a
recursive trip through the flow table.  The "clone" action can do that too,
without the need to create a port.  This commit takes advantage of the
clone action for that purpose, getting rid of most of the patch ports
previously created by ovn-controller.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agoovn-controller: Avoid code duplication getting chassis record.
Ben Pfaff [Thu, 15 Dec 2016 23:20:06 +0000 (15:20 -0800)]
ovn-controller: Avoid code duplication getting chassis record.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agopnysical: Factor code out of consider_port_binding().
Ben Pfaff [Mon, 5 Dec 2016 07:07:49 +0000 (23:07 -0800)]
pnysical: Factor code out of consider_port_binding().

These functions will have an additional user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agoovn-controller: Handle only relevant ports and flows.
Ben Pfaff [Mon, 19 Dec 2016 21:20:07 +0000 (13:20 -0800)]
ovn-controller: Handle only relevant ports and flows.

On a particular hypervisor, ovn-controller only needs to handle ports
and datapaths that have some relationship with it, that is, the
ports that actually reside on the hypervisor, plus all the other ports on
those ports' datapaths, plus all of the ports and datapaths that are
reachable from those via logical patch ports.  Until now, ovn-controller
has done a poor job of limiting what it deals with to this set.  This
commit improves the situation.

This commit gets rid of the concept of a "patched_datapath" which until now
was used to represent any datapath that contained a logical patch port.
Previously, the concept of a "local_datapath" meant a datapath with a VIF
that resides on the local hypervisor.  This commit extends that concept to
include any other datapath that can be reached from a VIF on the local
hypervisor, which is a simplification that makes the code easier to
understand in a few places.

CC: Gurucharan Shetty <guru@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agolport: Add index for logical datapaths.
Ben Pfaff [Tue, 6 Dec 2016 17:19:41 +0000 (09:19 -0800)]
lport: Add index for logical datapaths.

This will have its first real user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agolport: Tolerate null pointers in destroy functions.
Ben Pfaff [Fri, 2 Dec 2016 07:25:40 +0000 (23:25 -0800)]
lport: Tolerate null pointers in destroy functions.

The coding style says to do this.

The actual caller doesn't pass a null pointer.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agolport: Be a little more careful building lport index.
Ben Pfaff [Fri, 2 Dec 2016 07:24:41 +0000 (23:24 -0800)]
lport: Be a little more careful building lport index.

It seems like a good idea to check for and warn about all kinds of
duplicates, and to avoid segfaulting if a datapath column is empty.
(However, the database schema should prevent both issues.)

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agoovn-controller: Make indexes more broadly available.
Ben Pfaff [Fri, 2 Dec 2016 07:30:00 +0000 (23:30 -0800)]
ovn-controller: Make indexes more broadly available.

This will allow binding_run() to use them in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agoofp-actions: Add clone action.
William Tu [Sun, 18 Dec 2016 08:13:02 +0000 (00:13 -0800)]
ofp-actions: Add clone action.

This patch adds OpenFlow clone action with syntax as below:
"clone([action][,action...])".  The clone() action makes a copy of the
current packet and executes the list of actions against the packet,
without affecting the packet after the "clone(...)" action.  In other
word, the packet before the clone() and after the clone() is the same,
no matter what actions executed inside the clone().

Use case 1:
Set different fields and output to different ports without unset
actions=
  clone(mod_dl_src:<mac1>, output:1), clone(mod_dl_dst:<mac2>, output:2), output:3
Since each clone() has independent packet, output:1 has only dl_src modified,
output:2 has only dl_dst modified, output:3 has original packet.

Similar to case1
actions=
  push_vlan(...), output:2, pop_vlan, push_vlan(...), output:3
can be changed to
actions=
  clone(push_vlan(...), output:2),clone(push_vlan(...), output:3)
without having to add pop_vlan.

case 2: resubmit to another table without worrying packet being modified
  actions=clone(resubmit(1,2)), ...

Signed-off-by: William Tu <u9012063@gmail.com>
[blp@ovn.org revised this to omit the "sample" action]
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoofp-actions: Move function for struct ofpact_nest near struct definition.
Ben Pfaff [Thu, 15 Dec 2016 17:25:04 +0000 (09:25 -0800)]
ofp-actions: Move function for struct ofpact_nest near struct definition.

This seems like a logical place for it.

Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoofp-actions: Use struct ext_action_header for appropriate actions.
Ben Pfaff [Thu, 15 Dec 2016 17:24:24 +0000 (09:24 -0800)]
ofp-actions: Use struct ext_action_header for appropriate actions.

A few Open vSwitch extension actions have no fixed arguments but do have
variable-length options that follow the header, and an upcoming commit will
add another such action.  There is little value in having individual
structures for these actions, since they all have the same form, so this
commit makes all of them use the existing struct ext_action_header.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agoovsdb-idl: Drop write-only member from struct ovsdb_idl_condition.
Ben Pfaff [Sat, 17 Dec 2016 00:15:40 +0000 (16:15 -0800)]
ovsdb-idl: Drop write-only member from struct ovsdb_idl_condition.

The 'tc' member of struct ovsdb_idl_condition was written but never read,
so remove it.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
7 years agoovn-controller: Don't enable IDL tracking.
Ben Pfaff [Tue, 20 Dec 2016 03:34:02 +0000 (19:34 -0800)]
ovn-controller: Don't enable IDL tracking.

IDL tracking has a cost and nothing in ovn-controller was getting any value
for that cost, so disable it.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
7 years agodatapath-windows: Fix issues related to packet completion
Shashank Ram [Thu, 8 Dec 2016 21:31:49 +0000 (13:31 -0800)]
datapath-windows: Fix issues related to packet completion

In OvsTunnelPortTx() function, for packets coming from the
VIF port, the srcVportNo, srcPortId and srcNicIndex were
getting modified for the original NBL prior to creation
of newNbl. This is not correct since modifying the original
packet's forwarding detail can cause completion issues.
Instead, we should keep the forwarding detail of the original
packet as is, and only update the forwarding detail for the
newNbl.

Signed-off-by: Shashank Ram <rams@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agosystem-traffic: Skip test cases if firewalld is on.
Yi-Hung Wei [Fri, 9 Dec 2016 02:34:07 +0000 (18:34 -0800)]
system-traffic: Skip test cases if firewalld is on.

On RHEL 7.3, test cases that use vxlan, gre, and geneve tunnels fail because
traffic is blocked by default firewall configuration. This commit detects the
status of firewalld, and skips the tests if firewalld is on.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agosystem-traffic: Skip test cases if netcat is not installed.
Yi-Hung Wei [Fri, 9 Dec 2016 02:34:06 +0000 (18:34 -0800)]
system-traffic: Skip test cases if netcat is not installed.

Test cases that use netcat will fail if netcat is not installed. This patch
detects if netcat is present, and skips those test cases if netcat is not there.

Singed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: compat: Fix build on RHEL 7.3
Yi-Hung Wei [Fri, 9 Dec 2016 02:34:05 +0000 (18:34 -0800)]
datapath: compat: Fix build on RHEL 7.3

RHEL 7.3 provides upstream tunnel but it does not support name_assign_type
attribute in net-device. This patch fixes the build problem by backporting
functions with name_assign_type, and using proper flags in acinclude.m4 to
invoke backport functions.

Tested on RHEL 7.3 with kernel 3.10.0-514.el7.x86_64

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agotravis: Update build matrix for latest kernels.
Joe Stringer [Wed, 14 Dec 2016 00:00:00 +0000 (16:00 -0800)]
travis: Update build matrix for latest kernels.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
7 years agodist-docs: Make "make dist-docs" work again.
Ben Pfaff [Tue, 13 Dec 2016 20:50:10 +0000 (12:50 -0800)]
dist-docs: Make "make dist-docs" work again.

CC: Stephen Finucane <stephen@that.guru>
Fixes: c431227e3350 ("doc: Remove documentation from distdoc target")
Reported-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
7 years agodoc: Use higher resolution logo
Stephen Finucane [Tue, 13 Dec 2016 17:40:38 +0000 (17:40 +0000)]
doc: Use higher resolution logo

Rework the logo to remove much of the white background and increase
resolution.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Add link to manpages guide
Stephen Finucane [Tue, 13 Dec 2016 18:38:42 +0000 (18:38 +0000)]
doc: Add link to manpages guide

This was included only in the contents page.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reported-by: Russell Bryant <russell@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Fix a couple of broken links
Stephen Finucane [Tue, 13 Dec 2016 18:38:41 +0000 (18:38 +0000)]
doc: Fix a couple of broken links

I missed these while moving things around.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodatapath-windows: Conntrack move null checks to functions
Alin Serdean [Thu, 8 Dec 2016 18:44:50 +0000 (18:44 +0000)]
datapath-windows: Conntrack move null checks to functions

Add null checks inside OvsConntrackValidateIcmpPacket,
OvsConntrackValidateTcpPacket to make the functions self-contained.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Suggested-by: Yin Lin <linyi@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Fix the redefinition of variables
Sairam Venugopal [Sat, 3 Dec 2016 00:06:02 +0000 (16:06 -0800)]
datapath-windows: Fix the redefinition of variables

Some of the variables were getting re-defined in the function. This causes
compiler warning in Windows SDK 10.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoovn-northd: Sort options in put_dhcp(v6)_opts.
Daniele Di Proietto [Fri, 9 Dec 2016 01:43:31 +0000 (17:43 -0800)]
ovn-northd: Sort options in put_dhcp(v6)_opts.

The order of the options in the packet generated by ovs-controller
depends on the hash function.  I believe that murmur hash (our default)
produces different outputs depending on the endianness of the system.
Also, if SSE4.2 is enabled at build time, we use CRC32 for hashing which
gives different results even on x86.

This causes one unit test to fail on big endian or with SSE4.2:

ovn -- dhcpv4 : 1 HV, 2 LS, 2 LSPs/LS

This commit fixes the problem in ovn-northd by always sorting dhcp
options inside the logical flow put_dhcp(v6)_opts action.

Reported-at: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840770
Suggested-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agovswitch.xml: Document reasonable range for MTU.
nickcooper-zhangtonghao [Mon, 12 Dec 2016 04:48:57 +0000 (20:48 -0800)]
vswitch.xml: Document reasonable range for MTU.

According to RFC 791, every internet module must be
able to forward a datagram of 68 octets without further
fragmentation.  This is because an internet header may
be up to 60 octets, and the minimum fragment is 8 octets.
The maximum size of IP packets is 65535 bytes. The range
of MTU values allowes for the MTU configuration parameter
is 68 to 65535.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
[blp@ovn.org changed this to just a documentation patch]
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodatapath: Checks the MTU for netdev-dummy ports.
nickcooper-zhangtonghao [Mon, 12 Dec 2016 04:48:56 +0000 (20:48 -0800)]
datapath: Checks the MTU for netdev-dummy ports.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovs-sandbox: add '--vswitchd-unforced-dummy' option.
nickcooper-zhangtonghao [Wed, 7 Dec 2016 18:04:03 +0000 (10:04 -0800)]
ovs-sandbox: add '--vswitchd-unforced-dummy' option.

The ovs-sandbox runs in the "dummy mode" by default.
In this mode of testing, no packets travel across
physical or virtual networks. But sometimes, we may
create veth network devices and add them to ovs bridge
for developing and testing. It's necessary to add an option.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agopython: Update comment to mention SSL support.
Guoshuai Li [Fri, 9 Dec 2016 04:39:41 +0000 (12:39 +0800)]
python: Update comment to mention SSL support.

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agopython: Reconnect SSL connections when ovsdb-server restarts.
Guoshuai Li [Wed, 7 Dec 2016 06:38:22 +0000 (14:38 +0800)]
python: Reconnect SSL connections when ovsdb-server restarts.

The do_handshake() function throws the exception OpenSSL.SSL.SysCallError
when the peer's SSL connection is closed, And the recv() function also
throws the exception OpenSSL.SSL.SysCallError when the peer's SSL
connection is abnormally closed, This commit catches the exception and
return error's errno.

Similarly, the recv() function also throws the exception
OpenSSL.SSL.ZeroReturnError when the peer's SSL connection is closed.  This
exception refers to TCP connection normal closed, return (0, "")

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
7 years agoconfigure: Enable new warning options added in GCC 6.
Ben Pfaff [Mon, 5 Dec 2016 22:38:08 +0000 (14:38 -0800)]
configure: Enable new warning options added in GCC 6.

-Wnull-dereference is also new in GCC 6 but upon testing it produces far
too many false positives to be usable for OVS.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
7 years agoconfigure: Enable new warning options added in GCC 5.
Ben Pfaff [Mon, 5 Dec 2016 22:29:24 +0000 (14:29 -0800)]
configure: Enable new warning options added in GCC 5.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
7 years agoconfigure: Use -Wformat-security with -Wformat.
Ben Pfaff [Mon, 5 Dec 2016 22:28:59 +0000 (14:28 -0800)]
configure: Use -Wformat-security with -Wformat.

GCC 6.1 warns that -Wformat-security has no effect without -Wformat, so
this commit fixes the problem.

The change to _OVS_CHECK_CC_OPTION is needed so that the cache variable
name doesn't end up with a space in it, which obviously doesn't work.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
7 years agoacinclude: Fix -Wstrict-prototypes and -Wold-style-definition detection.
Ben Pfaff [Mon, 5 Dec 2016 22:29:35 +0000 (14:29 -0800)]
acinclude: Fix -Wstrict-prototypes and -Wold-style-definition detection.

AC_LANG_PROGRAM(,) uses a program like this:

    int main() { return 0; }

but that triggers warnings for -Wstrict-prototypes and for
-Wold-style-definition, since this definition of main() lacks a prototype
and is therefore old-style.  This meant that -Wstrict-prototypes and
-Wold-style-definition weren't being turned on for new-enough GCC.  This
commit fixes the problem by changing the program that is test-compiled to:

    int x;

which doesn't make any compilers mad, as far as I know.

I recently upgraded to GCC 6.1 and just now noticed the issue, so I think
that GCC somewhere between version 4.9 and version 6.1 must have started
warning about main() when it's declared this way.

Also, fix a few functions that lacked prototypes.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
7 years agoovn: Encode dhcpv6 PACKET_IN userdata as big endian.
Daniele Di Proietto [Thu, 8 Dec 2016 19:11:50 +0000 (11:11 -0800)]
ovn: Encode dhcpv6 PACKET_IN userdata as big endian.

The packet in userdata generated by ovn-controller when translating the
put_dhcpv6_opt action includes 16-bit integers.

Currently these 16-bit integers are encoded with native endianness.
This is ok becase the only consumer of that userdata is ovn-controller
itself, but it means that the OpenFlow action we're generating might
not really be the same on different hosts.

I think it's better to encode the userdata as big-endian, like the rest
of OpenFlow messages.

This fixes a test failure on big-endian platforms, because the generated
OpenFlow bytes were different than expected (the expectation was
generated on a little endian machine).

Now 'struct dhcp_opt6_header' is identical to 'struct
dhcpv6_opt_header', but I chose to keep them separate, because they
have different purposes.  I also renamed the members to avoid confusion.

I haven't tested this on a real setup.

CC: Numan Siddique <nusiddiq@redhat.com>
Reported-at: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840770
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
7 years agolib/dpdk: fix double free on exit
Aaron Conole [Fri, 9 Dec 2016 16:22:27 +0000 (11:22 -0500)]
lib/dpdk: fix double free on exit

The DPDK EAL library intents that all argc/argv arguments passed on the
command line will be in the form:

    progname dpdk arguments program arguments

This means the argv array will look something like:
   argv[0] = progname
   argv[1..x] = dpdk arguments
   argv[x..y] = program arguments

When the eal initialization routine completes, it will modify the argv array
to set argv[ret] = progname, such that the arguments can then be passed to
something like getopts for further processing.

When the dpdk arguments rework was initially added, the assignment mentioned
above was not considered.  This means two errors were introduced:
1. Leak of the element at argv[ret]
2. Double-free of the element at argv[0]

Reported-by: Ilya Maximets <i.maximets@samsung.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2016-November/325442.html
Fixes: bab694097133 ("netdev-dpdk: Convert initialization from cmdline to db")
Signed-off-by: Aaron Conole <aconole@redhat.com>
7 years agodoc: Add required packages for RHEL build dependency
Yi-Hung Wei [Sat, 10 Dec 2016 00:41:22 +0000 (16:41 -0800)]
doc: Add required packages for RHEL build dependency

Two more packages are needed to build ovs package on RHEL.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
[joe@ovn.org added fedora doc]
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath-windows: Avoid busy wait in OvsStartIpHelper
Shashank Ram [Wed, 23 Nov 2016 01:32:54 +0000 (17:32 -0800)]
datapath-windows: Avoid busy wait in OvsStartIpHelper

Previously, the IP Helper thread would wait for an event
but with a timeout of 0, which resulted in the thread
busy waiting causing high CPU usage by the kernel.
Since the IP Helper thread is only required based on
certain events, it makes sense to wait indefinitely
till we receieve such an event notification to wake up
the thread. This change aims to address this issue.

When OvsEnqueueIpHelperRequest() or OvsInternalAdapterUp()
is called, the ovsNumIpHelperRequests counter is incremented,
but upon consumption of the request, is not decremented.
Since the wakeup logic for the thread is determined by this
counter value, we need to reset the counter back correctly
once the request has been consumed by the IP Helper thread.

Signed-off-by: Shashank Ram <rams@vmware.com>
Acked-by: Yin Lin <linyi@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoovn-trace: Implement DHCP option support.
Ben Pfaff [Mon, 12 Dec 2016 17:16:18 +0000 (09:16 -0800)]
ovn-trace: Implement DHCP option support.

The put_dhcp_opts(v6) logical action didn't really work because ovn-trace
didn't handle DHCP options.  This fixes the problem.

This also makes the put_dhcp_opts(v6) logical provide useful tracing output
showing what's happening and the assumptions.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
7 years agodoc: Remove documentation from distdoc target
Stephen Finucane [Thu, 8 Dec 2016 12:55:30 +0000 (12:55 +0000)]
doc: Remove documentation from distdoc target

Basic Sphinx integration is now complete. Remove the documentation
aspects of the 'dist-docs' target in favor of the htmldocs target.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Populate 'faq' section
Stephen Finucane [Thu, 8 Dec 2016 12:55:29 +0000 (12:55 +0000)]
doc: Populate 'faq' section

This is mostly the exact same contents, albeit broken up into multiple
files.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Move WHY-OVS
Stephen Finucane [Thu, 8 Dec 2016 12:55:28 +0000 (12:55 +0000)]
doc: Move WHY-OVS

This is moved separately due to the sheer number of references to this
file in the codebase.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Populate 'tutorials' section
Stephen Finucane [Thu, 8 Dec 2016 12:55:27 +0000 (12:55 +0000)]
doc: Populate 'tutorials' section

Rename 'tutorial' to 'ovs-advanced' and 'ovn-tutorial' to 'ovn-basics'.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Populate 'topics' section
Stephen Finucane [Thu, 8 Dec 2016 12:55:26 +0000 (12:55 +0000)]
doc: Populate 'topics' section

There are many docs that don't need to kept at the top level, along
with many more hidden in random folders. Move them all.

This also allows us to add the '-W' flag to Sphinx, ensuring unindexed
docs result in build failures.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Further populate the 'howto' section
Stephen Finucane [Thu, 8 Dec 2016 12:55:25 +0000 (12:55 +0000)]
doc: Further populate the 'howto' section

There are a couple of references to these for various build systems.
The website is going to be our "one true resource" for all docs, so
simply remove these references.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Populate 'install', 'howto' sections
Stephen Finucane [Thu, 8 Dec 2016 12:55:24 +0000 (12:55 +0000)]
doc: Populate 'install', 'howto' sections

This is a dumb move of all 'INSTALL*' docs, with very little
refactoring (mostly updating links and making the titles a little more
consistent. Additional refactoring will be done in subsequent changes.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Populate 'internals' section
Stephen Finucane [Thu, 8 Dec 2016 12:55:23 +0000 (12:55 +0000)]
doc: Populate 'internals' section

This is mostly docs moved from the top-level directory and content
scraped from the Open vSwitch website source [1].

[1] https://github.com/openvswitch/openvswitch.github.io/

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Populate 'ref' section
Stephen Finucane [Thu, 8 Dec 2016 12:55:22 +0000 (12:55 +0000)]
doc: Populate 'ref' section

This is a simple table with links to the manpages published on
openvswitch.org. Something fancier can be done in the future.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Create directory structure
Stephen Finucane [Thu, 8 Dec 2016 12:55:21 +0000 (12:55 +0000)]
doc: Create directory structure

Create a series of sections, all of which are currently empty, using
the general design established by Jacob Kaplan-Moss and the Django
project [1]. Five sections are provided:

- intro
- tutorials
- topics
- howto
- ref
- faq
- internals

The purpose of each section is described in the documents themselves.

[1] https://jacobian.org/writing/great-documentation/

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoAdd initial sphinx configuration
Stephen Finucane [Thu, 8 Dec 2016 12:55:20 +0000 (12:55 +0000)]
Add initial sphinx configuration

This is essentially the output of 'sphinx-quickstart' but with the
following changes:

- Parts of the generated Makefile are merged into the existing
  Documentation/automake.mk Makefile
- A license is added to the index.rst file
- The OVS logo is added
- A 'contents' page is added, so we don't need to include a TOC on the
  home page
- The theme is switched to 'bizstyle', which makes better use of
  horizontal real estate than the default 'alabaster' theme

Copyright is assigned to "The Open vSwitch Development Community".

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-sbctl: Fix a few minor typesetting errors.
Ben Pfaff [Fri, 9 Dec 2016 18:28:04 +0000 (10:28 -0800)]
ovn-sbctl: Fix a few minor typesetting errors.

In manpages, \- is used primarily for literal "-" in literal text, that is,
it should usually be used for bold (literal) text.  (It's also used for
minus signs in mathematics.)  It should not generally be used for hyphens
in English text, as it was used here in italic (metasyntactic variable)
text.  This fixes the problem.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
7 years agonetdev: Set the default number of queues at removal from the database
Ilya Maximets [Thu, 8 Dec 2016 08:55:31 +0000 (11:55 +0300)]
netdev: Set the default number of queues at removal from the database

Expected behavior for attribute removal from the database is
resetting it to default value. Currently this doesn't work for
n_rxq/n_txq options of pmd netdevs (last requested value used):

# ovs-vsctl set interface dpdk0 options:n_rxq=4
# ovs-vsctl remove interface dpdk0 options n_rxq
# ovs-appctl dpif/show | grep dpdk0
  <...>
  dpdk0 1/1: (dpdk: configured_rx_queues=4, <...> \
                    requested_rx_queues=4,  <...>)

Fix that by using NR_QUEUE or 1 as a default value for 'smap_get_int'.

Fixes: a14b8947fd13 ("dpif-netdev: Allow different numbers of
                      rx queues for different ports.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Tested-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agodatapath: Fix compile time assertion.
Jarno Rajahalme [Sat, 10 Dec 2016 01:52:48 +0000 (17:52 -0800)]
datapath: Fix compile time assertion.

compiletime_assert() cannot be used in file scope, so use preprocessor
directives instead.

Reported-by: Joe Stringer <joe@ovn.org>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: Allow compile against current net-next.
Jarno Rajahalme [Sat, 10 Dec 2016 01:22:42 +0000 (17:22 -0800)]
datapath: Allow compile against current net-next.

This patch allows openvswitch kernel module in the OVS tree to be
compiled against the current net-next Linux kernel.  The changes are
due to these upstream commits:

56989f6d856 ("genetlink: mark families as __ro_after_init")
489111e5c25 ("genetlink: statically initialize families")
a07ea4d9941 ("genetlink: no longer support using static family IDs")

struct genl_family initialization is changed be completely static and
to include the new (in Linux 4.6) __ro_after_init attribute.  Compat
code defines it as an empty macro if not defined already.

GENL_ID_GENERATE is no longer defined, but since it was defined as 0,
it is safe to drop it from all initializers also on older Linux
versions.  A compiletime_assert is added to make sure this is true
whenever GENL_ID_GENERATE is defined.

Tested with current Linux net-next (4.9) and 3.16.

It should be noted that there are still a number of fixes and new
features in upstream net-next that are yet to be backported.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
7 years agoofproto-dpif-ipfix: Fix assertion failure for bad configuration.
Ben Pfaff [Fri, 9 Dec 2016 23:09:42 +0000 (15:09 -0800)]
ofproto-dpif-ipfix: Fix assertion failure for bad configuration.

The assertions in dpif_ipfix_set_options() made some bad assumptions about
flow exporters.  The code that added and removed exporters would add a flow
exporter even if it had an invalid configuration ("broken"), but the
assertions checked that broken flow exporters were not added.  Thus, the
when a flow exporter was broken, ovs-vswitchd would crash due to an
assertion failure.

Here is an example vsctl command that, run in the sandbox, would crash
ovs-vswitchd:

    ovs-vsctl \
        -- add-br br0 \
        -- --id=@br0 get bridge br0 \
        -- --id=@ipfix create ipfix target='["xyzzy"]' \
        -- create flow_sample_collector_set id=1 bridge=@br0 ipfix=@ipfix

The minimal fix would be to remove the assertions, but this would leave
broken flow exporters in place.  This commit goes a little farther and
actually removes broken flow exporters.

This fix pulls code out of an "if" statement to a higher level, so it is a
smaller fix when viewed igoring space changes.

This bug dates back to the introduction of IPFIX in 2013.

VMware-BZ: #1779123
CC: Romain Lenglet <romain.lenglet@berabera.info>
Fixes: 29089a540cfa ("Implement IPFIX export")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agorpms: Remove more OVN files form openvswitch rpm builds
Andy Zhou [Fri, 9 Dec 2016 01:26:10 +0000 (17:26 -0800)]
rpms: Remove more OVN files form openvswitch rpm builds

OVN is packaged with openvswitch-fedora.spec.in, but not with
openvswitch.spec.in. Remove OVN files from openvswitch.spec.in
builds to make rpm build happy.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
7 years agocsum: Fix csum_continue() on big endian with an odd number of bytes.
Daniele Di Proietto [Thu, 8 Dec 2016 19:35:30 +0000 (11:35 -0800)]
csum: Fix csum_continue() on big endian with an odd number of bytes.

Even though it reads 16 bits at a time, csum_continue() is almost
neutral to endianness (see RFC 1071 1.2 (B), "Byte Order Independence").

Consider a buffer like the following:

00000000: XX YY XX YY XX YY XX YY ZZ

Each couple of bytes is interpreted on little endian as:

*data = 0xYYXX

while on big endian

*data = 0xXXYY

The last byte "ZZ" should be treated as the two bytes "ZZ 00"
little endian:

*data = 0x00ZZ

big endian:

*data = 0xZZ00

which means that the last byte (for odd buffers) should be left shifted
by 8 bits on big endian platforms.

This fixes a couple of connection tracking tests in userspace for big
endian platforms.

I guess RFC1071 4.1 (implementation example of the checksum in C), would
manifest the same problem on big endian.

Reported-at: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840770
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agoovs-vswitchd: Avoid segfault for "netdev" datapath.
nickcooper-zhangtonghao [Wed, 7 Dec 2016 18:04:04 +0000 (10:04 -0800)]
ovs-vswitchd: Avoid segfault for "netdev" datapath.

When the datapath, whose type is "netdev", processes packets
in userspce action, it may cause a segmentation fault. In the
dp_execute_userspace_action(), we pass the "wc" argument to
dp_netdev_upcall() using NULL. In the dp_netdev_upcall() call tree,
the "wc" will be used. For example, dp_netdev_upcall() uses the
&wc->masks for debugging, and flow_wildcards_init_for_packet()
uses the  "wc" if we disable megaflow, which is described in
more detail below.

Segmentation fault in flow_wildcards_init_for_packet:

    #0  0x0000000000468fe8 flow_wildcards_init_for_packet lib/flow.c:1275
    #1  0x0000000000436c0b upcall_cb ofproto/ofproto-dpif-upcall.c:1231
    #2  0x000000000045bd96 dp_netdev_upcall lib/dpif-netdev.c:3857
    #3  0x0000000000461bf3 dp_execute_userspace_action lib/dpif-netdev.c:4388
    #4  dp_execute_cb lib/dpif-netdev.c:4521
    #5  0x0000000000486ae2 odp_execute_actions lib/odp-execute.c:538
    #6  0x00000000004607f9 dp_netdev_execute_actions lib/dpif-netdev.c:4627
    #7  packet_batch_per_flow_execute lib/dpif-netdev.c:3927
    #8  dp_netdev_input__ lib/dpif-netdev.c:4229
    #9  0x0000000000460ba8 dp_netdev_input lib/dpif-netdev.c:4238
    #10 dp_netdev_process_rxq_port lib/dpif-netdev.c:2873
    #11 0x000000000046126e dpif_netdev_run lib/dpif-netdev.c:3000
    #12 0x000000000042baf5 type_run ofproto/ofproto-dpif.c:504
    #13 0x00000000004192bf ofproto_type_run ofproto/ofproto.c:1687
    #14 0x0000000000409965 bridge_run__ vswitchd/bridge.c:2875
    #15 0x000000000040f145 bridge_run vswitchd/bridge.c:2938
    #16 0x00000000004062e5 main vswitchd/ovs-vswitchd.c:111

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agotreewide: Fix recent flake8-check.
Joe Stringer [Thu, 8 Dec 2016 18:22:16 +0000 (10:22 -0800)]
treewide: Fix recent flake8-check.

Without this patch, I see errors like this on master:
../ofproto/ipfix-gen-entities:115:1: E305 expected 2 blank lines after
class or function definition, found 1

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agoIntegrationGuide: Fix word wrapping.
Guoshuai Li [Wed, 7 Dec 2016 06:07:05 +0000 (14:07 +0800)]
IntegrationGuide: Fix word wrapping.

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoFix ovndb_servers master and VirtualIP are not on the same node.
Guoshuai Li [Sat, 3 Dec 2016 07:38:12 +0000 (15:38 +0800)]
Fix ovndb_servers master and VirtualIP are not on the same node.

PCS man page says role=Stopped/Started/Master/Slave.
A role can be master or slave (if no role is specified,
it defaults to 'started').

Command line

"$pcs constraint colocation add ovndb_servers-master with
master VirtualIP"

means that the Started role node of ovsdb follows the master node of
VirtualIP.  But we actually want the ovsdb master node to follow the
VirtualIP's Started node.

Signed-off-by: Andy Zhou <azhou@ovn.org>
7 years agoovn: Fix pacemaker Master node does not monitor the OVSDB status
Guoshuai Li [Tue, 6 Dec 2016 12:35:08 +0000 (20:35 +0800)]
ovn: Fix pacemaker Master node does not monitor the OVSDB status

OVSDB resource is multi-state resource, pacemaker monitor actions are
insufficient to monitor a multi-state resource.  The usual one will
cover the slave role, so it is need to configure monitoring for the
master.

http://clusterlabs.org/doc/en-US/Pacemaker/1.1-pcs/html/ \
Pacemaker_Explained/_monitoring_multi_state_resources.html

Signed-off-by: Andy Zhou <azhou@ovn.org>
7 years agodpctl: Fix usage for most dpctl commands.
Ben Pfaff [Tue, 6 Dec 2016 19:40:29 +0000 (11:40 -0800)]
dpctl: Fix usage for most dpctl commands.

The usage should not repeat the command name, but most of the dpctl
commands' usage did repeat it.  This fixes the problem.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Aaron Conole <aconole@redhat.com>
7 years agoovs-appctl: Add usage content to "upcall/set-flow-limit" command.
nickcooper-zhangtonghao [Tue, 6 Dec 2016 09:01:22 +0000 (01:01 -0800)]
ovs-appctl: Add usage content to "upcall/set-flow-limit" command.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovs-appctl: Add usage content to "dpctl/*" command.
nickcooper-zhangtonghao [Tue, 6 Dec 2016 09:01:21 +0000 (01:01 -0800)]
ovs-appctl: Add usage content to "dpctl/*" command.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-trace: Add output format options to usage message.
Ben Pfaff [Sun, 23 Oct 2016 18:25:02 +0000 (11:25 -0700)]
ovn-trace: Add output format options to usage message.

Also adjust the indentation of the option explanations so that they line up
better.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
7 years agotests: Add tracing to "ovn -- 2 HVs, 4 lports/HV, localnet ports" test.
Ben Pfaff [Sun, 23 Oct 2016 17:50:36 +0000 (10:50 -0700)]
tests: Add tracing to "ovn -- 2 HVs, 4 lports/HV, localnet ports" test.

Adding ovn-trace calls makes failures easier to understand and diagnose.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
7 years agotests: Fix order confusion in "ovn -- 2 HVs, 4 lports/HV, localnet ports".
Ben Pfaff [Sun, 23 Oct 2016 17:50:35 +0000 (10:50 -0700)]
tests: Fix order confusion in "ovn -- 2 HVs, 4 lports/HV, localnet ports".

The order of src and dst was swapped both in assignment and reference,
which meant that the result worked OK but was really confusing to try to
extend or modify.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
7 years agonetdev-dpdk: Don't use dev->vhost_id without mutex.
Ilya Maximets [Tue, 6 Dec 2016 06:45:07 +0000 (09:45 +0300)]
netdev-dpdk: Don't use dev->vhost_id without mutex.

The copy should be used here.
Additionally, 'strlen' changed to the faster check.

Fixes: 821b86649a90 ("netdev-dpdk: Don't try to unregister empty vhost_id.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agonetdev-bsd: Fix compiling error in netbsd.
Hui Kang [Tue, 6 Dec 2016 05:04:00 +0000 (00:04 -0500)]
netdev-bsd: Fix compiling error in netbsd.

In some netbsd version, RTF_LLINFO is undefined.

Signed-off-by: Hui Kang <hkang.sunysb@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agotests/bundle: Use active_backup algorithm for up/down test.
Ilya Maximets [Tue, 6 Dec 2016 11:48:43 +0000 (14:48 +0300)]
tests/bundle: Use active_backup algorithm for up/down test.

HRW algorithm uses hash function which is dependent from the build
environment. This leads to constant fails of the testsuite
with CFLAGS='-march=native' if CPU supports hashing instructions:

[-------------------------------------------------------------------]
 ./bundle.at:233: ovs-appctl ofproto/trace br0 \
     'in_port=LOCAL,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06'
 stdout:
 Bridge: br0
 Flow: in_port=LOCAL,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,\
       dl_dst=50:54:00:00:00:06,dl_type=0x0000

 Rule: table=0 cookie=0
 OpenFlow actions=bundle(eth_src,50,hrw,ofport,slaves:1,2)

 Final flow: unchanged
 Megaflow: recirc_id=0,in_port=LOCAL,dl_src=50:54:00:00:00:05, \
           dl_type=0x0000
 Datapath actions: 2
 ./bundle.at:234: tail -1 stdout
 --- -
 +++ /testsuite.dir/at-groups/85/stdout
 @@ -1,2 +1,2 @@
 -Datapath actions: 1
 +Datapath actions: 2

[-------------------------------------------------------------------]

Using of 'active_backup' algorithm will help to avoid such issues.

CC: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Fixes: 63460a30c53e ("tests/bundle: test bundle action with ports up and down")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovn: Fix the duplicate code: start) ovsdb_server_start; ;
Guoshuai Li [Tue, 6 Dec 2016 11:36:09 +0000 (19:36 +0800)]
ovn: Fix the duplicate code: start) ovsdb_server_start; ;

In 341 line already have this code

Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agotunnel: set udp dst-port in tunnel metadata
Pravin B Shelar [Tue, 6 Dec 2016 02:22:11 +0000 (18:22 -0800)]
tunnel: set udp dst-port in tunnel metadata

VxLan device expect valid tp-dst in tunnel metadata.
Following patch sets consistent tp-dst with respect to
the egress tunnel port.

Reported-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>
Tested-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agoovn-controller(8): ovn-remote must be an ovsdb remote.
Russell Bryant [Mon, 5 Dec 2016 17:04:32 +0000 (12:04 -0500)]
ovn-controller(8): ovn-remote must be an ovsdb remote.

Document that the value of the ovn-remote configuration
option must be in the form of an ovsdb remote as previously documented
in this man page. This came up on IRC where someone trying OVN
put a hostname here and observed that it did not work.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoofproto: Honor OFPFF_RESET_COUNTS flag in flow modify message.
Jarno Rajahalme [Thu, 1 Dec 2016 21:10:53 +0000 (13:10 -0800)]
ofproto: Honor OFPFF_RESET_COUNTS flag in flow modify message.

While a flow modify must keep the original flow's flags, it must reset
counts if (and only if) the reset_counts flag is present in the flow
mod message.

Behavior prior to this patch is broken in a few ways:

- OpenFlow 1.0 and 1.1 mod-flows did reset the counts, if the flow had
  reset_counts flag set.  Only add-flow should reset counts.
- With OpenFlow 1.2 and later, if the old flow had the reset_counts
  flag set, the counts would be reset by mod-flows, even if the
  flow-mod message does not have the reset_counts flag set.
- With OpenFlow 1.2 and later, mod-flows with a reset_count did not
  reset the counts, if the old flow did not have the reset_counts flag
  set.

Even though the prevailing interpretation seems to be that the
reset_counts flag in the flow-mod message should be stored as part of
the flow state (and reported back in flow dumps with OpenFlow >= 1.3),
we should always just look at the reset_counts flag in the current
flow-mod and ignore the reset_counts flag stored in the flow when
processing a flow mod.

For OpenFlow 1.0 and 1.1 we already implicitly add the reset_counts
flag for add-flow messages (only) to maintain the expected behavior.

This patch adds a comprehensive test case to prevent future regressions.

Suggested-by: Tony van der Peet <tony.vanderpeet@alliedtelesis.co.nz>
Fixes: 748eb2f5b1 ("ofproto-dpif: Always forward 'used' from the old_rule.")
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agompls: Fix MPLS restoration after patch port and group bucket.
Jarno Rajahalme [Thu, 1 Dec 2016 22:05:24 +0000 (14:05 -0800)]
mpls: Fix MPLS restoration after patch port and group bucket.

This patch fixes problems with MPLS handling related to patch ports
and group buckets.

If a group bucket or a peer bridge across a patch port pushes MPLS
headers to a non-MPLS packet and outputs, the flow translation after
returning from the group bucket or patch port would undo the packet
transformations so that the processing could continue with the packet
as it was before entering the patch port.  There were two problems
with this:

1. As part of the first MPLS push on a non-MPLS packet, the flow
translation would first clear the L3/4 headers of the 'flow' to mark
those fields invalid.  Later, when committing 'flow' changes to
datapath actions before output, the necessary datapath MPLS actions
are created and the corresponding changes updated to the 'base flow'.
This was done using the same flow_push_mpls() function that clears
the L2/3 headers, so also the 'base flow' L2/3 headers were cleared.

Then, when translation returns from a patch port or group bucket, the
original 'flow' is restored, now showing no sign of the MPLS labels.
Since the 'base flow' now has the MPLS labels, following translations
know to issue MPLS POP actions before any output actions.  However, as
part of checking for changes to IP headers we test that the IP
protocol type was not changed.  But now the 'base flow's 'nw_proto'
field is zero and an assert fail crashes OVS.

This is solved by not clearing the L3/4 fields of the 'base
flow'. This allows the processing after the patch port to continue
with L3/4 fields as if no MPLS was done, after first issuing the
necessary MPLS POP actions.

2. IP header updates were done before the MPLS POP actions were
issued. This caused incorrect packet output after, e.g., group action
or patch port.  For example, with actions:

group 1234: all bucket=push_mpls,output:LOCAL

ip actions=group:1234,dec_ttl,output:LOCAL,output:LOCAL

the dec_ttl would only be executed before the last output to LOCAL,
since at the time of committing IP changes after the group action the
packet was still an MPLS packet.

This is solved by checking the dl_type of both 'flow' and 'base flow'
and issuing MPLS actions if they can transform the packet from an MPLS
packet to a non-MPLS packet.  For an IP packet the change in ttl can
then be correctly committed before the last two output actions.

Two test cases are added to prevent future regressions.

Reported-by: Thomas Morin <thomas.morin@orange.com>
Suggested-by: Takashi YAMAMOTO <yamamoto@ovn.org>
Fixes: 8bfd0fdac ("Enhance userspace support for MPLS, for up to 3 labels.")
Fixes: 1b035ef20 ("mpls: Allow l3 and l4 actions to prior to a push_mpls action")
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: YAMAMOTO Takashi <yamamoto@ovn.org>
7 years agoovs-numa: Allow leading 0x on pmd-cpu-mask.
billyom [Tue, 29 Nov 2016 10:24:53 +0000 (10:24 +0000)]
ovs-numa: Allow leading 0x on pmd-cpu-mask.

pmd-cpu-mask is interpreted as a hex bit mask. So it should be written
with a leading 0x to indicate this. But if this is done, while the value
is interpreted correctly and the PMDs pinned as expected, a confusing
warning message is also issued.

This patch allows but does not require a leading 0x or 0X to be used
without a warning. Existing functionality is not affected. Relevant DPDK
docs also updated.

Signed-off-by: Billy O'Mahony <billy.o.mahony@intel.com>
Tested-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agopython: Add double newline after fuction or class (E305).
Daniele Di Proietto [Thu, 1 Dec 2016 20:58:25 +0000 (12:58 -0800)]
python: Add double newline after fuction or class (E305).

pycodestyle >= 2.1.0 reports E305 otherwise, and the flake8-check step
fails.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agonetdev-dpdk: Don't try to unregister empty vhost_id.
Ilya Maximets [Tue, 29 Nov 2016 12:20:56 +0000 (15:20 +0300)]
netdev-dpdk: Don't try to unregister empty vhost_id.

If 'vhost-server-path' not provided for vhostuserclient port,
'netdev_dpdk_vhost_destruct()' will try to unregister an empty string.
This leads to error message in log:

netdev_dpdk|ERR|vhost2: Unable to unregister vhost driver for socket ''.

CC: Ciara Loftus <ciara.loftus@intel.com>
Fixes: 2d24d165d6a5 ("netdev-dpdk: Add new 'dpdkvhostuserclient' port type")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agodatapath-windows: Fix typos in function summaries
Sairam Venugopal [Fri, 2 Dec 2016 18:21:21 +0000 (10:21 -0800)]
datapath-windows: Fix typos in function summaries

Fixed mismatch between function names and descriptions.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-controller: Remove unused members from local_datapath.
Ben Pfaff [Fri, 2 Dec 2016 00:34:03 +0000 (16:34 -0800)]
ovn-controller: Remove unused members from local_datapath.

Nothing used these, except to initialize and free them.  'logical_port'
wasn't meaningful in any case, it was just the name of the first logical
port encountered from a particular logical datapath when traversing the
database's Port_Binding table, which isn't in a meaningful order.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>