Skip to content

odhcpd: supports rewrite DNS server to local IPv6 DNS server in relay mode#323

Draft
jjm2473 wants to merge 1 commit intoopenwrt:masterfrom
jjm2473:supports-dns-rewrite-in-relay-mode
Draft

odhcpd: supports rewrite DNS server to local IPv6 DNS server in relay mode#323
jjm2473 wants to merge 1 commit intoopenwrt:masterfrom
jjm2473:supports-dns-rewrite-in-relay-mode

Conversation

@jjm2473
Copy link

@jjm2473 jjm2473 commented Nov 24, 2025

Just like server mode.

My ISP provides IPv6 DNS in the RA. In odhcpd relay mode, internal network devices use the IPv6 DNS advertised by the ISP, causing internal DNS requests to bypass OpenWRT's DNS server. Therefore, relay mode needs to support overriding the DNS server.

In relay mode, dns_service is false by default, so this change doesn't affect the original logic. A future PR will be given to LuCI to allow modification of dns_service in relay mode.

@jjm2473 jjm2473 force-pushed the supports-dns-rewrite-in-relay-mode branch from a98479e to 3e2bdd5 Compare November 24, 2025 05:10
… mode

My ISP provides IPv6 DNS servers in RA. In odhcpd relay mode,
internal network devices use the IPv6 DNS server advertised by the ISP,
causing internal DNS requests to bypass OpenWRT's DNS server.

Therefore, relay mode needs to support rewriting the DNS server.

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
@jjm2473 jjm2473 force-pushed the supports-dns-rewrite-in-relay-mode branch from 3e2bdd5 to c974605 Compare November 24, 2025 05:13
@Noltari
Copy link
Member

Noltari commented Nov 25, 2025

@Alphix @systemcrash can you take a look at this?

@systemcrash
Copy link
Contributor

This is a low-cost fix, but the initial post and commit message need rewriting to support the commit's reasoning.

It's possible to have dnsmasq capture everything on port (8)53 and send that upstream via DoH or whatever, but this might not be viable for everyone.

Maybe something like:

In odhcpd RA/DHCPv6 relay mode, downstream network devices receive the upstream IPv6 DNS. This commit enables overriding the DNS server in relay modes (with the exception of authenticated DHCPv6), whereby the local device is substituted as the DNS server. Since dns_service is false by default, this change does not affect the default behaviour.

@jjm2473
Copy link
Author

jjm2473 commented Nov 26, 2025

I was wrong. dns_service doesn't default to false. Switching the mode to relay on LuCI only hides the dns_service option; it doesn't become false.

If dns_service is not specified, it will always be true (in set_interface_defaults):

iface->dns_service = true;

@jjm2473 jjm2473 marked this pull request as draft November 26, 2025 03:26
@jjm2473
Copy link
Author

jjm2473 commented Nov 26, 2025

Should we first enable LuCI to support configuring dns_service in relay mode?
I want to override the ISP's IPv6 DNS with the local DNS in relay mode, which theoretically should be configured using dns_service.

@Alphix
Copy link
Contributor

Alphix commented Nov 28, 2025

Should we first enable LuCI to support configuring dns_service in relay mode? I want to override the ISP's IPv6 DNS with the local DNS in relay mode, which theoretically should be configured using dns_service.

I haven't looked into this in detail yet, but there's (from the top of my head) two options that are relevant.

One is if dns has been set explicitly, the other one is if dns_service has been set.

My main concern is not whether this makes sense...I agree that being able to override the ISP's DNS servers is desirable. It's more about what the cfg should look like and how it should behave, both in LuCI and in the cfg files.

(and forgive me if I missed something simple here...I haven't looked into the relevant parts of the code, I'm busy with other hacks)

@systemcrash
Copy link
Contributor

Hi @jjm2473 have you given this some more thought?

@jjm2473
Copy link
Author

jjm2473 commented Dec 9, 2025

Hi @systemcrash :
This patch currently meets the needs of most users, but in relay mode, it overrides the DNS provided by the RA/DHCPv6 by default, which is different from before. However, I think this is reasonable because the description of dns_service in LuCI is 'Announce this device as IPv6 DNS server' It shouldn't differ based on server or relay mode.

This patch has another issue: it only overrides DNS provided by the upstream RA/DHCPv6. If the upstream RA/DHCPv6 itself doesn't provide DNS, then the downstream won't receive IPv6 DNS (it will generally fall back to IPv4 DNS).

Actually, for me, as long as it overridden the DNS provided by the ISP, even completely deleting it is fine, because the ISP-provided DNS allows OpenWrt's DNS to be bypassed by clients, which is the most important issue.

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.

4 participants