Skip to content

Conversation

@markozajc
Copy link

See openwrt/openwrt#18610 for more information. These pull requests should be merged together.

  • This PR is not from my main or master branch 💩, but a separate branch ✅

  • Each commit has a valid ✒️ Signed-off-by: <[email protected]> row (via git commit --signoff)

  • Each commit and PR title has a valid 📝 <package name>: title first line subject for packages

  • Incremented 🆙 any PKG_VERSION in the Makefile

  • Tested on: ramips/mt7621, OpenWrt 24.10.2, Firefox ✅

  • ( Preferred ) Mention: @ the original code author for feedback

  • ( Preferred ) Screenshot or mp4 of changes:
    image

  • ( Optional ) Closes: e.g. openwrt/luci#issue-number

  • ( Optional ) Depends on: e.g. dnsmasq: prevent upstream resolution of addresses openwrt#18610

  • Description: Adds a toggle for the behaviour described in dnsmasq: prevent upstream resolution of addresses openwrt#18610. The toggle defaults to off (old behaviour) to avoid breaking existing workflows.

markozajc added a commit to markozajc/openwrt that referenced this pull request Sep 24, 2025
`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]>
markozajc added a commit to markozajc/openwrt that referenced this pull request Sep 24, 2025
`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]>
@systemcrash systemcrash added the depends on PR in other repo PR depends on PR in sister repo e.g. openwrt/packags label Sep 29, 2025
@efahl
Copy link
Contributor

efahl commented Oct 10, 2025

Tested on 24.10.3, LGTM for main and 24.10 backport...

$ cat /etc/config/dhcp
...
config dnsmasq
...
        option address_as_local '1'

markozajc added a commit to markozajc/openwrt that referenced this pull request Oct 22, 2025
`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]>
@markozajc markozajc force-pushed the patch/dnsmasq-local-resolve branch from deab95e to 24503fe Compare October 22, 2025 21:40
@systemcrash
Copy link
Contributor

Can you add the commit message from the openwrt repo here also? Then it's more understandable why this setting should exist - its rationale if you will.

@markozajc
Copy link
Author

Sure,

`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). https://github.com/openwrt/luci/pull/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.

@systemcrash
Copy link
Contributor

… to the commit

@markozajc
Copy link
Author

Ah, right.

'Addresses' option entries in the general tab of DHCP and DNS settings are
sometimes (I'm not sure about the exact conditions) passed to upstream resolver,
bypassing local resolution.

A workaround for a small list of domains is to add them to 'Resolve these
locally' option, but this is very tedious to do, and dnsmasq limits it to 1024
characters.

openwrt/openwrt#18610 adds behaviour to add addresses to the local resolution
list automatically, and this commit adds a flag to LuCI to control that.

Signed-off-by: Marko Zajc <[email protected]>
@markozajc markozajc force-pushed the patch/dnsmasq-local-resolve branch from 24503fe to 59688c6 Compare October 23, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

depends on PR in other repo PR depends on PR in sister repo e.g. openwrt/packags

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants