From 9ec8e2b6dc8144d4d5a17e53b1c183e22497580f Mon Sep 17 00:00:00 2001 From: zsdc Date: Thu, 15 Apr 2021 00:20:44 +0300 Subject: dhclient: T3392: Changed dhclient-script hooks for VRF There were two problems with VRF support inside dhclient-script: - VRF check inside the `01-vyos-cleanup` hook was needless because it will be done inside the `03-vyos-ipwrapper` anyway; - VRF was ignored for in-kernel routes in `03-vyos-ipwrapper`. Theoretically, there must be no situation now when this can leads to a real problem, but better will be to keep both kernel and FRR backends in sync. Also, the way to get and use a VRF name was changed to an easier one. --- src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup') 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 edb7c7b27..694d53b6b 100644 --- a/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup +++ b/src/etc/dhcp/dhclient-exit-hooks.d/01-vyos-cleanup @@ -17,14 +17,8 @@ if [[ $reason =~ (EXPIRE|FAIL|RELEASE|STOP) ]]; then # try to delete default ip route for router in $old_routers; do - # 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} ${if_metric:+metric $if_metric} ${vrf}" - ip -4 route del default via $router dev ${interface} ${if_metric:+metric $if_metric} ${vrf} + logmsg info "Deleting default route: via $router dev ${interface} ${if_metric:+metric $if_metric}" + ip -4 route del default via $router dev ${interface} ${if_metric:+metric $if_metric} if_metric=$((if_metric+1)) done -- cgit v1.2.3