summaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-28 07:12:21 +0200
committerDavid S. Miller <davem@davemloft.net>2020-05-28 20:11:45 +0200
commit557eadfcc5ee8f8fa98a795e05ed21db58a65db5 (patch)
tree395ea12521c20583d18d69a14b5978953a7fca12 /net/ipv4/tcp.c
parenttcp: add tcp_sock_set_quickack (diff)
downloadlinux-557eadfcc5ee8f8fa98a795e05ed21db58a65db5.tar.xz
linux-557eadfcc5ee8f8fa98a795e05ed21db58a65db5.zip
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>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 27b5e7a4e2ef..d2c67ae1da07 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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.
*/