[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220427201938.GC4326@1wt.eu>
Date: Wed, 27 Apr 2022 22:19:39 +0200
From: Willy Tarreau <w@....eu>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: netdev@...r.kernel.org, David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Moshe Kol <moshe.kol@...l.huji.ac.il>,
Yossi Gilad <yossi.gilad@...l.huji.ac.il>,
Amit Klein <aksecurity@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net 1/7] secure_seq: return the full 64-bit of the siphash
Hi Jason,
On Wed, Apr 27, 2022 at 07:18:48PM +0200, Jason A. Donenfeld wrote:
> Hi Willy,
>
> On Wed, Apr 27, 2022 at 08:52:27AM +0200, Willy Tarreau wrote:
> > diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h
> > index d7d2495f83c2..5cea9ed9c773 100644
> > --- a/include/net/secure_seq.h
> > +++ b/include/net/secure_seq.h
> > @@ -4,7 +4,7 @@
> >
> > #include <linux/types.h>
> >
> > -u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
> > +u64 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
> > u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
> > __be16 dport);
> > u32 secure_tcp_seq(__be32 saddr, __be32 daddr,
> > diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c
> > index 9b8443774449..2cdd43a63f64 100644
> > --- a/net/core/secure_seq.c
> > +++ b/net/core/secure_seq.c
> > @@ -142,7 +142,7 @@ u32 secure_tcp_seq(__be32 saddr, __be32 daddr,
> > }
> > EXPORT_SYMBOL_GPL(secure_tcp_seq);
> >
> > -u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport)
> > +u64 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport)
> > {
> > net_secret_init();
> > return siphash_3u32((__force u32)saddr, (__force u32)daddr,
>
> Should you be doing the same with secure_ipv6_port_ephemeral() too? Why
> the asymmetry?
I remember not finding it in the similar code path, but maybe I missed
something. It's used by inet6_sk_port_offset() which also returns a u32,
itself used by inet6_hash_connect() and passed to __inet_hash_connect().
Hmmm the loop is now closed, I don't know how I missed it. So yes I
agree that it would definitely be needed. I'll update the patch, many
thanks!
Willy
Powered by blists - more mailing lists