summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/interfaces/tunnel/node.def72
-rw-r--r--templates/interfaces/tunnel/node.tag/bridge-group/bridge/node.def16
-rw-r--r--templates/interfaces/tunnel/node.tag/encapsulation/node.def7
-rw-r--r--templates/interfaces/tunnel/node.tag/key/node.def18
-rw-r--r--templates/interfaces/tunnel/node.tag/local-ip/node.def31
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/bridge/node.def16
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/cost/node.def (renamed from templates/interfaces/tunnel/node.tag/bridge-group/cost/node.def)0
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/node.def (renamed from templates/interfaces/tunnel/node.tag/bridge-group/node.def)0
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/priority/node.def (renamed from templates/interfaces/tunnel/node.tag/bridge-group/priority/node.def)0
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ip/key/node.def18
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ip/node.def1
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ip/tos/node.def10
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ip/ttl/node.def10
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ipv6/encaplimit/node.def19
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ipv6/flowlabel/node.def20
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ipv6/hoplimit/node.def19
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ipv6/node.def9
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/ipv6/tclass/node.def20
-rw-r--r--templates/interfaces/tunnel/node.tag/parameters/node.def1
-rw-r--r--templates/interfaces/tunnel/node.tag/remote-ip/node.def28
-rw-r--r--templates/interfaces/tunnel/node.tag/tos/node.def7
-rw-r--r--templates/interfaces/tunnel/node.tag/ttl/node.def8
22 files changed, 244 insertions, 86 deletions
diff --git a/templates/interfaces/tunnel/node.def b/templates/interfaces/tunnel/node.def
index 669f7636..85bed6ac 100644
--- a/templates/interfaces/tunnel/node.def
+++ b/templates/interfaces/tunnel/node.def
@@ -13,34 +13,50 @@ commit:expression: $VAR(./remote-ip/) != "" ; \
commit:expression: $VAR(./encapsulation/) != "" ; \
"Must configure the tunnel encapsulation for $VAR(@)"
-create:if [ -n "$VAR(./key/@)" ]; then
- KEY="key $VAR(./key/@)";
- fi
- if [ x$VAR(./multicast/@) == xenable ]; then
- MC="multicast on allmulticast on";
- fi
- if [ -n "$VAR(./bridge-group/)" ] && [ "$VAR(./encapsulation/@)" != "gre-bridge" ]; then
- echo "interfaces tunnel $VAR(@): Tunnel encapsulation type must be gre-bridge if a bridge group is defined";
- exit 1;
- fi
- if [ "$VAR(./encapsulation/@)" == "gre-bridge" ]; then
- ip link add $VAR(@) type gretap local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) ||
- echo "interfaces tunnel $VAR(@): error creating tunnel interface"
- else
- ip tunnel add $VAR(@) local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) mode $VAR(./encapsulation/@) $KEY ||
- echo "interfaces tunnel $VAR(@): error creating tunnel interface"
- fi
- ip link set $VAR(@) $MC up ||
- echo "interfaces tunnel $VAR(@): error setting tunnel interface active"
+create:
+ if [ x$VAR(./multicast/@) == xenable ]; then
+ MC="multicast on allmulticast on";
+ fi
+ case "$VAR(./encapsulation/@)" in
+ "gre" | "ipip" | "sit")
+ 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;
+ fi
+ if [ -z "$VAR(./parameters/ip/ttl/@)" ]; then
+ TTL="ttl 255"
+ fi
+ if [ -n "$VAR(./parameters/ip/key/@)" ]; then
+ KEY="key $VAR(./parameters/ip/key/@)";
+ fi
+ ip tunnel add $VAR(@) local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) mode $VAR(./encapsulation/@) $KEY $TTL ||
+ echo "interfaces tunnel $VAR(@): error creating tunnel interface"
+ ;;
+ "gre-bridge")
+ ip link add $VAR(@) type gretap local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) ||
+ echo "interfaces tunnel $VAR(@): error creating tunnel interface"
+ ;;
+ "ipip6" | "ip6ip6")
+ ip -6 tunnel add $VAR(@) local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) mode $VAR(./encapsulation/@) ||
+ echo "interfaces tunnel $VAR(@): error creating tunnel interface"
+ ;;
+ esac
+ ip link set $VAR(@) $MC up ||
+ echo "interfaces tunnel $VAR(@): error setting tunnel interface active"
-delete: ip link set $VAR(@) down
- if [ "$VAR(./encapsulation/@)" == "gre-bridge" ]; then
- ip link delete $VAR(@)
- else
- ip tunnel del $VAR(@) mode $VAR(./encapsulation/@)
- fi
+delete:
+ ip link set $VAR(@) down
+ case "$VAR(./encapsulation/@)" in
+ "gre" | "ipip" | "sit")
+ ip tunnel del $VAR(@) mode $VAR(./encapsulation/@);;
+ "gre-bridge")
+ ip link delete $VAR(@) ;;
+ "ipip6" | "ip6ip6")
+ ip -6 tunnel del $VAR(@) mode $VAR(./encapsulation/@);;
+ esac
-end: if [ "${COMMIT_ACTION}" == DELETE ]; then
- /opt/vyatta/sbin/vyatta-tunnel-cleanup $VAR(@)
- fi
+end:
+if [ "${COMMIT_ACTION}" == DELETE ]; then
+ /opt/vyatta/sbin/vyatta-tunnel-cleanup $VAR(@)
+fi
diff --git a/templates/interfaces/tunnel/node.tag/bridge-group/bridge/node.def b/templates/interfaces/tunnel/node.tag/bridge-group/bridge/node.def
deleted file mode 100644
index 5100a190..00000000
--- a/templates/interfaces/tunnel/node.tag/bridge-group/bridge/node.def
+++ /dev/null
@@ -1,16 +0,0 @@
-type: txt
-help: Bridge group interface
-allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=bridge
-commit:expression: exec \
- "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=bridge"
-commit:expression: $VAR(../../encapsulation/@) == "gre-bridge"; "tunnel encapsulation type must be gre-bridge"
-create:
- # TODO: need to add logic for update as we need to remove the interface first.
- if [ "$(ip link show $VAR(../../@) | grep ether)" ]; then
- sudo brctl addif $VAR(@) $VAR(../../@) ||
- echo interfaces tunnel $VAR(../../@) bridge-group bridge $VAR(@): error adding interface to bridge
- else
- echo interfaces tunnel $VAR(../../@) bridge-group bridge $VAR(@): tunnel encapsulation type must be gre-bridge
- exit 1
- fi
-delete: sudo brctl delif $VAR(@) $VAR(../../@)
diff --git a/templates/interfaces/tunnel/node.tag/encapsulation/node.def b/templates/interfaces/tunnel/node.tag/encapsulation/node.def
index 651e79b8..b0df7a10 100644
--- a/templates/interfaces/tunnel/node.tag/encapsulation/node.def
+++ b/templates/interfaces/tunnel/node.tag/encapsulation/node.def
@@ -1,8 +1,8 @@
type: txt
help: Encapsulation of this tunnel interface [REQUIRED]
-syntax:expression: $VAR(@) in "ipip", "gre", "sit", "gre-bridge"; "Must be (ipip, gre, gre-bridge, sit)"
-allowed: echo gre gre-bridge ipip sit
+syntax:expression: $VAR(@) in "ipip", "gre", "sit", "gre-bridge", "ipip6", "ip6ip6"; "Must be (ipip, gre, gre-bridge, sit, ipip6, ip6ip6)"
+allowed: echo gre gre-bridge ipip sit ipip6 ip6ip6
create:expression: "true"
update:expression: "false" ; \
@@ -12,4 +12,5 @@ val_help: gre; Generic Routing Encapsulation
val_help: gre-bridge; Generic Routing Encapsulation bridge interface
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
diff --git a/templates/interfaces/tunnel/node.tag/key/node.def b/templates/interfaces/tunnel/node.tag/key/node.def
deleted file mode 100644
index 3f4cea4e..00000000
--- a/templates/interfaces/tunnel/node.tag/key/node.def
+++ /dev/null
@@ -1,18 +0,0 @@
-type: u32
-help: Tunnel key
-syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 999999; \
- "Must be between 0-999999 for $VAR(../@)"
-val_help: u32:0-999999; Tunnel key
-
-syntax:expression: exec " \
- if [ -n \"`ip tunnel show $VAR(../@) | grep $VAR(../@) `\" ]; then \
- echo Key can only be set at tunnel creation for $VAR(../@); \
- exit 1 ; \
- fi ; "
-
-commit:expression: $VAR(../encapsulation/@) in "gre" ; \
- "Key only valid for GRE for $VAR(../@)"
-
-create:expression: "true"
-update:expression: "false" ; \
- "Key can only be set at tunnel creation for $VAR(../@)"
diff --git a/templates/interfaces/tunnel/node.tag/local-ip/node.def b/templates/interfaces/tunnel/node.tag/local-ip/node.def
index c60b3adc..5733605a 100644
--- a/templates/interfaces/tunnel/node.tag/local-ip/node.def
+++ b/templates/interfaces/tunnel/node.tag/local-ip/node.def
@@ -1,10 +1,33 @@
-type: ipv4
+type: ipv4, ipv6
help: Local IP address for this tunnel [REQUIRED]
+val_help: ipv4; Local IPv4 address for this tunnel [REQUIRED]
+val_help: ipv6; Local IPv6 address for this tunnel [REQUIRED]
syntax:expression: exec \
"/opt/vyatta/sbin/local_ip $VAR(@) || \
echo Warning! IP address $VAR(@) doesn\\'t exist on this system"
-update: if [ "$VAR(../encapsulation/@)" != "gre-bridge" ]; then
- sudo ip tunnel cha $VAR(../@) local $VAR(@)
- fi
+update:case "$VAR(../encapsulation/@)" in
+ "gre-bridge")
+ ;;
+ "gre" | "ipip" | "sit")
+ sudo ip tunnel cha $VAR(../@) local $VAR(@)
+ ;;
+ "ipip6" | "ip6ip6")
+ if [ -n "$VAR(../parameters/ipv6/encaplimit/@)" ]; then
+ ECL="encaplimit $VAR(../parameters/ipv6/encaplimit/@)"
+ fi
+ if [ -n "$VAR(../parameters/ipv6/hoplimit/@)" ]; then
+ HL="hoplimit $VAR(../parameters/ipv6/hoplimit/@)"
+ fi
+ if [ -n "$VAR(../parameters/ipv6/tclass/@)" ]; then
+ TC="tclass $VAR(../parameters/ipv6/tclass/@)"
+ fi
+ if [ -n "$VAR(../parameters/ipv6/flowlabel/@)" ]; then
+ FL="flowlabel $VAR(../parameters/ipv6/flowlabel/@)"
+ fi
+ sudo ip -6 tunnel cha $VAR(../@) local $VAR(@) \
+ remote $VAR(../remote-ip/@) mode $VAR(../encapsulation/@) \
+ $HL $ECL $TC $FL
+ ;;
+ esac
diff --git a/templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/bridge/node.def b/templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/bridge/node.def
new file mode 100644
index 00000000..85666c41
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/bridge/node.def
@@ -0,0 +1,16 @@
+type: txt
+help: Bridge group interface
+allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=bridge
+commit:expression: exec \
+ "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=bridge"
+commit:expression: $VAR(../../../../encapsulation/@) == "gre-bridge"; "tunnel encapsulation type must be gre-bridge"
+create:
+ # TODO: need to add logic for update as we need to remove the interface first.
+ if [ "$(ip link show $VAR(../../../../@) | grep ether)" ]; then
+ sudo brctl addif $VAR(@) $VAR(../../../../@) ||
+ echo interfaces tunnel $VAR(../../../../@) bridge-group bridge $VAR(@): error adding interface to bridge
+ else
+ echo interfaces tunnel $VAR(../../../../@) bridge-group bridge $VAR(@): tunnel encapsulation type must be gre-bridge
+ exit 1
+ fi
+delete: sudo brctl delif $VAR(@) $VAR(../../../../@)
diff --git a/templates/interfaces/tunnel/node.tag/bridge-group/cost/node.def b/templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/cost/node.def
index 243747b9..243747b9 100644
--- a/templates/interfaces/tunnel/node.tag/bridge-group/cost/node.def
+++ b/templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/cost/node.def
diff --git a/templates/interfaces/tunnel/node.tag/bridge-group/node.def b/templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/node.def
index 663979dd..663979dd 100644
--- a/templates/interfaces/tunnel/node.tag/bridge-group/node.def
+++ b/templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/node.def
diff --git a/templates/interfaces/tunnel/node.tag/bridge-group/priority/node.def b/templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/priority/node.def
index be0ff479..be0ff479 100644
--- a/templates/interfaces/tunnel/node.tag/bridge-group/priority/node.def
+++ b/templates/interfaces/tunnel/node.tag/parameters/ip/bridge-group/priority/node.def
diff --git a/templates/interfaces/tunnel/node.tag/parameters/ip/key/node.def b/templates/interfaces/tunnel/node.tag/parameters/ip/key/node.def
new file mode 100644
index 00000000..b9ed181e
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/ip/key/node.def
@@ -0,0 +1,18 @@
+type: u32
+help: Tunnel key
+syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 999999; \
+ "Must be between 0-999999 for $VAR(../../../@)"
+val_help: u32:0-999999; Tunnel key
+
+syntax:expression: exec " \
+ if [ -n \"`ip tunnel show $VAR(../../../@) | grep $VAR(../../../@) `\" ]; then \
+ echo Key can only be set at tunnel creation for $VAR(../../../@); \
+ exit 1 ; \
+ fi ; "
+
+commit:expression: $VAR(../../../encapsulation/@) in "gre" ; \
+ "Key only valid for GRE for $VAR(../../../@)"
+
+create:expression: "true"
+update:expression: "false" ; \
+ "Key can only be set at tunnel creation for $VAR(../../../@)"
diff --git a/templates/interfaces/tunnel/node.tag/parameters/ip/node.def b/templates/interfaces/tunnel/node.tag/parameters/ip/node.def
new file mode 100644
index 00000000..9ec0a606
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/ip/node.def
@@ -0,0 +1 @@
+help: IPv4 specific tunnel parameters
diff --git a/templates/interfaces/tunnel/node.tag/parameters/ip/tos/node.def b/templates/interfaces/tunnel/node.tag/parameters/ip/tos/node.def
new file mode 100644
index 00000000..c784e512
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/ip/tos/node.def
@@ -0,0 +1,10 @@
+type: u32
+help: Type of Service (TOS)
+syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 99; "Must be between 0-99"
+val_help: u32:0-99; Type Of Service (TOS)
+
+commit:expression: $VAR(../../../encapsulation/@) in "gre", "sit", "ipip" ; \
+ "tunnel encapsulation must be GRE, SIT or IPIP"
+
+update: ip tunnel change $VAR(../../../@) tos $VAR(@)
+delete: ip tunnel change $VAR(../../../@) tos inherit
diff --git a/templates/interfaces/tunnel/node.tag/parameters/ip/ttl/node.def b/templates/interfaces/tunnel/node.tag/parameters/ip/ttl/node.def
new file mode 100644
index 00000000..24d27104
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/ip/ttl/node.def
@@ -0,0 +1,10 @@
+type: u32
+help: Time to live field
+val_help: u32:0-255; Time to live (default 255)
+
+syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 255; "Must be between 0-255"
+commit:expression: $VAR(../../../encapsulation/@) in "gre", "sit", "ipip" ; \
+ "tunnel encapsulation must be GRE, SIT or IPIP"
+
+update:sudo ip tunnel change $VAR(../../../@) ttl $VAR(@)
+delete:sudo ip tunnel change $VAR(../../../@) ttl inherit
diff --git a/templates/interfaces/tunnel/node.tag/parameters/ipv6/encaplimit/node.def b/templates/interfaces/tunnel/node.tag/parameters/ipv6/encaplimit/node.def
new file mode 100644
index 00000000..80d90cfa
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/ipv6/encaplimit/node.def
@@ -0,0 +1,19 @@
+type: txt
+help: Encaplimit field
+default: "4"
+val_help: <0-255>; Encaplimit (default 4)
+val_help: none; Encaplimit disabled
+
+syntax:expression: $VAR(@) == "none" || (pattern $VAR(@) "^([01]?[[:digit:]][[:digit:]]?|2[0-4][[:digit:]]|25[0-5])$"); "Must be 'none' or a number <0-255>"
+update:if [ -n "$VAR(../hoplimit/@)" ]; then
+ HL="hoplimit $VAR(../hoplimit/@)"
+ fi;
+ if [ -n "$VAR(../tclass/@)" ]; then
+ TC="tclass $VAR(../tclass/@)"
+ fi;
+ if [ -n "$VAR(../flowlabel/@)" ]; then
+ FL="flowlabel $VAR(../flowlabel/@)"
+ fi;
+ sudo ip -6 tunnel change $VAR(../../../@) \
+ local $VAR(../../../local-ip/@) remote $VAR(../../../remote-ip/@) \
+ encaplimit $VAR(@) mode $VAR(../../../encapsulation/@) $HL $TC $FL
diff --git a/templates/interfaces/tunnel/node.tag/parameters/ipv6/flowlabel/node.def b/templates/interfaces/tunnel/node.tag/parameters/ipv6/flowlabel/node.def
new file mode 100644
index 00000000..919ad69a
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/ipv6/flowlabel/node.def
@@ -0,0 +1,20 @@
+type: txt
+help: Flowlabel
+default: "0x00000"
+syntax:expression: $VAR(@) == "inherit" || (pattern $VAR(@) "^0x([0]?[[:xdigit:]][[:xdigit:]]?[[:xdigit:]]?[[:xdigit:]]?[[:xdigit:]]?)$") ; "Must be 'inherit' or a number"
+val_help: <0-0xfffff>; Flowlabel
+val_help: inherit; Flowlabel (default)
+
+update:if [ -n "$VAR(../hoplimit/@)" ]; then
+ HL="hoplimit $VAR(../hoplimit/@)"
+ fi;
+ if [ -n "$VAR(../encaplimit/@)" ]; then
+ ECL="encaplimit $VAR(../encaplimit/@)"
+ fi;
+ if [ -n "$VAR(../tclass/@)" ]; then
+ TC="tclass $VAR(../tclass/@)"
+ fi;
+ sudo ip -6 tunnel change $VAR(../../../@) \
+ local $VAR(../../../local-ip/@) remote $VAR(../../../remote-ip/@) \
+ mode $VAR(../../../encapsulation/@) \
+ $HL $ECL $TC flowlabel $VAR(@)
diff --git a/templates/interfaces/tunnel/node.tag/parameters/ipv6/hoplimit/node.def b/templates/interfaces/tunnel/node.tag/parameters/ipv6/hoplimit/node.def
new file mode 100644
index 00000000..5c4c29ea
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/ipv6/hoplimit/node.def
@@ -0,0 +1,19 @@
+type: u32
+help: Hoplimit
+default: 64
+val_help: u32:0-255; Hoplimit (default 64)
+
+syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 255; "Must be between 0-255"
+update:if [ -n "$VAR(../encaplimit/@)" ]; then
+ ECL="encaplimit $VAR(../encaplimit/@)"
+ fi;
+ if [ -n "$VAR(../tclass/@)" ]; then
+ TC="tclass $VAR(../tclass/@)"
+ fi;
+ if [ -n "$VAR(../flowlabel/@)" ]; then
+ FL="flowlabel $VAR(../flowlabel/@)"
+ fi;
+ sudo ip -6 tunnel change $VAR(../../../@) \
+ local $VAR(../../../local-ip/@) remote $VAR(../../../remote-ip/@) \
+ mode $VAR(../../../encapsulation/@) \
+ hoplimit $VAR(@) $ECL $TC $FL
diff --git a/templates/interfaces/tunnel/node.tag/parameters/ipv6/node.def b/templates/interfaces/tunnel/node.tag/parameters/ipv6/node.def
new file mode 100644
index 00000000..d6dc668a
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/ipv6/node.def
@@ -0,0 +1,9 @@
+help: IPv6 specific tunnel parameters
+end:
+ # set all parameters back to defaults if deleting this node
+ if [[ "${COMMIT_ACTION}" == "DELETE" ]]; then
+ sudo ip -6 tunnel change $VAR(../../@) \
+ local $VAR(../../local-ip/@) remote $VAR(../../remote-ip/@) \
+ hoplimit 64 encaplimit 4 tclass 0x00 flowlabel 0x00000
+ fi
+
diff --git a/templates/interfaces/tunnel/node.tag/parameters/ipv6/tclass/node.def b/templates/interfaces/tunnel/node.tag/parameters/ipv6/tclass/node.def
new file mode 100644
index 00000000..35da99c7
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/ipv6/tclass/node.def
@@ -0,0 +1,20 @@
+type: txt
+help: Traffic class (Tclass)
+default: "0x00"
+syntax:expression: $VAR(@) == "inherit" || (pattern $VAR(@) "^0x([0]?[[:xdigit:]][[:xdigit:]]?)$"); "Must be 'inherit' or a hexnumber <0-0xff>"
+val_help: <0-0xff>; Traffic class (tclass)
+val_help: inherit; Traffic class (default)
+
+update:if [ -n "$VAR(../hoplimit/@)" ]; then
+ HL="hoplimit $VAR(../hoplimit/@)"
+ fi;
+ if [ -n "$VAR(../encaplimit/@)" ]; then
+ ECL="encaplimit $VAR(../encaplimit/@)"
+ fi;
+ if [ -n "$VAR(../flowlabel/@)" ]; then
+ FL="flowlabel $VAR(../flowlabel/@)"
+ fi;
+ sudo ip -6 tunnel change $VAR(../../../@) \
+ local $VAR(../../../local-ip/@) remote $VAR(../../../remote-ip/@) \
+ mode $VAR(../../../encapsulation/@) \
+ $HL $ECL tclass $VAR(@) $FL
diff --git a/templates/interfaces/tunnel/node.tag/parameters/node.def b/templates/interfaces/tunnel/node.tag/parameters/node.def
new file mode 100644
index 00000000..0c732174
--- /dev/null
+++ b/templates/interfaces/tunnel/node.tag/parameters/node.def
@@ -0,0 +1 @@
+help: Tunnel parameters
diff --git a/templates/interfaces/tunnel/node.tag/remote-ip/node.def b/templates/interfaces/tunnel/node.tag/remote-ip/node.def
index f24397b8..1ce6c789 100644
--- a/templates/interfaces/tunnel/node.tag/remote-ip/node.def
+++ b/templates/interfaces/tunnel/node.tag/remote-ip/node.def
@@ -1,5 +1,29 @@
-type: ipv4
+type: ipv4, ipv6
help: Remote IP address for this tunnel [REQUIRED]
-update: if [ "$VAR(../encapsulation/@)" != "gre-bridge" ]; then
+val_help: ipv4; Remote IPv4 address for this tunnel [REQUIRED]
+val_help: ipv6; Remote IPv6 address for this tunnel [REQUIRED]
+
+update:case "$VAR(../encapsulation/@)" in
+ "gre-bridge")
+ ;;
+ "gre" | "ipip" | "sit")
sudo ip tunnel cha $VAR(../@) remote $VAR(@)
+ ;;
+ "ipip6" | "ip6ip6")
+ if [ -n "$VAR(../parameters/ipv6/encaplimit/@)" ]; then
+ ECL="encaplimit $VAR(../parameters/ipv6/encaplimit/@)"
fi
+ if [ -n "$VAR(../parameters/ipv6/hoplimit/@)" ]; then
+ HL="hoplimit $VAR(../parameters/ipv6/hoplimit/@)"
+ fi
+ if [ -n "$VAR(../parameters/ipv6/tclass/@)" ]; then
+ TC="tclass $VAR(../parameters/ipv6/tclass/@)"
+ fi
+ if [ -n "$VAR(../parameters/ipv6/flowlabel/@)" ]; then
+ FL="flowlabel $VAR(../parameters/ipv6/flowlabel/@)"
+ fi
+ sudo ip -6 tunnel cha $VAR(../@) local $VAR(../local-ip/@) \
+ remote $VAR(@) mode $VAR(../encapsulation/@) \
+ $HL $ECL $TC $FL
+ ;;
+ esac
diff --git a/templates/interfaces/tunnel/node.tag/tos/node.def b/templates/interfaces/tunnel/node.tag/tos/node.def
deleted file mode 100644
index 7a7817fc..00000000
--- a/templates/interfaces/tunnel/node.tag/tos/node.def
+++ /dev/null
@@ -1,7 +0,0 @@
-type: u32
-help: Type of Service (TOS)
-syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 99; "Must be between 0-99"
-val_help: u32:0-99; Type Of Service (TOS)
-
-update: ip tunnel change $VAR(../@) tos $VAR(@)
-delete: ip tunnel change $VAR(../@) tos inherit
diff --git a/templates/interfaces/tunnel/node.tag/ttl/node.def b/templates/interfaces/tunnel/node.tag/ttl/node.def
deleted file mode 100644
index fba20795..00000000
--- a/templates/interfaces/tunnel/node.tag/ttl/node.def
+++ /dev/null
@@ -1,8 +0,0 @@
-type: u32
-default: 255
-help: Time to live field
-val_help: u32:0-255; Time to live (default 255)
-
-syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 255; "Must be between 0-255"
-update:if [ "$VAR(../encapsulation/@)" != "gre-bridge" ]; then sudo ip tunnel change $VAR(../@) ttl $VAR(@); fi;
-delete:if [ "$VAR(../encapsulation/@)" != "gre-bridge" ]; then sudo ip tunnel change $VAR(../@) ttl inherit; fi;