aboutsummaryrefslogtreecommitdiffstats
path: root/test/packetdrill/tests/linux/mss/mss-getsockopt-tcp_maxseg-server-advmss-ts-ipv4.pkt
blob: 2222d5135dd262bca492ba8df94974450a61f39b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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>