Add support for 'hard_timeout' in OF1.2 flow_removed message.

ofputil_decode_flow_removed() doesn't yet support OF1.2 at all so that
piece is missing but this otherwise should be complete.

CC: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Allow decoding of Open Flow 1.1 & 1.2 Flow Removed Messages

Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com added support for hard_timeout, plus a test]
Signed-off-by: Ben Pfaff <blp@nicira.com>
stream-ssl: Seed OpenSSL if it fails to seed itself.

We occasionally see OpenSSL fail to seed its random number generator in
heavily loaded hypervisors.  I suspect the following scenario:

1. OpenSSL calls read() to get 32 bytes from /dev/urandom.
2. The kernel generates 10 bytes of randomness and copies it out.
3. A signal arrives (perhaps SIGALRM).
4. The kernel interrupts the system call to service the signal.
5. Userspace gets 10 bytes of entropy.
6. OpenSSL doesn't read again to get the final 22 bytes.  Therefore
   OpenSSL doesn't have enough entropy to consider itself initialized.
   It never tries again, so we're stuck forever.

The only part I'm not entirely sure about is #6, because the OpenSSL code
is so hard to read.

Thanks to Alex Yip for suggesting that this might be a startup problem.

Bug #10164.
Reported-by: Ram Jothikumar <ram@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
stream-ssl: Avoid logging no-match error redundantly.

If we've already reported an error at this point, then we currently report
a no-match error also, but that doesn't add any useful information; it's
just noise in the log.

Signed-off-by: Ben Pfaff <blp@nicira.com>
lockfile: Remove lockfile_lock timeout argument

lockfile_lock() accepts a timeout argument but, aside from unit tests
pertaining to timeout, its value is always 0. Since this feature relies on
a periodic SIGALRM signal, which is not a given if we're not caching time,
the cleanest solution is just to remove it.

Signed-off-by: Leo Alterman <lalterman@nicira.com>
timeval: On Linux x86-64 systems refresh time whenever it is requested.

64-bit Linux appears to avoid syscalls for clock_gettime(), so we can get
higher resolution timing and avoid having a timer firing off SIGALRM
without introducing extra overhead.

Signed-off-by: Leo Alterman <lalterman@nicira.com>
ofp-util: Use 32bit port for Open Flow 1.1 & 1.2 Port Mod Request

When encoding Open Flow 1.1 & 1.2 Port Mod Request messages
the port number should be converted to 32bits using
ofputil_port_to_ofp11() rather than htonl(). This ensures
that port numbers in the reserved range are translated correctly.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Allow encoding of Open Flow 1.2 Port Mod Messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Allow decoding of Open Flow 1.2 Port Mod Message

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-msgs: Split OFPRAW_OFPST_FLOW_{REQUEST,REPLY}

Split OFPRAW_OFPST_FLOW_{REQUEST,REPLY} into OpenFlow 1.0 and 1.1+
versions.

This is in preparation for adding encoding and decoding of
Open Flow 1.1 & 1.2 messages.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Allow encoding of Open Flow 1.2 Flow Statistics Response Messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Allow decoding of Open Flow 1.2 Flow Statistics Response Messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-msgs: Allow 1.0-1.2 range

This is intended for use with OFPRAW_OFPST_TABLE_REQUEST
in order for it to be symmetric with OpenFlow 1.0, 1.1 and 1.2
versions of OFPRAW_OFPST1TABLE_REPLY.

OpenFlow 1.3 introduces yet another format for OFPRAW_OFPST1TABLE_REPLY.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-msgs: Split OFPRAW_OFPST_TABLE_REPLY

Split OFPRAW_OFPST_TABLE_REPLY into OpenFlow 1.0, 1.1 and 1.2 versions.

This is preparation for allowing encoding and  decoding of Open Flow 1.1
and 1.2 Table Stats Reply messages.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-print: Enable display of Open Flow 1.1 & 1.2 Table Stats Reply Messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
netdev-dummy: New appctl command netdev-dummy/set-admin-state.

There's currently no way to set the admin state on dummy netdevs.
This patch provides a mechanism to do so which will be used in
future unit tests.

Signed-off-by: Ethan Jackson <ethan@nicira.com>