summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-01 08:45:21 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-01 08:45:21 -0700
commit6be23f1b642cb5954218400534e0d2ae456fe8e6 (patch)
tree1451b93f7bdb09c382c65d29dcd1cb9682f8ad51
parent09ff3f81b09c15ea2e5ceea86ecf29738d8e5edf (diff)
downloadvyatta-cfg-quagga-6be23f1b642cb5954218400534e0d2ae456fe8e6.tar.gz
vyatta-cfg-quagga-6be23f1b642cb5954218400534e0d2ae456fe8e6.zip
Use interface check program
For consistency all templates should use same script to validate interface names.
-rw-r--r--templates/service/dns/dynamic/interface/node.def33
-rw-r--r--templates/service/dns/forwarding/listen-on/node.def19
2 files changed, 11 insertions, 41 deletions
diff --git a/templates/service/dns/dynamic/interface/node.def b/templates/service/dns/dynamic/interface/node.def
index b540d2b2..c402e483 100644
--- a/templates/service/dns/dynamic/interface/node.def
+++ b/templates/service/dns/dynamic/interface/node.def
@@ -1,30 +1,15 @@
tag:
help: Set interface to send DDNS updates for
type: txt
-
-allowed: local -a array ;
- array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev));
- echo -n ${array[@]%:*}
-
+allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=all
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=all"
commit:expression: $VAR(./@/service/@@) != ""; "At least one service must be set to send DDNS updates for $VAR(@)"
-delete:expression: "touch /tmp/ddclient_$VAR(@).$PPID"
+delete:touch /tmp/ddclient_$VAR(@).$PPID
-end:expression: "if [ -f \"/tmp/ddclient_$VAR(@).$PPID\" ]; then \
- sudo /opt/vyatta/sbin/vyatta-dynamic-dns.pl --stop-dynamicdns --interface $VAR(@) \
- 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; "
+end: if [ -f /tmp/ddclient_$VAR(@).$PPID ]; then
+ sudo /opt/vyatta/sbin/vyatta-dynamic-dns.pl --stop-dynamicdns --interface $VAR(@)
+ rm /tmp/ddclient_$VAR(@).$PPID
+ else
+ sudo /opt/vyatta/sbin/vyatta-dynamic-dns.pl --update-dynamicdns --interface $VAR(@)
+ fi
diff --git a/templates/service/dns/forwarding/listen-on/node.def b/templates/service/dns/forwarding/listen-on/node.def
index 9510cebe..9032b7f0 100644
--- a/templates/service/dns/forwarding/listen-on/node.def
+++ b/templates/service/dns/forwarding/listen-on/node.def
@@ -1,20 +1,5 @@
multi:
type: txt
help: Set interface to listen for DNS queries
-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));
- echo -n ${array[@]%:*}
+allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=all
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=all"