diff --git a/README.md b/README.md index a5fcea440de5a197a2f1f97454e0b4fa2c48afaa..21a85bd8c74f04524b5b2c5df79fceb2dcbb6e5d 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,6 @@ A fork of [packetdrill](https://code.google.com/p/packetdrill/) which adds suppo and generic bugfixes, espcially several fixes required to get packetdrill working on FreeBSD. There are some papers ([;login: October 2013](https://www.usenix.org/system/files/login/articles/10_cardwell-online.pdf), [USENIX ATC '13](https://www.usenix.org/system/files/conference/atc13/atc13-cardwell.pdf)) and a presentation ([ICCRG IETF87](https://www.ietf.org/proceedings/87/slides/slides-87-iccrg-1.pdf)) describing packetdrill. + +The status of continous integration testing is available from [grid](http://212.201.121.110:38010/grid) and [waterfall](http://212.201.121.110:38010/waterfall). +If you are only interested in a single branch, just append `?branch=BRANCHNAME` to the URL, for example [waterfall](http://212.201.121.110:38010/waterfall?branch=master). diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c index 60fbd33a11d8ca6534dcd76b915351b3f6f1deaf..4467cac483dcbef3226046e4945cd384972d5cac 100644 --- a/gtests/net/packetdrill/run_system_call.c +++ b/gtests/net/packetdrill/run_system_call.c @@ -6279,7 +6279,7 @@ static void *system_call_thread(void *arg) #elif defined(__FreeBSD__) state->syscalls->thread_id = pthread_getthreadid_np(); #else - state->syscalls->thread_id = 0 /* FIXME */ + state->syscalls->thread_id = 0; /* FIXME */ #endif while (!done) { diff --git a/gtests/net/packetdrill/tests/bsd/tcp/blocking/blocking-accept.pkt b/gtests/net/packetdrill/tests/bsd/tcp/blocking/blocking-accept.pkt new file mode 100644 index 0000000000000000000000000000000000000000..026353370f59135d6af12f437f5f28e3803fed77 --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/tcp/blocking/blocking-accept.pkt @@ -0,0 +1,18 @@ +// Test for blocking accept + +// Establish a connection +0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0.000 bind(3, ..., ...) = 0 +0.000 listen(3, 1) = 0 + +// Initiate a blocking system call +0.000...0.200 accept(3, ..., ...) = 4 + +0.100 < S 0:0(0) win 65535 <mss 1460,sackOK,nop,nop,nop,wscale 7> +0.100 > S. 0:0(0) ack 1 <...> +0.200 < . 1:1(0) ack 1 win 65535 +// The connection gets accepted at this point + +0.300 write(4, ..., 1460) = 1460 +0.300 > P. 1:1461(1460) ack 1 <...> diff --git a/gtests/net/packetdrill/tests/bsd/tcp/blocking/blocking-read.pkt b/gtests/net/packetdrill/tests/bsd/tcp/blocking/blocking-read.pkt new file mode 100644 index 0000000000000000000000000000000000000000..5ef5fad9e4604fefaa7456b244795fb0a79a48bd --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/tcp/blocking/blocking-read.pkt @@ -0,0 +1,23 @@ +// Test for blocking read + +// Establish a connection +0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0.000 bind(3, ..., ...) = 0 +0.000 listen(3, 1) = 0 + +0.100 < S 0:0(0) win 65535 <mss 1460,sackOK,nop,nop,nop,wscale 7> +0.100 > S. 0:0(0) ack 1 <...> +0.200 < . 1:1(0) ack 1 win 65535 +0.200 accept(3, ..., ...) = 4 + +// We initiate a blocking read system call +0.200...0.300 read(4, ..., 2000) = 2000 +0.300 < P. 1:2001(2000) ack 1 win 65535 +0.300 > . 1:1(0) ack 2001 + +0.400...0.500 read(4, ..., 1000) = 1000 +0.500 < P. 2001:3001(1000) ack 1 win 65535 + +// We send a delayed ack +0.600 > . 1:1(0) ack 3001 <...> diff --git a/gtests/net/packetdrill/tests/bsd/tcp/close/close-read-data-fin.pkt b/gtests/net/packetdrill/tests/bsd/tcp/close/close-read-data-fin.pkt new file mode 100644 index 0000000000000000000000000000000000000000..1516fd23f50f698e31fce0c510d0db6ed110e0dd --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/tcp/close/close-read-data-fin.pkt @@ -0,0 +1,42 @@ +// Test for checking whether a FIN is generated when +// we close the connection after read()'ing what the +// client sent. This behavior conforms to RFC 793. + +0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0.000 bind(3, ..., ...) = 0 +0.000 listen(3, 1) = 0 + +0.100 < S 0:0(0) win 65535 <mss 1460,sackOK,nop,nop,nop,wscale 7> +0.100 > S. 0:0(0) ack 1 <...> +0.200 < . 1:1(0) ack 1 win 65535 +0.200 accept(3, ..., ...) = 4 + +// We receive first segment +0.210 < P. 1:1001(1000) ack 1 win 65535 + +// We send one ACK +0.350 > . 1:1(0) ack 1001 win 1026 + +// Our application writes 1000 bytes +0.400 write(4, ..., 1000) = 1000 +0.400 > P. 1:1001(1000) ack 1001 + +// Client sends one ACK +0.410 < . 1001:1001(0) ack 1001 win 65535 + +0.420 read(4, ..., 1000) = 1000 + +// Client closes connection +0.450 < F. 1001:1001(0) ack 1001 win 65535 + +// TODO: ack or delayed ack ? +0.460 > . 1001:1001(0) ack 1002 win 1026 + +// We close the connection with a delay, in case there +// is still data left to read +0.470 close(4) = 0 +0.470 > F. 1001:1001(0) ack 1002 win 1026 + +// The success of the tests depends on the correctness +// of the outbound sniffed packet on line 39. diff --git a/gtests/net/packetdrill/tests/bsd/tcp/close/close-unread-data-rst.pkt b/gtests/net/packetdrill/tests/bsd/tcp/close/close-unread-data-rst.pkt new file mode 100644 index 0000000000000000000000000000000000000000..909d6850da4ea17a4c24abded9c0d3a5efb83730 --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/tcp/close/close-unread-data-rst.pkt @@ -0,0 +1,39 @@ +// Test for checking whether a RST is generated when +// we close the connection before read()'ing what the +// client sent. + +0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0.000 bind(3, ..., ...) = 0 +0.000 listen(3, 1) = 0 + +0.100 < S 0:0(0) win 65535 <mss 1460,sackOK,nop,nop,nop,wscale 7> +0.100 > S. 0:0(0) ack 1 <...> +0.200 < . 1:1(0) ack 1 win 65535 +0.200 accept(3, ..., ...) = 4 + +// We receive first segment +0.210 < P. 1:1001(1000) ack 1 win 65535 + +// We send one ACK +0.350 > . 1:1(0) ack 1001 win 1026 + +// Our application writes 1000 bytes +0.400 write(4, ..., 1000) = 1000 +0.400 > P. 1:1001(1000) ack 1001 + +// Client sends one ACK +0.410 < . 1001:1001(0) ack 1001 win 65535 + +// Client closes connection +0.450 < F. 1001:1001(0) ack 1001 win 65535 + +0.460 > . 1001:1001(0) ack 1002 win 1026 + +// We close the connection with a delay, in case there +// is still data left to send +0.470 close(4) = 0 +0.480 > R. 1001:1001(0) ack 1002 win 1026 + +// The success of the tests depends on the correctness +// of the outbound sniffed packet on line 36. diff --git a/gtests/net/packetdrill/tests/bsd/tcp/icmp/icmp-all-types.pkt b/gtests/net/packetdrill/tests/bsd/tcp/icmp/icmp-all-types.pkt new file mode 100644 index 0000000000000000000000000000000000000000..8c8a15fc0e589bc83121b350cb55c548083e9023 --- /dev/null +++ b/gtests/net/packetdrill/tests/bsd/tcp/icmp/icmp-all-types.pkt @@ -0,0 +1,63 @@ +// Test for handling of incoming ICMP packets. +// This test tests all known ICMP types, and a +// few unknown types. + +// Establish a connection +0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0.000 bind(3, ..., ...) = 0 +0.000 listen(3, 1) = 0 + +0.100 < S 0:0(0) win 65535 <mss 1460,sackOK,nop,nop,nop,wscale 7> +0.100 > S. 0:0(0) ack 1 <...> +0.200 < . 1:1(0) ack 1 win 65535 +0.200 accept(3, ..., ...) = 4 + +// Unreachable types +0.300 < icmp unreachable net_unreachable +0.301 < icmp unreachable host_unreachable +0.302 < icmp unreachable protocol_unreachable +0.303 < icmp unreachable port_unreachable +0.304 < icmp unreachable frag_needed mtu 1234 +0.305 < icmp unreachable source_route_failed +0.306 < icmp unreachable net_unknown +0.307 < icmp unreachable host_unknown +0.308 < icmp unreachable source_host_isolated +0.309 < icmp unreachable net_prohibited +0.310 < icmp unreachable host_prohibited +0.311 < icmp unreachable net_unreachable_for_tos +0.312 < icmp unreachable host_unreachable_for_tos +0.313 < icmp unreachable packet_filtered +0.314 < icmp unreachable precedence_violation +0.315 < icmp unreachable precedence_cutoff + +0.400 < icmp echo_reply +0.401 < icmp source_quench +0.402 < icmp redirect +0.403 < icmp echo_request +0.404 < icmp time_exceeded +0.405 < icmp parameter_problem +0.406 < icmp timestamp_request +0.407 < icmp timestamp_reply +0.408 < icmp information_request +0.409 < icmp information_reply +0.410 < icmp address_mask_request +0.411 < icmp address_mask_reply + +// Symbolic types with numeric codes. +0.450 < icmp unreachable code_0 +0.451 < icmp unreachable code_1 +0.452 < icmp unreachable code_255 + +// Numeric types with numeric codes +0.460 < icmp type_0 code_0 +0.461 < icmp type_1 code_0 +0.462 < icmp type_255 code_0 + +0.470 < . 1:1(0) ack 1 win 65535 + +// We close the connection +0.500 close(4) = 0 +0.500 > F. 1:1(0) ack 1 win 1026 +0.510 < F. 1:1(0) ack 2 win 65535 +0.510 > . 2:2(0) ack 2