Skip to content

Commit

Permalink
bpf: Add SO_RCVBUF/SO_SNDBUF in _bpf_getsockopt().
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Kuniyuki Iwashima authored and Alexei Starovoitov committed Jan 5, 2022
1 parent 04c350b commit 2847993
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/core/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2847993

Please sign in to comment.