packetdrill: initial commit

Initial commit for the packetdrill network stack testing tool:

  https://code.google.com/p/packetdrill/

Signed-off-by: Neal Cardwell <ncardwell@google.com>
Adds emacs and vim syntax highlighting modes for packetdrill scripts.
packetdrill: initial tests for Linux 3.11.0-rc4

Adds initial batch of packetdrill tests that have been confirmed to pass on
stock (Ubuntu) Linux 3.11.0-rc4.

Signed-off-by: Barath Raghavan <barath@google.com>
free tcp_options buffer after use

fmemopen(3) states that buffers opened via open_memstream should be
freed after closing the associated stream.

Signed-off-by: Mike Neilsen <mneilsen@acm.org>
packetdrill: fix platforms.h for FreeBSD 10.x build

FreeBSD 10.x has fmemopen in libc, so check __FreeBSD_version and set
defines appropriately.
packetdrill: improve .gitignore

Ignore .o and ~ files.

Signed-off-by: Neal Cardwell <ncardwell@google.com>
packetdrill: fix Makefile.common for systems without gcc

For example, FreeBSD 10.0 beta 3 default installation does not have a
"gcc".

Signed-off-by: Neal Cardwell <ncardwell@google.com>
packetdrill: fix clang compilation error on FreeBSD 10.x

Rewrite an if conditional that clang complained about on FreeBSD 10.x.

Signed-off-by: Neal Cardwell <ncardwell@google.com>
fmemopen() is also available in FreeBSD 9.2 and higher.

Signed-off-by: tuexen@fh-muenster.de
packetdrill: fix "running" paths in README

Signed-off-by: Mike Neilsen <mneilsen@acm.org>
net-test: packetdrill encap support: header metadata definitions

As a first step for packetdrill supporting encapsulated packets,
introduce types to represent all the layers of headers in a packet.


Change-Id: I617a6b977d4fc1f6a51b1b0211dc2c3b39cc2738
net-test: packetdrill encap support: GRE header defs and logic

Basic definitions to support GRE-encapsulated packets.


Change-Id: I9c3158d17577c54c3298a65667976a7edab9c184
net-test: packetdrill encap support: main encapsulation engine

The main engine for handling encapsualted packets in packetdrill,
including:

- parsing scripts with encapsulation
- parsing packets with encapsulation
- injecting packets with encapsulation

Encapsulated packets look like the following, which has an IP header,
GRE header, and then regular IP/TCP header:

+0 > ipv4 1.1.1.1 > 2.2.2.2: gre: . 1:1001(1000) ack 1

See other patches in the series for more detailed examples.


Change-Id: Ia8c7580e268f5b0347bd9d3fdc73b096f751a79d
net-test: packetdrill encap support: GRE encap parsing

Add code for basic parsing of GRE v0 headers, per RFC 1701.


Change-Id: I0d564f3ef17132f94a1df76512409b4cee7b441f
net-test: packetdrill encap support: outbound packet header checking

Basic verification for outbound encapsulated packets from the kernel
under test.


Change-Id: I5efeb08fb262312ec85d257680e4df46829a38f0
net-test: packetdrill encap support: refactor packet receive loops into one loop

Factor out the packet sniffing loop that's common to local and remote
mode, since it is nearly identical in both cases. This is in
preparation for fixing a bug that is found in both loops, so we can
make the fix in just one place.


Change-Id: Ic9a9b84b66a9f812866b1e29cd7c897f7c1d40cf
net-test: packetdrill encap support: free unknown sniffed packets

When we sniff an unknown packet, free it and allocate another packet
at the top of the sniffing loop. Previously we were not clearing state
after parsing an unknown packet, so state from the unkbown packet
could linger on, co-mingling with state from the next sniffed packet.


Change-Id: Ia9a330766969b114fd6084a087ff3f0d6b11d9d4
net-test: packetdrill encap support: IPv6 support

Add support for IPv6 in encapsulation layers, including: lexical
scanning of IPv6 addresses, parsing IPv6 encap in scripts, appending
and filling in IPv6 encapsulation.


Change-Id: I1349cd4056c168a4114a92324eb2a321f7db7697
net-test: packetdrill encap support: basic header printing

Basic support for printing encapsulation headers: IPv4, IPv6, GRE.


Change-Id: I67b9e432c98a00ba2c19ac6ea25ea35592462ea9
net-test: packetdrill encap support: test GRE encap parsing

Add simple coverage of IP/GRE encapsulation parsing.

Change-Id: I5938edc521a387e0c72bbf547d2862077f6af204