diff options
author | Jakub Sitnicki <jakub@cloudflare.com> | 2020-07-22 18:17:19 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-07-25 20:16:01 -0700 |
commit | c8a2983c4df06c4cd11bea6abfa7e2947bd3113b (patch) | |
tree | abeea2f58802f33b291ecca87738ab23d3e21f56 /net | |
parent | f3c93a93b564d25cab715cd71a6c3417e77b19f3 (diff) | |
download | linux-c8a2983c4df06c4cd11bea6abfa7e2947bd3113b.tar.gz linux-c8a2983c4df06c4cd11bea6abfa7e2947bd3113b.tar.bz2 linux-c8a2983c4df06c4cd11bea6abfa7e2947bd3113b.zip |
udp: Don't discard reuseport selection when group has connections
When BPF socket lookup prog selects a socket that belongs to a reuseport
group, and the reuseport group has connected sockets in it, the socket
selected by reuseport will be discarded, and socket returned by BPF socket
lookup will be used instead.
Modify this behavior so that the socket selected by reuseport running after
BPF socket lookup always gets used. Ignore the fact that the reuseport
group might have connections because it is only relevant when scoring
sockets during regular hashtable-based lookup.
Fixes: 72f7e9440e9b ("udp: Run SK_LOOKUP BPF program on socket lookup")
Fixes: 6d4201b1386b ("udp6: Run SK_LOOKUP BPF program on socket lookup")
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
Link: https://lore.kernel.org/bpf/20200722161720.940831-2-jakub@cloudflare.com
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/udp.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 5530c9dcb61c..c394e674f486 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -155,9 +155,6 @@ static struct sock *lookup_reuseport(struct net *net, struct sock *sk, hash = udp6_ehashfn(net, daddr, hnum, saddr, sport); reuse_sk = reuseport_select_sock(sk, hash, skb, sizeof(struct udphdr)); - /* Fall back to scoring if group has connections */ - if (reuseport_has_conns(sk, false)) - return NULL; } return reuse_sk; } |