diff options
author | Brandon Stepler <brandon@stepler.net> | 2021-02-15 10:30:00 -0500 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-03-19 19:41:09 +0100 |
commit | ff6afe62e801e570f6478decf2b4a813a5c0ee94 (patch) | |
tree | 2ba8221481e0460ea710f3bfe86c83196d2adeee /src/etc/dhcp/dhclient-exit-hooks.d | |
parent | 74f526c9c1fe782c604d2b88c1753d787dc696b4 (diff) | |
download | vyos-1x-ff6afe62e801e570f6478decf2b4a813a5c0ee94.tar.gz vyos-1x-ff6afe62e801e570f6478decf2b4a813a5c0ee94.zip |
dhcp: T3300: add DHCP default route distance
(cherry picked from commit dd2eb5e5686655c996ae95285b8ad7eb73d63d0b)
Diffstat (limited to 'src/etc/dhcp/dhclient-exit-hooks.d')
-rw-r--r-- | src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup | 8 |
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 |