diff options
-rw-r--r-- | include/net/arp.h | 7 | ||||
-rw-r--r-- | net/core/neighbour.c | 1 | ||||
-rw-r--r-- | net/ipv4/arp.c | 3 |
3 files changed, 9 insertions, 2 deletions
diff --git a/include/net/arp.h b/include/net/arp.h index 91f0568a04ef..723bde501c64 100644 --- a/include/net/arp.h +++ b/include/net/arp.h | |||
@@ -8,6 +8,13 @@ | |||
8 | 8 | ||
9 | extern struct neigh_table arp_tbl; | 9 | extern struct neigh_table arp_tbl; |
10 | 10 | ||
11 | static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd) | ||
12 | { | ||
13 | u32 val = key ^ dev->ifindex; | ||
14 | |||
15 | return val * hash_rnd; | ||
16 | } | ||
17 | |||
11 | extern void arp_init(void); | 18 | extern void arp_init(void); |
12 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); | 19 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); |
13 | extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); | 20 | extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); |
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) | |||
334 | ret->hash_buckets = buckets; | 334 | ret->hash_buckets = buckets; |
335 | ret->hash_shift = shift; | 335 | ret->hash_shift = shift; |
336 | get_random_bytes(&ret->hash_rnd, sizeof(ret->hash_rnd)); | 336 | get_random_bytes(&ret->hash_rnd, sizeof(ret->hash_rnd)); |
337 | ret->hash_rnd |= 1; | ||
337 | return ret; | 338 | return ret; |
338 | } | 339 | } |
339 | 340 | ||
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 @@ | |||
97 | #include <linux/init.h> | 97 | #include <linux/init.h> |
98 | #include <linux/net.h> | 98 | #include <linux/net.h> |
99 | #include <linux/rcupdate.h> | 99 | #include <linux/rcupdate.h> |
100 | #include <linux/jhash.h> | ||
101 | #include <linux/slab.h> | 100 | #include <linux/slab.h> |
102 | #ifdef CONFIG_SYSCTL | 101 | #ifdef CONFIG_SYSCTL |
103 | #include <linux/sysctl.h> | 102 | #include <linux/sysctl.h> |
@@ -232,7 +231,7 @@ static u32 arp_hash(const void *pkey, | |||
232 | const struct net_device *dev, | 231 | const struct net_device *dev, |
233 | __u32 hash_rnd) | 232 | __u32 hash_rnd) |
234 | { | 233 | { |
235 | return jhash_2words(*(u32 *)pkey, dev->ifindex, hash_rnd); | 234 | return arp_hashfn(*(u32 *)pkey, dev, hash_rnd); |
236 | } | 235 | } |
237 | 236 | ||
238 | static int arp_constructor(struct neighbour *neigh) | 237 | static int arp_constructor(struct neighbour *neigh) |