Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/net: convert stress_reuseport_listen.sh to run it in unique namespace

Here is the test result after conversion.

# ./stress_reuseport_listen.sh
listen 24000 socks took 0.47714

Acked-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Hangbin Liu and committed by
David S. Miller
098f1ce0 d3b6b111

+3 -3
+3 -3
tools/testing/selftests/net/stress_reuseport_listen.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 # Copyright (c) 2022 Meta Platforms, Inc. and affiliates. 4 4 5 - NS='stress_reuseport_listen_ns' 5 + source lib.sh 6 6 NR_FILES=24100 7 7 SAVED_NR_FILES=$(ulimit -n) 8 8 9 9 setup() { 10 - ip netns add $NS 10 + setup_ns NS 11 11 ip netns exec $NS sysctl -q -w net.ipv6.ip_nonlocal_bind=1 12 12 ulimit -n $NR_FILES 13 13 } 14 14 15 15 cleanup() { 16 - ip netns del $NS 16 + cleanup_ns $NS 17 17 ulimit -n $SAVED_NR_FILES 18 18 } 19 19