提交 cb6cd2ce 编写于 作者: A Akhmat Karakotov 提交者: David S. Miller

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: NAkhmat Karakotov <hmukos@yandex-team.ru>
Reviewed-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e7b9bfd1
...@@ -1452,7 +1452,8 @@ int sock_setsockopt(struct socket *sock, int level, int optname, ...@@ -1452,7 +1452,8 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
sk->sk_txrehash = (u8)val; /* Paired with READ_ONCE() in tcp_rtx_synack() */
WRITE_ONCE(sk->sk_txrehash, (u8)val);
break; break;
default: default:
......
...@@ -4092,7 +4092,9 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req) ...@@ -4092,7 +4092,9 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req)
struct flowi fl; struct flowi fl;
int res; int res;
tcp_rsk(req)->txhash = net_tx_rndhash(); /* 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, res = af_ops->send_synack(sk, NULL, &fl, req, NULL, TCP_SYNACK_NORMAL,
NULL); NULL);
if (!res) { if (!res) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册