diff options
Diffstat (limited to 'test/packetdrill/tests/linux/mss')
8 files changed, 178 insertions, 0 deletions
diff --git a/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-client-ts.pkt b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-client-ts.pkt new file mode 100644 index 0000000..a8544f5 --- /dev/null +++ b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-client-ts.pkt @@ -0,0 +1,17 @@ +// Test that getsockopt of TCP_MAXSEG works on active/client TCP connections. +// In this variant we test that a simple query of segment size works, +// in the case where TCP timestamps reduce the usable payload space. + +// Create a socket. +0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 + +0.100...0.200 connect(3, ..., ...) = 0 + +// Establish a connection. +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 32792 <mss 1100,sackOK,TS val 200 ecr 100,nop,wscale 7> +0.200 > . 1:1(0) ack 1 <nop,nop,TS val 200 ecr 200> + +// Verify that the kernel reduced the returned segment size +// to account for TCP timestamps. +0.300 getsockopt(3, SOL_TCP, TCP_MAXSEG, [1088], [4]) = 0 diff --git a/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-client.pkt b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-client.pkt new file mode 100644 index 0000000..a75b8b3 --- /dev/null +++ b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-client.pkt @@ -0,0 +1,14 @@ +// Test that getsockopt of TCP_MAXSEG works on active/client TCP connections. +// In this variant we test that a simple query of segment size works. + +// Create a socket. +0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 + +0.100...0.200 connect(3, ..., ...) = 0 + +// Establish a connection. +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 32792 <mss 1100,nop,wscale 7> +0.200 > . 1:1(0) ack 1 + +0.300 getsockopt(3, SOL_TCP, TCP_MAXSEG, [1100], [4]) = 0 diff --git a/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server-advmss-ipv4.pkt b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server-advmss-ipv4.pkt new file mode 100644 index 0000000..c07c5c0 --- /dev/null +++ b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server-advmss-ipv4.pkt @@ -0,0 +1,29 @@ +// Test that getsockopt of TCP_MAXSEG works on passive/server TCP connections. +// In this variant we test that we get the expected result when +// the routing config specifies an "advmss 1430 mtu lock 1470" for the +// route to the remote IP under test. + +// To ensure that we do not cache something that interferes with other tests: +--remote_ip="192.0.2.2" + +`ip route change 192.0.2.2 via 192.168.0.2 dev tun0 advmss 1430 mtu lock 1470` + +// Set up a listening 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 + +// Establish a connection without timestamps. ++0 < S 0:0(0) win 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7> ++0 > S. 0:0(0) ack 1 <mss 1430,nop,nop,sackOK,nop,wscale 6> ++0 < . 1:1(0) ack 1 win 257 + ++0 accept(3, ..., ...) = 4 + +// Verify that the kernel returns the expected TCP max payload size. ++0 getsockopt(4, SOL_TCP, TCP_MAXSEG, [1430], [4]) = 0 + ++0 write(4, ..., 1500) = 1500 ++0 > . 1:1431(1430) ack 1 ++0 > P. 1431:1501(70) ack 1 diff --git a/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server-advmss-ts-ipv4.pkt b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server-advmss-ts-ipv4.pkt new file mode 100644 index 0000000..2222d51 --- /dev/null +++ b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server-advmss-ts-ipv4.pkt @@ -0,0 +1,30 @@ +// Test that getsockopt of TCP_MAXSEG works on passive/server TCP connections. +// In this variant we test that we get the expected result when +// the routing config specifies an "advmss 1430 mtu lock 1470" for the +// route to the remote IP under test. + +// To ensure that we do not cache something that interferes with other tests: +--remote_ip="192.0.2.2" + +`ip route change 192.0.2.2 via 192.168.0.2 dev tun0 advmss 1430 mtu lock 1470` + +// Set up a listening 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 + +// Establish a connection ++0 < S 0:0(0) win 32792 <mss 1460,sackOK,TS val 0 ecr 0,nop,wscale 7> ++0 > S. 0:0(0) ack 1 <mss 1430,sackOK,TS val 0 ecr 0,nop,wscale 6> ++0 < . 1:1(0) ack 1 win 257 <nop,nop,TS val 0 ecr 0> + ++0 accept(3, ..., ...) = 4 + +// Verify that the kernel reduced the returned segment size +// to account for TCP timestamps. ++0 getsockopt(4, SOL_TCP, TCP_MAXSEG, [1418], [4]) = 0 + ++0 write(4, ..., 1500) = 1500 ++0 > . 1:1419(1418) ack 1 <nop,nop,TS val 0 ecr 0> ++0 > P. 1419:1501(82) ack 1 <nop,nop,TS val 0 ecr 0> diff --git a/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server-ts.pkt b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server-ts.pkt new file mode 100644 index 0000000..5d28c93 --- /dev/null +++ b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server-ts.pkt @@ -0,0 +1,20 @@ +// Test that getsockopt of TCP_MAXSEG works on passive/server TCP connections. +// In this variant we test that a simple query of segment size works, +// in the case where TCP timestamps reduce the usable payload space. + +// Set up a listening 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 32792 <mss 1100,sackOK,TS val 100 ecr 0,nop,wscale 7> +0.100 > S. 0:0(0) ack 1 <mss 1460,sackOK,TS val 100 ecr 100,nop,wscale 6> +0.200 < . 1:1(0) ack 1 win 257 <nop,nop,TS val 200 ecr 100> + +0.300 accept(3, ..., ...) = 4 + +// Verify that the kernel reduced the returned segment size +// to account for TCP timestamps. +0.400 getsockopt(4, SOL_TCP, TCP_MAXSEG, [1088], [4]) = 0 diff --git a/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server.pkt b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server.pkt new file mode 100644 index 0000000..03516c1 --- /dev/null +++ b/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server.pkt @@ -0,0 +1,17 @@ +// Test that getsockopt of TCP_MAXSEG works on passive/server TCP connections. +// In this variant we test that a simple query of segment size works. + +// Set up a listening 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 32792 <mss 1100,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 accept(3, ..., ...) = 4 + +0.400 getsockopt(4, SOL_TCP, TCP_MAXSEG, [1100], [4]) = 0 diff --git a/test/packetdrill/tests/linux/mss/mss-setsockopt-tcp_maxseg-client.pkt b/test/packetdrill/tests/linux/mss/mss-setsockopt-tcp_maxseg-client.pkt new file mode 100644 index 0000000..906ad6e --- /dev/null +++ b/test/packetdrill/tests/linux/mss/mss-setsockopt-tcp_maxseg-client.pkt @@ -0,0 +1,24 @@ +// Test TCP_MAXSEG works on active/client TCP connections. + +// Create a socket. +0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 + +// Set MSS to 1100. +0.010 setsockopt(3, SOL_TCP, TCP_MAXSEG, [1100], 4) = 0 +// TODO(ncardwell): the following is silly; should we fix it? +0.020 getsockopt(3, SOL_TCP, TCP_MAXSEG, [536], [4]) = 0 + +0.100...0.200 connect(3, ..., ...) = 0 + +// Establish a connection with an outgoing advertised MSS of 1100. +0.100 > S 0:0(0) <mss 1100,sackOK,TS val 100 ecr 0,nop,wscale 6> +0.200 < S. 0:0(0) ack 1 win 32792 <mss 1460,nop,wscale 7> +0.200 > . 1:1(0) ack 1 + +0.300 getsockopt(3, SOL_TCP, TCP_MAXSEG, [1100], [4]) = 0 + +0.400 %{ assert tcpi_advmss == 1100; assert tcpi_snd_mss == 1100 }% + +// IW10 MSS should yield outgoing TSO packet with 10*1100 == 11000 bytes: +0.500 write(3, ..., 12000) = 12000 +0.500 > . 1:11001(11000) ack 1 diff --git a/test/packetdrill/tests/linux/mss/mss-setsockopt-tcp_maxseg-server.pkt b/test/packetdrill/tests/linux/mss/mss-setsockopt-tcp_maxseg-server.pkt new file mode 100644 index 0000000..f2ed31d --- /dev/null +++ b/test/packetdrill/tests/linux/mss/mss-setsockopt-tcp_maxseg-server.pkt @@ -0,0 +1,27 @@ +// Test TCP_MAXSEG works on passive/server TCP connections. + +// Set up a listening 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 + +// Set MSS to 1100. +0.010 setsockopt(3, SOL_TCP, TCP_MAXSEG, [1100], 4) = 0 +// TODO(ncardwell): the following is silly; should we fix it? +0.020 getsockopt(3, SOL_TCP, TCP_MAXSEG, [536], [4]) = 0 + +// Establish a connection with an outgoing advertised MSS of 1100. +0.100 < S 0:0(0) win 32792 <mss 1300,nop,wscale 7> +0.100 > S. 0:0(0) ack 1 <mss 1100,nop,wscale 6> +0.200 < . 1:1(0) ack 1 win 257 + +0.300 accept(3, ..., ...) = 4 + +0.400 getsockopt(4, SOL_TCP, TCP_MAXSEG, [1100], [4]) = 0 + +0.500 %{ assert tcpi_advmss == 1100; assert tcpi_snd_mss == 1100 }% + +// IW10 MSS should yield outgoing TSO packet with 10*1100 == 11000 bytes: +0.600 write(4, ..., 12000) = 12000 +0.600 > . 1:11001(11000) ack 1 |