Skip to content

Commit 2847993

Browse files
q2venAlexei Starovoitov
authored and
Alexei Starovoitov
committed
bpf: Add SO_RCVBUF/SO_SNDBUF in _bpf_getsockopt().
This patch exposes SO_RCVBUF/SO_SNDBUF through bpf_getsockopt(). Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 04c350b commit 2847993

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/core/filter.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4969,6 +4969,12 @@ static int _bpf_getsockopt(struct sock *sk, int level, int optname,
49694969
goto err_clear;
49704970

49714971
switch (optname) {
4972+
case SO_RCVBUF:
4973+
*((int *)optval) = sk->sk_rcvbuf;
4974+
break;
4975+
case SO_SNDBUF:
4976+
*((int *)optval) = sk->sk_sndbuf;
4977+
break;
49724978
case SO_MARK:
49734979
*((int *)optval) = sk->sk_mark;
49744980
break;

0 commit comments

Comments
 (0)