dnsmasq: prevent upstream resolution of addresses
authorMarko Zajc <[email protected]>
Sat, 26 Apr 2025 12:21:10 +0000 (14:21 +0200)
committerRobert Marko <[email protected]>
Fri, 7 Nov 2025 14:23:25 +0000 (15:23 +0100)
commit38753dea6405fcc3b92994b0926d3bfd4760345f
treecbdb8c18318e17e5a8682ac1d6f27e25416d0df8
parent81a9c9f3c819258d896c7b57e74655cfae3782f1
dnsmasq: prevent upstream resolution of addresses

`list address` entries in /etc/config/dhcp are sometimes (I'm not sure
about the exact conditions) passed to upstream resolver, bypassing local
resolution. Adding them (minus the IP) to --local prevents this. In the
configuration, this means that

    # /etc/config/dhcp
    list address '/hello.com/world.com/1.2.3.4'
    list address '/foo.com/bar.com/4.3.2.1'

which previously translated into

    # /var/etc/dnsmasq.conf.*
    address=/hello.com/world.com/1.2.3.4
    address=/foo.com/bar.com/4.3.2.1

now becomes

    # /var/etc/dnsmasq.conf.*
    address=/hello.com/world.com/1.2.3.4
    local=/hello.com/world.com/
    address=/foo.com/bar.com/4.3.2.1
    local=/foo.com/bar.com/

This behaviour is controlled by the `address_as_local` boolean option, which
defaults to false (old behaviour). openwrt/luci#7957 adds support for this flag
to LuCI.

A workaround for a small list of domains is to add them to `option local`,
but this is very tedious to do for every `list address` entry and dnsmasq
limits this option to 1024 characters.

Signed-off-by: Marko Zajc <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/18610
Signed-off-by: Robert Marko <[email protected]>
package/network/services/dnsmasq/files/dnsmasq.init