summaryrefslogtreecommitdiff
path: root/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup
diff options
context:
space:
mode:
authorBrandon Stepler <brandon@stepler.net>2021-02-15 10:30:00 -0500
committerBrandon Stepler <brandon@stepler.net>2021-02-15 10:30:00 -0500
commitdd2eb5e5686655c996ae95285b8ad7eb73d63d0b (patch)
tree82b072b215ecbdf99ccbd221e9b70ac29a9664a4 /src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup
parentdf7e790df0c71c41455c9e05c0544889110dac0f (diff)
downloadvyos-1x-dd2eb5e5686655c996ae95285b8ad7eb73d63d0b.tar.gz
vyos-1x-dd2eb5e5686655c996ae95285b8ad7eb73d63d0b.zip
dhcp: T3300: add DHCP default route distance
Diffstat (limited to 'src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup')
-rw-r--r--src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup b/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup
index b768e1ae5..edb7c7b27 100644
--- a/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup
+++ b/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup
@@ -13,6 +13,8 @@ if [[ $reason =~ (EXPIRE|FAIL|RELEASE|STOP) ]]; then
$hostsd_client --delete-name-servers --tag "dhcp-${interface}"
hostsd_changes=y
+ if_metric="$IF_METRIC"
+
# try to delete default ip route
for router in $old_routers; do
# check if we are bound to a VRF
@@ -21,8 +23,10 @@ if [[ $reason =~ (EXPIRE|FAIL|RELEASE|STOP) ]]; then
vrf="vrf $vrf_name"
fi
- logmsg info "Deleting default route: via $router dev ${interface} ${vrf}"
- ip -4 route del default via $router dev ${interface} ${vrf}
+ logmsg info "Deleting default route: via $router dev ${interface} ${if_metric:+metric $if_metric} ${vrf}"
+ ip -4 route del default via $router dev ${interface} ${if_metric:+metric $if_metric} ${vrf}
+
+ if_metric=$((if_metric+1))
done
# delete rfc3442 routes