From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 749F8C433F5 for ; Wed, 27 Apr 2022 20:20:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235641AbiD0UXN (ORCPT ); Wed, 27 Apr 2022 16:23:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235403AbiD0UXH (ORCPT ); Wed, 27 Apr 2022 16:23:07 -0400 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8E72891557; Wed, 27 Apr 2022 13:19:51 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 23RKJdO9004481; Wed, 27 Apr 2022 22:19:39 +0200 Date: Wed, 27 Apr 2022 22:19:39 +0200 From: Willy Tarreau To: "Jason A. Donenfeld" Cc: netdev@vger.kernel.org, David Miller , Jakub Kicinski , Eric Dumazet , Moshe Kol , Yossi Gilad , Amit Klein , linux-kernel@vger.kernel.org Subject: Re: [PATCH net 1/7] secure_seq: return the full 64-bit of the siphash Message-ID: <20220427201938.GC4326@1wt.eu> References: <20220427065233.2075-1-w@1wt.eu> <20220427065233.2075-2-w@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > > -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