• Antoine Tenart's avatar
    net: ipv6: fix skb hash for some RST packets · dc6456e9
    Antoine Tenart authored
    The skb hash comes from sk->sk_txhash when using TCP, except for some
    IPv6 RST packets. This is because in tcp_v6_send_reset when not in
    TIME_WAIT the hash is taken from sk->sk_hash, while it should come from
    sk->sk_txhash as those two hashes are not computed the same way.
    
    Packetdrill script to test the above,
    
       0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
      +0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
      +0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress)
    
      +0 > (flowlabel 0x1) S 0:0(0) <...>
    
      // Wrong ack seq, trigger a rst.
      +0 < S. 0:0(0) ack 0 win 4000
    
      // Check the flowlabel matches prior one from SYN.
      +0 > (flowlabel 0x1) R 0:0(0) <...>
    
    Fixes: 9258b8b1 ("ipv6: tcp: send consistent autoflowlabel in RST packets")
    Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
    Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    dc6456e9
tcp_ipv6.c 58.3 KB