Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
[firefly-linux-kernel-4.4.55.git] / include / net / inet6_hashtables.h
index 7ca75cbbf75e2071ed068276c8f69f1a11990b2a..fd4ee016ba5cd5e4dc87b08cf06aef17a6b9cc27 100644 (file)
 
 struct inet_hashinfo;
 
-/* I have no idea if this is a good hash for v6 or not. -DaveM */
 static inline unsigned int inet6_ehashfn(struct net *net,
                                const struct in6_addr *laddr, const u16 lport,
                                const struct in6_addr *faddr, const __be16 fport)
 {
-       u32 ports = (lport ^ (__force u16)fport);
+       u32 ports = (((u32)lport) << 16) | (__force u32)fport;
 
        return jhash_3words((__force u32)laddr->s6_addr32[3],
-                           (__force u32)faddr->s6_addr32[3],
-                           ports, inet_ehash_secret + net_hash_mix(net));
+                           ipv6_addr_jhash(faddr),
+                           ports,
+                           inet_ehash_secret + net_hash_mix(net));
 }
 
 static inline int inet6_sk_ehashfn(const struct sock *sk)