ofp-util: ofputil_pull_ofp11_match: Allow OXM match

* Allow OXM matches which specified in OpenFlow 1.2.
  Also allow them for OpenFlow 1.1 as there seems little reason not to.

* Pass padded_match_len parameter which if on NULL will be set to
  the padded match len. This will be used when decoding flow statistics
  response messages.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-print: Open Flow 1.2 Flow Mod message tests

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 Packet In 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 Packet In Messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-msgs: Update OFPRAW_OFPT_SET_CONFIG for OpenFlow 1.2

This is sufficient to allow encoding and decoding of
OpenFlow 1.2 Set Config messages as the format is the same
as OpenFlow 1.0 and OpenFlow 1.2.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-actions: Return action size

Modify ofpacts_put_openflow11_actions() to return the length of actions
appended. This will be used when encoding Packet Out messages for
Open Flow 1.1 and 1.2. The motivation for this is to avoid open coding
the size calculation which may end up being needed elsewhere too.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Prepare Packet Out encoder for other Open Flow versions

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.1 and 1.2 Packet Out Messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Prepare Packet Out decoder for other Open Flow versions

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.1 and 1.2 Packet Out 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 Removed messages

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

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
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>