Index: tests/sys/netinet/fibs_test.sh =================================================================== --- tests/sys/netinet/fibs_test.sh +++ tests/sys/netinet/fibs_test.sh @@ -798,6 +798,92 @@ cleanup_ifaces } +# Test that a route can be modified with "route change $SUBNET/$MASK" without +# needing to also specify the gateway of the route. +atf_test_case ipv4_change_route_without_dest cleanup +ipv4_change_route_without_dest_head() +{ + atf_set "descr" "Test modifying a route without re-specifying its gateway" + atf_set "require.user" "root" + atf_set "require.config" "fibs" +} + +ipv4_change_route_without_dest_body() +{ + # Configure the TAP interfaces to use a RFC5737 nonrouteable addresses + # and a non-default fib + SUBNET_PREFIX="192.0.2" + SUBNET="${SUBNET_PREFIX}.0" + ADDR0="${SUBNET_PREFIX}.1" + ADDR1="${SUBNET_PREFIX}.2" + + MASK="24" + + # Check system configuration + if [ 0 != `sysctl -n net.add_addr_allfibs` ]; then + atf_skip "This test requires net.add_addr_allfibs=0" + fi + get_fibs 1 + + setup_tap "$FIB0" inet ${ADDR0} $MASK + ifconfig $TAP mtu 9000 + + atf_check -s exit:0 -o ignore setfib $FIB0 route change \ + ${SUBNET}/${MASK} -mtu 8723 + + # Just searching for "8723" is awful, but the output of 'route get' is + # not amenable to parsing + atf_check -o match:8723 setfib $FIB0 route get $ADDR1 +} + +ipv4_change_route_without_dest_cleanup() +{ + cleanup_ifaces +} + +# Test that a route can be modified with "route change $SUBNET/$MASK" without +# needing to also specify the gateway of the route. +atf_test_case ipv6_change_route_without_dest cleanup +ipv6_change_route_without_dest_head() +{ + atf_set "descr" "Test modifying a route without re-specifying its gateway" + atf_set "require.user" "root" + atf_set "require.config" "fibs" +} + +ipv6_change_route_without_dest_body() +{ + # Configure the TAP interfaces to use a RFC5737 nonrouteable addresses + # and a non-default fib + SUBNET_PREFIX="2001:db8:" + SUBNET="${SUBNET_PREFIX}:0" + ADDR0="${SUBNET_PREFIX}:1" + ADDR1="${SUBNET_PREFIX}:2" + + MASK="64" + + # Check system configuration + if [ 0 != `sysctl -n net.add_addr_allfibs` ]; then + atf_skip "This test requires net.add_addr_allfibs=0" + fi + get_fibs 1 + + setup_tap "$FIB0" inet6 ${ADDR0} $MASK + ifconfig $TAP mtu 9000 + + atf_check -s exit:0 -o ignore setfib $FIB0 route -6 change \ + ${SUBNET}/${MASK} -mtu 8723 + + # Just searching for "8723" is awful, but the output of 'route get' is + # not amenable to parsing + atf_check -o match:8723 setfib $FIB0 route -6 get $ADDR1 +} + +ipv6_change_route_without_dest_cleanup() +{ + cleanup_ifaces +} + atf_init_test_cases() { atf_add_test_case arpresolve_checks_interface_fib @@ -815,6 +901,8 @@ atf_add_test_case udp_dontroute6 atf_add_test_case ipv4_move_subnet_route atf_add_test_case ipv6_move_subnet_route + atf_add_test_case ipv4_change_route_without_dest + atf_add_test_case ipv6_change_route_without_dest } # Looks up one or more fibs from the configuration data and validates them.