Skip to content
Snippets Groups Projects
Commit ea8f2fec authored by Barath Raghavan's avatar Barath Raghavan
Browse files

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: default avatarBarath Raghavan <barath@google.com>
parent 4d3c2251
No related branches found
No related tags found
No related merge requests found
Showing
with 569 additions and 0 deletions
Packetdrill tests for Linux.
This directory contains Packetdrill tests for Linux. The tests all pass under
kernel 3.11.0-rc4 (installed on an Ubuntu 13.04 machine). However, due to TCP
metrics caching in recent kernels, a second run of all tests can result in
failures. The script run_tests.sh in this directory uses the iproute tool to
flush the TCP metrics cache before each test.
// 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
0.000...0.200 accept(3, ..., ...) = 4
0.100 < S 0:0(0) win 32792 <mss 1000,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.300 write(4, ..., 2000) = 2000
0.300 > P. 1:2001(2000) ack 1
// 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 32792 <mss 1000,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
0.200...0.300 read(4, ..., 2000) = 2000
0.300 < P. 1:2001(2000) ack 1 win 257
0.300 > . 1:1(0) ack 2001
0.400...0.500 read(4, ..., 2000) = 2000
0.500 < P. 2001:4001(2000) ack 1 win 257
0.500 > . 1:1(0) ack 4001
0.600 < P. 4001:6001(2000) ack 1 win 257
0.600 > . 1:1(0) ack 6001
0.600...0.600 read(4, ..., 1000) = 1000
0.600...0.600 read(4, ..., 1000) = 1000
// If we close the connection after read()'ing what
// the other side sent, a FIN will be generated. 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 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
// Receive first segment
0.210 < P. 1:1001(1000) ack 1 win 46
// Send one ACK
0.210 > . 1:1(0) ack 1001
// Application writes 1000 bytes
0.250 write(4, ..., 1000) = 1000
0.250 > P. 1:1001(1000) ack 1001
// ACK
0.300 < . 1001:1001(0) ack 1001 win 257
0.400 read(4, ..., 1000) = 1000
// Client closes the connection
0.610 < F. 1001:1001(0) ack 1001 win 260
// Respond with (delayed) ACK
0.650 > . 1001:1001(0) ack 1002
// We close the connection
0.700 close(4) = 0
0.701 > F. 1001:1001(0) ack 1002
// Verify that when a process uses SO_LINGER with {onoff=1, linger=0},
// and then closes the socket, the kernel sends a RST.
// (TODO(ncardwell): it also frees the socket immediately without any
// time in TIME_WAIT; we should test this too once we have some
// infrastructure for testing this kind of thing reliably...)
// Initialize a server socket.
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
+0 < . 1:1(0) ack 1 win 257
+0 accept(3, ..., ...) = 4
+0 setsockopt(4, SOL_SOCKET, SO_LINGER, {onoff=1, linger=0}, 8) = 0
// Write some data, receive an ACK.
+0 write(4, ..., 1000) = 1000
+0 > P. 1:1001(1000) ack 1
+0 < . 1:1(0) ack 1001 win 257
// Clean up.
+0 close(4) = 0
+0 > R. 1001:1001(0) ack 1
// If we close the connection before read()'ing what
// the other side sent, a RST will be generated instead
// of a FIN.
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 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
// Receive first segment.
0.210 < P. 1:1001(1000) ack 1 win 46
// Send one ACK.
0.210 > . 1:1(0) ack 1001
// Application writes 1000 bytes.
0.250 write(4, ..., 1000) = 1000
0.250 > P. 1:1001(1000) ack 1001
// ACK
0.300 < . 1001:1001(0) ack 1001 win 257
// Client closes the connection.
0.610 < F. 1001:1001(0) ack 1001 win 260
// Respond with (delayed) ACK.
0.650 > . 1001:1001(0) ack 1002
// We close the connection.
0.700 close(4) = 0
// Since we have not read, we generate a RST instead of a FIN
// conforming to RFC 1122 section 4.2.2.13.
0.701 > R. 1001:1001(0) ack 1002
// A simple client-side HTTP-style test that does a connect, sends a
// short request, and receives a short response.
// Create a socket and set it to non-blocking.
0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
0.000 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR)
0.000 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
// Establish connection and verify that there was no error.
0.100 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress)
0.100 > S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 6>
0.200 < S. 0:0(0) ack 1 win 5792 <mss 1460,sackOK,TS val 700 ecr 100,nop,wscale 7>
0.200 > . 1:1(0) ack 1 <nop,nop,TS val 200 ecr 700>
0.200 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
0.200 fcntl(3, F_SETFL, O_RDWR) = 0 // set back to blocking
// Send the HTTP request.
0.200 write(3, ..., 57) = 57
0.200 > P. 1:58(57) ack 1 <nop,nop,TS val 200 ecr 700>
0.300 < . 1:1(0) ack 58 win 92 <nop,nop,TS val 800 ecr 200>
// Receive the HTTP response and the server's FIN.
0.300 < P. 1:786(785) ack 58 win 92 <nop,nop,TS val 800 ecr 200>
0.300 > . 58:58(0) ack 786 <nop,nop,TS val 300 ecr 800>
0.300 < F. 786:786(0) ack 58 win 92 <nop,nop,TS val 800 ecr 200>
0.300 read(3, ..., 1024) = 785
0.300 read(3, ..., 1024) = 0
// Delayed ACK.
0.340 > . 58:58(0) ack 787 <nop,nop,TS val 300 ecr 800>
// Close the connection.
0.350 close(3) = 0
0.350 > F. 58:58(0) ack 787 <nop,nop,TS val 300 ecr 800>
0.450 < . 787:787(0) ack 59 win 92 <nop,nop,TS val 900 ecr 300>
// Test delayed ER with 2 packets outstanding, receiver sending SACKs.
// Enable delayed early retransmit.
`sysctl -q net.ipv4.tcp_early_retrans=2`
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 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
0.200 write(4, ..., 2920) = 2920
0.200 > P. 1:2921(2920) ack 1
0.300 < . 1:1(0) ack 1 win 257 <sack 1461:2921,nop,nop>
0.325 > . 1:1461(1460) ack 1 // delayed Early Retransmit at RTT/4 = 25ms
0.425 < . 1:1(0) ack 2921 win 257
0.500 close(4) = 0
0.500 > F. 2921:2921(0) ack 1
0.600 < F. 1:1(0) ack 2922 win 257
0.601 > . 2922:2922(0) ack 2
0.700 `sysctl -q net.ipv4.tcp_early_retrans=3`
// Test delayed ER with 3 packets outstanding, receiver sending SACKs.
// Enable delayed early retransmit.
`sysctl -q net.ipv4.tcp_early_retrans=2`
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 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
0.200 write(4, ..., 4380) = 4380
0.200 > P. 1:4381(4380) ack 1
0.300 < . 1:1(0) ack 1 win 257 <sack 1461:2921,nop,nop>
0.300 < . 1:1(0) ack 1 win 257 <sack 1461:4381,nop,nop>
0.325 > . 1:1461(1460) ack 1 // delayed Early Retransmit at RTT/4 = 25ms
0.425 < . 1:1(0) ack 4381 win 257
0.500 close(4) = 0
0.500 > F. 4381:4381(0) ack 1
0.600 < F. 1:1(0) ack 4382 win 257
0.601 > . 4382:4382(0) ack 2
0.700 `sysctl -q net.ipv4.tcp_early_retrans=3`
// Test delayed ER with 3 packets outstanding, receiver sending SACKs.
// Added wrinkles: (1) ACK for missing first packet finally arrives,
// filling the hole and making the ER superfluous.
// This test verifies that the ER timer gets correctly cancelled.
// Enable delayed early retransmit.
`sysctl -q net.ipv4.tcp_early_retrans=2`
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 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
0.200 write(4, ..., 4380) = 4380
0.200 > P. 1:4381(4380) ack 1
0.300 < . 1:1(0) ack 1 win 257 <sack 1461:2921,nop,nop>
0.300 < . 1:1(0) ack 1 win 257 <sack 1461:4381,nop,nop>
0.310 < . 1:1(0) ack 4381 win 257
// No ER or RTO timer should fire here, since all data is ACKed
1.800 close(4) = 0
1.800 > F. 4381:4381(0) ack 1
1.900 < F. 1:1(0) ack 4382 win 257
1.900 > . 4382:4382(0) ack 2
2.000 `sysctl -q net.ipv4.tcp_early_retrans=3`
// Test delayed ER with 3 packets outstanding, receiver sending SACKs.
// Added wrinkles: (1) sender gets an ACK before delayed ER timer fires,
// so we don't do the originally scheduled ER but instead reschedule
// the ER timer for later.
// Enable delayed early retransmit.
`sysctl -q net.ipv4.tcp_early_retrans=2`
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 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
0.200 write(4, ..., 4380) = 4380
0.200 > P. 1:4381(4380) ack 1
0.300 < . 1:1(0) ack 1 win 257 <sack 1461:2921,nop,nop>
0.300 < . 1:1(0) ack 1 win 257 <sack 1461:4381,nop,nop>
// Next we get an ACK before ER fires. Any ACK should cause us
// to cancel ER timer, whether it ACKs new data or (as in this case) does not.
// Then we reschedule the ER timer again.
0.310 < . 1:1(0) ack 1 win 257 <sack 1461:4381,nop,nop>
0.335 > . 1:1461(1460) ack 1 // delayed ER at 0.310 + RTT/4=25ms
0.435 < . 1:1(0) ack 4381 win 257
0.700 close(4) = 0
0.700 > F. 4381:4381(0) ack 1
0.800 < F. 1:1(0) ack 4382 win 257
0.800 > . 4382:4382(0) ack 2
0.900 `sysctl -q net.ipv4.tcp_early_retrans=3`
// Test quick ER (no delay) with 2 packets outstanding, receiver sending SACKs.
// Enable quick early retransmit.
`sysctl -q net.ipv4.tcp_early_retrans=1`
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 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
0.200 write(4, ..., 2920) = 2920
0.200 > P. 1:2921(2920) ack 1
0.300 < . 1:1(0) ack 1 win 257 <sack 1461:2921,nop,nop>
0.300 > . 1:1461(1460) ack 1 // quick Early Retransmit
0.400 < . 1:1(0) ack 2921 win 257
0.500 close(4) = 0
0.500 > F. 2921:2921(0) ack 1
0.600 < F. 1:1(0) ack 2922 win 257
0.601 > . 2922:2922(0) ack 2
0.700 `sysctl -q net.ipv4.tcp_early_retrans=3`
// Test quick ER (no delay) with 3 packets outstanding, receiver sending SACKs.
// Enable quick early retransmit.
`sysctl -q net.ipv4.tcp_early_retrans=1`
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 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
0.200 write(4, ..., 4380) = 4380
0.200 > P. 1:4381(4380) ack 1
0.300 < . 1:1(0) ack 1 win 257 <sack 1461:2921,nop,nop>
0.300 < . 1:1(0) ack 1 win 257 <sack 1461:4381,nop,nop>
0.300 > . 1:1461(1460) ack 1 // quick ER (no delay)
0.400 < . 1:1(0) ack 4381 win 257
0.500 close(4) = 0
0.500 > F. 4381:4381(0) ack 1
0.600 < F. 1:1(0) ack 4382 win 257
0.601 > . 4382:4382(0) ack 2
0.700 `sysctl -q net.ipv4.tcp_early_retrans=3`
// Test PRR-slowstart implementation.
// In this variant we verify that the sender uses SACK info on an ACK
// below snd_una.
// This variant tests behavior with Reno congestion control.
`sysctl -q net.ipv4.tcp_congestion_control=reno`
// 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 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
// RTT 100ms
0.200 < . 1:1(0) ack 1 win 320
0.200 accept(3, ..., ...) = 4
// Send 10 data segments.
0.200 write(4, ..., 10000) = 10000
0.200 > P. 1:10001(10000) ack 1
// Lost packet 1:1001,4001:5001,7001:8001.
// Lots of reordering in both directions.
0.310 < . 1:1(0) ack 1 win 320 <sack 1001:2001,nop,nop>
0.320 < . 1:1(0) ack 1 win 320 <sack 1001:3001,nop,nop>
0.330 < . 1:1(0) ack 1 win 320 <sack 1001:3001 8001:9001,nop,nop>
// Enter fast recovery.
0.330 > . 1:1001(1000) ack 1
0.330 > . 3001:4001(1000) ack 1
// An ACK advances snd_una.
0.440 < . 1:1(0) ack 4001 win 320 <sack 8001:9001,nop,nop>
0.440 > . 4001:5001(1000) ack 1
0.440 > . 5001:6001(1000) ack 1
// The following ACK was reordered - delayed so that it arrives with
// an ACK field below snd_una. Here we check that the newly-SACKed
// 2MSS at 5001:7001 cause us to send out 1 more MSS.
0.450 < . 1:1(0) ack 3001 win 320 <sack 5001:7001,nop,nop>
0.450 > . 7001:8001(1000) ack 1
// Receiver ACKs all data.
0.560 < . 1:1(0) ack 10001 win 320
// Write another 10 MSS, of which 5MSS (cwnd=ssthresh) should go out:
0.600 write(4, ..., 10000) = 10000
0.600 > . 10001:15001(5000) ack 1
0.700 `sysctl -q net.ipv4.tcp_congestion_control=cubic`
// Test handling of incoming ICMP packets.
// This test tests all known ICMP packet 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 32792 <mss 1460,nop,wscale 7>
0.100 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 6>
0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
// Send 1 data segment.
0.200 write(4, ..., 1460) = 1460
0.200 > P. 1:1461(1460) ack 1
// We get lots of incoming ICMP messages.
// First the unreachable type and all its codes
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
// Then all the other types. These are legal because the code is optional.
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
// Now try symbolic types with numeric codes.
0.450 < icmp unreachable code_0
0.451 < icmp unreachable code_1
0.452 < icmp unreachable code_255
// Now try 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
// Receiver ACKs all data.
0.470 < . 1:1(0) ack 1461 win 257
// Clean up.
0.600 close(4) = 0
0.600 > F. 1461:1461(0) ack 1
0.700 < F. 1:1(0) ack 1462 win 257
0.700 > . 1462:1462(0) ack 2
// Test inet_diag for AF_INET6 sockets with IPv4 traffic.
// We use the "ss" socket statistics tool, which uses inet_diag sockets.
// We use the default tcptest local IP address for IPv4-mapped-IPv6.
// Options (command line arguments in script file) to force ipv4-mapped-ipv6.
--ip_version="ipv4-mapped-ipv6"
// Establish a connection.
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 2>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
+0 `ss -6 -n state SYN-RECV | grep ::ffff:192.168.0.1:8080 > /dev/null`
+0 < . 1:1(0) ack 1 win 32890
+0 accept(3, ..., ...) = 4
// first, use inet_diag with no filter:
+0 `ss -6 -n | grep ::ffff:192.168.0.1:8080 > /dev/null`
// then try filters, which use a different code path:
+0 `ss -6 -n --options --extended --info '( sport = :8080 )' | grep ::ffff:192.168.0.1:8080 > /dev/null`
+0 `ss -6 -n --options --extended --info '( sport = :8080 )' src ::ffff:192.168.0.1/128 | grep ::ffff:192.168.0.1:8080 > /dev/null`
// Test inet_diag for AF_INET sockets with IPv4 traffic.
// We use the "ss" socket statistics tool, which uses inet_diag sockets.
// We use the default tcptest local IP address for IPv4.
// Options (command line arguments in script file) to force IPv4.
--ip_version=ipv4
// Establish a connection.
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 2>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
+0 `ss -4 -n state SYN-RECV | grep 192.168.0.1:8080 > /dev/null`
+0 < . 1:1(0) ack 1 win 32890
+0 accept(3, ..., ...) = 4
// first, use inet_diag with no filter:
+0 `ss -4 -n | grep :8080 | grep 192.168.0.1:8080 > /dev/null`
// then try filters, which use a different code path:
+0 `ss -4 -n --options --extended --info '( sport = :8080 )' | grep 192.168.0.1:8080 > /dev/null`
+0 `ss -4 -n --options --extended --info '( sport = :8080 )' src 192.168.0.1/32 | grep 192.168.0.1:8080 > /dev/null`
// Test inet_diag for AF_INET6 sockets with IPv6 traffic.
// We use the "ss" socket statistics tool, which uses inet_diag sockets.
// We use the default tcptest local IP address for IPv6.
// Options (command line arguments in script file) to force IPv6.
--ip_version=ipv6
--mtu=1520
// Establish a connection.
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 2>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 6>
+0 `ss -6 -n state SYN-RECV | grep fd3d:fa7b:d17d::1:8080 > /dev/null`
+0 < . 1:1(0) ack 1 win 32890
+0 accept(3, ..., ...) = 4
// first, use inet_diag with no filter:
+0 `ss -6 -n | grep :8080 | grep fd3d:fa7b:d17d::1:8080 > /dev/null`
// then try filters, which use a different code path:
+0 `ss -6 -n --options --extended --info '( sport = :8080 )' | grep fd3d:fa7b:d17d::1:8080 > /dev/null`
+0 `ss -6 -n --options --extended --info '( sport = :8080 )' src fd3d:fa7b:d17d::1/128 | grep fd3d:fa7b:d17d::1:8080 > /dev/null`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment