summaryrefslogtreecommitdiff
path: root/templates/protocols/static
diff options
context:
space:
mode:
Diffstat (limited to 'templates/protocols/static')
-rw-r--r--templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def14
-rw-r--r--templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/next-hop-interface/node.def16
2 files changed, 28 insertions, 2 deletions
diff --git a/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def
index 17f1f0dc..eb99af50 100644
--- a/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def
+++ b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def
@@ -8,6 +8,14 @@ end:
fi
if [[ -z "$VAR(./disable)" ]]
then
+ ### remove the old entry from frr first on an update
+ if [ ${COMMIT_ACTION} = 'ACTIVE' ]
+ then
+ OLD_IF=`cli-shell-api returnEffectiveValue protocols static $table route $VAR(../@) next-hop $VAR(@) next-hop-interface`
+ vtysh -c "configure terminal" \
+ -c "no ip route $VAR(../@) $VAR(@) $OLD_IF $VAR(./distance/@) $table";
+ fi
+
if [[ ${COMMIT_ACTION} = 'DELETE' ]]
then
if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 address; then
@@ -16,8 +24,10 @@ end:
if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \
"$VAR(../@)" "$VAR(@)"
then
+ DIST=`cli-shell-api returnEffectiveValue protocols static $table route $VAR(../@) next-hop $VAR(@) distance`
+ NHIF=`cli-shell-api returnEffectiveValue protocols static $table route $VAR(../@) next-hop $VAR(@) next-hop-interface`
vtysh -c "configure terminal" \
- -c "no ip route $VAR(../@) $VAR(@) $table"
+ -c "no ip route $VAR(../@) $VAR(@) $NHIF $DIST $table";
fi
else
if [[ -n "$VAR(./distance/@)" ]]
@@ -25,7 +35,7 @@ end:
dist="$VAR(./distance/@)"
fi
vtysh -c "configure terminal" \
- -c "ip route $VAR(../@) $VAR(@) $table $dist";
+ -c "ip route $VAR(../@) $VAR(@) $VAR(./next-hop-interface/@) $table $dist";
fi
else
if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \
diff --git a/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/next-hop-interface/node.def b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/next-hop-interface/node.def
new file mode 100644
index 00000000..17979d4b
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/next-hop-interface/node.def
@@ -0,0 +1,16 @@
+type: txt
+help: network interface
+allowed: sh -c "${vyos_completion_dir}/list_interfaces.py"
+end:
+ if [[ ${COMMIT_ACTION} = 'DELETE' ]]
+ then
+ if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 address; then
+ exit 1;
+ fi
+ if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \
+ "$VAR(../../@)" "$VAR(../@)"
+ then
+ vtysh -c "configure terminal" \
+ -c "no ip route $VAR(../../@) $VAR(../@) $VAR(@)"
+ fi
+ fi