mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-11 21:25:48 +00:00
Revert "dnsmasq: manage resolv.conf if when listening on 127.0.0.1#53"
This reverts commit a53f8ba6771de64c9c82a2e6867791226f3003cb. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
This commit is contained in:
parent
a3332f2aa2
commit
8180bbac7c
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=dnsmasq
|
PKG_NAME:=dnsmasq
|
||||||
PKG_VERSION:=2.77
|
PKG_VERSION:=2.77
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||||
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/
|
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/
|
||||||
|
@ -707,21 +707,6 @@ dhcp_relay_add() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
dnsmasq_ismain()
|
|
||||||
{
|
|
||||||
local cfg="$1"
|
|
||||||
local port notinterfaces
|
|
||||||
|
|
||||||
config_get port "$cfg" port "53"
|
|
||||||
[ $port = "53" ] || return 1
|
|
||||||
|
|
||||||
config_get notinterfaces "$cfg" notinterface ""
|
|
||||||
[ -n $notinterfaces ] && list_contains $notinterfaces "loopback" || return 1
|
|
||||||
|
|
||||||
# dnsmasq instance is designated to listen on 127.0.0.1#53.
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
dnsmasq_start()
|
dnsmasq_start()
|
||||||
{
|
{
|
||||||
local cfg="$1" disabled resolvfile user_dhcpscript
|
local cfg="$1" disabled resolvfile user_dhcpscript
|
||||||
@ -868,10 +853,14 @@ dnsmasq_start()
|
|||||||
[ -n "$leasefile" -a \! -e "$leasefile" ] && touch "$leasefile"
|
[ -n "$leasefile" -a \! -e "$leasefile" ] && touch "$leasefile"
|
||||||
config_get_bool cachelocal "$cfg" cachelocal 1
|
config_get_bool cachelocal "$cfg" cachelocal 1
|
||||||
|
|
||||||
config_get resolvfile "$cfg" resolvfile "/tmp/resolv.conf.auto"
|
config_get_bool noresolv "$cfg" noresolv 0
|
||||||
xappend "--resolv-file=$resolvfile"
|
if [ "$noresolv" != "1" ]; then
|
||||||
# So jail doesn't complain if file missing
|
config_get resolvfile "$cfg" resolvfile "/tmp/resolv.conf.auto"
|
||||||
[ \! -e "$resolvfile" ] && touch "$resolvfile"
|
# So jail doesn't complain if file missing
|
||||||
|
[ -n "$resolvfile" -a \! -e "$resolvfile" ] && touch "$resolvfile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$resolvfile" ] && xappend "--resolv-file=$resolvfile"
|
||||||
|
|
||||||
config_get hostsfile "$cfg" dhcphostsfile
|
config_get hostsfile "$cfg" dhcphostsfile
|
||||||
[ -e "$hostsfile" ] && xappend "--dhcp-hostsfile=$hostsfile"
|
[ -e "$hostsfile" ] && xappend "--dhcp-hostsfile=$hostsfile"
|
||||||
@ -984,6 +973,16 @@ dnsmasq_start()
|
|||||||
echo >> $CONFIGFILE_TMP
|
echo >> $CONFIGFILE_TMP
|
||||||
mv -f $CONFIGFILE_TMP $CONFIGFILE
|
mv -f $CONFIGFILE_TMP $CONFIGFILE
|
||||||
|
|
||||||
|
[ "$resolvfile" = "/tmp/resolv.conf.auto" ] && {
|
||||||
|
rm -f /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
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
procd_open_instance $cfg
|
procd_open_instance $cfg
|
||||||
procd_set_param command $PROG -C $CONFIGFILE -k -x /var/run/dnsmasq/dnsmasq."${cfg}".pid
|
procd_set_param command $PROG -C $CONFIGFILE -k -x /var/run/dnsmasq/dnsmasq."${cfg}".pid
|
||||||
@ -1001,29 +1000,20 @@ dnsmasq_start()
|
|||||||
procd_add_jail_mount_rw /var/run/dnsmasq/ $leasefile
|
procd_add_jail_mount_rw /var/run/dnsmasq/ $leasefile
|
||||||
|
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
|
|
||||||
|
|
||||||
# write /tmp/resolve.conf only for main instance
|
|
||||||
dnsmasq_ismain $cfg && {
|
|
||||||
rm -f /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
|
|
||||||
done
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dnsmasq_stop()
|
dnsmasq_stop()
|
||||||
{
|
{
|
||||||
local cfg="$1"
|
local cfg="$1"
|
||||||
|
|
||||||
|
config_get resolvfile "$cfg" "resolvfile"
|
||||||
|
|
||||||
#relink /tmp/resolve.conf only for main instance
|
#relink /tmp/resolve.conf only for main instance
|
||||||
dnsmasq_ismain $cfg && {
|
[ "$resolvfile" = "/tmp/resolv.conf.auto" ] && {
|
||||||
[ -f /tmp/resolv.conf ] && rm -f /tmp/resolv.conf
|
[ -f /tmp/resolv.conf ] && {
|
||||||
ln -s /tmp/resolv.conf.auto /tmp/resolv.conf
|
rm -f /tmp/resolv.conf
|
||||||
|
ln -s "$resolvfile" /tmp/resolv.conf
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp
|
rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user