aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/dnsmasq
diff options
context:
space:
mode:
Diffstat (limited to 'package/network/services/dnsmasq')
-rw-r--r--package/network/services/dnsmasq/files/dnsmasq.init7
1 files changed, 7 insertions, 0 deletions
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index b5fb58c524..f7edb28806 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -13,6 +13,7 @@ ADD_LOCAL_DOMAIN=1
ADD_LOCAL_HOSTNAME=1
CONFIGFILE="/var/etc/dnsmasq.conf"
+HOSTFILE="/tmp/hosts/dhcp"
xappend() {
local value="$1"
@@ -300,6 +301,11 @@ dhcp_host_add() {
[ "$broadcast" = "0" ] && broadcast=
xappend "--dhcp-host=$macs${networkid:+,net:$networkid}${broadcast:+,set:needs-broadcast}${tag:+,set:$tag}${ip:+,$ip}${name:+,$name}"
+
+ config_get_bool dns "$cfg" dns 0
+ [ "$dns" = "1" ] && {
+ echo "$ip $name${DOMAIN:+.$DOMAIN}" >> $HOSTFILE
+ }
}
dhcp_tag_add() {
@@ -528,6 +534,7 @@ start_service() {
mkdir -p $(dirname $CONFIGFILE)
echo "# auto-generated config file from /etc/config/dhcp" > $CONFIGFILE
+ echo "# auto-generated config file from /etc/config/dhcp" > $HOSTFILE
# if we did this last, we could override auto-generated config
[ -f /etc/dnsmasq.conf ] && {