Skip to content

Support ipv6 link-local servers and %iface syntax - #646

Merged
bradh352 merged 31 commits into
c-ares:mainfrom
bradh352:linklocal
Dec 7, 2023
Merged

Support ipv6 link-local servers and %iface syntax#646
bradh352 merged 31 commits into
c-ares:mainfrom
bradh352:linklocal

Conversation

@bradh352

@bradh352 bradh352 commented Dec 5, 2023

Copy link
Copy Markdown
Member

Some environments may send router advertisements on a link setting their link-local (fe80::/10) address as a valid DNS server to the remote system. This will cause a DNS entry to be created like fe80::1%iface, since all link-local network interfaces are technically part of the same /10 subnet, it must be told what interface to send packets through explicitly if there are multiple physical interfaces.

This PR adds support for the %iface modifier when setting DNS servers via /etc/resolv.conf as well as via ares_set_servers_csv().

For MacOS and iOS it is assumed that libresolve will set the sin6_scope_id and should be supported, but my test systems don't seem to read the Router Advertisement for RDNSS link-local. Specifying the link-local dns server on MacOS via adig has been tested and confirmed working.

For Windows, this is similar to MacOS in that the system doesn't seem to honor the RDNSS RA, but specifying manually has been tested to work.

At this point, Android support does not exist.

Fixes Bug #462
Supersedes PR #463

Fix By: Brad House (@bradh352) and Serhii Purik (@sergvpurik)

@bradh352

bradh352 commented Dec 6, 2023

Copy link
Copy Markdown
Member Author

Tested on Ubuntu 22.04 after disabling systemd-resolved with another ubuntu host using radvd to advertise its link local address as a DNS server. Works as intended, and specifically does not work if you omit the %iface.

@bradh352
bradh352 requested a review from bagder December 7, 2023 00:59
@bradh352
bradh352 merged commit d974c55 into c-ares:main Dec 7, 2023
@bradh352
bradh352 deleted the linklocal branch December 7, 2023 15:05
shpala added a commit to shpala/c-ares that referenced this pull request Apr 16, 2024
and iOS.
The issue only happens when using system default link-local IPv6 DNS.
Specifying link-local IPv6 DNS address manually works.
Disabling libresolv and using the manual parsing fixes the issue after
the change made in c-ares#646

On macOS and iOS c-ares uses libresolv and assumes that its API
res_getservers() fills sin6_scope_id in case of a link-local IPv6 DNS
addresses in /etc/resolv.conf.

Unfortunately this is not the case.
See res_getservers() here: https://opensource.apple.com/source/libresolv/libresolv-60/res_init.c.auto.html
shpala added a commit to shpala/c-ares that referenced this pull request Apr 16, 2024
The issue only happens when using system default link-local IPv6 DNS.
Specifying link-local IPv6 DNS address manually works.
Disabling libresolv and using the manual parsing fixes the issue after
the change made in c-ares#646

On macOS c-ares uses libresolv and assumes that its API
res_getservers() fills sin6_scope_id in case of a link-local IPv6 DNS
addresses in /etc/resolv.conf.

Unfortunately this is not the case.
See res_getservers() here: https://opensource.apple.com/source/libresolv/libresolv-60/res_init.c.auto.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