diff options
author | Kuniyuki Iwashima <kuniyu@amazon.co.jp> | 2022-01-04 04:31:49 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-01-06 01:16:07 +0300 |
commit | 28479934f26bcf9ddeb94125e05ddc5c4312b1f3 (patch) | |
tree | d5d9e09f6b40c35ce729ba796607e61ac67afd12 /net | |
parent | 04c350b1ae6bdb12b84009a4d0bf5ab4e621c47b (diff) | |
download | linux-28479934f26bcf9ddeb94125e05ddc5c4312b1f3.tar.xz |
bpf: Add SO_RCVBUF/SO_SNDBUF in _bpf_getsockopt().
This patch exposes SO_RCVBUF/SO_SNDBUF through bpf_getsockopt().
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220104013153.97906-3-kuniyu@amazon.co.jp
Diffstat (limited to 'net')
-rw-r--r-- | net/core/filter.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; |