Repository navigation
Remove preference for IPv4 when resolving target - #24
Merged
Merged
Conversation
lance0
approved these changes
Jan 25, 2026
lance0
left a comment
Owner
There was a problem hiding this comment.
Thanks for this contribution! The change makes sense - aligning with standard Unix tools and respecting the OS resolver configuration is the right approach.
Good catch on the /etc/gai.conf compliance. We'll note this behavior change in the next release notes so users know to use -4 if they need to force IPv4.
Merging!
lance0
added a commit
that referenced
this pull request
Jan 25, 2026
Contributor
Author
|
Nice, thanks! 👏🏻 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes the preference for IPv4 when resolving target, but use whatever the OS resolver suggests.
I noticed that
ttlhas a preference for IPv4, unlike other tools likeping,traceroute,mtretc. Instead, these tools use with what the resolver (getaddrinfo()) returns.I think an application shouldn't make any assumptions about the users preference / violate the users preference configured in
/etc/gai.conf, unless the user explicitly asks for it (e.g. with-4/-6), see https://linux.die.net/man/3/getaddrinfo ("Normally, the application should try using the addresses in the order in which they are returned.").I tested this change on Debian and macOS. On Debian, I additionally tested the compliance with
/etc/gai.conf:)