OSDN Git Service

ipv6: tcp: send consistent autoflowlabel in SYN_RECV state
authorEric Dumazet <edumazet@google.com>
Wed, 31 Aug 2022 20:37:29 +0000 (13:37 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 2 Sep 2022 03:57:03 +0000 (20:57 -0700)
commitaa51b80e1af47b3781abb1fb1666445a7616f0cd
tree8239cf124651a465ca103c21ef4d154b799948cb
parent1ab3d4175775378106965ce32a07248675680c2c
ipv6: tcp: send consistent autoflowlabel in SYN_RECV state

This is a followup of commit c67b85558ff2 ("ipv6: tcp: send consistent
autoflowlabel in TIME_WAIT state"), but for SYN_RECV state.

In some cases, TCP sends a challenge ACK on behalf of a SYN_RECV request.
WHen this happens, we want to use the flow label that was used when
the prior SYNACK packet was sent, instead of another one.

After his patch, following packetdrill passes:

    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

  +.2 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
   +0 > (flowlabel 0x11) S. 0:0(0) ack 1 <...>
// Test if a challenge ack is properly sent (same flowlabel than prior SYNACK)
   +.01 < . 4000000000:4000000000(0) ack 1 win 320
   +0  > (flowlabel 0x11) . 1:1(0) ack 1

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20220831203729.458000-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv6/tcp_ipv6.c