Netdev List
 help / color / mirror / Atom feed
From: Jussi Maki <jmaki@sisapiiri.net.net>
To: Jussi Maki <joamaki@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH] xfrm: xfrm hash to use Jenkins' hash
Date: Thu, 6 Aug 2009 11:58:55 +0300 (EEST)	[thread overview]
Message-ID: <alpine.DEB.1.10.0908061147060.3426@sisapiiri.net.net> (raw)
In-Reply-To: <ce10d01f0908052332o1db16460k58ed47849670c6de@mail.gmail.com>


Hi,

Did some testing and one possible fix to this problem
would be to change the xor to addition. Would this be OK?

---
 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

On Thu, 6 Aug 2009, Jussi Maki wrote:

> Hi David,
> 
> Changing the (h >> 16) to ((h >> 16) ^ (h >> 24)) still has the same
> problem as given in the example,
> that is if you have a set of transports with incrementing addresses
> (192.168.0.1-172.16.0.1, 192.168.0.2-172.16.0.2,..) they
> still hash to the same value. The reason to this is that it's doing
> src^dst in __xfrm4_daddr_saddr_hash.
> 
> Should I pursue with fixing the inlining issue in my patch or would
> you have any suggestions how I could
> fix this by perhaps modifying __xfrm4_daddr_saddr_hash?

  reply	other threads:[~2009-08-06  9:08 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 [this message]
2009-08-06 17:40       ` David Miller
2009-08-07  7:38         ` [PATCH] Fix xfrm hash collisions by changing __xfrm4_daddr_saddr_hash to hash addresses with addition Jussi Maki
2009-08-10  4:52           ` 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.0908061147060.3426@sisapiiri.net.net \
    --to=jmaki@sisapiiri.net.net \
    --cc=davem@davemloft.net \
    --cc=joamaki@gmail.com \
    --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