diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-04 18:30:16 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-04-04 18:30:20 +0200 |
commit | 9ebef9e13c1bd3718b8fafabdfd78c33412b8722 (patch) | |
tree | 18d28fedad9b3498623702c85812a8331ec3c186 /data | |
parent | 3e7fe69a6b03b053098171411e286ba515838842 (diff) | |
download | vyos-1x-9ebef9e13c1bd3718b8fafabdfd78c33412b8722.tar.gz vyos-1x-9ebef9e13c1bd3718b8fafabdfd78c33412b8722.zip |
wwan: T2219: rework route add to VRF
The old implementation actually did not work as the Quotes "" around the
"vrf foo" statement got actually lost in translation.
Diffstat (limited to 'data')
-rw-r--r-- | data/templates/wwan/ip-up.script.tmpl | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/data/templates/wwan/ip-up.script.tmpl b/data/templates/wwan/ip-up.script.tmpl index 7382309ac..89e42a23a 100644 --- a/data/templates/wwan/ip-up.script.tmpl +++ b/data/templates/wwan/ip-up.script.tmpl @@ -7,6 +7,8 @@ if [ -z "$(echo $tty | egrep "tty(USB|ACM)")" ]; then exit 0 fi +DIALER_PID=$(cat /var/run/{{ intf }}.pid) + # Determine if we are enslaved to a VRF, this is needed to properly insert # the default route VRF_NAME="" @@ -15,12 +17,9 @@ if [ -d /sys/class/net/{{ intf }}/upper_* ]; then VRF=$(basename $(ls -d /sys/class/net/{{ intf }}/upper_*)) # Remove upper_ prefix from result string VRF=${VRF#"upper_"} - # Populate variable to run in VR context - VRF_NAME=" -c vrf ${VRF_NAME} " + VRF_NAME="vrf ${VRF}" fi # Apply default route to either default or VRF routing table -vtysh -c "conf t" ${VRF_NAME} -c "ip route 0.0.0.0/0 {{ intf }} {{ metric }}" - -DIALER_PID=$(cat /var/run/{{ intf }}.pid) -logger -t pppd[$DIALER_PID] "added default route via {{ intf }} metric {{ metric }}" +vtysh -c "conf t" -c "ip route 0.0.0.0/0 {{ intf }} ${VRF_NAME} {{ metric }}" +logger -t pppd[$DIALER_PID] "added default route via {{ intf }} metric {{ metric }} ${VRF_NAME}" |