diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-29 16:54:03 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-03-29 16:54:03 +0200 |
commit | 9120535d042bbd8d9042e14357cc9aee8f546064 (patch) | |
tree | 7b127a277b1a00902eeb0c70c5cf937cad3294ef | |
parent | 7783a019e04c0a46ae88814215a34f62cd0d17f0 (diff) | |
download | vyatta-cfg-quagga-9120535d042bbd8d9042e14357cc9aee8f546064.tar.gz vyatta-cfg-quagga-9120535d042bbd8d9042e14357cc9aee8f546064.zip |
vrf: T2170: support leaking from default table into vrf
4 files changed, 37 insertions, 6 deletions
diff --git a/templates/protocols/static/route/node.tag/next-hop/node.def b/templates/protocols/static/route/node.tag/next-hop/node.def index d70486d3..0574781d 100644 --- a/templates/protocols/static/route/node.tag/next-hop/node.def +++ b/templates/protocols/static/route/node.tag/next-hop/node.def @@ -23,8 +23,11 @@ end: -c "no ip route $VAR(../@) $VAR(@)" fi else + 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(@) $VAR(./next-hop-interface/@) $VAR(./distance/@)"; + -c "ip route $VAR(../@) $VAR(@) $VAR(./next-hop-interface/@) $NEXTHOP_VRF $VAR(./distance/@)"; fi else if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ diff --git a/templates/protocols/static/route/node.tag/next-hop/node.tag/next-hop-vrf/node.def b/templates/protocols/static/route/node.tag/next-hop/node.tag/next-hop-vrf/node.def new file mode 100644 index 00000000..414da0cb --- /dev/null +++ b/templates/protocols/static/route/node.tag/next-hop/node.tag/next-hop-vrf/node.def @@ -0,0 +1,20 @@ +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: + VRF_NAME=$VAR(../../../../@) + 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(../@) nexthop-vrf $VAR(@)" + fi + fi diff --git a/templates/protocols/static/route6/node.tag/next-hop/node.def b/templates/protocols/static/route6/node.tag/next-hop/node.def index a63064d9..7db15b34 100644 --- a/templates/protocols/static/route6/node.tag/next-hop/node.def +++ b/templates/protocols/static/route6/node.tag/next-hop/node.def @@ -20,18 +20,20 @@ end: -c "no ipv6 route $VAR(../@) $VAR(@) $ifname" fi else - if [[ -n "$VAR(./distance/@)" ]] - then + if [[ -n "$VAR(./distance/@)" ]]; then DIST="$VAR(./distance/@)" fi - if [[ -n "$VAR(./interface/@)" ]] - then + if [[ -n "$VAR(./interface/@)" ]]; then INTERFACE="$VAR(./interface/@)" fi + if [[ -n "$VAR(./next-hop-vrf/@)" ]]; then + NEXTHOP_VRF="nexthop-vrf $VAR(./next-hop-vrf/@)" + fi + vtysh -c "configure terminal" \ - -c "ipv6 route $VAR(../@) $VAR(@) $INTERFACE $DIST"; + -c "ipv6 route $VAR(../@) $VAR(@) $INTERFACE $NEXTHOP_VRF $DIST"; fi else if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ diff --git a/templates/protocols/static/route6/node.tag/next-hop/node.tag/next-hop-vrf/node.def b/templates/protocols/static/route6/node.tag/next-hop/node.tag/next-hop-vrf/node.def new file mode 100644 index 00000000..45d1a5c1 --- /dev/null +++ b/templates/protocols/static/route6/node.tag/next-hop/node.tag/next-hop-vrf/node.def @@ -0,0 +1,6 @@ +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 |