diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-06 19:36:53 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-03-06 19:37:05 +0100 |
commit | 14cd4a6ae55b9a3c7d91fa74ba07a8d0f46dc00e (patch) | |
tree | 0edbf63b7fbc5c6f43b69cab164c0749bc1ee751 | |
parent | e60dcd0ba00f0c38f10c7f4e487f7be3e43d277a (diff) | |
download | vyatta-cfg-quagga-14cd4a6ae55b9a3c7d91fa74ba07a8d0f46dc00e.tar.gz vyatta-cfg-quagga-14cd4a6ae55b9a3c7d91fa74ba07a8d0f46dc00e.zip |
vrf: T31: add IPv6 static routing support
8 files changed, 85 insertions, 1 deletions
diff --git a/templates/protocols/vrf/node.tag/static/route/node.def b/templates/protocols/vrf/node.tag/static/route/node.def index 0d17bb4b..43c77c71 100644 --- a/templates/protocols/vrf/node.tag/static/route/node.def +++ b/templates/protocols/vrf/node.tag/static/route/node.def @@ -1,7 +1,7 @@ tag: priority: 482 type: ipv4net -help: Static route +help: VRF static IPv4 route syntax:expression: exec "ipaddrcheck --verbose --is-ipv4-net $VAR(@)" commit:expression: $VAR(./next-hop/) != "" || $VAR(./blackhole/) != "" || $VAR(./dhcp-interface/) != ""; \ diff --git a/templates/protocols/vrf/node.tag/static/route6/node.def b/templates/protocols/vrf/node.tag/static/route6/node.def new file mode 100644 index 00000000..984b6dbe --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/route6/node.def @@ -0,0 +1,8 @@ +tag: +priority: 482 +type: ipv6net +help: VRF static IPv6 route +syntax:expression: exec "ipaddrcheck --verbose --is-ipv6-net $VAR(@)" + +commit:expression: $VAR(./next-hop/) != "" || $VAR(./blackhole/) != ""; \ + "Must add either a next-hop or blackhole for route $VAR(@)" diff --git a/templates/protocols/vrf/node.tag/static/route6/node.tag/blackhole/distance/node.def b/templates/protocols/vrf/node.tag/static/route6/node.tag/blackhole/distance/node.def new file mode 100644 index 00000000..61abcc65 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/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/vrf/node.tag/static/route6/node.tag/blackhole/node.def b/templates/protocols/vrf/node.tag/static/route6/node.tag/blackhole/node.def new file mode 100644 index 00000000..e3f1c967 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/route6/node.tag/blackhole/node.def @@ -0,0 +1,16 @@ +help: Silently discard pkts when matched +end: VRF_NAME=$VAR(../../../@) + 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 vrf $VRF_NAME"; + else + if [ -n "$VAR(./distance/@)" ]; then + DIST="$VAR(./distance/@)"; + fi; + vtysh -c "configure terminal" \ + -c "ipv6 route $VAR(../@) Null0 vrf $VRF_NAME $DIST"; + fi; diff --git a/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.def b/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.def new file mode 100644 index 00000000..b8da3114 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.def @@ -0,0 +1,45 @@ +tag: +type: ipv6 +help: Next-hop IPv6 router [REQUIRED] +end: + VRF_NAME=$VAR(../../../@) + 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 + quagga_conf=`vtysh -c "show running-config" | \ + sed -n '/vrf $VRF_NAME/,/!/p' | \ + grep "^ipv6 route $VAR(../@) $VAR(@)"` + ifname=`echo $quagga_conf | awk '{print $5}'` + + vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@) $ifname vrf $VRF_NAME" + fi + else + if [[ -n "$VAR(./distance/@)" ]] + then + DIST="$VAR(./distance/@)" + fi + + if [[ -n "$VAR(./interface/@)" ]] + then + INTERFACE="$VAR(./interface/@)" + fi + + vtysh -c "configure terminal" \ + -c "ipv6 route $VAR(../@) $VAR(@) $INTERFACE vrf $VRF_NAME $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(@) vrf $VRF_NAME" + fi + fi diff --git a/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.tag/disable/node.def b/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.tag/disable/node.def new file mode 100644 index 00000000..a71e3c24 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/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/vrf/node.tag/static/route6/node.tag/next-hop/node.tag/distance/node.def b/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.tag/distance/node.def new file mode 100644 index 00000000..61abcc65 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/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 diff --git a/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.tag/interface/node.def b/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.tag/interface/node.def new file mode 100644 index 00000000..bd24aca3 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/route6/node.tag/next-hop/node.tag/interface/node.def @@ -0,0 +1,6 @@ +type: txt +help: Outgoing interface +# show all current interface +# but syntax accepts any interface since it may exist later (ppp etc) +allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show all + |