Commit ae543965 authored by Jakub Sitnicki's avatar Jakub Sitnicki Committed by Jakub Kicinski

selftests/net: Cover the IP_LOCAL_PORT_RANGE socket option

Exercise IP_LOCAL_PORT_RANGE socket option in various scenarios:

1. pass invalid values to setsockopt
2. pass a range outside of the per-netns port range
3. configure a single-port range
4. exhaust a configured multi-port range
5. check interaction with late-bind (IP_BIND_ADDRESS_NO_PORT)
6. set then get the per-socket port range
Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 91d0b78c
...@@ -45,6 +45,7 @@ TEST_PROGS += arp_ndisc_untracked_subnets.sh ...@@ -45,6 +45,7 @@ TEST_PROGS += arp_ndisc_untracked_subnets.sh
TEST_PROGS += stress_reuseport_listen.sh TEST_PROGS += stress_reuseport_listen.sh
TEST_PROGS += l2_tos_ttl_inherit.sh TEST_PROGS += l2_tos_ttl_inherit.sh
TEST_PROGS += bind_bhash.sh TEST_PROGS += bind_bhash.sh
TEST_PROGS += ip_local_port_range.sh
TEST_PROGS_EXTENDED := in_netns.sh setup_loopback.sh setup_veth.sh TEST_PROGS_EXTENDED := in_netns.sh setup_loopback.sh setup_veth.sh
TEST_PROGS_EXTENDED += toeplitz_client.sh toeplitz.sh TEST_PROGS_EXTENDED += toeplitz_client.sh toeplitz.sh
TEST_GEN_FILES = socket nettest TEST_GEN_FILES = socket nettest
...@@ -76,6 +77,7 @@ TEST_PROGS += sctp_vrf.sh ...@@ -76,6 +77,7 @@ TEST_PROGS += sctp_vrf.sh
TEST_GEN_FILES += sctp_hello TEST_GEN_FILES += sctp_hello
TEST_GEN_FILES += csum TEST_GEN_FILES += csum
TEST_GEN_FILES += nat6to4.o TEST_GEN_FILES += nat6to4.o
TEST_GEN_FILES += ip_local_port_range
TEST_FILES := settings TEST_FILES := settings
......
This diff is collapsed.
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
./in_netns.sh \
sh -c 'sysctl -q -w net.ipv4.ip_local_port_range="40000 49999" && ./ip_local_port_range'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment