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>
This commit is contained in:
David S. Miller
2011-12-28 15:06:58 -05:00
parent 32288eb4d9
commit 2c2aba6c56
7 changed files with 32 additions and 21 deletions

View File

@ -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);