summaryrefslogtreecommitdiffstats
path: root/include/net/ndisc.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-12-28 15:06:58 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-28 15:06:58 -0500
commit2c2aba6c561ac425602f4a0be61422224cb87151 (patch)
tree30b5f2c40b823ca61e2e0930d5e98a89a83222bb /include/net/ndisc.h
parent32288eb4d940b10e40c6d4178fe3a40d1437d2f8 (diff)
downloadlinux-2c2aba6c561ac425602f4a0be61422224cb87151.tar.gz
linux-2c2aba6c561ac425602f4a0be61422224cb87151.tar.bz2
linux-2c2aba6c561ac425602f4a0be61422224cb87151.zip
ipv6: Use universal hash for NDISC.
In order to perform a proper universal hash on a vector of integers, we have to use different universal hashes on each vector element. Which means we need 4 different hash randoms for ipv6. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ndisc.h')
-rw-r--r--include/net/ndisc.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index c977c377c015..e9c30023b784 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -79,6 +79,15 @@ struct nd_opt_hdr {
__u8 nd_opt_len;
} __packed;
+static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd)
+{
+ const u32 *p32 = pkey;
+
+ return (((p32[0] ^ dev->ifindex) * hash_rnd[0]) +
+ (p32[1] * hash_rnd[1]) +
+ (p32[2] * hash_rnd[2]) +
+ (p32[3] * hash_rnd[3]));
+}
extern int ndisc_init(void);