net: remove duplicate reuseport_lookup functions
[platform/kernel/linux-starfive.git] / net / ipv6 / inet6_hashtables.c
index b7c5686..3616225 100644 (file)
@@ -39,6 +39,7 @@ u32 inet6_ehashfn(const struct net *net,
        return __inet6_ehashfn(lhash, lport, fhash, fport,
                               inet6_ehash_secret + net_hash_mix(net));
 }
+EXPORT_SYMBOL_GPL(inet6_ehashfn);
 
 /*
  * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
@@ -111,18 +112,22 @@ static inline int compute_score(struct sock *sk, struct net *net,
        return score;
 }
 
+INDIRECT_CALLABLE_DECLARE(inet6_ehashfn_t udp6_ehashfn);
+
 struct sock *inet6_lookup_reuseport(struct net *net, struct sock *sk,
                                    struct sk_buff *skb, int doff,
                                    const struct in6_addr *saddr,
                                    __be16 sport,
                                    const struct in6_addr *daddr,
-                                   unsigned short hnum)
+                                   unsigned short hnum,
+                                   inet6_ehashfn_t *ehashfn)
 {
        struct sock *reuse_sk = NULL;
        u32 phash;
 
        if (sk->sk_reuseport) {
-               phash = inet6_ehashfn(net, daddr, hnum, saddr, sport);
+               phash = INDIRECT_CALL_INET(ehashfn, udp6_ehashfn, inet6_ehashfn,
+                                          net, daddr, hnum, saddr, sport);
                reuse_sk = reuseport_select_sock(sk, phash, skb, doff);
        }
        return reuse_sk;
@@ -145,7 +150,7 @@ static struct sock *inet6_lhash2_lookup(struct net *net,
                score = compute_score(sk, net, hnum, daddr, dif, sdif);
                if (score > hiscore) {
                        result = inet6_lookup_reuseport(net, sk, skb, doff,
-                                                       saddr, sport, daddr, hnum);
+                                                       saddr, sport, daddr, hnum, inet6_ehashfn);
                        if (result)
                                return result;
 
@@ -176,7 +181,8 @@ static inline struct sock *inet6_lookup_run_bpf(struct net *net,
        if (no_reuseport || IS_ERR_OR_NULL(sk))
                return sk;
 
-       reuse_sk = inet6_lookup_reuseport(net, sk, skb, doff, saddr, sport, daddr, hnum);
+       reuse_sk = inet6_lookup_reuseport(net, sk, skb, doff,
+                                         saddr, sport, daddr, hnum, inet6_ehashfn);
        if (reuse_sk)
                sk = reuse_sk;
        return sk;