summaryrefslogtreecommitdiffstats
path: root/net/ipv4/udp.c
diff options
context:
space:
mode:
authorJakub Sitnicki <jakub@cloudflare.com>2020-07-26 14:02:28 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2020-07-31 02:00:48 +0200
commitc64c9c282a9a7ec0515b725d5aaed68c32e403a4 (patch)
tree0d5f58ae0796b1877e0b04d50f25877c5fc95466 /net/ipv4/udp.c
parentlibbpf: Make destructors more robust by handling ERR_PTR(err) cases (diff)
downloadlinux-c64c9c282a9a7ec0515b725d5aaed68c32e403a4.tar.xz
linux-c64c9c282a9a7ec0515b725d5aaed68c32e403a4.zip
udp, bpf: Ignore connections in reuseport group after BPF sk lookup
When BPF sk lookup invokes reuseport handling for the selected socket, it should ignore the fact that reuseport group can contain connected UDP sockets. With BPF sk lookup this is not relevant as we are not scoring sockets to find the best match, which might be a connected UDP socket. Fix it by unconditionally accepting the socket selected by reuseport. This fixes the following two failures reported by test_progs. # ./test_progs -t sk_lookup ... #73/14 UDP IPv4 redir and reuseport with conns:FAIL ... #73/20 UDP IPv6 redir and reuseport with conns:FAIL ... Fixes: a57066b1a019 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net") Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20200726120228.1414348-1-jakub@cloudflare.com
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r--net/ipv4/udp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 7ce31beccfc2..e88efba07551 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -473,7 +473,7 @@ static struct sock *udp4_lookup_run_bpf(struct net *net,
return sk;
reuse_sk = lookup_reuseport(net, sk, skb, saddr, sport, daddr, hnum);
- if (reuse_sk && !reuseport_has_conns(sk, false))
+ if (reuse_sk)
sk = reuse_sk;
return sk;
}