All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Schillstrom <hans.schillstrom@ericsson.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jan Engelhardt <jengelh@inai.de>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	"kaber@trash.net" <kaber@trash.net>,
	"jengelh@medozas.de" <jengelh@medozas.de>,
	"netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"dan.carpenter@oracle.com" <dan.carpenter@oracle.com>,
	"hans@schillstrom.com" <hans@schillstrom.com>
Subject: Re: [PATCH] netfilter: xt_HMARK: endian bugs
Date: Mon, 14 May 2012 19:51:34 +0200	[thread overview]
Message-ID: <201205141951.36692.hans.schillstrom@ericsson.com> (raw)
In-Reply-To: <1337012674.8512.589.camel@edumazet-glaptop>

On Monday 14 May 2012 18:24:34 Eric Dumazet wrote:
> On Mon, 2012-05-14 at 18:09 +0200, Hans Schillstrom wrote:
> 
> > This context can contain both le & be machines,
> > so at least in hmark it make sense
> 
> Before jhash() and its shuffle ? What do you mean ?

I want that a Big endian machine should produce the same
hash value independent of flow direction as a Little endian.

OK, I missed ntohl() before calling jhash_3words()

Correct me if I'm wrong here (have no big endian machine available for test)
jhash_3words() and __jhash_final() seems to be "endian" safe.

So by doing the expensive ntohl on addresses and ports into jhash_3words()
it will produce the same value on both be and le.

That's why I want to have the ntohs() / ntohl() when comparing.

> 
> Please respin your patch using (__force u16/u32) instead of
> useless/expensive ntohs() / ntohl() (in _this_ context of hashing)
> 
> If you compare two 32bits values, of course they must have same
> ordering, but seeding jhash() is another matter.
> 
> (Granted all calls use the same ordering of course)
> 
> sparse is great tool, but if you add useless ntohl() calls to make
> sparse silent, then its probably better to not use sparse.
> 

  reply	other threads:[~2012-05-14 17:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14 13:42 [PATCH] netfilter: xt_HMARK: endian bugs Hans Schillstrom
2012-05-14 14:40 ` Pablo Neira Ayuso
2012-05-14 15:05   ` Hans Schillstrom
2012-05-14 15:05   ` Jan Engelhardt
2012-05-14 15:24     ` Eric Dumazet
2012-05-14 16:09       ` Hans Schillstrom
2012-05-14 16:24         ` Eric Dumazet
2012-05-14 17:51           ` Hans Schillstrom [this message]
2012-05-14 18:24             ` Jan Engelhardt
2012-05-14 18:28             ` Eric Dumazet
2012-05-14 18:35             ` Jozsef Kadlecsik
2012-05-14 19:02               ` Pablo Neira Ayuso
2012-05-14 19:13                 ` Eric Dumazet
2012-05-15  5:57                   ` Hans Schillström
2012-05-15  7:33       ` Hans Schillström

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=201205141951.36692.hans.schillstrom@ericsson.com \
    --to=hans.schillstrom@ericsson.com \
    --cc=dan.carpenter@oracle.com \
    --cc=eric.dumazet@gmail.com \
    --cc=hans@schillstrom.com \
    --cc=jengelh@inai.de \
    --cc=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.