summaryrefslogtreecommitdiff
path: root/src/etc/dhcp/dhclient-exit-hooks.d
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-08-16 14:27:03 +0200
committerChristian Poessinger <christian@poessinger.com>2020-08-16 14:33:16 +0200
commitb17b8a0129f42c757c1e9a740664406e8da3dd42 (patch)
tree54912f1b9b9c2198c55ec617a1260ab1bc9acdb0 /src/etc/dhcp/dhclient-exit-hooks.d
parent3104c0ea8284ac5039e1dbab4a3ccd193e748ede (diff)
downloadvyos-1x-b17b8a0129f42c757c1e9a740664406e8da3dd42.tar.gz
vyos-1x-b17b8a0129f42c757c1e9a740664406e8da3dd42.zip
dhclient: T2277: remove VRF route when DHCP client exits
Diffstat (limited to 'src/etc/dhcp/dhclient-exit-hooks.d')
-rw-r--r--src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup10
1 files changed, 8 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 01981ad04..b768e1ae5 100644
--- a/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup
+++ b/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup
@@ -15,8 +15,14 @@ if [[ $reason =~ (EXPIRE|FAIL|RELEASE|STOP) ]]; then
# try to delete default ip route
for router in $old_routers; do
- logmsg info "Deleting default route: via $router dev ${interface}"
- ip -4 route del default via $router dev ${interface}
+ # check if we are bound to a VRF
+ local vrf_name=$(basename /sys/class/net/${interface}/upper_* | sed -e 's/upper_//')
+ if [ -n $vrf_name ]; 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}
done
# delete rfc3442 routes