summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-30 15:47:37 +0200
committerChristian Poessinger <christian@poessinger.com>2020-03-30 15:47:37 +0200
commitecf92a312574a06dba476b5c67ef2b564159b32a (patch)
treee0bb653fb67147b32dfe1d2649b2830a4189beb4 /templates
parentd40fe04ccde0993975ecdb6f560588042b96067e (diff)
downloadvyatta-cfg-quagga-ecf92a312574a06dba476b5c67ef2b564159b32a.tar.gz
vyatta-cfg-quagga-ecf92a312574a06dba476b5c67ef2b564159b32a.zip
vrf: T2170: IPv4 support route-leaking on interface routes
Diffstat (limited to 'templates')
-rw-r--r--templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.def14
-rw-r--r--templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.tag/next-hop-vrf/node.def21
2 files changed, 30 insertions, 5 deletions
diff --git a/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.def b/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.def
index 46f6abc0..5a2b304b 100644
--- a/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.def
+++ b/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.def
@@ -7,9 +7,9 @@ allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show all
end:
+ VRF_NAME=$VAR(../../../@)
if [[ -z "$VAR(./disable)" ]]
then
- VRF_NAME=$VAR(../../../@)
if [[ ${COMMIT_ACTION} = 'DELETE' ]]
then
if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 interface; then
@@ -18,14 +18,18 @@ end:
vtysh -c "configure terminal" \
-c "no ip route $VAR(../@) $VAR(@) vrf $VRF_NAME"
else
- if [[ -n "$VAR(./distance/@)" ]]
- then
+ if [[ -n "$VAR(./distance/@)" ]]; then
DIST="$VAR(./distance/@)"
fi
+ if [[ -n "$VAR(./next-hop-vrf/@)" ]]; then
+ NEXTHOP_VRF="nexthop-vrf $VAR(./next-hop-vrf/@)"
+ fi
vtysh -c "configure terminal" \
- -c "ip route $VAR(../@) $VAR(@) vrf $VRF_NAME $DIST";
+ -c "vrf $VRF_NAME" \
+ -c "ip route $VAR(../@) $VAR(@) $NEXTHOP_VRF $DIST";
fi
else
vtysh -c "configure terminal" \
- -c "no ip route $VAR(../@) $VAR(@) vrf $VRF_NAME"
+ -c "vrf $VRF_NAME" \
+ -c "no ip route $VAR(../@) $VAR(@)"
fi
diff --git a/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.tag/next-hop-vrf/node.def b/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.tag/next-hop-vrf/node.def
new file mode 100644
index 00000000..06c90fdc
--- /dev/null
+++ b/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.tag/next-hop-vrf/node.def
@@ -0,0 +1,21 @@
+type: txt
+help: VRF to leak route
+allowed: local -a params
+ eval "params=($(cli-shell-api listNodes vrf name))"
+ echo -n "${params[@]}"
+val_help: <vrf> ; Name of VRF to leak to
+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
+ VRF_NAME=$VAR(../../../../@)
+ vtysh -c "configure terminal" \
+ -c "vrf $VRF_NAME" \
+ -c "no ip route $VAR(../../@) $VAR(../@) nexthop-vrf $VAR(@)"
+ fi
+ fi