From 81b1b1fd957571f74cd38f38fa1496d2d8f047bc Mon Sep 17 00:00:00 2001 From: Saurabh Mohan Date: Mon, 11 Jun 2012 17:48:26 -0700 Subject: VTI delete check for reference under vpn. --- templates/interfaces/vti/node.def | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'templates') diff --git a/templates/interfaces/vti/node.def b/templates/interfaces/vti/node.def index 0d9c422d..9a5120a6 100644 --- a/templates/interfaces/vti/node.def +++ b/templates/interfaces/vti/node.def @@ -6,6 +6,16 @@ val_help: ; 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 -- cgit v1.2.3