Commit b79a79471bd31d737c939a6ddc347417047b4320

Authored by Jussi Mäki
Committed by David S. Miller
1 parent 082ba88a5e

Fix xfrm hash collisions by changing __xfrm4_daddr_saddr_hash to hash addresses with addition

This patch fixes hash collisions in cases where number
of entries have incrementing IP source and destination addresses
from single respective subnets (i.e. 192.168.0.1-172.16.0.1,
192.168.0.2-172.16.0.2, and so on.).

Signed-off-by: Jussi Maki <joamaki@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

net/xfrm/xfrm_hash.h
... ... @@ -16,7 +16,7 @@
16 16  
17 17 static inline unsigned int __xfrm4_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr)
18 18 {
19   - return ntohl(daddr->a4 ^ saddr->a4);
  19 + return ntohl(daddr->a4 + saddr->a4);
20 20 }
21 21  
22 22 static inline unsigned int __xfrm6_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr)