flow: Extend struct flow to contain tunnel outer header.

Soon the kernel will begin supplying the information about the outer
IP header for tunneled packets and userspace will need to be able to
track it as part of the flow.  For the time being this is only used
internally by OVS and not exposed outwards to OpenFlow.  As a result,
this threads the information throughout userspace but simply stores
the existing tun_id in it.

Signed-off-by: Jesse Gross <jesse@nicira.com>
flow: Fix struct flow size build assertion failure.

The new struct flow_tnl contains an extra four bytes of padding on
64-bit machines but we currently assert that the total struct flow
is a fixed size.  The size difference isn't actually a problem
because both are multiples of 4 and the build assertion is only
intended to remind people to update FLOW_WC_SEQ when new fields are
added.  This changes the assertion to fix just the non-tunnel field
size.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
ofp-util: Set Packet In Format: Use prevailing OpenFlow version

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib: Specify idl location more precisely.

For some reason, the ESX build tools seem to be confused about the
location of 'lib'.  This patch specifies it more directly.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
tests: Allow environment specified autom4te.

In the ESX build system, autom4te is in a funny location specified
by an environment variable.  Before this patch, this environment
variable was overridden by the tests automake file.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
datapath: Print device when warning about over MTU packets.

If an attempt is made to transmit a packet that is over the device's
MTU then we log it using the datapath's name.  However, it is much
more helpful to use the device name instead.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
Fix vswitch-idl.ovsidl build rule with separate source and build dirs.

Before commit e3a880272 (lib: Specify idl location more precisely.), the
files named in VSWITCH_IDL_FILES were relative to the source directory.
That commit made them inconsistent: one remained relative to the source
directory, the other became relative to the build directory.  This meant
that if the source and build directories differed, the ovsdb-idlc
invocation had no change of succeeding.

This commit fixes the problem by making the file names consistently
relative to the build directory and then adjusting the ovsdb-idlc
invocation to expect that.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
Avoid requiring autom4te when it won't necessarily be needed.

Commit 7fd3e43db07 (tests: Allow environment specified autom4te.) added a
requirement for Autom4te without anyone noticing it in advance.  This
caused a build failure in the XenServer DDK, which doesn't have Autom4te.
Since Autom4te is only needed if the testsuite is modified, this commit
makes it optional.

(Autom4te is part of Autoconf.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ovsdb/jsonrpc-server: ovsdb-server closes accepted connections immediately.

2012-09-14T05:38:26Z|00001|jsonrpc|WARN|tcp:127.0.0.1:6634: receive error: Con
ovsdb-client: transaction failed (Connection reset by peer)
NOTE: This occurs intermittently depending on how ovsdb-server runs.
      Running ovsdb-client on a remote machine increases the possibility.

This is because ovsdb-server closes newly accepted tcp connection.
The following changesets caused it. struct jsonrpc_session::dscp isn't set
based on listening socket's dscp value.
- ovsdb-server creates passive connection and listens on it.
- ovsdb-server accepts connection by ovsdb_jsonrpc_server_run().
  The accepted socket inherits from the listening sockets.
  ovsdb_jsonrpc_server_run() creates json session, but leaves dscp of
  struct jsonrpc_session zero.
- On calling reconfigure_from_db(), it resets dscp value to
  all jsonrpc sessions. Eventually jsonrpc_session_set_dscp() is called.
  Then jsonrpc_session_force_reconnect() closes the connection.

With this patch,
- struct jsonrpc_session::dscp is correctly set based on
  listening sockets dscp value.
- dscp of listening socket is changed dynamically by setsockopt.
  This leaves a window where accepted socket may have old dscp.
  But it is ignored for now because it would complicates codes
  too much.

The related change sets:
- 0442efd9b1a88d923b56eab6b72b6be8231a49f7
  Reapplying the dscp changes: No need to restart DB/OVS on changing
  dscp value.
- 59efa47adf3234ec51541405726d033173851285
  Revert DSCP update changes.
- b2e18db292cd4962af3248f11e9f17e6eaf9c033
  No need to restart DB / OVS on changing dscp value.
- f125905cdd3dc0339ad968c0a70128807884b400
  Allow configuring DSCP on controller and manager connections.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
ofproto-dpif: Avoid zeroing tunnel info in handle_miss_upcalls().

Commit 296e07ace0f (flow: Extend struct flow to contain tunnel outer
header.) changed the tunnel ID parameter of flow_extract() from an integer
passed by value to a structure passed by pointer.  Before flow_extract()
reads the tunnel ID, it zeros the entire flow parameter.  This means that,
if a caller passes the address of the tunnel member of the flow as the
tunnel ID, then flow_extract() zeros the tunnel data before it reads and
copies the tunnel data (that it just zeroed).  The result is that the
tunnel data is ignored.

This commit fixes the problem by making the caller that did this use a
separate flow structure instead of trying to be clever.

Bug #13461.
CC: Pankaj Thakkar <thakkar@nicira.com>
Reported-by: Michael Hu <mhu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Merge branch 'master' into bsd-port-threaded

Conflicts:
	lib/dpif-netdev.c