From 28479934f26bcf9ddeb94125e05ddc5c4312b1f3 Mon Sep 17 00:00:00 2001 From: Kuniyuki Iwashima Date: Tue, 4 Jan 2022 10:31:49 +0900 Subject: bpf: Add SO_RCVBUF/SO_SNDBUF in _bpf_getsockopt(). This patch exposes SO_RCVBUF/SO_SNDBUF through bpf_getsockopt(). Signed-off-by: Kuniyuki Iwashima Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220104013153.97906-3-kuniyu@amazon.co.jp --- net/core/filter.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'net') diff --git a/net/core/filter.c b/net/core/filter.c index 368fe28c8dc6..cac2be559ab0 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4969,6 +4969,12 @@ static int _bpf_getsockopt(struct sock *sk, int level, int optname, goto err_clear; switch (optname) { + case SO_RCVBUF: + *((int *)optval) = sk->sk_rcvbuf; + break; + case SO_SNDBUF: + *((int *)optval) = sk->sk_sndbuf; + break; case SO_MARK: *((int *)optval) = sk->sk_mark; break; -- cgit v1.2.3