hindex: Fix test expected output.

Signed-off-by: Ben Pfaff <blp@nicira.com>
tests: Fix theoretical races in "ofproto-dpif - controller" test.

I don't see anything that guaranteed that ovs-ofctl would receive and print
the packets before it exited.  This commit inserts explicit waits, to avoid
the problem.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-ofctl: Bug fix in flow_format()

Fix a corner case bug where ARP packet with ARP opcode value of 1 would cause
tp_src and tp_dst to appear in the output string.

This bug caused some output from flow_format() to not be accepted by
'ovs-appctl ofproto/trace'

Added test coverage by using ARP opcode 1 in one unit test case, that
would have exposed the bug.

Bug #18334

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Use masked flow when validating actions.

It is important to validate flow actions to ensure that they do
not try to write off the end of a packet. The mechanism to do this
is to ensure that a flow is precise enough to describe valid vs.
invalid packets and only allowing actions on valid flows.

The introduction of megaflows broke this by using a narrow base
flow but a potentially wide match. This meant that while the
original flow was properly validated, later packets might not
conform to that flow and could be truncated. This switches to
using the masked flow instead, effectively requiring that all
possible matching packets be valid in order for a flow's actions
to be accepted.

This change only affects the flow setup path - executed packets
have always used the flow extracted from the packet and therefore
were properly validated.

Signed-off-by: Jesse Gross <jesse@nicira.com>
poll-loop: Simplify and speed up polling.

The simplification comes from dropping support for canceling a
poll_waiter, which was a feature that was never used.  The speedup
comes from avoiding a malloc() for every call to poll_fd_wait().
(I doubt that this significantly improves performance.)

This prepares for making the polling structures per-thread in
the next commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
poll-loop: Make poll loop data structures per-thread.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif: Don't put new subfacets as result of "userspace" action.

Don't install a flow if it's the result of the "userspace" action for an
already installed facet.  This can occur when a datapath flow with
wildcards has a "userspace" action and flows sent to userspace result in
a different subfacet, which will then be rejected as overlapping by the
datapath.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Co-authored-by: Ethan Jackson <ethan@nicira.com>
BFD: Add BFD output to bugtool

This change includes the output of ovs-appctl bfd/show to
ovs-bugtool output.

Signed-off-by: Pavithra Ramesh <paramesh@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
bfd: Use htonll() instead of htonl() for tunnel ID constant.

This is not a real bug, since htonl(0) and htonll(0) have the same value
although not the same type.

Found by sparse.

CC: Pavithra Ramesh <paramesh@vmware.com>
CC: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>