Netdev List
 help / color / mirror / Atom feed
From: Jussi Maki <joamaki@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH] Fix xfrm hash collisions by changing __xfrm4_daddr_saddr_hash to hash addresses with addition
Date: Fri, 7 Aug 2009 10:38:14 +0300 (EEST)	[thread overview]
Message-ID: <alpine.DEB.1.10.0908071032171.3426@sisapiiri.net.net> (raw)
In-Reply-To: <20090806.104034.186857842.davem@davemloft.net>


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>
---
 net/xfrm/xfrm_hash.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/xfrm/xfrm_hash.h b/net/xfrm/xfrm_hash.h
index d401dc8..e5195c9 100644
--- a/net/xfrm/xfrm_hash.h
+++ b/net/xfrm/xfrm_hash.h
@@ -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)
-- 
1.5.6.5


  reply	other threads:[~2009-08-07  7:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-05  7:41 [PATCH] xfrm: xfrm hash to use Jenkins' hash Jussi Mäki
2009-08-05  8:39 ` Jussi Maki
2009-08-05 19:08 ` David Miller
2009-08-06  6:32   ` Jussi Maki
2009-08-06  8:58     ` Jussi Maki
2009-08-06 17:40       ` David Miller
2009-08-07  7:38         ` Jussi Maki [this message]
2009-08-10  4:52           ` [PATCH] Fix xfrm hash collisions by changing __xfrm4_daddr_saddr_hash to hash addresses with addition David Miller
2009-08-13  2:06           ` Herbert Xu
2009-08-13  3:42             ` David Miller
2009-08-13  3:53               ` Herbert Xu
2009-08-13  3:56                 ` David Miller
2009-08-13  4:11                   ` Herbert Xu
2009-08-13  4:18                     ` David Miller
2009-08-13  4:19                   ` Herbert Xu
2009-08-06 17:40     ` [PATCH] xfrm: xfrm hash to use Jenkins' hash David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.1.10.0908071032171.3426@sisapiiri.net.net \
    --to=joamaki@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox