tests: Additional test for run time addition of a database.

Adding a removed database covers a common use case.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
datapath: Rename skb_network_protocol() to __skb_network_protocol()

The function skb_network_protocol() is already defined in
<linux/netdevice.h> upstream but not an exported symbol.

Rename the OVS internal implementation to work around this.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath: rhel: Account for RHEL specific backports

The following symbols have been backported to RHEL and the kernel
version is no longer an accurate indicator for their presence:

 - skb_gso_segment
 - netif_skb_features
 - netif_needs_gso

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath: rhel: Move RHEL OVS hook registration to netdev_rx_handler_register() backport

Moves the registration of the RHEL specific OVS hook to the compat
backport of netdev_rx_handler_register(). This moves the hook
unregistration from the RCU callback to the netdev_destroy()
callback directly.

This is purely cosmetic though, the RHEL hook is only used if the
IFF_OVS_DATAPATH flag is present which was removed under RTNL
protection before the RCU callback.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
utilities: New helper script ovs-dev.py.

ovs-dev.py is a script I've written to help perform common tasks
necessary for developing Open vSwitch.  It allows a developer to
configure, build, and run the switch with a minimum of effort or
knowledge of the various idiosyncrasies involved.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
csum: Suppress sparse warning.

The latest version of sparse triggers the following warning in the
checksum tests.  This patch suppresses it.

warning: too long initializer-string for array of char

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ovs-vsctl: Fix behavioral regression for "--if-exists del-port <bridge>".

Commit 89f3c258fe (ovs-vsctl: Improve error message for "ovs-vsctl del-port
<bridge>".) changed the behavior of
    ovs-vsctl --if-exists del-port <bridge>
from a silent no-op to a hard failure.  This commit fixes this regression.

This caused problems on XenServer, for which the Open vSwitch integration
runs commands like:
    /usr/bin/ovs-vsctl --timeout=20 \
        -- --with-iface --if-exists del-port xapi103 \
        -- --if-exists del-br xapi103

Bug #18276.
Reported-by: Michael Hu <mhu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Use DP_MAX_PORTS when no IN_PORT attribute is present.

To indicate that a flow is not associated with any particular in port,
userspace may omit the IN_PORT attribute, which the kernel translates
internally to the special value DP_MAX_PORTS. After the megaflows
changes, this was no longer being done, resulting in it using port 0
(the internal port).

This also adopts a wildcarding scheme similar to 802.2 packets where
a mask can be specified for this non-existent key attribute but it
must either be completely wildcarded or completely exact match.

CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath: Fix Netlink error message header.

CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath: fix bugs in exporting netlink attributes

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath: Always include tunnel TTL in serialized Netlink attributes.

There is no default value for the tunnel TTL so it must always be
included in flow keys sent from userspace to kernel. The kernel
should also respect this convertion when sending flows to userspace
by always including the TTL in tunnel flows.

CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datpath: Fix tunnel TTL flow rejection message.

There is no default value for the tunnel TTL, so it must be
specified when setting up a new flow. However, the flow rejection
log message indicates that the TTL must be non-zero, which is not
true.

CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
ovs-bugtool: Add ovsdb-server/list-dbs command to bugtool.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
atomic: Suppress sparse warning.

With the latest version of sparse, the ATOMIC_VAR_INIT macro
generates the following warning.  This patch suppresses it.

warning: Using plain integer as NULL pointer

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
vswitchd: Fix typo in the BFD section of vswitch.xml

Signed-off-by: Min Chen <minchnew@gmail.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
lib: Add CRC32C Implementation

This implementation was derived from FreeBSD:
http://code.google.com/p/freebsd-head/source/browse/sys/libkern/crc32.c

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
---
v4: Fold in debian license modification
    Suppress checksum test sparse warning
v3: Rebase
    Return crc32c checksum in network byte-order
    Add checksum tests based on Intel IPPs documentation
v2: Update copyright notice
    Include config.h (Fix sparse error)
datapath: Add SCTP support

This patch adds support for rewriting SCTP src,dst ports similar to the
functionality already available for TCP/UDP.

Rewriting SCTP ports is expensive due to double-recalculation of the
SCTP checksums; this is performed to ensure that packets traversing OVS
with invalid checksums will continue to the destination with any
checksum corruption intact.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
---
This patch introduces sparse warnings when calling
sctp_end_cksum(), due to a bug that was fixed in v3.10:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=eee1d5a14780b9391ec51f3feaf4cffb521ddbb1

v4: Rebase against megaflow
    Move compute_sctp_checksum to compat/
    Move openvswitch.h header changes in from other patch
    Don't set CHECKSUM_UNNECESSARY on port-rewrite
    Remove checksumming from Xen compat code
v3: Rebase
    Refactor sctp checksum computation
    Handle skb fragments for checksum calculation
    Fix sparse errors
v2: Remove SCTP checksum recalculation when changing IP address
    Calculate checksums as delta from incoming checksum
ofproto-dpif: Add SCTP support

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
---
v4: Rebase against megaflow
    Move openvswitch.h header changes to datapath patch
v3: Rebase
v2: Fix broken test
    Use the correct packet pointer
    Calculate checksums as delta from incoming checksum
ofp-util: Add SCTP support

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
---
v4: No change
v3: Rebase
v2: Add flowmod parse tests
    Add set-field tests
    Add NEWS item
    Add sctp to ovs-ofctl.8