Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/netinet6/forward6.sh
Show First 20 Lines • Show All 460 Lines • ▼ Show 20 Lines | fwd_ip6_gu_icmp_gw_ll_slow_success_body() { | ||||
atf_check -o match:'1 packet forwarded' jexec ${jname} netstat -sp ip6 | atf_check -o match:'1 packet forwarded' jexec ${jname} netstat -sp ip6 | ||||
} | } | ||||
fwd_ip6_gu_icmp_gw_ll_slow_success_cleanup() { | fwd_ip6_gu_icmp_gw_ll_slow_success_cleanup() { | ||||
vnet_cleanup | vnet_cleanup | ||||
} | } | ||||
atf_test_case "fwd_ip6_blackhole" "cleanup" | |||||
fwd_ip6_blackhole_head() { | |||||
atf_set descr 'Test blackhole routing' | |||||
atf_set require.user root | |||||
} | |||||
fwd_ip6_blackhole_body() { | |||||
jname="v6t-fwd_ip6_blackhole" | |||||
vnet_init | |||||
epair=$(vnet_mkepair) | |||||
epair_out=$(vnet_mkepair) | |||||
ifconfig ${epair}a inet6 2001:db8::2/64 up no_dad | |||||
vnet_mkjail ${jname} ${epair}b ${epair_out}b | |||||
jexec ${jname} ifconfig lo0 inet6 ::1/128 up no_dad | |||||
jexec ${jname} ifconfig ${epair}b inet6 2001:db8::1/64 up no_dad | |||||
jexec ${jname} ifconfig ${epair_out}b inet6 2001:db8:1::1/64 up no_dad | |||||
jexec ${jname} sysctl net.inet6.ip6.forwarding=1 | |||||
route -6 add default 2001:db8::1 | |||||
atf_check -s exit:2 -o ignore \ | |||||
ping6 -c 1 -t 1 2001:db8:1::2 | |||||
atf_check -s exit:0 -o match:"0 packets not forwardable" \ | |||||
jexec ${jname} netstat -s -p ip6 | |||||
# Create blackhole route | |||||
jexec ${jname} route -6 add 2001:db8:1::2 -blackhole | |||||
# Force slow path | |||||
jexec ${jname} sysctl net.inet6.ip6.redirect=1 | |||||
atf_check -s exit:2 -o ignore \ | |||||
ping6 -c 1 -t 1 2001:db8:1::2 | |||||
atf_check -s exit:0 -o match:"1 packet not forwardable" \ | |||||
jexec ${jname} netstat -s -p ip6 | |||||
# Now try the fast path | |||||
jexec ${jname} sysctl net.inet6.ip6.redirect=0 | |||||
atf_check -s exit:2 -o ignore \ | |||||
ping6 -c 1 -t 1 2001:db8:1::2 | |||||
atf_check -s exit:0 -o match:"2 packets not forwardable" \ | |||||
jexec ${jname} netstat -s -p ip6 | |||||
} | |||||
fwd_ip6_blackhole_cleanup() { | |||||
vnet_cleanup | |||||
} | |||||
atf_init_test_cases() | atf_init_test_cases() | ||||
{ | { | ||||
atf_add_test_case "fwd_ip6_gu_icmp_iface_fast_success" | atf_add_test_case "fwd_ip6_gu_icmp_iface_fast_success" | ||||
atf_add_test_case "fwd_ip6_gu_icmp_gw_gu_fast_success" | atf_add_test_case "fwd_ip6_gu_icmp_gw_gu_fast_success" | ||||
atf_add_test_case "fwd_ip6_gu_icmp_gw_ll_fast_success" | atf_add_test_case "fwd_ip6_gu_icmp_gw_ll_fast_success" | ||||
atf_add_test_case "fwd_ip6_gu_icmp_iface_slow_success" | atf_add_test_case "fwd_ip6_gu_icmp_iface_slow_success" | ||||
atf_add_test_case "fwd_ip6_gu_icmp_gw_gu_slow_success" | atf_add_test_case "fwd_ip6_gu_icmp_gw_gu_slow_success" | ||||
atf_add_test_case "fwd_ip6_gu_icmp_gw_ll_slow_success" | atf_add_test_case "fwd_ip6_gu_icmp_gw_ll_slow_success" | ||||
atf_add_test_case "fwd_ip6_blackhole" | |||||
} | } | ||||
# end | # end | ||||