linux/Makefile.main.in, acinclude: preparation for linux 3.7.0+

The version.h is moved from include/linux/version.h to
include/generated/uapi/linux/version.h.
So check both pathes.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jesse Gross <jesse@nicira.com>
netdev-linux: Use underlying tap device on netdev_linux_listen().

Commit acf608 (ofproto-dpif: Use a single underlying datapath across
multiple bridges.) broke connectivity to userspace datapath devices.
The code assumed the first caller to open a tap device with
netdev_linux_open() wanted to write to it.  This commit moves that logic
to when netdev_linux_listen() is called.

Thanks to Ben Pfaff for helping debug the issue.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Reported-by: Simon Horman <horms@verge.net.au>
Tested-by: Simon Horman <horms@verge.net.au>
tests: Avoid race condition in flow monitoring test.

The execution of "ovs-appctl -t ovs-ofctl ofctl/send" could happen before
ovs-appctl received and printed the
    NXST_FLOW_MONITOR reply (xid=0x0):
     event=ADDED table=0 cookie=0 in_port=2 actions=output:1
msesage, which could cause the
    send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
message to be printed before rather than after the NXST_FLOW_MONITOR reply.

This commit fixes the problem by inserting a serializing barrier.

Reported-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
netdev-bsd: Use underlying tap device on netdev_bsd_listen().

This is a trivial port to netdev-bsd of Justin Pettit's netdev-linux
commit 33d82a56d (netdev-linux: Use underlying tap device on
netdev_linux_listen().), which had the commit message:

  Commit acf608 (ofproto-dpif: Use a single underlying datapath across
  multiple bridges.) broke connectivity to userspace datapath devices.  The
  code assumed the first caller to open a tap device with
  netdev_linux_open() wanted to write to it.  This commit moves that logic
  to when netdev_linux_listen() is called.

This fixes the userspace datapath on FreeBSD.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
nx-match: Log a warning when a wildcarded bit is set to 1.

This was prompted by a conversation on the openflow-discuss mailing list
where developers of some OpenFlow switches mentioned that they save an
entire copy of raw flows passed in by controllers because of the
possibility that there might be wildcarded 1-bits, e.g. something like
192.168.1.1/255.255.0.0 instead of 192.168.0.0/255.255.0.0.  I've always
intended that this not be necessary, but it was never explicitly written
down.  This commit starts the process of updating OVS to make this a
requirement, by logging a warning whenever such a NXM or OXM entry is seen,
and by updating the spec in nicira-ext.h to describe my intent.

This is related to issue EXT-238 (OXM should require that 0-bits in mask
be 0-bits in value) in the Open Networking Foundation's "extensibility"
bugtracker at https://www.opennetworking.org/bugs/browse/EXT-238.
(Unfortunately one must be an employee of an ONF member company to
access this bug tracker.  It's the network that's open, not the
foundation.)

Thanks to Zoltán Lajos Kis, Dan Talayco, Rob Sherwood, and HIDEyuki
Shimonishi for participating in the discussion on openflow-discuss.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
Added RHEL ovs-ifup STP option handling

Signed-off-by: Andres Toomsalu <andres@active.ee>
Signed-off-by: Ben Pfaff <blp@nicira.com>
vlog: New vlog/enable-rate-limit and vlog/disable-rate-limit commands.

A few times while troubleshooting it would have been useful to get
complete logs, rather than post-rate-limiting snapshots of them.  These
ovs-appctl commands make that possible.

Signed-off-by: Ben Pfaff <blp@nicira.com>
vswitchd: Make the maximum size of MAC learning tables user-configurable.

We've had a couple of requests for this over the years.  It's easy to do,
so let's implement it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
ofproto: Report correct error for emergency flow with timeout.

The OpenFlow 1.0 specification says:

    Emergency flow mod messages must have timeout values set to zero.
    Otherwise, the switch must refuse the addition and respond with an
    ofp_error_msg with OFPET_FLOW_MOD_FAILED type and
    OFPFMFC_BAD_EMERG_TIMEOUT code.

but Open vSwitch reported OFPFMFC_TABLE_FULL in this case.  This commit
fixes the problem.

Fixes detailed_contr_sw_messages.EmerFlowTimeout failure in OFTest.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
vswitchd: Avoid writing to const struct

When built with Clang, vswitchd segfaulted in ovsrec_open_vswitch_init,
from calling memset() on a const struct.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Openflow 1.1 queue set/get config placeholders.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Add OpenFlow13 to the allowed protocols for ofproto testing.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-vsctl: Allow command-specific options to mingle with global options.

Until now, a command like "ovs-vsctl --may-exist add-br br0" yielded a
confusing error message.  Users had to realize that the correct form was
"ovs-vsctl -- --may-exist add-br br0", but instead they often reported a
bug or gave up in frustration.  Even though the behavior was documented, it
was counterintuitive.

This commit allows command-specific options to be mixed with global
options, making both forms of the command listed above equally acceptable.

CC: 691508@bugs.debian.org
Reported-by: Adam Heath <doogie@brainfood.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
packets: Change IP_ARGS interface to take an ovs_be32 instead of a pointer.

An ovs_be32 is a more obvious way to represent an IP address than a
pointer to one.  It is also more type-safe, especially since "sparse" is
able to check that the argument is in network byte order.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
daemon: Start monitor process, not daemon process, in new session.

To keep control+C and other signals in the initiating session from killing
the monitor process, we need to put the monitor process into its own
session.  However, until this point, we've only done that for the daemon
processes that the monitor started, which means that control+C would kill
the monitor but not the daemons that it launched.

I don't know of a benefit to putting the monitor and daemon processes in
different sessions, as opposed to one new session for both of them, so
this change does the latter.

daemonize_post_detach() is called from one additional context where we'd
want to be in a new session, the worker_start() function, but that function
is documented as to be called after daemonize_start(), in which case we
will (after this commit) already have called setsid(), so no additional
change is required there.

Bug #14280.
Reported-by: Gordon Good <ggood@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Fix typo in invalid port range error message.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
meta-flow: Don't allow negative port numbers.

If a negative number is supplied, the parsing code used to convert it
into a signed one.  We ran into an incident where a third-party script
was attempting to get the OpenFlow port number for an interface, but got
-1 from the database, since the number had not yet been assigned.  This
was converted to 65535, which maps to OFPP_NONE and all flows with
ingress port OFPP_NONE were modified.  This commit disallows negative
port numbers to help prevent broken integration scripts from disturbing
the flow table.

Issue #14036

Signed-off-by: Justin Pettit <jpettit@nicira.com>
flow: Fix harmless typo in flow_wildcards_hash().

Signed-off-by: Ben Pfaff <blp@nicira.com>
OPENFLOW-1.1+: New file for OpenFlow 1.1 and later to-do list.

This is an updated plain text version of the webpage at
    http://openvswitch.org/development/openflow-1-x-plan/
which I intend to replace by a link to this file after it is committed.

Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Zero out key when looking up null ports.

When we are searching for a tunnel port to receive traffic on,
everything should be zeroed out by the time that we get to null
ports since they are wildcarded.  However, if certain other ports
also exist (primarily multicast ports with keys) then this might
not be the case and the key can be set.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>