Add regression test for PR kern/189088.

PR:		kern/189088
MFC after:	3 weeks
Sponsored by:	Spectra Logic
This commit is contained in:
asomers 2014-04-29 15:12:23 +00:00
parent 5e3b8b27ae
commit c95e6bbc4f

View File

@ -252,6 +252,59 @@ same_ip_multiple_ifaces_fib0_cleanup()
cleanup_tap
}
# Regression test for PR kern/189088
# Test that removing an IP address works even if the same IP is assigned to a
# different interface, on a different FIB. Tests the same code that whose
# panic was regressed by same_ip_multiple_ifaces_fib0.
# Create two tap interfaces and assign them both the same IP address but with
# different netmasks, and on different FIBs. Then remove one's IP
# address. Hopefully the machine won't panic. Also, the IP's hostroute should
# dissappear from the correct fib.
atf_test_case same_ip_multiple_ifaces cleanup
same_ip_multiple_ifaces_head()
{
atf_set "descr" "Can remove an IP alias from an interface when the same IP 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()
{
atf_expect_fail "kern/189088 Assigning the same IP to multiple interfaces in different FIBs creates a host route for only one"
ADDR="192.0.2.2"
MASK0="24"
MASK1="32"
# Unlike most of the tests in this file, this is applicable regardless
# of net.add_addr_allfibs
get_fibs 2
# Setup the interfaces, then remove one alias. It should not panic.
setup_tap ${FIB0} ${ADDR} ${MASK0}
TAP0=${TAP}
setup_tap ${FIB1} ${ADDR} ${MASK1}
TAP1=${TAP}
ifconfig ${TAP1} -alias ${ADDR}
atf_check -o not-match:"^${ADDR}[[:space:]]" \
setfib ${FIB1} netstat -rn -f inet
# Do it again, in the opposite order. It should not panic.
setup_tap ${FIB0} ${ADDR} ${MASK0}
TAP0=${TAP}
setup_tap ${FIB1} ${ADDR} ${MASK1}
TAP1=${TAP}
ifconfig ${TAP0} -alias ${ADDR}
atf_check -o not-match:"^${ADDR}[[:space:]]" \
setfib ${FIB0} netstat -rn -f inet
}
same_ip_multiple_ifaces_cleanup()
{
# Due to PR kern/189088, we must destroy the interfaces in LIFO order
# in order for the routes to be correctly cleaned up.
for TAPD in `tail -r "tap_devices_to_cleanup"`; do
ifconfig ${TAPD} destroy
done
}
# Regression test for kern/187550
atf_test_case subnet_route_with_multiple_fibs_on_same_subnet cleanup
subnet_route_with_multiple_fibs_on_same_subnet_head()
@ -349,6 +402,7 @@ atf_init_test_cases()
atf_add_test_case loopback_and_network_routes_on_nondefault_fib
atf_add_test_case default_route_with_multiple_fibs_on_same_subnet
atf_add_test_case same_ip_multiple_ifaces_fib0
atf_add_test_case same_ip_multiple_ifaces
atf_add_test_case subnet_route_with_multiple_fibs_on_same_subnet
atf_add_test_case udp_dontroute
}