summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-07-11 10:37:28 +0200
committerDavid S. Miller <davem@davemloft.net>2011-07-11 10:37:28 +0200
commitf610b74b14d74a069f61583131e689550fd5bab3 (patch)
tree331ce90858ed17ed32b27ff9b283ced43566ea28 /net
parentneigh: Store hash shift instead of mask. (diff)
downloadlinux-f610b74b14d74a069f61583131e689550fd5bab3.tar.xz
linux-f610b74b14d74a069f61583131e689550fd5bab3.zip
ipv4: Use universal hash for ARP.
We need to make sure the multiplier is odd. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/neighbour.c1
-rw-r--r--net/ipv4/arp.c3
2 files changed, 2 insertions, 2 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 4d5fc9433fd9..50bd960983e0 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -334,6 +334,7 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift)
ret->hash_buckets = buckets;
ret->hash_shift = shift;
get_random_bytes(&ret->hash_rnd, sizeof(ret->hash_rnd));
+ ret->hash_rnd |= 1;
return ret;
}
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 1b74d3b64371..4412b57f6ff6 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -97,7 +97,6 @@
#include <linux/init.h>
#include <linux/net.h>
#include <linux/rcupdate.h>
-#include <linux/jhash.h>
#include <linux/slab.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
@@ -232,7 +231,7 @@ static u32 arp_hash(const void *pkey,
const struct net_device *dev,
__u32 hash_rnd)
{
- return jhash_2words(*(u32 *)pkey, dev->ifindex, hash_rnd);
+ return arp_hashfn(*(u32 *)pkey, dev, hash_rnd);
}
static int arp_constructor(struct neighbour *neigh)