From 7826986414a6b5b2597ed0e39ad4c1975900115e Mon Sep 17 00:00:00 2001
From: Mohit Mehta <mohit.mehta@vyatta.com>
Date: Tue, 6 Jan 2009 11:24:04 -0800
Subject: Fix Bug 4022 dynamic dns config fails during system boot if interface
 does not exist - Generate a warning rather than a commit fail when user
 enters a non-existent interface

---
 templates/service/dns/dynamic/interface/node.def | 25 ++++++++++++------------
 1 file changed, 12 insertions(+), 13 deletions(-)

(limited to 'templates/service/dns/dynamic/interface/node.def')

diff --git a/templates/service/dns/dynamic/interface/node.def b/templates/service/dns/dynamic/interface/node.def
index bbf0c310..cf7483bb 100644
--- a/templates/service/dns/dynamic/interface/node.def
+++ b/templates/service/dns/dynamic/interface/node.def
@@ -1,19 +1,6 @@
 tag:
 help: Set interface to send DDNS updates for
 type: txt
-syntax:expression: exec "
-        intf_array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev))
-        intf_array_len=${#intf_array[*]}
-        i=0
-        while [ $i -lt $intf_array_len ]; do
-             temp=${intf_array[$i]%:*}
-             if [ \"$temp\" == \"$VAR(@)\" ] ; then
-                   exit 0
-             fi
-             let i++
-        done
-        echo Invalid interface [$VAR(@)]
-        exit 1 "
 
 allowed: local -a array ;
          array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev));
@@ -28,4 +15,16 @@ end:expression: "if [ -f \"/tmp/ddclient_$VAR(@).$PPID\" ]; then \
         rm /tmp/ddclient_$VAR(@).$PPID; \
       else \
         sudo /opt/vyatta/sbin/vyatta-dynamic-dns.pl --update-dynamicdns --interface $VAR(@); \
+	# generate a warning if interface does not exist on system
+        intf_array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev))
+        intf_array_len=${#intf_array[*]}
+        i=0
+        while [ $i -lt $intf_array_len ]; do
+             temp=${intf_array[$i]%:*}
+             if [ \"$temp\" == \"$VAR(@)\" ] ; then
+                   exit 0
+             fi
+             let i++
+        done
+        echo Dynamic DNS warning : interface [$VAR(@)] does not exist on system
       fi; "
-- 
cgit v1.2.3

