summaryrefslogtreecommitdiff
path: root/templates/protocols/static/route
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-06-17 14:19:51 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-06-17 14:19:51 -0500
commitcc04866fe7589bcdeafd0b8f9babcd5e4d8b7597 (patch)
tree473e341a7e65eefc6b16d24f33d515550663794d /templates/protocols/static/route
parentf0219bd5420d182aa53cd323815de510c676782e (diff)
downloadvyatta-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/route')
-rw-r--r--templates/protocols/static/route/node.tag/blackhole/node.def14
-rw-r--r--templates/protocols/static/route/node.tag/next-hop/node.def12
2 files changed, 25 insertions, 1 deletions
diff --git a/templates/protocols/static/route/node.tag/blackhole/node.def b/templates/protocols/static/route/node.tag/blackhole/node.def
index b6691ed4..c72fabd2 100644
--- a/templates/protocols/static/route/node.tag/blackhole/node.def
+++ b/templates/protocols/static/route/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 route $VAR(../@) next-hop) )
+ cli-shell-api exists protocols static route $VAR(../@) blackhole
+ RETVAL_BH=$?
+ cli-shell-api exists protocols static route $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 ip route $VAR(../@) null0";
else
if [ -n "$VAR(./distance/@)" ]; then
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 1c72e7f5..9160dd8d 100644
--- a/templates/protocols/static/route/node.tag/next-hop/node.def
+++ b/templates/protocols/static/route/node.tag/next-hop/node.def
@@ -6,6 +6,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 route $VAR(../@) next-hop) )
+ cli-shell-api exists protocols static route $VAR(../@) blackhole
+ RETVAL_BH=$?
+ cli-shell-api exists protocols static route $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