linux-stable/tools/testing
Kuniyuki Iwashima 539b6b94b1 selftest: net: Fix weird setsockopt() in bind_bhash.c.
[ Upstream commit fd2004d82d ]

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: c35ecb95c4 ("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>
Link: https://patch.msgid.link/20250903222938.2601522-1-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-09-09 19:02:28 +02:00
..
crypto/chacha20-s390
cxl Merge branch 'for-6.16/cxl-features-ras' into cxl-for-next 2025-05-23 13:26:24 -07:00
fault-injection
ktest ktest.pl: Prevent recursion of default variable options 2025-08-20 18:41:06 +02:00
kunit Revert "kunit: configs: Enable CONFIG_INIT_STACK_ALL_PATTERN in all_tests" 2025-06-03 11:20:21 +02:00
memblock
nvdimm
radix-tree
rbtree
scatterlist
selftests selftest: net: Fix weird setsockopt() in bind_bhash.c. 2025-09-09 19:02:28 +02:00
shared
vma mm: add mmap_prepare() compatibility layer for nested file systems 2025-06-12 21:39:02 -07:00
vsock vsock/test: Add test for an unexpectedly lingering close() 2025-05-27 11:05:22 +02:00