ofproto-dpif: keep slow path flow time stamp up-to-date

Noting updating slow path subfacet's time stamp can cause their datapath
flows deleted periodically. For example, CFM datapath flow have usespace
actions that are handled in dpif slow path. They are deleted and
recreated periodically without the fix.

This bug are not obvious during normal operation. Deleted CFM flow
would cause CFM packets to be handled by flow miss handler which will
reinstall the flow in the datapath. The only potentially observable
behavior is that when the user space is overwhelmed with flow miss packets,
the periodic CFM miss packets may get stuck behind other miss packets,
cause tunnel flapping.

Ben refactored the patch to its current form.

Reported-by: Guolin Yang <gyang@nicira.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
byte-order: Make uint32_byteswap() available regardless of endianness.

pcap_read() can use it whether we're big-endian or not.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofpbuf: New function ofpbuf_shift().

An upcoming commit will add the first user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
pcap-file: Add timestamp support for reading and writing pcap files.

Only the write support is initially useful, but an upcoming commit will add
a user for the read support.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-ofctl: New command "ofp-parse-pcap" to dump OpenFlow from PCAP files.

Based on the number of people who ask about Wireshark support for OpenFlow,
this is likely to be widely useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
[RFC] Add support for capturing all OpenFlow traffic to a .pcap file.

Occasionally I get asked for the ability to capture all OpenFlow traffic
in a raw format, to allow for analysis and debugging.  OVS has a few
existing tools for this but none of them really fit the bill.  For example,
turning up the log level for the "vconn" module will dump all traffic but
only in a pre-parsed format, and "ovs-ofctl snoop" can only print a single
connection at a time (also pre-parsed).  One can instead run tcpdump to
capture all traffic, but then you run into the issue that you need the SSL
keys to decrypt it, which is inconvenient.

This commit proposes another approach: write all OpenFlow traffic to a
.pcap file in binary format.  The really odd part of this approach is that
OVS doesn't actually have the headers that should go into the .pcap file
(because OVS uses the host network stack) so we have to synthesize
plausible ones.  While that's easy enough (it's about 100 lines of code in
this commit), it's weird enough that it seems worth doing an RFC patch for
it.

This commit is pretty preliminary in that it doesn't have a proper approach
for configuring and enabling the feature.  Instead, it just writes
everything that goes over a TCP stream socket to a file in the current
directory called capture.pcap.

Feedback appreciated!