diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-03-17 19:43:09 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-03-17 19:43:09 +0100 |
commit | db38bdcc554cbc2271d1bd664418d6843f83dd62 (patch) | |
tree | d2c067006e5d92ea23ca0eea8d2fadcc15504c79 /templates/protocols | |
parent | 20a2848b298753f65a44d5c2f1fc3d7cf5801517 (diff) | |
download | vyatta-cfg-quagga-db38bdcc554cbc2271d1bd664418d6843f83dd62.tar.gz vyatta-cfg-quagga-db38bdcc554cbc2271d1bd664418d6843f83dd62.zip |
vrf: T2111: validate existence of target VRF when leaking
Diffstat (limited to 'templates/protocols')
4 files changed, 16 insertions, 0 deletions
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 index ee872997..8c157906 100644 --- 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 @@ -6,6 +6,10 @@ allowed: local -a params echo -n "${params[@]}" val_help: <vrf> ; Name of VRF to leak to end: + if [ ! -e /sys/class/net/$VAR(@) ]; then + echo 'VRF "$VAR(@)" does not exist!' + exit 1 + fi if [[ ${COMMIT_ACTION} = 'DELETE' ]] then if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 address; then diff --git a/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.def b/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.def index 52f198b1..e2deadb2 100644 --- a/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.def +++ b/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.def @@ -24,6 +24,10 @@ end: fi if [[ -n "$VAR(./next-hop-vrf/@)" ]]; then NEXTHOP_VRF="nexthop-vrf $VAR(./next-hop-vrf/@)" + if [ ! -e /sys/class/net/$NEXTHOP_VRF ]; then + echo 'VRF "$NEXTHOP_VRF" does not exist!' + exit 1 + fi fi vtysh -c "configure terminal" \ diff --git a/templates/protocols/vrf/node.tag/static/route/node.tag/next-hop/node.tag/next-hop-vrf/node.def b/templates/protocols/vrf/node.tag/static/route/node.tag/next-hop/node.tag/next-hop-vrf/node.def index ad3e92a9..b2624cd7 100644 --- a/templates/protocols/vrf/node.tag/static/route/node.tag/next-hop/node.tag/next-hop-vrf/node.def +++ b/templates/protocols/vrf/node.tag/static/route/node.tag/next-hop/node.tag/next-hop-vrf/node.def @@ -6,6 +6,10 @@ allowed: local -a params echo -n "${params[@]}" val_help: <vrf> ; Name of VRF to leak to end: + if [ ! -e /sys/class/net/$VAR(@) ]; then + echo 'VRF "$VAR(@)" does not exist!' + exit 1 + fi VRF_NAME=$VAR(../../../../@) if [[ ${COMMIT_ACTION} = 'DELETE' ]] then diff --git a/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.def b/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.def index 3fb5b798..044f2689 100644 --- a/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.def +++ b/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.def @@ -41,6 +41,10 @@ end: exit 1 fi NEXTHOP_VRF="nexthop-vrf $VAR(./next-hop-vrf/@)" + if [ ! -e /sys/class/net/$NEXTHOP_VRF ]; then + echo 'VRF "$NEXTHOP_VRF" does not exist!' + exit 1 + fi fi vtysh -c "configure terminal" \ |