diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 6ad5dd316748..85481d43be69 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -417,7 +417,7 @@ static struct sock *udp4_lib_lookup2(struct net *net, struct udp_hslot *hslot2, struct sk_buff *skb) { - struct sock *sk, *result, *reuseport_result; + struct sock *sk, *result; int score, badness; u32 hash = 0; @@ -427,20 +427,17 @@ static struct sock *udp4_lib_lookup2(struct net *net, score = compute_score(sk, net, saddr, sport, daddr, hnum, dif, sdif); if (score > badness) { - reuseport_result = NULL; - if (sk->sk_reuseport && sk->sk_state != TCP_ESTABLISHED) { hash = udp_ehashfn(net, daddr, hnum, saddr, sport); - reuseport_result = reuseport_select_sock(sk, hash, skb, - sizeof(struct udphdr)); - if (reuseport_result && !reuseport_has_conns(sk, false)) - return reuseport_result; + result = reuseport_select_sock(sk, hash, skb, + sizeof(struct udphdr)); + if (result && !reuseport_has_conns(sk, false)) + return result; } - - result = reuseport_result ? : sk; badness = score; + result = sk; } } return result; diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index fec0060319f6..bf9153beec8e 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -162,7 +162,7 @@ static struct sock *udp6_lib_lookup2(struct net *net, int dif, int sdif, struct udp_hslot *hslot2, struct sk_buff *skb) { - struct sock *sk, *result, *reuseport_result; + struct sock *sk, *result; int score, badness; u32 hash = 0; @@ -172,20 +172,17 @@ static struct sock *udp6_lib_lookup2(struct net *net, score = compute_score(sk, net, saddr, sport, daddr, hnum, dif, sdif); if (score > badness) { - reuseport_result = NULL; - if (sk->sk_reuseport && sk->sk_state != TCP_ESTABLISHED) { hash = udp6_ehashfn(net, daddr, hnum, saddr, sport); - reuseport_result = reuseport_select_sock(sk, hash, skb, - sizeof(struct udphdr)); - if (reuseport_result && !reuseport_has_conns(sk, false)) - return reuseport_result; + result = reuseport_select_sock(sk, hash, skb, + sizeof(struct udphdr)); + if (result && !reuseport_has_conns(sk, false)) + return result; } - - result = reuseport_result ? : sk; + result = sk; badness = score; } }