dnsmasq: add ignore hosts dir to dnsmasq init script
authorJoão Henriques <joaoh88@gmail.com>
Sun, 18 Apr 2021 22:41:30 +0000 (23:41 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Sat, 24 Apr 2021 19:35:27 +0000 (21:35 +0200)
When running multiple instances of dnsmasq, for example one being for the lan
and another for a guest network, it might not be desirable to have the same dns names
configured in both networks

Signed-off-by: João Henriques <joaoh88@gmail.com>
package/network/services/dnsmasq/files/dnsmasq.init

index 680e72f9e77b96b0c345a6c4d82fc3e81195b30b..44e7d2d4f90c0fb40cb4181cfd8550c1a4ad4441 100644 (file)
@@ -1012,7 +1012,12 @@ dnsmasq_start()
 
        xappend "--dhcp-broadcast=tag:needs-broadcast"
 
-       xappend "--addn-hosts=$(dirname $HOSTFILE)"
+       config_get_bool ignore_hosts_dir "$cfg" ignore_hosts_dir 0
+       if [ "$ignore_hosts_dir" = "1" ]; then
+               xappend "--addn-hosts=$HOSTFILE"
+       else
+               xappend "--addn-hosts=$(dirname $HOSTFILE)"
+       fi
 
        config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq.d"
        xappend "--conf-dir=$dnsmasqconfdir"