From c297e0cd2aad7d2919c11edeca7c0f736ef86ba4 Mon Sep 17 00:00:00 2001 From: Mohit Mehta Date: Wed, 12 Aug 2009 17:36:28 -0700 Subject: add support for disabling ipv6 and ipv6 static routes in config --- .../node.tag/next-hop-interface/node.def | 29 ++++++++++----- .../next-hop-interface/node.tag/disable/node.def | 1 + .../node.tag/next-hop-interface/node.def | 29 ++++++++++----- .../next-hop-interface/node.tag/disable/node.def | 1 + .../static/route/node.tag/next-hop/node.def | 43 ++++++++++++++-------- .../node.tag/next-hop/node.tag/disable/node.def | 1 + .../static/route6/node.tag/next-hop/node.def | 37 ++++++++++++++----- .../node.tag/next-hop/node.tag/disable/node.def | 1 + 8 files changed, 96 insertions(+), 46 deletions(-) create mode 100644 templates/protocols/static/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def create mode 100644 templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.tag/disable/node.def create mode 100644 templates/protocols/static/route/node.tag/next-hop/node.tag/disable/node.def create mode 100644 templates/protocols/static/route6/node.tag/next-hop/node.tag/disable/node.def (limited to 'templates/protocols/static') diff --git a/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.def b/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.def index cd739481..d98a223b 100644 --- a/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.def +++ b/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.def @@ -6,13 +6,22 @@ help: Set the next-hop interface allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show all -end: if [ ${COMMIT_ACTION} = 'DELETE' ]; then - vyatta-vtysh -c "configure terminal" \ - -c "no ip route $VAR(../@) $VAR(@)"; - else - if [ -n "$VAR(./distance/@)" ]; then - DIST="$VAR(./distance/@)"; - fi; - vyatta-vtysh -c "configure terminal" \ - -c "ip route $VAR(../@) $VAR(@) $DIST"; - fi; +end: + if [[ -z "$VAR(./disable)" ]] + then + if [[ ${COMMIT_ACTION} = 'DELETE' ]] + then + vyatta-vtysh -c "configure terminal" \ + -c "no ip route $VAR(../@) $VAR(@)" + else + if [[ -n "$VAR(./distance/@)" ]] + then + DIST="$VAR(./distance/@)" + fi + vyatta-vtysh -c "configure terminal" \ + -c "ip route $VAR(../@) $VAR(@) $DIST"; + fi + else + vyatta-vtysh -c "configure terminal" \ + -c "no ip route $VAR(../@) $VAR(@)" + fi diff --git a/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def b/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def new file mode 100644 index 00000000..92f2ba51 --- /dev/null +++ b/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def @@ -0,0 +1 @@ +help: Disable IPv4 interface static route diff --git a/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.def b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.def index 052e1a2f..d1c5e21f 100644 --- a/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.def +++ b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.def @@ -5,13 +5,22 @@ help: Set the next-hop interface # but syntax accepts any interface since it may exist later (ppp etc) allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show all -end: if [ ${COMMIT_ACTION} = 'DELETE' ]; then - vyatta-vtysh -c "configure terminal" \ - -c "no ipv6 route $VAR(../@) $VAR(@)"; - else - if [ -n "$VAR(./distance/@)" ]; then - DIST="$VAR(./distance/@)"; - fi; - vyatta-vtysh -c "configure terminal" \ - -c "ipv6 route $VAR(../@) $VAR(@) $DIST"; - fi; +end: + if [[ -z "$VAR(./disable)" ]] + then + if [[ ${COMMIT_ACTION} = 'DELETE' ]] + then + vyatta-vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@)" + else + if [[ -n "$VAR(./distance/@)" ]] + then + DIST="$VAR(./distance/@)" + fi + vyatta-vtysh -c "configure terminal" \ + -c "ipv6 route $VAR(../@) $VAR(@) $DIST"; + fi + else + vyatta-vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@)" + fi diff --git a/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.tag/disable/node.def b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.tag/disable/node.def new file mode 100644 index 00000000..bc4b57e6 --- /dev/null +++ b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.tag/disable/node.def @@ -0,0 +1 @@ +help: Disable IPv6 interface static route 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 c8632ed8..943857f8 100644 --- a/templates/protocols/static/route/node.tag/next-hop/node.def +++ b/templates/protocols/static/route/node.tag/next-hop/node.def @@ -1,19 +1,30 @@ tag: type: ipv4 help: Set the next-hop router -end: if [[ ${COMMIT_ACTION} = 'DELETE' ]] - then - if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ - "$VAR(../@)" "$VAR(@)" - then - vyatta-vtysh -c "configure terminal" \ - -c "no ip route $VAR(../@) $VAR(@)" - fi - else - if [[ -n "$VAR(./distance/@)" ]] - then - DIST="$VAR(./distance/@)" - fi - vyatta-vtysh -c "configure terminal" \ - -c "ip route $VAR(../@) $VAR(@) $DIST"; - fi +end: + if [[ -z "$VAR(./disable)" ]] + then + if [[ ${COMMIT_ACTION} = 'DELETE' ]] + then + if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ + "$VAR(../@)" "$VAR(@)" + then + vyatta-vtysh -c "configure terminal" \ + -c "no ip route $VAR(../@) $VAR(@)" + fi + else + if [[ -n "$VAR(./distance/@)" ]] + then + DIST="$VAR(./distance/@)" + fi + vyatta-vtysh -c "configure terminal" \ + -c "ip route $VAR(../@) $VAR(@) $DIST"; + fi + else + if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ + "$VAR(../@)" "$VAR(@)" + then + vyatta-vtysh -c "configure terminal" \ + -c "no ip route $VAR(../@) $VAR(@)" + fi + fi diff --git a/templates/protocols/static/route/node.tag/next-hop/node.tag/disable/node.def b/templates/protocols/static/route/node.tag/next-hop/node.tag/disable/node.def new file mode 100644 index 00000000..de3afda4 --- /dev/null +++ b/templates/protocols/static/route/node.tag/next-hop/node.tag/disable/node.def @@ -0,0 +1 @@ +help: Disable IPv4 next-hop static route 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 e58c4fcc..fdaa8ef4 100644 --- a/templates/protocols/static/route6/node.tag/next-hop/node.def +++ b/templates/protocols/static/route6/node.tag/next-hop/node.def @@ -1,13 +1,30 @@ tag: type: ipv6 help: Set the next-hop IPv6 router -end: if [ ${COMMIT_ACTION} = 'DELETE' ]; then - if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl "$VAR(../@)" "$VAR(@)"; then - vyatta-vtysh -c "configure terminal" -c "no ipv6 route $VAR(../@) $VAR(@)" ; - fi; - else - if [ -n "$VAR(./distance/@)" ]; then - DIST="$VAR(./distance/@)"; - fi; - vyatta-vtysh -c "configure terminal" -c "ipv6 route $VAR(../@) $VAR(@) $DIST"; - fi; +end: + if [[ -z "$VAR(./disable)" ]] + then + if [[ ${COMMIT_ACTION} = 'DELETE' ]] + then + if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ + "$VAR(../@)" "$VAR(@)" + then + vyatta-vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@)" + fi + else + if [[ -n "$VAR(./distance/@)" ]] + then + DIST="$VAR(./distance/@)" + fi + vyatta-vtysh -c "configure terminal" \ + -c "ipv6 route $VAR(../@) $VAR(@) $DIST"; + fi + else + if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ + "$VAR(../@)" "$VAR(@)" + then + vyatta-vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@)" + fi + fi diff --git a/templates/protocols/static/route6/node.tag/next-hop/node.tag/disable/node.def b/templates/protocols/static/route6/node.tag/next-hop/node.tag/disable/node.def new file mode 100644 index 00000000..a71e3c24 --- /dev/null +++ b/templates/protocols/static/route6/node.tag/next-hop/node.tag/disable/node.def @@ -0,0 +1 @@ +help: Disable IPv6 next-hop static route -- cgit v1.2.3