[GH-ISSUE #854] Handle IPv6 addresses containing scope IDs #549

Open
opened 2026-03-15 23:06:25 +03:00 by kerem · 5 comments
Owner

Originally created by @davechallis on GitHub (Aug 21, 2019).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/854

Is your feature request related to a problem? Please describe.

I often seen warnings from trust DNS when reading IPv6 hosts file entries containing scope IDs.

E.g. my hosts file contains the following v6 entry:

fe80::1%lo0 localhost

which causes triggers the following warning from trust dns:

WARN  trust_dns_resolver::hosts] could not parse an IP from hosts file

I don't know much about them (https://superuser.com/a/99753 contains some info), but would be nice if they could be parsed without warnings.

Originally created by @davechallis on GitHub (Aug 21, 2019). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/854 **Is your feature request related to a problem? Please describe.** I often seen warnings from trust DNS when reading IPv6 hosts file entries containing scope IDs. E.g. my hosts file contains the following v6 entry: ``` fe80::1%lo0 localhost ``` which causes triggers the following warning from trust dns: ``` WARN trust_dns_resolver::hosts] could not parse an IP from hosts file ``` I don't know much about them (https://superuser.com/a/99753 contains some info), but would be nice if they could be parsed without warnings.
Author
Owner

@bluejekyll commented on GitHub (Aug 21, 2019):

Is this a windows machine?

We rely on the internal ipv4 and ipv6 parsers in Rust for this. I think the easiest thing todo would be to first parse for the % and then strip the identifier. In the long run, it would be good to incorporate this into routing information for ipv6 upstream resolvers.

<!-- gh-comment-id:523461828 --> @bluejekyll commented on GitHub (Aug 21, 2019): Is this a windows machine? We rely on the internal ipv4 and ipv6 parsers in Rust for this. I think the easiest thing todo would be to first parse for the % and then strip the identifier. In the long run, it would be good to incorporate this into routing information for ipv6 upstream resolvers.
Author
Owner

@davechallis commented on GitHub (Aug 21, 2019):

This was on Mac OS X - it was an autogenerated entry from something as far as I could see.

<!-- gh-comment-id:523491445 --> @davechallis commented on GitHub (Aug 21, 2019): This was on Mac OS X - it was an autogenerated entry from something as far as I could see.
Author
Owner

@jbg commented on GitHub (Feb 13, 2026):

These now seem to parse correctly (resolv-conf has ScopedIp which preserves the scope) , but the scope is silently discarded here in hickory-resolver (v0.25.2 / main), resulting in failure to resolve.

<!-- gh-comment-id:3895882137 --> @jbg commented on GitHub (Feb 13, 2026): These now seem to parse correctly (resolv-conf has `ScopedIp` which preserves the scope) , but the scope is silently discarded here in hickory-resolver ([v0.25.2](https://github.com/hickory-dns/hickory-dns/blob/v0.25.2/crates/resolver/src/system_conf/unix.rs#L74) / [main](https://github.com/hickory-dns/hickory-dns/blob/main/crates/resolver/src/system_conf/unix.rs#L58)), resulting in failure to resolve.
Author
Owner

@jbg commented on GitHub (Feb 13, 2026):

I'd be happy to do the work to fix this but there are several public types which encode the lack of scope information, including NameServerConfig and ConnectionProvider, so there would be breaking changes. I think two reasonable approaches would be to change IpAddr to SocketAddr with port unused/0, or to use ScopedIp from resolv-conf (or a type in this crate with the same shape) to represent "IpAddr plus possible scope".

<!-- gh-comment-id:3895971116 --> @jbg commented on GitHub (Feb 13, 2026): I'd be happy to do the work to fix this but there are several public types which encode the lack of scope information, including `NameServerConfig` and `ConnectionProvider`, so there would be breaking changes. I think two reasonable approaches would be to change `IpAddr` to `SocketAddr` with port unused/0, or to use `ScopedIp` from resolv-conf (or a type in this crate with the same shape) to represent "`IpAddr` plus possible scope".
Author
Owner

@djc commented on GitHub (Feb 13, 2026):

main has already broken compatibility, so that's not a blocker. Happy to review a PR in this direction!

<!-- gh-comment-id:3896558706 --> @djc commented on GitHub (Feb 13, 2026): `main` has already broken compatibility, so that's not a blocker. Happy to review a PR in this direction!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#549
No description provided.