diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2008-07-27 15:00:37 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2008-07-27 15:00:37 -0700 |
commit | 1a2eec7ac911aa1e455de7b1a2e71d3536ac83af (patch) | |
tree | e5758898eb5d537d3d69d64b05a0ac9f5457da34 | |
parent | 0cda6a40b32c442df5e3ae3e8513bb19bc219d7e (diff) | |
download | vyatta-cfg-quagga-1a2eec7ac911aa1e455de7b1a2e71d3536ac83af.tar.gz vyatta-cfg-quagga-1a2eec7ac911aa1e455de7b1a2e71d3536ac83af.zip |
Add cli for IPv6 static routes.
12 files changed, 102 insertions, 0 deletions
diff --git a/templates/protocols/static/interface-route6/node.def b/templates/protocols/static/interface-route6/node.def new file mode 100644 index 00000000..04624589 --- /dev/null +++ b/templates/protocols/static/interface-route6/node.def @@ -0,0 +1,4 @@ +tag: +type: ipv6net +help: Set an interface-based IPv6 static route +syntax:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --check-prefix-boundry $VAR(@)" 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 new file mode 100644 index 00000000..1ad9ab2f --- /dev/null +++ b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.def @@ -0,0 +1,47 @@ +# +# Config template for +# protocols/static/interface-route6/<prefix>/next-hop-interface +# + +tag: + +type: txt + +help: Set the next-hop interface + +# +# Argument must be the name of an interface on the system. PPP interfaces +# only come into existance when they come up. Allow interface routes +# via them to be configured even though the link may not be up right now. +# We need a special case for multilink interfaces because their names +# are not coded into the name of the PPP config file in /etc/ppp/peers. +# +syntax:expression: exec " \ + IFNAME=$VAR(@) ; \ + if [ ! -e /sys/class/net/$IFNAME ]; then \ + if [ \"${IFNAME::5}\" != \"pppoa\" -a \"${IFNAME::5}\" != \"pppoe\" \ + -a \"${IFNAME::3}\" != \"wan\" \ + -a \"${IFNAME::2}\" != \"ml\" ]; then \ + echo interface $IFNAME doesn\\'t exist on this system ; \ + exit 1 ; \ + fi ; \ + if [ ! -e /etc/ppp/peers/${IFNAME} -a \"$IFNAME\" != \"ml0\" \ + -a \"$IFNAME\" != \"ml1\" ]; then \ + echo PPP interface $IFNAME doesn\\'t exist on this system ; \ + exit 1 ; \ + fi ; \ + fi ; " + +delete: touch /tmp/static.$PPID + +end: if [ -f "/tmp/static.$PPID" ]; then + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@)"; + rm /tmp/static.$PPID; + else + if [ -n "$VAR(./distance/@)" ]; then + DIST="$VAR(./distance/@)"; + fi; + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "ipv6 route $VAR(../@) $VAR(@) $DIST"; + fi; diff --git a/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.tag/distance/node.def b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.tag/distance/node.def new file mode 100644 index 00000000..08a06ad8 --- /dev/null +++ b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.tag/distance/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Set distance value for this route +syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)" +comp_help: <1-255> Distance for this route diff --git a/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.tag/node.def b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.tag/node.def new file mode 100644 index 00000000..5bd7d7c7 --- /dev/null +++ b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.tag/node.def @@ -0,0 +1 @@ +help: Set next-hop interface diff --git a/templates/protocols/static/interface-route6/node.tag/node.def b/templates/protocols/static/interface-route6/node.tag/node.def new file mode 100644 index 00000000..1bc36220 --- /dev/null +++ b/templates/protocols/static/interface-route6/node.tag/node.def @@ -0,0 +1,3 @@ +help: Set IP network +commit:expression: $VAR(./next-hop-interface/) != "" ; \ + "Must add a next-hop-interface for route $VAR(@)" diff --git a/templates/protocols/static/route6/node.def b/templates/protocols/static/route6/node.def new file mode 100644 index 00000000..7f95d0be --- /dev/null +++ b/templates/protocols/static/route6/node.def @@ -0,0 +1,4 @@ +tag: +type: ipv6net +help: Set a static IPv6 route +syntax:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --check-prefix-boundry $VAR(@)" diff --git a/templates/protocols/static/route6/node.tag/blackhole/distance/node.def b/templates/protocols/static/route6/node.tag/blackhole/distance/node.def new file mode 100644 index 00000000..08a06ad8 --- /dev/null +++ b/templates/protocols/static/route6/node.tag/blackhole/distance/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Set distance value for this route +syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)" +comp_help: <1-255> Distance for this route diff --git a/templates/protocols/static/route6/node.tag/blackhole/node.def b/templates/protocols/static/route6/node.tag/blackhole/node.def new file mode 100644 index 00000000..aaeab5b6 --- /dev/null +++ b/templates/protocols/static/route6/node.tag/blackhole/node.def @@ -0,0 +1,11 @@ +help: Set to silently discard pkts when matched +delete:expression: "touch /tmp/static.$PPID" +end:expression: "if [ -f \"/tmp/static.$PPID\" ]; then \ + ${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" -c \"no ip route $VAR(../@) null0\" ; \ + rm /tmp/static.$PPID; \ + else \ + if [ -n \"$VAR(./distance/@)\" ]; then \ + DIST=\"$VAR(./distance/@)\"; \ + fi; \ + ${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" -c \"ip route $VAR(../@) null0 $DIST \" ; \ + 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 new file mode 100644 index 00000000..d62088ce --- /dev/null +++ b/templates/protocols/static/route6/node.tag/next-hop/node.def @@ -0,0 +1,15 @@ +tag: +type: ipv6 +help: Set the next-hop IPv6 router +delete: touch /tmp/static.$PPID +end: if [ -f "/tmp/static.$PPID" ]; then + if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl "$VAR(../@)" "$VAR(@)"; then + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" -c "no ipv6 route $VAR(../@) $VAR(@)" ; + fi; + rm /tmp/static.$PPID; + else + if [ -n "$VAR(./distance/@)" ]; then + DIST="$VAR(./distance/@)"; + fi; + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" -c "ipv6 route $VAR(../@) $VAR(@) $DIST"; + fi; diff --git a/templates/protocols/static/route6/node.tag/next-hop/node.tag/distance/node.def b/templates/protocols/static/route6/node.tag/next-hop/node.tag/distance/node.def new file mode 100644 index 00000000..08a06ad8 --- /dev/null +++ b/templates/protocols/static/route6/node.tag/next-hop/node.tag/distance/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Set distance value for this route +syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)" +comp_help: <1-255> Distance for this route diff --git a/templates/protocols/static/route6/node.tag/next-hop/node.tag/node.def b/templates/protocols/static/route6/node.tag/next-hop/node.tag/node.def new file mode 100644 index 00000000..08dff1a9 --- /dev/null +++ b/templates/protocols/static/route6/node.tag/next-hop/node.tag/node.def @@ -0,0 +1,2 @@ +help: Set next-hop router + diff --git a/templates/protocols/static/route6/node.tag/node.def b/templates/protocols/static/route6/node.tag/node.def new file mode 100644 index 00000000..7e15c498 --- /dev/null +++ b/templates/protocols/static/route6/node.tag/node.def @@ -0,0 +1,3 @@ +help: Set IP network +commit:expression: $VAR(./next-hop/) != "" || $VAR(./blackhole/) != ""; "Must add either a next-hop or blackhole for route $VAR(@)" + |