dns: do not consult hosts file in reverse lookups#64268
Conversation
|
Review requested:
|
|
Marking as semver-major (happy to be overruled). Although we do state in the small print that |
|
@Renegade334 How about using baking-for-lts label and ship to assess the impact? like this pr: #64114 |
addaleax
left a comment
There was a problem hiding this comment.
This should come with a changes: entry in the documentation as well, even if it only aligns behavior with what is already documented. It's a significant change, and semver-major seems appropriate.
Additionally, I would strongly recommend giving this a proper commit message. Commit messages should explain:
- What happened
- How it happened
- Why it happened this way
Right now, this PR's commit message explains very little, but most importantly, it's not explaining why this change in behavior is better than e.g. a change of the documentation to just match current reality.
dns.reverse() is documented with dns.resolve*() as always performing DNS queries without using hosts file configuration. However, c-ares ares_gethostbyaddr() honors the channel lookup order, which can include the files source and cause reverse lookups to return entries from /etc/hosts. Configure c-ares resolver channels with ARES_OPT_LOOKUPS set to "b" so getHostByAddr uses DNS/PTR lookups only. This keeps dns.reverse() aligned with dns.resolve*() and preserves the distinction from system-resolution APIs such as dns.lookup() and dns.lookupService(). This is preferable to documenting the current behavior because hosts- file reverse lookup results are platform-dependent and expose hostent alias semantics rather than DNS PTR record semantics. Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com>
Done, thanks for the helpful reminder. Could you please trigger a fresh CI run by applying request-ci? Thanks ! |
addaleax
left a comment
There was a problem hiding this comment.
I'll approve so CI can be kicked off but one thing that stands out a bit is that this, just based on the code changes, seems to also affect regular/non-reverse lookups? That seems like a pretty significant unintentional change
Not really, the normal And I can't access jenkins ci so could you review what happend for these failed tests when available? Thanks! |
Fixes: #64257