1 #!/bin/bash 2 # SPDX-License-Identifier: GPL-2.0 3 # 4 # Run tests when all ephemeral ports are exhausted. 5 # 6 # Author: Kuniyuki Iwashima <kuniyu@amazon.co.jp> 7 8 set +x 9 set -e 10 11 readonly NETNS="ns-$(mktemp -u XXXXXX)" 12 13 setup() { 14 ip netns add "${NETNS}" 15 ip -netns "${NETNS}" link set lo up 16 ip netns exec "${NETNS}" \ 17 sysctl -w net.ipv4.ip_local_port_range="32768 32768" \ 18 > /dev/null 2>&1 19 ip netns exec "${NETNS}" \ 20 sysctl -w net.ipv4.ip_autobind_reuse=1 > /dev/null 2>&1 21 } 22 23 cleanup() { 24 ip netns del "${NETNS}" 25 } 26 27 trap cleanup EXIT 28 setup 29 30 do_test() { 31 ip netns exec "${NETNS}" ./reuseaddr_ports_exhausted 32 } 33 34 do_test 35 echo "tests done"
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.