Fix xfrm hash collisions by changing __xfrm4_daddr_saddr_hash to hash addresses with...
authorJussi Mäki <joamaki@gmail.com>
Thu, 6 Aug 2009 21:38:14 +0000 (21:38 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Aug 2009 04:45:31 +0000 (21:45 -0700)
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>
net/xfrm/xfrm_hash.h

index d401dc8f05ed4b16ddde802bf3d2190d72cd2cf3..e5195c99f71e267e70cb62b3689f7e6f02a809dd 100644 (file)
@@ -16,7 +16,7 @@ static inline unsigned int __xfrm6_addr_hash(xfrm_address_t *addr)
 
 static inline unsigned int __xfrm4_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr)
 {
-       return ntohl(daddr->a4 ^ saddr->a4);
+       return ntohl(daddr->a4 + saddr->a4);
 }
 
 static inline unsigned int __xfrm6_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr)