datapath: Fix kernel style issues.

Suggested-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Add IPv6 support for OpenFlow, OVSDB, NetFlow, and sFlow.

Does not add IPv6 support for in-band control.

Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Nandan Nivgune <nandan.nivgune@calsoftinc.com>
Signed-off-by: Abhijit Bhopatkar <abhijit.bhopatkar@calsoftinc.com>
Signed-off-by: Arun Sharma <arun.sharma@calsoftinc.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
netdev-bsd: Fix tx/rx stats for type=tap netdev

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif.at: Avoid races in "ofproto-dpif - dummy interface"

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Always insert MPLS labels after VLAN tags.

OpenFlow 1.1 and 1.2 always inserted MPLS labels after VLAN tags.
OpenFlow 1.3 and 1.4 insert MPLS labels before VLAN tags.
OpenFlow 1.3.4 and 1.5, both in preparation, recognize that the change in
1.3 was an error and revert it.  This commit implements that reversion
in Open vSwitch.

EXT-457.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
tests: Add MPLS + VLAN tests.

Originally part of "odp: Allow VLAN actions after MPLS actions"
by Joe Stringer.

Co-authored-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
FAQ: Describe the state of MPLS in Open vSwitch.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
FAQ: Correct typo.

Reported-by: Pasi Kärkkäinen <pasik@iki.fi>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-thread: Add a comment.

Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
collectors: Improve log message to better describe errors.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto: Update documentation

'cls' is no longer a parameter to this function.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
netdev-dummy: disable periodic probing

netdev-dummy is mostly useed over reliable link for testing. Periodic
probing over those links seem overkill.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
tests: Don't rely on strace for IPv6 IDL testcases.

This would cause testsuite failures if someone runs the testsuite
without strace installed.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Read tcp flags only then the tranport header is present.

Only the first IP fragment can have a TCP header, check for this.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
upcall: Add appctl call to set flow_limit.

This should assist testing of datapath performance, as it allows us to
skip "warming up" the flow limit value.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
pcap-file: Allow capturing TCP streams where the SYN is not seen.

Until now, the tcp_stream() code has ignored any TCP packets that don't
correspond to a stream that began with a TCP SYN.  This commit changes the
code so that any TCP packet that contains a payload starts a new stream.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Vasu Dasari <vdasari@gmail.com>
ofproto-dpif-xlate: Make flows that match ICMP fields revalidate correctly.

ICMPv4 and ICMPv6 have 8-bit "type" and "code" fields.  struct flow
uses the low 8 bits of the 16-bit tp_src and tp_dst members to
represent these fields.  The datapath interface, on the other hand,
represents them with just 8 bits each.  This means that if the high 8
bits of the masks for these fields somehow become set (meaning to
match on the nonexistent "high bits" of these fields) during
translation, then they will get chopped off by a round trip through
the datapath, and revalidation will spot that as an inconsistency and
delete the flow.  This commit avoids the problem by making sure that
only the low 8 bits of either field can be unwildcarded for ICMP.

This seems like the minimal fix for this problem, appropriate for
backporting to earlier branches.  The root of the issue is that these high
bits can get set in the match at all.  I have some leads on that, but they
require more invasive changes elsewhere.

Bug #23320.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
tests: Add missing banner.

Reported-by: Arun Sharma <arun.sharma@calsoftinc.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
poll-loop: Make poll_fd_wait_event() cross-platform.

This is helpful if we want to wait either on 'fd' for POSIX or
events for Windows.

For Windows, if both 'fd' and 'wevent' is specified, we associate
that event with the 'fd' using WSAEventSelect() in poll_block().
So any 'events' on that 'fd' will wake us up from WaitForMultipleObjects().

WSAEventSelect() does not understand  POLLIN, POLLOUT etc.  Instead the
macros it understands are FD_READ, FD_ACCEPT, FD_CONNECT, FD_CLOSE etc.
So we need to make that transition.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
socket-util: error number to string for sockets.

For winsock2 functions, error number has to be converted to string
using FormatMessage().

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>