diff options
author | William Steve Applegate <wsapplegate@est.un.goret.info> | 2014-03-19 03:38:09 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2014-11-21 18:54:50 +0100 |
commit | 4f1a9a70568f795148d64ddc379db23f3f6da164 (patch) | |
tree | 00dc88b9c260c811e3656b458b9a707fbd5b5a45 /templates | |
parent | f0b4b43b5091b025ec2ddf48e0d785d67b110c69 (diff) | |
download | vyatta-cfg-quagga-4f1a9a70568f795148d64ddc379db23f3f6da164.tar.gz vyatta-cfg-quagga-4f1a9a70568f795148d64ddc379db23f3f6da164.zip |
Add kludge to setup IPv6 routes for policy routing.
Signed-off-by: Daniil Baturin <daniil@baturin.org>
Diffstat (limited to 'templates')
10 files changed, 124 insertions, 0 deletions
diff --git a/templates/protocols/static/table/node.tag/interface-route6/node.def b/templates/protocols/static/table/node.tag/interface-route6/node.def new file mode 100644 index 00000000..0015e601 --- /dev/null +++ b/templates/protocols/static/table/node.tag/interface-route6/node.def @@ -0,0 +1,7 @@ +tag: +type: ipv6net +help: Interface based IPv6 static route +syntax:expression: exec "${vyatta_sbindir}/check_prefix_boundary $VAR(@)" + +commit:expression: $VAR(./next-hop-interface/) != "" ; \ + "Must add a next-hop-interface for route $VAR(@)" diff --git a/templates/protocols/static/table/node.tag/interface-route6/node.tag/next-hop-interface/node.def b/templates/protocols/static/table/node.tag/interface-route6/node.tag/next-hop-interface/node.def new file mode 100644 index 00000000..60e75f78 --- /dev/null +++ b/templates/protocols/static/table/node.tag/interface-route6/node.tag/next-hop-interface/node.def @@ -0,0 +1,34 @@ +tag: +type: txt +help: Next-hop interface [REQUIRED] +# show all current interface +# but syntax accepts any interface since it may exist later (ppp etc) +allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show all + +end: + if [[ -n "$VAR(../../../table/@)" ]] + then + table="table $VAR(../../../table/@)" + fi + if [[ -z "$VAR(./disable)" ]] + then + if [[ ${COMMIT_ACTION} = 'DELETE' ]] + then + if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv6 interface; then + exit 1; + fi + + vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@) $table" + else + if [[ -n "$VAR(./distance/@)" ]] + then + dist="$VAR(./distance/@)" + fi + vtysh -c "configure terminal" \ + -c "ipv6 route $VAR(../@) $VAR(@) $table $dist"; + fi + else + vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@) $table" + fi diff --git a/templates/protocols/static/table/node.tag/interface-route6/node.tag/next-hop-interface/node.tag/disable/node.def b/templates/protocols/static/table/node.tag/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/table/node.tag/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/table/node.tag/interface-route6/node.tag/next-hop-interface/node.tag/distance/node.def b/templates/protocols/static/table/node.tag/interface-route6/node.tag/next-hop-interface/node.tag/distance/node.def new file mode 100644 index 00000000..61abcc65 --- /dev/null +++ b/templates/protocols/static/table/node.tag/interface-route6/node.tag/next-hop-interface/node.tag/distance/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Distance value for this route +syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)" +val_help: u32:1-255; Distance for this route diff --git a/templates/protocols/static/table/node.tag/route6/node.def b/templates/protocols/static/table/node.tag/route6/node.def new file mode 100644 index 00000000..de3f1cd8 --- /dev/null +++ b/templates/protocols/static/table/node.tag/route6/node.def @@ -0,0 +1,7 @@ +tag: +type: ipv6net +help: Static IPv6 route +syntax:expression: exec "${vyatta_sbindir}/check_prefix_boundary $VAR(@)" + +commit:expression: $VAR(./next-hop/) != "" || $VAR(./blackhole/) != ""; \ + "Must add either a next-hop or blackhole for route $VAR(@)" diff --git a/templates/protocols/static/table/node.tag/route6/node.tag/blackhole/distance/node.def b/templates/protocols/static/table/node.tag/route6/node.tag/blackhole/distance/node.def new file mode 100644 index 00000000..61abcc65 --- /dev/null +++ b/templates/protocols/static/table/node.tag/route6/node.tag/blackhole/distance/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Distance value for this route +syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)" +val_help: u32:1-255; Distance for this route diff --git a/templates/protocols/static/table/node.tag/route6/node.tag/blackhole/node.def b/templates/protocols/static/table/node.tag/route6/node.tag/blackhole/node.def new file mode 100644 index 00000000..a4d3fe8a --- /dev/null +++ b/templates/protocols/static/table/node.tag/route6/node.tag/blackhole/node.def @@ -0,0 +1,21 @@ +help: Silently discard pkts when matched + +end: + if [[ -n "$VAR(../../../table/@)" ]] + then + table="table $VAR(../../../table/@)" + fi + if [ ${COMMIT_ACTION} = 'DELETE' ]; then + if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv6 address; then + exit 1; + fi + + vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) null0 $table"; + else + if [ -n "$VAR(./distance/@)" ]; then + dist="$VAR(./distance/@)"; + fi; + vtysh -c "configure terminal" \ + -c "ipv6 route $VAR(../@) null0 $table $dist"; + fi; diff --git a/templates/protocols/static/table/node.tag/route6/node.tag/next-hop/node.def b/templates/protocols/static/table/node.tag/route6/node.tag/next-hop/node.def new file mode 100644 index 00000000..20514d0f --- /dev/null +++ b/templates/protocols/static/table/node.tag/route6/node.tag/next-hop/node.def @@ -0,0 +1,41 @@ +tag: + +type: ipv6 + +help: Next-hop IPv6 router [REQUIRED] + +end: + if [[ -n "$VAR(../../../table/@)" ]] + then + table="table $VAR(../../../table/@)" + fi + if [[ -z "$VAR(./disable)" ]] + then + if [[ ${COMMIT_ACTION} = 'DELETE' ]] + then + if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv6 address; then + exit 1; + fi + if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ + "$VAR(../@)" "$VAR(@)" + then + vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@) $table" + fi + else + if [[ -n "$VAR(./distance/@)" ]] + then + DIST="$VAR(./distance/@)" + fi + + vtysh -c "configure terminal" \ + -c "ipv6 route $VAR(../@) $VAR(@) $table $DIST"; + fi + else + if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ + "$VAR(../@)" "$VAR(@)" + then + vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@) $table" + fi + fi diff --git a/templates/protocols/static/table/node.tag/route6/node.tag/next-hop/node.tag/disable/node.def b/templates/protocols/static/table/node.tag/route6/node.tag/next-hop/node.tag/disable/node.def new file mode 100644 index 00000000..a71e3c24 --- /dev/null +++ b/templates/protocols/static/table/node.tag/route6/node.tag/next-hop/node.tag/disable/node.def @@ -0,0 +1 @@ +help: Disable IPv6 next-hop static route diff --git a/templates/protocols/static/table/node.tag/route6/node.tag/next-hop/node.tag/distance/node.def b/templates/protocols/static/table/node.tag/route6/node.tag/next-hop/node.tag/distance/node.def new file mode 100644 index 00000000..61abcc65 --- /dev/null +++ b/templates/protocols/static/table/node.tag/route6/node.tag/next-hop/node.tag/distance/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Distance value for this route +syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)" +val_help: u32:1-255; Distance for this route |