From 74b6f9487c8226aebd3e6ea13d056ccc8a995386 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 2 Oct 2020 15:41:12 -0600 Subject: [PATCH] static: always associate default routes with $IFACE 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. --- executor-scripts/linux/static | 2 +- tests/linux/static_test | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/executor-scripts/linux/static b/executor-scripts/linux/static index aa99533..ed6bd10 100755 --- a/executor-scripts/linux/static +++ b/executor-scripts/linux/static @@ -27,7 +27,7 @@ configure_addresses() { configure_gateways() { for i in $(ifquery -p gateway -i $INTERFACES_FILE $IFACE); do addrfam=$(addr_family $i) - ${MOCK} ip $addrfam route $1 default via $i $VRF_TABLE $METRIC + ${MOCK} ip $addrfam route $1 default via $i $VRF_TABLE $METRIC dev $IFACE done } diff --git a/tests/linux/static_test b/tests/linux/static_test index d8bdab2..04c5e8f 100755 --- a/tests/linux/static_test +++ b/tests/linux/static_test @@ -11,8 +11,8 @@ up_body() { 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' \ - -o match:'route add default via 2001:db8:1000:2::1' \ + -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} } @@ -21,8 +21,8 @@ down_body() { 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' \ - -o match:'route del default via 2001:db8:1000:2::1' \ + -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} }