summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2008-08-05 01:53:32 +0000
committerMohit Mehta <mohit.mehta@vyatta.com>2008-08-05 01:53:32 +0000
commitd49c9edf95ecb4a94ad3800c336d081030e764c1 (patch)
treec7a615597c12825f9bc358fe3d91c84de111137e
parentf6dbf8f85e1bcc2e01810e4b5989ee92345abfe1 (diff)
downloadvyatta-cfg-system-d49c9edf95ecb4a94ad3800c336d081030e764c1.tar.gz
vyatta-cfg-system-d49c9edf95ecb4a94ad3800c336d081030e764c1.zip
- add ability to set cache-size for DNS forwarding from CLI
- restart dnsmasq when /etc/hosts is modified from CLI to re-read added or deleted hosts
-rw-r--r--scripts/dns-forwarding/vyatta-dns-forwarding.pl8
-rw-r--r--templates/service/dns-forwarding/cache-size/node.def4
-rw-r--r--templates/system/static-host-mapping/host-name/node.def17
3 files changed, 21 insertions, 8 deletions
diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl
index 01111d4a..4eebf6d7 100644
--- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl
+++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl
@@ -39,12 +39,12 @@ sub dnsforwarding_init {
}
sub dnsforwarding_restart {
- system("$dnsforwarding_init restart 2&>1 /dev/null");
+ system("$dnsforwarding_init restart >&/dev/null");
print "Setting up DNS forwarding.\n";
}
sub dnsforwarding_stop {
- system("$dnsforwarding_init stop 2&>1 /dev/null");
+ system("$dnsforwarding_init stop >&/dev/null");
print "Stopping DNS forwarding.\n";
}
@@ -62,6 +62,10 @@ sub dnsforwarding_get_values {
my $config = new VyattaConfig;
$config->setLevel("service dns-forwarding");
+ my $cache_size = $config->returnValue("cache-size");
+ if (defined $cache_size) {
+ $output .= "cache-size=$cache_size\n";
+ }
return $output;
}
diff --git a/templates/service/dns-forwarding/cache-size/node.def b/templates/service/dns-forwarding/cache-size/node.def
new file mode 100644
index 00000000..3a73f308
--- /dev/null
+++ b/templates/service/dns-forwarding/cache-size/node.def
@@ -0,0 +1,4 @@
+type: u32
+default:150
+help: Set DNS forwarding cache size
+syntax:expression: ($VAR(@) >=0 && $VAR(@) < 10001) ; "Cache size must be between 0 and 10000"
diff --git a/templates/system/static-host-mapping/host-name/node.def b/templates/system/static-host-mapping/host-name/node.def
index 189025e3..187b21dd 100644
--- a/templates/system/static-host-mapping/host-name/node.def
+++ b/templates/system/static-host-mapping/host-name/node.def
@@ -3,9 +3,14 @@ type: txt
help: Set to map DNS names to system interfaces
syntax:expression: pattern $VAR(@) "^[-a-zA-Z0-9.]+$" ; "invalid host name $VAR(@)"
commit:expression: $VAR(./inet) != ""; "IP address for the static mapping must be set"
-end:expression: "sudo sh -c \"\
- touch /etc/hosts; \
- sed -i '/ $VAR(@) .*#vyatta entry/d' /etc/hosts; \
- if [ -z \"$VAR(./inet/@)\" ]; then exit 0; fi; \
- declare -a aliases=( $VAR(alias/@@) ); \
- echo \\\"$VAR(inet/@)\t $VAR(@) \\${aliases[*]} \t #vyatta entry\\\" \ >> /etc/hosts\" "
+end: sudo sh -c "
+ touch /etc/hosts
+ sed -i '/ $VAR(@) .*#vyatta entry/d' /etc/hosts
+ if [ -z \"$VAR(./inet/@)\" ]; then
+ if [ -d /opt/vyatta/config/active/service/dns-forwarding ]; then /etc/init.d/dnsmasq restart >&/dev/null; fi
+ exit 0
+ fi
+ declare -a aliases=( $VAR(alias/@@) )
+ echo -e \"$VAR(inet/@)\\t $VAR(@) \${aliases[*]} \\t #vyatta entry\" >> /etc/hosts
+ if [ -d /opt/vyatta/config/active/service/dns-forwarding ]; then /etc/init.d/dnsmasq restart >&/dev/null; fi"
+