Skip to content

fix: dnsmasq DNS server entries use /#/ wildcard; disable strict-order; set no-resolv#491

Open
li3p wants to merge 1 commit into
yichya:masterfrom
rtoser:fix/dnsmasq-dns-wildcard-clean
Open

fix: dnsmasq DNS server entries use /#/ wildcard; disable strict-order; set no-resolv#491
li3p wants to merge 1 commit into
yichya:masterfrom
rtoser:fix/dnsmasq-dns-wildcard-clean

Conversation

@li3p

@li3p li3p commented Mar 3, 2026

Copy link
Copy Markdown

Previously, only the first server= line used the /#/ catch-all wildcard,
while extra DNS instances generated by dns_count used plain server=
entries. In dnsmasq, domain-specific directives have higher priority than
generic ones, so the extra ports (5301, 5302, ...) could be starved by the
first catch-all rule and never queried effectively.

Also, keep strict-order disabled and explicitly set no-resolv:

  • Without strict-order, dnsmasq can query any known-up upstream and prefer
    healthy servers, improving failover and reducing head-of-line blocking.
  • no-resolv prevents fallback to resolvers from /tmp/resolv.conf* (often
    ISP DNS on OpenWrt WAN). This is critical to avoid polluted DNS answers,
    especially for blocked domains that have no IPv6 records, where leaked ISP
    DNS resolution can bypass intended Xray DNS behavior.

Changes:

  • Add /#/ wildcard to all generated server= lines so all configured Xray
    DNS ports are treated uniformly.
  • Keep strict-order disabled (commented out in template).
  • Add no-resolv to ensure dnsmasq only uses configured Xray DNS upstreams.
  • Start extra-port loop from dns_port + 1 to avoid duplicate first entry.

References:

…r; set no-resolv

Previously, only the first `server=` line used the `/#/` catch-all wildcard,
while extra DNS instances generated by `dns_count` used plain `server=`
entries. In dnsmasq, domain-specific directives have higher priority than
generic ones, so the extra ports (5301, 5302, ...) could be starved by the
first catch-all rule and never queried effectively.

Also, keep `strict-order` disabled and explicitly set `no-resolv`:
- Without `strict-order`, dnsmasq can query any known-up upstream and prefer
  healthy servers, improving failover and reducing head-of-line blocking.
- `no-resolv` prevents fallback to resolvers from `/tmp/resolv.conf*` (often
  ISP DNS on OpenWrt WAN). This is critical to avoid polluted DNS answers,
  especially for blocked domains that have no IPv6 records, where leaked ISP
  DNS resolution can bypass intended Xray DNS behavior.

Changes:
- Add `/#/` wildcard to all generated `server=` lines so all configured Xray
  DNS ports are treated uniformly.
- Keep `strict-order` disabled (commented out in template).
- Add `no-resolv` to ensure dnsmasq only uses configured Xray DNS upstreams.
- Start extra-port loop from `dns_port + 1` to avoid duplicate first entry.

References:
- dnsmasq man page (-o/--strict-order, -R/--no-resolv):
  https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant