diff options
Diffstat (limited to 'templates/interfaces/tunnel/node.def')
-rw-r--r-- | templates/interfaces/tunnel/node.def | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/templates/interfaces/tunnel/node.def b/templates/interfaces/tunnel/node.def index 85bed6ac..7490f336 100644 --- a/templates/interfaces/tunnel/node.def +++ b/templates/interfaces/tunnel/node.def @@ -8,17 +8,18 @@ syntax:expression: pattern $VAR(@) "^tun[0-9]+$" \ commit:expression: $VAR(./local-ip/) != "" ; \ "Must configure the tunnel local-ip for $VAR(@)" -commit:expression: $VAR(./remote-ip/) != "" ; \ - "Must configure the tunnel remote-ip for $VAR(@)" commit:expression: $VAR(./encapsulation/) != "" ; \ "Must configure the tunnel encapsulation for $VAR(@)" create: + if [ "$VAR(./encapsulation/@)" == "gre-multipoint" ]; then + sudo invoke-rc.d opennhrp.init start; + fi if [ x$VAR(./multicast/@) == xenable ]; then MC="multicast on allmulticast on"; fi case "$VAR(./encapsulation/@)" in - "gre" | "ipip" | "sit") + "gre" | "ipip" | "sit" | "gre-multipoint") 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; @@ -29,8 +30,15 @@ create: 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" + if [ "$VAR(./encapsulation/@)" == "gre-multipoint" ]; then + ip tunnel add $VAR(@) local $VAR(./local-ip/@) mode gre $KEY $TTL + else + ip tunnel add $VAR(@) local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) mode $VAR(./encapsulation/@) $KEY $TTL + fi + if [ -z "`ip tun sh | grep $VAR(@)`" ]; then + echo interfaces tunnel $VAR(@): error creating tunnel interface + exit 1 + fi ;; "gre-bridge") ip link add $VAR(@) type gretap local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) || @@ -53,10 +61,15 @@ delete: ip link delete $VAR(@) ;; "ipip6" | "ip6ip6") ip -6 tunnel del $VAR(@) mode $VAR(./encapsulation/@);; + "gre-multipoint") + ip tunnel del $VAR(@) mode gre;; 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 + if [ -e /opt/vyatta/sbin/vyatta-update-nhrp.pl ]; then + sudo /opt/vyatta/sbin/vyatta-update-nhrp.pl --tun "$VAR(@)" --commit_tun; + fi |