The nonwildcard option only allows to choose between the default behaviour (bind
to the wildcard address only, which unfeasible when running multiple instances
of dnsmasq) and --bind-dynamic (bind to any existing/new interfaces which aren't
explicitly configured otherwise). Add a new "bind" option, which can take the
value of "dynamic" or "interfaces", allowing the user to additionally choose the
--bind-interfaces behaviour (bind only to explicitly configured interfaces).

The dnsmasq man page [1] contains more detailed information about these
arguments. Finally, the nonwildcard option is kept for backwards compatibility.

[1] https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

Signed-off-by: Rui Salvaterra <rsalvate...@gmail.com>
---
 package/network/services/dnsmasq/files/dhcp.conf    | 2 +-
 package/network/services/dnsmasq/files/dnsmasq.init | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/package/network/services/dnsmasq/files/dhcp.conf 
b/package/network/services/dnsmasq/files/dhcp.conf
index 8c42ef782e..0d7a0d241e 100644
--- a/package/network/services/dnsmasq/files/dhcp.conf
+++ b/package/network/services/dnsmasq/files/dhcp.conf
@@ -15,7 +15,7 @@ config dnsmasq
        option leasefile        '/tmp/dhcp.leases'
        option resolvfile       '/tmp/resolv.conf.d/resolv.conf.auto'
        #list server            '/mycompany.local/1.2.3.4'
-       option nonwildcard      1 # bind to & keep track of interfaces
+       option bind             'dynamic' # bind to & keep track of interfaces
        #list interface         br-lan
        #list notinterface      lo
        #list bogusnxdomain     '64.94.110.11'
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init 
b/package/network/services/dnsmasq/files/dnsmasq.init
index f86b4b04f3..21e1464882 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -892,7 +892,13 @@ dnsmasq_start()
        config_get tftp_root "$cfg" "tftp_root"
        [ -n "$tftp_root" ] && mkdir -p "$tftp_root" && append_bool "$cfg" 
enable_tftp "--enable-tftp"
        append_bool "$cfg" tftp_no_fail "--tftp-no-fail"
-       append_bool "$cfg" nonwildcard "--bind-dynamic" 1
+
+       config_get bind "$cfg" "bind"
+       [ -n "$bind" ] && xappend "--bind-$bind" || {
+               # for compatibility reasons
+               append_bool "$cfg" nonwildcard "--bind-dynamic" 1
+       }
+
        append_bool "$cfg" fqdn "--dhcp-fqdn"
        append_bool "$cfg" proxydnssec "--proxy-dnssec"
        append_bool "$cfg" localservice "--local-service"
-- 
2.32.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to