summaryrefslogtreecommitdiff
path: root/src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper
diff options
context:
space:
mode:
authorBrandon Stepler <brandon@stepler.net>2021-03-08 14:20:00 -0500
committerChristian Poessinger <christian@poessinger.com>2021-03-19 19:37:50 +0100
commit74f526c9c1fe782c604d2b88c1753d787dc696b4 (patch)
tree6bf544468e85e6fde197928b2fd995e0397d721f /src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper
parent6b0e361d0681ab516542b9eeb58c1bbaf55add33 (diff)
downloadvyos-1x-74f526c9c1fe782c604d2b88c1753d787dc696b4.tar.gz
vyos-1x-74f526c9c1fe782c604d2b88c1753d787dc696b4.zip
dhcp: T3392: fix VRF detection
(cherry picked from commit ce0600e97baec18c1781605f3a80c26d4ed01e2b)
Diffstat (limited to 'src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper')
-rw-r--r--src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper b/src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper
index d1161e704..cf320fbbf 100644
--- a/src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper
+++ b/src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper
@@ -42,8 +42,8 @@ function iptovtysh () {
fi
# Add route to VRF routing table
- local VTYSH_VRF_NAME=$(basename /sys/class/net/$VTYSH_DEV/upper_* | sed -e 's/upper_//')
- if [ -n $VTYSH_VRF_NAME ]; then
+ local VTYSH_VRF_NAME=$(/usr/sbin/ip link show dev $VTYSH_DEV | sed -nre '1s/.* master ([^ ]*) .*/\1/p')
+ if /usr/sbin/ip -d link show dev $VTYSH_DEV | grep -q "vrf_slave"; then
VTYSH_VRF="vrf $VTYSH_VRF_NAME"
fi
VTYSH_CMD="ip route $VTYSH_NETADDR $VTYSH_GATEWAY $VTYSH_DEV tag $VTYSH_TAG $VTYSH_DISTANCE $VTYSH_VRF"