summaryrefslogtreecommitdiff
path: root/templates/interfaces/tunnel/node.def
diff options
context:
space:
mode:
authorJon Andersson <jon.andersson@Thalesgroup.com>2011-08-11 12:49:40 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-08-11 12:49:40 -0500
commit696972c4d2089979fbfc884a9c03a6d2dae5bd25 (patch)
tree72de4c890b3ec223d4d38a205e41c535bd2a1dec /templates/interfaces/tunnel/node.def
parent11838faf598644c436d5d16c689918503b31185e (diff)
downloadvyatta-cfg-quagga-696972c4d2089979fbfc884a9c03a6d2dae5bd25.tar.gz
vyatta-cfg-quagga-696972c4d2089979fbfc884a9c03a6d2dae5bd25.zip
Initial checkin of ipv6 tunnel support
Diffstat (limited to 'templates/interfaces/tunnel/node.def')
-rw-r--r--templates/interfaces/tunnel/node.def72
1 files changed, 44 insertions, 28 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