tcp: add tcp_sock_set_syncnt

Add a helper to directly set the TCP_SYNCNT sockopt from kernel space
without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christoph Hellwig
2020-05-28 07:12:21 +02:00
committed by David S. Miller
parent ddd061b8da
commit 557eadfcc5
3 changed files with 14 additions and 8 deletions

View File

@@ -2881,6 +2881,18 @@ void tcp_sock_set_quickack(struct sock *sk, int val)
}
EXPORT_SYMBOL(tcp_sock_set_quickack);
int tcp_sock_set_syncnt(struct sock *sk, int val)
{
if (val < 1 || val > MAX_TCP_SYNCNT)
return -EINVAL;
lock_sock(sk);
inet_csk(sk)->icsk_syn_retries = val;
release_sock(sk);
return 0;
}
EXPORT_SYMBOL(tcp_sock_set_syncnt);
/*
* Socket option code for TCP.
*/