1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3# Copyright (c) 2022 Meta Platforms, Inc. and affiliates.
4
5NS='stress_reuseport_listen_ns'
6NR_FILES=24100
7SAVED_NR_FILES=$(ulimit -n)
8
9setup() {
10	ip netns add $NS
11	ip netns exec $NS sysctl -q -w net.ipv6.ip_nonlocal_bind=1
12	ulimit -n $NR_FILES
13}
14
15cleanup() {
16	ip netns del $NS
17	ulimit -n $SAVED_NR_FILES
18}
19
20trap cleanup EXIT
21setup
22# 300 different vips listen on port 443
23# Each vip:443 sockaddr has 80 LISTEN sock by using SO_REUSEPORT
24# Total 24000 listening socks
25ip netns exec $NS ./stress_reuseport_listen 300 80
26