From e0b3e729d1f9c663a4f41339fe205f024ceaca1a Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Thu, 8 Jul 2021 11:33:07 +0100 Subject: [PATCH] dnsmasq: add a new "bind" configuration option 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 --- package/network/services/dnsmasq/files/dhcp.conf | 2 +- package/network/services/dnsmasq/files/dnsmasq.init | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package/network/services/dnsmasq/files/dhcp.conf b/package/network/services/dnsmasq/files/dhcp.conf index d5b9dfa018..3ebae43486 100644 --- a/package/network/services/dnsmasq/files/dhcp.conf +++ b/package/network/services/dnsmasq/files/dhcp.conf @@ -16,7 +16,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 be701bf525..5b6d000422 100755 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -958,7 +958,18 @@ 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" + case "$bind" in + dynamic|interfaces) + xappend "--bind-$bind" + ;; + "") + # for compatibility reasons + append_bool "$cfg" nonwildcard "--bind-dynamic" 1 + ;; + esac + append_bool "$cfg" fqdn "--dhcp-fqdn" append_bool "$cfg" proxydnssec "--proxy-dnssec" append_bool "$cfg" localservice "--local-service" -- 2.30.2