tcp: Change SYN ACK retransmit behaviour to account for rehash

Disabling rehash behavior did not affect SYN ACK retransmits because hash
was forcefully changed bypassing the sk_rethink_hash function. This patch
adds a condition which checks for rehash mode before resetting hash.

Signed-off-by: Akhmat Karakotov <hmukos@yandex-team.ru>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Akhmat Karakotov 2022-01-31 16:31:25 +03:00 committed by David S. Miller
parent e7b9bfd184
commit cb6cd2cec7
2 changed files with 5 additions and 2 deletions

View File

@ -1452,7 +1452,8 @@ set_sndbuf:
ret = -EINVAL;
break;
}
sk->sk_txrehash = (u8)val;
/* Paired with READ_ONCE() in tcp_rtx_synack() */
WRITE_ONCE(sk->sk_txrehash, (u8)val);
break;
default:

View File

@ -4092,6 +4092,8 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req)
struct flowi fl;
int res;
/* Paired with WRITE_ONCE() in sock_setsockopt() */
if (READ_ONCE(sk->sk_txrehash) == SOCK_TXREHASH_ENABLED)
tcp_rsk(req)->txhash = net_tx_rndhash();
res = af_ops->send_synack(sk, NULL, &fl, req, NULL, TCP_SYNACK_NORMAL,
NULL);