From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Tom Herbert <therbert@google.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, jesse.brandeburg@intel.com
Subject: Re: [PATCH 2/2] net: Use Toeplitz for IPv4 and IPv6 connection hashing
Date: Tue, 24 Sep 2013 01:17:52 +0200 [thread overview]
Message-ID: <20130923231752.GA2593@order.stressinduktion.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1309231543330.23714@tomh.mtv.corp.google.com>
On Mon, Sep 23, 2013 at 03:44:51PM -0700, Tom Herbert wrote:
> diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
> index f52fa88..492a45b 100644
> --- a/include/net/inet6_hashtables.h
> +++ b/include/net/inet6_hashtables.h
> @@ -32,12 +32,28 @@ static inline unsigned int inet6_ehashfn(struct net *net,
> const struct in6_addr *laddr, const u16 lport,
> const struct in6_addr *faddr, const __be16 fport)
> {
> +#if IS_ENABLED(CONFIG_IP_HASH_TOEPLITZ)
> + struct {
> + struct in6_addr saddr;
> + struct in6_addr daddr;
> + u16 sport;
> + u16 dport;
> + } input;
> +
> + input.daddr = *laddr;
> + input.saddr = *faddr;
> + input.sport = htons(lport);
> + input.dport = fport;
> +
> + return toeplitz_hash((u8 *)&input, toeplitz_net, sizeof(input));
> +#else
> u32 ports = (((u32)lport) << 16) | (__force u32)fport;
>
> return jhash_3words((__force u32)laddr->s6_addr32[3],
> ipv6_addr_jhash(faddr),
> ports,
> inet_ehash_secret + net_hash_mix(net));
> +#endif
You seem to discard the secret inputs. This should make the hashing
considerable more insecure.
I always believed the reason for choosing linear feedback shift register
based hash functions was because of the parallelism a pure hardware
based implementation could exploit. This does not matter for the kernel.
IMHO jhash should be considered more secure just because of its wider usage.
;)
Greetings,
Hannes
prev parent reply other threads:[~2013-09-23 23:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-23 22:44 [PATCH 2/2] net: Use Toeplitz for IPv4 and IPv6 connection hashing Tom Herbert
2013-09-23 23:11 ` Stephen Hemminger
2013-09-23 23:26 ` Tom Herbert
2013-09-23 23:17 ` Hannes Frederic Sowa [this message]
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=20130923231752.GA2593@order.stressinduktion.org \
--to=hannes@stressinduktion.org \
--cc=davem@davemloft.net \
--cc=jesse.brandeburg@intel.com \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.com \
/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