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>
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>
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>
datapath: Fix stale comment in flow.c.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
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>
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>
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>
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>