diff options
author | Manu Bretelle <chantra@fb.com> | 2021-03-10 21:23:05 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2021-03-15 19:22:22 +0300 |
commit | 6503b9f29a47cdb4ebd6c36d8bbb018418415c2a (patch) | |
tree | ca183c2682d941b959261ef67f77605aa63f7df5 /net/core/filter.c | |
parent | 1211f4e9ae138614bee4e19e0637b220b94e04ad (diff) | |
download | linux-6503b9f29a47cdb4ebd6c36d8bbb018418415c2a.tar.xz |
bpf: Add getter and setter for SO_REUSEPORT through bpf_{g,s}etsockopt
Augment the current set of options that are accessible via
bpf_{g,s}etsockopt to also support SO_REUSEPORT.
Signed-off-by: Manu Bretelle <chantra@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20210310182305.1910312-1-chantra@fb.com
Diffstat (limited to 'net/core/filter.c')
-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 b6732000d8a2..10dac9dd5086 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4729,6 +4729,9 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname, sk->sk_prot->keepalive(sk, valbool); sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); break; + case SO_REUSEPORT: + sk->sk_reuseport = valbool; + break; default: ret = -EINVAL; } @@ -4898,6 +4901,9 @@ static int _bpf_getsockopt(struct sock *sk, int level, int optname, case SO_BINDTOIFINDEX: *((int *)optval) = sk->sk_bound_dev_if; break; + case SO_REUSEPORT: + *((int *)optval) = sk->sk_reuseport; + break; default: goto err_clear; } |