Last active
September 23, 2016 19:02
-
-
Save shivansh/f931d36beb3236d68e4a41b1addf00b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode | |
listening on tun0, link-type NULL (BSD loopback), capture size 262144 bytes | |
05:59:55.381693 IP 192.0.2.1.47963 > 192.168.0.1.8080: Flags [S], seq 0, win 65535, options [mss 1460,sackOK,nop,nop,nop,wscale 7], length 0 | |
05:59:55.381717 IP 192.168.0.1.8080 > 192.0.2.1.47963: Flags [S.], seq 3379463730, ack 1, win 65535, options [mss 1460,nop,wscale 6,sackOK,eol], length 0 | |
05:59:55.382710 IP 192.0.2.1.47963 > 192.168.0.1.8080: Flags [.], ack 1, win 65535, length 0 | |
05:59:55.383863 IP 192.0.2.1.47963 > 192.168.0.1.8080: Flags [F.], seq 1, ack 1, win 65535, length 0 | |
05:59:55.383877 IP 192.168.0.1.8080 > 192.0.2.1.47963: Flags [.], ack 2, win 1026, length 0 | |
05:59:55.584821 IP6 :: > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28 | |
05:59:55.796828 IP6 :: > ff02::16: HBH ICMP6, multicast listener report v2, 2 group record(s), length 48 | |
05:59:55.982448 IP6 :: > ff02::1:ffa0:b9e2: ICMP6, neighbor solicitation, who has fe80::a00:27ff:fea0:b9e2, length 32 | |
05:59:56.220824 IP6 :: > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28 | |
05:59:57.916822 IP6 fe80::a00:27ff:fea0:b9e2 > ff02::16: HBH ICMP6, multicast listener report v2, 2 group record(s), length 48 | |
06:00:09.936582 IP 192.168.0.1.8080 > 192.0.2.1.16730: Flags [R.], seq 169419763, ack 1, win 1026, length 0 | |
06:00:13.911574 IP 192.168.0.1.8080 > 192.0.2.1.48548: Flags [F.], seq 309313001, ack 1, win 1026, length 0 | |
06:00:47.379576 IP 192.168.0.1.8080 > 192.0.2.1.39061: Flags [F.], seq 1171129280, ack 1, win 1026, length 0 | |
06:01:17.928589 IP 192.168.0.1.8080 > 192.0.2.1.48548: Flags [F.], seq 0, ack 1, win 1026, length 0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a listening TCP socket | |
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 | |
// Establish a connection | |
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.100 < . 1:1(0) ack 1 win 65535 | |
0.100 accept(3, ..., ...) = 4 | |
// 0.100 close(4) = 0 | |
// 0.100 > F. 1:1(0) ack 1 <...> | |
// | |
0.110 < F. 1:1(0) ack 1 win 65535 | |
// Observation 1 : Even when we are not sending the following ACK, the TCP | |
// stack will automatically send the ACK, as intercepted by tcpdump. | |
0.110 > . 1:1(0) ack 2 <...> | |
// The following ACK has to be removed. | |
// 0.110 < . 2:2(0) ack 2 win 65535 | |
// The client skips the ACK (last ACK lost) | |
// We now try to close the connection from the other side first. | |
// 0.110 < F. 1:1(0) ack 1 win 65535 | |
0.110 > F. 1:1(0) ack 2 <...> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test for Retransmission Timeout with 10 packets outstanding. | |
// Receiver in this case supports Sack. | |
// Create a listening TCP socket | |
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 | |
// Establish a connection | |
0.100 < S 0:0(0) win 65535 <mss 1000,sackOK,nop,nop,nop,wscale 7> | |
0.100 > S. 0:0(0) ack 1 <...> | |
0.100 < . 1:1(0) ack 1 win 65535 | |
0.100 accept(3, ..., ...) = 4 | |
0.110 %{ assert tcpi_rto == 3000000 }% | |
// We write 10 data segments | |
0.110 write(4, ..., 10000) = 10000 | |
0.110 > . 1:1001(1000) ack 1 | |
0.110 > . 1001:2001(1000) ack 1 | |
0.110 > . 2001:3001(1000) ack 1 | |
0.110 > . 3001:4001(1000) ack 1 | |
0.110 > . 4001:5001(1000) ack 1 | |
0.110 > . 5001:6001(1000) ack 1 | |
0.110 > . 6001:7001(1000) ack 1 | |
0.110 > . 7001:8001(1000) ack 1 | |
0.110 > . 8001:9001(1000) ack 1 | |
0.110 > P. 9001:10001(1000) ack 1 | |
// Client ACKs first 4 data segments | |
0.120 < . 1:1(0) ack 4001 win 65535 <sack 1:4001, nop, nop> | |
0.320 %{ assert tcpi_rto == 230000 }% | |
// Retransmission timeout occurs | |
0.320 > . 4001:5001(1000) ack 1 | |
// Retransmission timeout occurs | |
0.620 > . 4001:5001(1000) ack 1 | |
================================================================= | |
The output of the test - | |
▶ sudo ./packetdrill -v --tolerance_usecs=100000 ~/soc-16/rto/retransmission_timeout.pkt | |
inbound injected packet: 0.106955 S 0:0(0) win 65535 <mss 1000,sackOK,nop,nop,nop,wscale 7> | |
outbound sniffed packet: 0.107372 S. 644337437:644337437(0) ack 1 win 65535 <mss 1000,nop,wscale 6,sackOK,eol,eol> | |
inbound injected packet: 0.107718 . 1:1(0) ack 644337438 win 65535 | |
outbound sniffed packet: 0.110271 . 644337438:644338438(1000) ack 1 win 1031 | |
outbound sniffed packet: 0.110281 . 644338438:644339438(1000) ack 1 win 1031 | |
outbound sniffed packet: 0.110287 . 644339438:644340438(1000) ack 1 win 1031 | |
outbound sniffed packet: 0.110292 . 644340438:644341438(1000) ack 1 win 1031 | |
outbound sniffed packet: 0.110299 . 644341438:644342438(1000) ack 1 win 1031 | |
outbound sniffed packet: 0.110304 . 644342438:644343438(1000) ack 1 win 1031 | |
outbound sniffed packet: 0.110310 . 644343438:644344438(1000) ack 1 win 1031 | |
outbound sniffed packet: 0.110315 . 644344438:644345438(1000) ack 1 win 1031 | |
outbound sniffed packet: 0.110320 . 644345438:644346438(1000) ack 1 win 1031 | |
outbound sniffed packet: 0.110326 P. 644346438:644347438(1000) ack 1 win 1031 | |
inbound injected packet: 0.120323 . 1:1(0) ack 644341438 win 65535 <sack 644337438:644341438,nop,nop> | |
outbound sniffed packet: 0.364135 . 644341438:644342438(1000) ack 1 win 1031 | |
outbound sniffed packet: 0.640008 . 644341438:644342438(1000) ack 1 win 1031 | |
tcpi_rto = 3000000 | |
The value drops - | |
tcpi_rto = 230000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Borrowed from https://github.com/google/packetdrill | |
// This test checks for the behavior of the sequence | |
// shutdown(SHUT_RD), read, shutdown(SHUT_WR), write(), close() | |
--tolerance_usecs=100000 | |
// Establish the 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 | |
0.210 shutdown(4, SHUT_WR) = 0 | |
0.210 write(4, ..., 1000) = -1 EPIPE (Broken pipe) | |
0.210 > F. 1:1(0) ack 1 | |
0.210 < . 1:1(0) ack 2 win 65535 | |
0.220 < F. 1:1(0) ack 2 win 65535 | |
0.220 > . 2:2(0) ack 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c | |
47: if (TCPS_HAVERCVDFIN(ssk->state) == 0) | |
444: TCPS_HAVERCVDFIN(ssk->state)) { | |
sys/netinet/tcp_fsm.h | |
76:#define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT) | |
sys/netinet/tcp_stacks/fastpath.c | |
1050: (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { | |
1450: TCPS_HAVERCVDFIN(tp->t_state) == 0) { | |
1520: TCPS_HAVERCVDFIN(tp->t_state) == 0) { | |
1587: if (TCPS_HAVERCVDFIN(tp->t_state) == 0) { | |
sys/netinet/tcp_input.c | |
2523: (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { | |
2954: TCPS_HAVERCVDFIN(tp->t_state) == 0) { | |
3026: TCPS_HAVERCVDFIN(tp->t_state) == 0) { | |
3094: if (TCPS_HAVERCVDFIN(tp->t_state) == 0) { | |
sys/netinet/tcp_output.c | |
640: !TCPS_HAVERCVDFIN(tp->t_state)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test for establishing TIME_WAIT configuration. | |
--tolerance_usecs=100000 | |
// Create a listening TCP socket | |
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 | |
// Establish a connection | |
0.100 < S 0:0(0) win 65535 <mss 1460,sackOK,nop,nop,nop,wscale 7> | |
0.100 > S. 0:0(0) ack 1 win 65535 <...> | |
0.100 < . 1:1(0) ack 1 win 65535 | |
0.100 accept(3, ..., ...) = 4 | |
// We make a transition to FIN_WAIT_1. | |
0.100 close(4) = 0 | |
0.100 > F. 1:1(0) ack 1 <...> | |
+0 %{ assert tcpi_state == TCPS_FIN_WAIT1 }% | |
// We make a transition to FIN_WAIT_2. | |
0.110 < . 1:1(0) ack 2 win 65535 | |
0.110 < F. 1:1(0) ack 2 win 65535 | |
0.120 > . 2:2(0) ack 2 <...> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment