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>
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>
Set release date for 1.10.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
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>
FAQ: Indicate LTS is now the 1.9.x series.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
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>
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>
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>
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>
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>
socket-util: Use getaddrinfo() instead of gethostbyname() for thread safety.

Signed-off-by: Ben Pfaff <blp@nicira.com>
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>
Use gmtime_r() and localtime_r() instead of non-thread-safe versions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
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>
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>
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>
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>
netdev-linux: Mark more static data as "const".

This makes this code more obviously thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
netdev: Make 'smap' variable const in netdev_set_qos().

This makes this code more obviously thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
stream-fd: Mark 'fd_pstream_class' const.

These data structures are never modified so this seems like a
logical change.

Signed-off-by: Ben Pfaff <blp@nicira.com>