summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2008-08-05 07:22:38 +0000
committerMohit Mehta <mohit.mehta@vyatta.com>2008-08-05 07:22:38 +0000
commit24ea5effd365d09abf7bdfa7e2c1f6601cacda50 (patch)
treed13e611facc65d680abbe61b53da0e3e636d9973
parent505a40f29bff4799e1fa53ea5f4b7d6697975a31 (diff)
downloadvyatta-cfg-quagga-24ea5effd365d09abf7bdfa7e2c1f6601cacda50.tar.gz
vyatta-cfg-quagga-24ea5effd365d09abf7bdfa7e2c1f6601cacda50.zip
add command for user to enter interfaces on which not to listen for DNS queries
-rw-r--r--scripts/dns-forwarding/vyatta-dns-forwarding.pl8
-rw-r--r--templates/service/dns-forwarding/ignore-interface/node.def19
2 files changed, 27 insertions, 0 deletions
diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl
index 4eebf6d7..1fb2282a 100644
--- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl
+++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl
@@ -62,6 +62,14 @@ sub dnsforwarding_get_values {
my $config = new VyattaConfig;
$config->setLevel("service dns-forwarding");
+
+ my @ignore_interfaces = $config->returnValues("ignore-interface");
+ if ($#ignore_interfaces >= 0) {
+ foreach my $interface (@ignore_interfaces) {
+ $output .= "except-interface=$interface\n";
+ }
+ }
+
my $cache_size = $config->returnValue("cache-size");
if (defined $cache_size) {
$output .= "cache-size=$cache_size\n";
diff --git a/templates/service/dns-forwarding/ignore-interface/node.def b/templates/service/dns-forwarding/ignore-interface/node.def
new file mode 100644
index 00000000..5355eecf
--- /dev/null
+++ b/templates/service/dns-forwarding/ignore-interface/node.def
@@ -0,0 +1,19 @@
+multi:
+type: txt
+help: Set interface to ignore DNS queries on
+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
+ if [ \"${intf_array[$i]}\" == \"$VAR(@):\" ] ; then
+ exit 0
+ fi
+ let i++
+ done
+ echo Invalid ethernet interface [$VAR(@)]
+ exit 1 "
+
+allowed: local -a array ;
+ array=($(awk '$1 ~ /:$/ { print $1 }' /proc/net/dev));
+ echo -n ${array[@]%:}