From: Simon Horman <horms@kernel.org>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Joanne Koong <joannelkoong@gmail.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH v1 net] selftest: net: Fix weird setsockopt() in bind_bhash.c.
Date: Thu, 4 Sep 2025 10:25:16 +0100 [thread overview]
Message-ID: <20250904092516.GD372207@horms.kernel.org> (raw)
In-Reply-To: <20250903222938.2601522-1-kuniyu@google.com>
On Wed, Sep 03, 2025 at 10:28:51PM +0000, Kuniyuki Iwashima wrote:
> bind_bhash.c passes (SO_REUSEADDR | SO_REUSEPORT) to setsockopt().
>
> In the asm-generic definition, the value happens to match with the
> bare SO_REUSEPORT, (2 | 15) == 15, but not on some arch.
>
> arch/alpha/include/uapi/asm/socket.h:18:#define SO_REUSEADDR 0x0004
> arch/alpha/include/uapi/asm/socket.h:24:#define SO_REUSEPORT 0x0200
> arch/mips/include/uapi/asm/socket.h:24:#define SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */
> arch/mips/include/uapi/asm/socket.h:33:#define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
> arch/parisc/include/uapi/asm/socket.h:12:#define SO_REUSEADDR 0x0004
> arch/parisc/include/uapi/asm/socket.h:18:#define SO_REUSEPORT 0x0200
> arch/sparc/include/uapi/asm/socket.h:13:#define SO_REUSEADDR 0x0004
> arch/sparc/include/uapi/asm/socket.h:20:#define SO_REUSEPORT 0x0200
> include/uapi/asm-generic/socket.h:12:#define SO_REUSEADDR 2
> include/uapi/asm-generic/socket.h:27:#define SO_REUSEPORT 15
>
> Let's pass SO_REUSEPORT only.
>
> Fixes: c35ecb95c448 ("selftests/net: Add test for timing a bind request to a port with a populated bhash entry")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2025-09-04 9:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 22:28 [PATCH v1 net] selftest: net: Fix weird setsockopt() in bind_bhash.c Kuniyuki Iwashima
2025-09-04 9:25 ` Simon Horman [this message]
2025-09-04 14:40 ` patchwork-bot+netdevbpf
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=20250904092516.GD372207@horms.kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joannelkoong@gmail.com \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).