lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201201164357.2623610-2-prankgup@fb.com>
Date:   Tue, 1 Dec 2020 08:43:56 -0800
From:   Prankur gupta <prankgup@...com>
To:     <bpf@...r.kernel.org>
CC:     <kernel-team@...com>, <netdev@...r.kernel.org>
Subject: [PATCH bpf-next 1/2] bpf: Adds support for setting window clamp

Adds a new bpf_setsockopt for TCP sockets, TCP_BPF_WINDOW_CLAMP,
which sets the maximum receiver window size. It will be useful for
limiting receiver window based on RTT.

Signed-off-by: Prankur gupta <prankgup@...com>
---
 net/core/filter.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/net/core/filter.c b/net/core/filter.c
index 2ca5eecebacf..8c52ffae7b0c 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4910,6 +4910,19 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname,
 				tp->notsent_lowat = val;
 				sk->sk_write_space(sk);
 				break;
+			case TCP_WINDOW_CLAMP:
+				if (!val) {
+					if (sk->sk_state != TCP_CLOSE) {
+						ret = -EINVAL;
+						break;
+					}
+					tp->window_clamp = 0;
+				} else {
+					tp->window_clamp =
+						val < SOCK_MIN_RCVBUF / 2 ?
+						SOCK_MIN_RCVBUF / 2 : val;
+				}
+				break;
 			default:
 				ret = -EINVAL;
 			}
-- 
2.24.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ