From d238516424882caadbb97a32d3aabaea4fae5c16 Mon Sep 17 00:00:00 2001 From: zsdc Date: Thu, 22 Aug 2019 21:44:03 +0300 Subject: [tunnel] T1593: Added ip6gre encapsulation for tunnel interfaces --- templates/interfaces/tunnel/node.def | 9 +++++++-- templates/interfaces/tunnel/node.tag/encapsulation/node.def | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'templates') diff --git a/templates/interfaces/tunnel/node.def b/templates/interfaces/tunnel/node.def index de5431a3..d42f6560 100644 --- a/templates/interfaces/tunnel/node.def +++ b/templates/interfaces/tunnel/node.def @@ -35,6 +35,9 @@ commit:expression: (!(pattern $VAR(./local-ip/@) ".*:.*") && $VAR(./encapsulatio commit:expression: (!(pattern $VAR(./address/@@) ".*:.*") && $VAR(./encapsulation/@) == "gre" && $VAR(./remote-ip/) == "") || \ $VAR(./encapsulation/@) != "gre" || ($VAR(./encapsulation/@) == "gre" && $VAR(./remote-ip/) != ""); "IPv6 addresses ($VAR(./address/@@)) are forbidden for mGRE tunnels." +commit:expression: !($VAR(./encapsulation/@) == "gre" && ((pattern $VAR(./local-ip/@@) ".*:.*") || (pattern $VAR(./remote-ip/@@) ".*:.*"))); \ + "Using IPv6 address in local-ip or remote-ip is not possible with \"encapsulation gre\". Use \"encapsulation ip6gre\" instead." + create: if [ $VAR(./encapsulation/@) == gre ] && [ -z $VAR(./remote-ip/) ]; then sudo invoke-rc.d opennhrp.init start; @@ -48,7 +51,7 @@ create: LIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$VAR(./dhcp-interface/@) --want=local) fi case "$VAR(./encapsulation/@)" in - "gre" | "ipip" | "sit") + "gre" | "ipip" | "sit" | "ip6gre") if [ -n "$VAR(./parameters/ip/bridge-group/)" ] ; then echo "interfaces tunnel $VAR(@): Tunnel encapsulation type must be gre-bridge if a bridge group is defined"; exit 1; @@ -68,6 +71,8 @@ create: fi if [ "$VAR(./encapsulation/@)" == "gre" ] && [ -z $VAR(./remote-ip/) ]; then sudo ip tunnel add $VAR(@) local $LIP mode gre $KEY $TTL $TOS + elif [ "$VAR(./encapsulation/@)" == "ip6gre" ] && [ -z $VAR(./remote-ip/) ]; then + sudo ip tunnel add $VAR(@) local $LIP mode ip6gre $KEY $TTL $TOS elif [ "$VAR(./encapsulation/@)" == "sit" ] && [ -n "$VAR(./6rd-prefix/@)" ]; then if [ -n "$VAR(./6rd-relay-prefix/@)" ]; then RP="6rd-relay_prefix $VAR(./6rd-relay-prefix/@)" @@ -77,7 +82,7 @@ create: else sudo ip tunnel add $VAR(@) local $LIP remote $VAR(./remote-ip/@) mode $VAR(./encapsulation/@) $KEY $TTL $TOS fi - if [ -z "`ip tunnel show | grep $VAR(@)`" ]; then + if [ -z "`ip tunnel show | grep $VAR(@)`" ] && [ -z "`ip -6 tunnel show | grep $VAR(@)`" ]; then echo interfaces tunnel $VAR(@): error creating tunnel interface exit 1 fi diff --git a/templates/interfaces/tunnel/node.tag/encapsulation/node.def b/templates/interfaces/tunnel/node.tag/encapsulation/node.def index c8d0c7c2..b8f38c0a 100644 --- a/templates/interfaces/tunnel/node.tag/encapsulation/node.def +++ b/templates/interfaces/tunnel/node.tag/encapsulation/node.def @@ -2,8 +2,8 @@ type: txt help: Encapsulation of this tunnel interface [REQUIRED] syntax:expression: ((pattern $VAR(@) "^[-a-zA-Z0-9_]+$") && \ - ($VAR(@) in "gre", "gre-bridge", "ipip", "sit", "ipip6", "ip6ip6"; \ - "Must be (gre gre-bridge ipip sit ipip6 ip6ip6)\n")) + ($VAR(@) in "gre", "gre-bridge", "ipip", "sit", "ipip6", "ip6ip6", "ip6gre"; \ + "Must be (gre gre-bridge ipip sit ipip6 ip6ip6 ip6gre)\n")) create:expression: "true" update:expression: "false" ; \ @@ -15,3 +15,4 @@ val_help: ipip; IP in IP encapsulation val_help: sit; Simple Internet Transition encapsulation val_help: ipip6; IP in IP6 encapsulation val_help: ip6ip6; IP6 in IP6 encapsulation +val_help: ip6gre; GRE over IPv6 network -- cgit v1.2.3