git: 81b076e43aa6 - main - fibs tests: Fix test failures and simplify
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 21 Jan 2025 21:50:04 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=81b076e43aa63ac255996093233ab3560a23977e commit 81b076e43aa63ac255996093233ab3560a23977e Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-01-21 21:44:25 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-01-21 21:44:25 +0000 fibs tests: Fix test failures and simplify The tests previously expected the invoker to pass a list of FIBs to use. However, they now run in separate VNET jails, so we can simply expand the FIB array as needed in each test. Modify each test to simply set net.fibs as needed and grab FIB numbers starting at 1. A number of tests were also broken by commit 9206c7996198 ("usr.bin/netstat: -n should not print symbolic names"), so fix those. Reviewed by: asomers Fixes: 9206c7996198 ("usr.bin/netstat: -n should not print symbolic names") MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D48585 --- tests/sys/netinet/fibs_test.sh | 43 ++++++++++++------------------------------ 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/tests/sys/netinet/fibs_test.sh b/tests/sys/netinet/fibs_test.sh index 5c1a918abb2c..a57d999496fc 100644 --- a/tests/sys/netinet/fibs_test.sh +++ b/tests/sys/netinet/fibs_test.sh @@ -30,9 +30,6 @@ # Authors: Alan Somers (Spectra Logic Corporation) # -# All of the tests in this file requires the test-suite config variable "fibs" -# to be defined to a space-delimited list of FIBs that may be used for testing. - # arpresolve should check the interface fib for routes to a target when # creating an ARP table entry. This is a regression for kern/167947, where # arpresolve only checked the default route. @@ -48,7 +45,6 @@ arpresolve_checks_interface_fib_head() { atf_set "descr" "arpresolve should check the interface fib, not the default fib, for routes" atf_set "require.user" "root" - atf_set "require.config" "fibs" atf_set "require.progs" "nping" } arpresolve_checks_interface_fib_body() @@ -100,7 +96,6 @@ loopback_and_network_routes_on_nondefault_fib_head() { atf_set "descr" "When creating and deleting loopback IPv4 routes, use the interface's fib" atf_set "require.user" "root" - atf_set "require.config" "fibs" } loopback_and_network_routes_on_nondefault_fib_body() @@ -157,7 +152,6 @@ loopback_and_network_routes_on_nondefault_fib_inet6_head() { atf_set "descr" "When creating and deleting loopback IPv6 routes, use the interface's fib" atf_set "require.user" "root" - atf_set "require.config" "fibs" } loopback_and_network_routes_on_nondefault_fib_inet6_body() @@ -216,7 +210,6 @@ default_route_with_multiple_fibs_on_same_subnet_head() { atf_set "descr" "Multiple interfaces on the same subnet but with different fibs can both have default IPv4 routes" atf_set "require.user" "root" - atf_set "require.config" "fibs" } default_route_with_multiple_fibs_on_same_subnet_body() @@ -247,9 +240,9 @@ default_route_with_multiple_fibs_on_same_subnet_body() # Verify that the default route exists for both fibs, with their # respective interfaces. - atf_check -o match:"^default.*${TAP0}$" \ + atf_check -o match:"^0\.0\.0\.0.*${TAP0}$" \ setfib ${FIB0} netstat -rn -f inet - atf_check -o match:"^default.*${TAP1}$" \ + atf_check -o match:"^0\.0\.0\.0.*${TAP1}$" \ setfib ${FIB1} netstat -rn -f inet } @@ -263,7 +256,6 @@ default_route_with_multiple_fibs_on_same_subnet_inet6_head() { atf_set "descr" "Multiple interfaces on the same subnet but with different fibs can both have default IPv6 routes" atf_set "require.user" "root" - atf_set "require.config" "fibs" } default_route_with_multiple_fibs_on_same_subnet_inet6_body() @@ -294,9 +286,9 @@ default_route_with_multiple_fibs_on_same_subnet_inet6_body() # Verify that the default route exists for both fibs, with their # respective interfaces. - atf_check -o match:"^default.*${TAP0}$" \ + atf_check -o match:"^::/0.*${TAP0}$" \ setfib ${FIB0} netstat -rn -f inet6 - atf_check -o match:"^default.*${TAP1}$" \ + atf_check -o match:"^::/0.*${TAP1}$" \ setfib ${FIB1} netstat -rn -f inet6 } @@ -315,7 +307,6 @@ same_ip_multiple_ifaces_fib0_head() { atf_set "descr" "Can remove an IPv4 alias from an interface when the same IPv4 is also assigned to another interface." atf_set "require.user" "root" - atf_set "require.config" "fibs" } same_ip_multiple_ifaces_fib0_body() { @@ -358,7 +349,6 @@ same_ip_multiple_ifaces_head() { atf_set "descr" "Can remove an IPv4 alias from an interface when the same address is also assigned to another interface, on non-default FIBs." atf_set "require.user" "root" - atf_set "require.config" "fibs" } same_ip_multiple_ifaces_body() { @@ -404,7 +394,6 @@ same_ip_multiple_ifaces_inet6_head() { atf_set "descr" "Can remove an IPv6 alias from an interface when the same address is also assigned to another interface, on non-default FIBs." atf_set "require.user" "root" - atf_set "require.config" "fibs" } same_ip_multiple_ifaces_inet6_body() { @@ -446,7 +435,7 @@ slaac_on_nondefault_fib6_head() { atf_set "descr" "SLAAC correctly installs routes on non-default FIBs" atf_set "require.user" "root" - atf_set "require.config" "fibs" "allow_sysctl_side_effects" + atf_set "require.config" "allow_sysctl_side_effects" } slaac_on_nondefault_fib6_body() { @@ -490,7 +479,7 @@ slaac_on_nondefault_fib6_body() atf_check -o match:"${SUBNET}:/${MASK}.*\<U\>.*$EPAIRB" \ netstat -rnf inet6 -F $FIB1 # Check default route - atf_check -o match:"default.*\<UG\>.*$EPAIRB" \ + atf_check -o match:"^::/0.*\<UG\>.*$EPAIRB" \ netstat -rnf inet6 -F $FIB1 # Check that none of the above routes appeared on other routes @@ -533,7 +522,6 @@ subnet_route_with_multiple_fibs_on_same_subnet_head() { atf_set "descr" "Multiple FIBs can have IPv4 subnet routes for the same subnet" atf_set "require.user" "root" - atf_set "require.config" "fibs" } subnet_route_with_multiple_fibs_on_same_subnet_body() @@ -570,7 +558,6 @@ subnet_route_with_multiple_fibs_on_same_subnet_inet6_head() { atf_set "descr" "Multiple FIBs can have IPv6 subnet routes for the same subnet" atf_set "require.user" "root" - atf_set "require.config" "fibs" } subnet_route_with_multiple_fibs_on_same_subnet_inet6_body() @@ -620,7 +607,6 @@ udp_dontroute_head() { atf_set "descr" "Source address selection for UDP packets with SO_DONTROUTE on non-default FIBs works" atf_set "require.user" "root" - atf_set "require.config" "fibs" } udp_dontroute_body() @@ -671,7 +657,6 @@ udp_dontroute6_head() { atf_set "descr" "Source address selection for UDP IPv6 packets with SO_DONTROUTE on non-default FIBs works" atf_set "require.user" "root" - atf_set "require.config" "fibs" } udp_dontroute6_body() @@ -748,15 +733,13 @@ get_fibs() { NUMFIBS=$1 net_fibs=`sysctl -n net.fibs` + if [ $net_fibs -lt $(($NUMFIBS + 1)) ]; then + atf_check -o ignore sysctl net.fibs=$(($NUMFIBS + 1)) + net_fibs=`sysctl -n net.fibs` + fi i=0 while [ $i -lt "$NUMFIBS" ]; do - fib=`atf_config_get "fibs" | \ - awk -v i=$(( i + 1 )) '{print $i}'` - echo "fib is ${fib}" - eval FIB${i}=${fib} - if [ "$fib" -ge "$net_fibs" ]; then - atf_skip "The ${i}th configured fib is ${fib}, which is not less than net.fibs, which is ${net_fibs}" - fi + eval FIB${i}=$(($i + 1)) i=$(( $i + 1 )) done } @@ -816,9 +799,7 @@ setup_iface() local ADDR=$4 local MASK=$5 local FLAGS=$6 - echo setfib ${FIB} \ - ifconfig $IFACE ${PROTO} ${ADDR}/${MASK} fib $FIB $FLAGS - setfib ${FIB} ifconfig $IFACE ${PROTO} ${ADDR}/${MASK} fib $FIB $FLAGS + atf_check setfib ${FIB} ifconfig $IFACE ${PROTO} ${ADDR}/${MASK} fib $FIB $FLAGS } # Create a tap(4) interface, configure it, and register it for cleanup.