diff options
author | R. Christian McDonald <rcm@FreeBSD.org> | 2023-11-28 18:18:15 +0000 |
---|---|---|
committer | R. Christian McDonald <rcm@FreeBSD.org> | 2023-11-28 21:16:25 +0000 |
commit | ca7edd0d2c339b8e6e5e52257ea6d4f22db02550 (patch) | |
tree | 11abae171fde878e9ac2d10d40d1245db795476e /sbin/route | |
parent | f818559774cb0c1516364c4beca361480fd68b5b (diff) | |
download | src-ca7edd0d2c339b8e6e5e52257ea6d4f22db02550.tar.gz src-ca7edd0d2c339b8e6e5e52257ea6d4f22db02550.zip |
Diffstat (limited to 'sbin/route')
-rw-r--r-- | sbin/route/tests/basic.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/sbin/route/tests/basic.sh b/sbin/route/tests/basic.sh index bb432daa0793..2e2ab9dba97f 100644 --- a/sbin/route/tests/basic.sh +++ b/sbin/route/tests/basic.sh @@ -117,8 +117,66 @@ basic_v6_cleanup() vnet_cleanup } +atf_test_case "interface_route_v4" "cleanup" +interface_route_v4_head() +{ + atf_set descr 'add interface route for v4' + atf_set require.user root + atf_set require.progs jail jq +} + +interface_route_v4_body() +{ + epair=$(vnet_mkepair) + ifconfig ${epair}a up + vnet_mkjail alcatraz ${epair}b + + # add interface route + jexec alcatraz route add "192.0.2.1" -iface ${epair}b + gateway=$(check_route "alcatraz" "192.0.2.1") + + if [ -z "${gateway}" ]; then + atf_fail "Failed to add interface route." + fi +} + +interface_route_v4_cleanup() +{ + vnet_cleanup +} + +atf_test_case "interface_route_v6" "cleanup" +interface_route_v6_head() +{ + atf_set descr 'add interface route for v6' + atf_set require.user root + atf_set require.progs jail jq +} + +interface_route_v6_body() +{ + epair=$(vnet_mkepair) + ifconfig ${epair}a up + vnet_mkjail alcatraz ${epair}b + + # add interface route + jexec alcatraz route add -6 "2001:db8:cc4b::1" -iface ${epair}b + gateway=$(check_route "alcatraz" "2001:db8:cc4b::1") + + if [ -z "${gateway}" ]; then + atf_fail "Failed to add interface route." + fi +} + +interface_route_v6_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic_v4" atf_add_test_case "basic_v6" + atf_add_test_case "interface_route_v4" + atf_add_test_case "interface_route_v6" } |