diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-06-17 14:19:51 -0500 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-06-17 14:19:51 -0500 |
commit | cc04866fe7589bcdeafd0b8f9babcd5e4d8b7597 (patch) | |
tree | 473e341a7e65eefc6b16d24f33d515550663794d /templates/protocols/static/route6 | |
parent | f0219bd5420d182aa53cd323815de510c676782e (diff) | |
download | vyatta-cfg-quagga-cc04866fe7589bcdeafd0b8f9babcd5e4d8b7597.tar.gz vyatta-cfg-quagga-cc04866fe7589bcdeafd0b8f9babcd5e4d8b7597.zip |
Bugfix 6816: Verify that at least one next-hop exists if the parent node for the route still exists
Diffstat (limited to 'templates/protocols/static/route6')
-rw-r--r-- | templates/protocols/static/route6/node.tag/blackhole/node.def | 14 | ||||
-rw-r--r-- | templates/protocols/static/route6/node.tag/next-hop/node.def | 12 |
2 files changed, 25 insertions, 1 deletions
diff --git a/templates/protocols/static/route6/node.tag/blackhole/node.def b/templates/protocols/static/route6/node.tag/blackhole/node.def index bd0918d7..c8e202b2 100644 --- a/templates/protocols/static/route6/node.tag/blackhole/node.def +++ b/templates/protocols/static/route6/node.tag/blackhole/node.def @@ -1,7 +1,19 @@ help: Silently discard pkts when matched end: if [ ${COMMIT_ACTION} = 'DELETE' ]; then - vtysh -c "configure terminal" \ + # Check that there is still a next-hop or blackhole if the parent is not deleted + ARR=( $(cli-shell-api listNodes protocols static route6 $VAR(../@) next-hop) ) + cli-shell-api exists protocols static route6 $VAR(../@) blackhole + RETVAL_BH=$? + cli-shell-api exists protocols static route6 $VAR(../@) + RETVAL_PARENT=$? + if [ ${#ARR} -eq 0 ] && [ $RETVAL_BH -eq 1 ] && [ $RETVAL_PARENT -eq 0 ] + then + echo "Must add either a next-hop or blackhole for route $VAR(../@)" + exit 1 + fi + + vtysh -c "configure terminal" \ -c "no ipv6 route $VAR(../@) null0"; else if [ -n "$VAR(./distance/@)" ]; then 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 55574941..28b6ec00 100644 --- a/templates/protocols/static/route6/node.tag/next-hop/node.def +++ b/templates/protocols/static/route6/node.tag/next-hop/node.def @@ -9,6 +9,18 @@ end: then if [[ ${COMMIT_ACTION} = 'DELETE' ]] then + # Check that there is still a next-hop or blackhole if the parent is not deleted + ARR=( $(cli-shell-api listNodes protocols static route6 $VAR(../@) next-hop) ) + cli-shell-api exists protocols static route6 $VAR(../@) blackhole + RETVAL_BH=$? + cli-shell-api exists protocols static route6 $VAR(../@) + RETVAL_PARENT=$? + if [ ${#ARR} -eq 0 ] && [ $RETVAL_BH -eq 1 ] && [ $RETVAL_PARENT -eq 0 ] + then + echo "Must add either a next-hop or blackhole for route $VAR(../@)" + exit 1 + fi + if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ "$VAR(../@)" "$VAR(@)" then |