summaryrefslogtreecommitdiff
path: root/templates/interfaces/tunnel/node.def
blob: 34ef1ad6daea6a94a5dde280a3cbf8aec71bec21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
tag:
priority: 380
type: txt
help: Set tunnel interface name
comp_help: Enter tunnel interface name (tun0 - tun999)

syntax:expression: pattern $VAR(@) "^tun[0-9]+$" \
		   ; "tunnel must be (tun0-tun999)"

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:expression: "\
       if [ -n \"$VAR(./key/@)\" ]; then                        \
          KEY=\"key $VAR(./key/@)\";                            \
       fi;                                                      \
       if [ x$VAR(./multicast/@) == xenable ]; then             \
          MC=\"multicast on allmulticast on\";                  \
       fi;                                                      \
       ip tunnel add $VAR(@)                               \
            local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) \
            mode $VAR(./encapsulation/@) $KEY;                  \
       ip link set $VAR(@) $MC up;" ;                      \
            "Error creating $VAR(@)"

delete:expression: "ip tunnel del $VAR(@)" ; "Error deleting $VAR(@)"