74b6f9487c
Hetzner uses link-local addressing for their default IPv6 route, accordingly we should specify the device a route is associated with so that it will use the correct interface. Thanks to Devin Brown for reporting this issue.
59 lines
1.9 KiB
Text
Executable file
59 lines
1.9 KiB
Text
Executable file
#!/usr/bin/env atf-sh
|
|
|
|
. $(atf_get_srcdir)/../test_env.sh
|
|
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/static"
|
|
FIXTURES="$(atf_get_srcdir)/../fixtures"
|
|
|
|
tests_init up down vrf_up vrf_down metric_up metric_down
|
|
|
|
up_body() {
|
|
export IFACE=eth0 PHASE=up MOCK=echo INTERFACES_FILE="$FIXTURES/static-eth0.interfaces"
|
|
atf_check -s exit:0 \
|
|
-o match:'addr add 203.0.113.2/24 dev eth0' \
|
|
-o match:'addr add 2001:db8:1000:2::2/64 dev eth0' \
|
|
-o match:'route add default via 203.0.113.1 metric 1 dev eth0' \
|
|
-o match:'route add default via 2001:db8:1000:2::1 metric 1 dev eth0' \
|
|
${EXECUTOR}
|
|
}
|
|
|
|
down_body() {
|
|
export IFACE=eth0 PHASE=down MOCK=echo INTERFACES_FILE="$FIXTURES/static-eth0.interfaces"
|
|
atf_check -s exit:0 \
|
|
-o match:'addr del 203.0.113.2/24 dev eth0' \
|
|
-o match:'addr del 2001:db8:1000:2::2/64 dev eth0' \
|
|
-o match:'route del default via 203.0.113.1 metric 1 dev eth0' \
|
|
-o match:'route del default via 2001:db8:1000:2::1 metric 1 dev eth0' \
|
|
${EXECUTOR}
|
|
}
|
|
|
|
vrf_up_body() {
|
|
export IFACE=vrf-red PHASE=up MOCK=echo INTERFACES_FILE="$FIXTURES/vrf.interfaces" \
|
|
IF_VRF_TABLE=1
|
|
atf_check -s exit:0 \
|
|
-o match:'route add default via 203.0.113.2 table 1' \
|
|
${EXECUTOR}
|
|
}
|
|
|
|
vrf_down_body() {
|
|
export IFACE=vrf-red PHASE=down MOCK=echo INTERFACES_FILE="$FIXTURES/vrf.interfaces" \
|
|
IF_VRF_TABLE=1
|
|
atf_check -s exit:0 \
|
|
-o match:'route del default via 203.0.113.2 table 1' \
|
|
${EXECUTOR}
|
|
}
|
|
|
|
metric_up_body() {
|
|
export IFACE=vrf-red PHASE=up MOCK=echo INTERFACES_FILE="$FIXTURES/vrf.interfaces" \
|
|
IF_VRF_TABLE=1 IF_METRIC=20
|
|
atf_check -s exit:0 \
|
|
-o match:'route add default via 203.0.113.2 table 1 metric 20' \
|
|
${EXECUTOR}
|
|
}
|
|
|
|
metric_down_body() {
|
|
export IFACE=vrf-red PHASE=down MOCK=echo INTERFACES_FILE="$FIXTURES/vrf.interfaces" \
|
|
IF_VRF_TABLE=1 IF_METRIC=20
|
|
atf_check -s exit:0 \
|
|
-o match:'route del default via 203.0.113.2 table 1 metric 20' \
|
|
${EXECUTOR}
|
|
}
|