summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorGao Feng <gfree.wind@gmail.com>2022-08-04 23:04:21 +0800
committerDavid S. Miller <davem@davemloft.net>2022-08-08 09:45:14 +0100
commitf574f7f839fc1753467b52417591cf2668825a92 (patch)
tree267ec77064f655727c6504ce6c89c9e396d8d9f4 /net/core
parent7a542bee27c6a57e45c33cbbdc963325fd6493af (diff)
net: bpf: Use the protocol's set_rcvlowat behavior if there is one
The commit d1361840f8c5 ("tcp: fix SO_RCVLOWAT and RCVBUF autotuning") add one new (struct proto_ops)->set_rcvlowat method so that a protocol can override the default setsockopt(SO_RCVLOWAT) behavior. The prior bpf codes don't check and invoke the protos's set_rcvlowat, now correct it. Signed-off-by: Gao Feng <gfree.wind@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/filter.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index 5669248aff25..e8508aaafd27 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -5063,7 +5063,10 @@ static int __bpf_setsockopt(struct sock *sk, int level, int optname,
case SO_RCVLOWAT:
if (val < 0)
val = INT_MAX;
- WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
+ if (sk->sk_socket && sk->sk_socket->ops->set_rcvlowat)
+ ret = sk->sk_socket->ops->set_rcvlowat(sk, val);
+ else
+ WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
break;
case SO_MARK:
if (sk->sk_mark != val) {