summaryrefslogtreecommitdiff
path: root/templates/interfaces/vti/node.def
blob: 9a5120a6edc4aa2d09fcbc112802b594e3b6a9a6 (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
tag:
priority: 381
type: txt
help: Virtual Tunnel interface
val_help: <vtiN>; Virtual Tunnel interface name
syntax:expression: pattern $VAR(@) "^vti[0-9]+$" \
		   ; "vti must be (vti-vti999)"

begin:
if [ "${COMMIT_ACTION}" == DELETE ]; then
      # check if there is still a reference
      `${vyatta_sbindir}/vyatta-vti-config.pl --checkref --intf=$VAR(@)`
      if [ $? -gt 0 ] ; then
            echo "Interface $VAR(@) is referenced in vpn configuration."
            exit -1
      fi
fi

delete: 
  if [ -d /sys/class/net/$VAR(@) ] ; then
      ip link set $VAR(@) down
      ip tunnel del $VAR(@) mode esp
  fi

end: 
if [ "${COMMIT_ACTION}" == DELETE ]; then
  /opt/vyatta/sbin/vyatta-tunnel-cleanup $VAR(@)
fi