diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-03-04 21:51:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 21:51:45 +0100 |
commit | d79c80ff078ac686ae2a4e0da66bfbd40d67f824 (patch) | |
tree | 43edad0dc3de95472a065da7d8f1d8ebeb6d6d5a /src/etc/dhcp/dhclient-exit-hooks.d | |
parent | ecba3ff3a5d5032da735e0f73983b85918560570 (diff) | |
parent | dd2eb5e5686655c996ae95285b8ad7eb73d63d0b (diff) | |
download | vyos-1x-d79c80ff078ac686ae2a4e0da66bfbd40d67f824.tar.gz vyos-1x-d79c80ff078ac686ae2a4e0da66bfbd40d67f824.zip |
Merge pull request #729 from bstepler/T3300
dhcp: T3300: add DHCP default route distance
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 |