aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-07-01 11:32:46 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-07-01 11:32:46 +0000
commitcd2bdeddc5ca45883a83d42c683c4d46b059f963 (patch)
tree50c116339a55353412bc2a1a590bd391ddba43e6
parent0c3f2b8bd6074fc8888dd4af671879f3901f098b (diff)
downloadupstream-cd2bdeddc5ca45883a83d42c683c4d46b059f963.tar.gz
upstream-cd2bdeddc5ca45883a83d42c683c4d46b059f963.tar.bz2
upstream-cd2bdeddc5ca45883a83d42c683c4d46b059f963.zip
[package] dnsmasq: introduce "add_local_hostname" and "add_local_domain" options
- add_local_domain defaults to 1 and controls whether the local domain is written as search directive to the local resolv.conf - add_local_hostname defaults to 1 and controls whether A and PTR records are created automatically for the local hostname These change supersedes http://patchwork.openwrt.org/patch/2207/ and http://patchwork.openwrt.org/patch/2208/ git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32570 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/dnsmasq/files/dnsmasq.init14
1 files changed, 11 insertions, 3 deletions
diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init
index e90d793368..485a2f7b70 100644
--- a/package/dnsmasq/files/dnsmasq.init
+++ b/package/dnsmasq/files/dnsmasq.init
@@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common
-# Copyright (C) 2007 OpenWrt.org
+# Copyright (C) 2007-2012 OpenWrt.org
START=60
@@ -8,6 +8,9 @@ SERVICE_USE_PID=1
DNS_SERVERS=""
DOMAIN=""
+ADD_LOCAL_DOMAIN=1
+ADD_LOCAL_HOSTNAME=1
+
CONFIGFILE="/var/etc/dnsmasq.conf"
xappend() {
@@ -111,6 +114,9 @@ dnsmasq() {
config_get DOMAIN "$cfg" domain
+ config_get_bool ADD_LOCAL_DOMAIN "$cfg" add_local_domain 1
+ config_get_bool ADD_LOCAL_HOSTNAME "$cfg" add_local_hostname 1
+
config_get_bool readethers "$cfg" readethers
[ "$readethers" = "1" -a \! -e "/etc/ethers" ] && touch /etc/ethers
@@ -490,14 +496,16 @@ start() {
echo >> $CONFIGFILE
# add own hostname
- [ -z "$lanaddr" ] || {
+ [ $ADD_LOCAL_HOSTNAME -eq 1 ] && [ -n "$lanaddr" ] && {
local hostname="$(uci_get system.@system[0].hostname)"
dhcp_domain_add "" "${hostname:-OpenWrt}" "$lanaddr"
}
service_start /usr/sbin/dnsmasq -C $CONFIGFILE && {
rm -f /tmp/resolv.conf
- [ -n "$DOMAIN" ] && echo "search $DOMAIN" >> /tmp/resolv.conf
+ [ $ADD_LOCAL_DOMAIN -eq 1 ] && [ -n "$DOMAIN" ] && {
+ echo "search $DOMAIN" >> /tmp/resolv.conf
+ }
DNS_SERVERS="$DNS_SERVERS 127.0.0.1"
for DNS_SERVER in $DNS_SERVERS ; do
echo "nameserver $DNS_SERVER" >> /tmp/resolv.conf