Version
v22.20.0
Platform
Linux MY_LAPTOP 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 GNU/Linux
Subsystem
dns
What steps will reproduce the bug?
An /etc/hosts file with the contents,
And the following Node script,
const dns = require("dns");
dns.reverse("127.0.0.1", (err, results) => { console.log(err, results) }); // null []
If the /etc/hosts file instead looks like this,
127.0.0.1 localhost my-domain.local sub.my-domain.local # etc, etc,
Then the same node script will instead print out null, ['my-domain.local', 'sub.my-domain.local' /* etc */ ]
How often does it reproduce? Is there a required condition?
This is 100% reproduceable and confirmed with another person over Discord.
What is the expected behavior? Why is that the expected behavior?
This expected behavior would either to have dns.reverse return no results at all, as per the documentation, or to have it return all records associated an address, and not just the aliases.
What do you see instead?
Instead, I see the results from the /etc/hosts file sans the canonical name.
null, ['my-domain.com', /* etc */]
Additional information
The documentation for the dns module states that dns.resolve states that this function doesn't use the "configuration" from the etc/hosts file. Evidently it does use this file, but it ignores the canonical name of an address there, and instead only shows aliases.
From the documentation it is unclear if this is intended behavior or not
Version
v22.20.0
Platform
Subsystem
dns
What steps will reproduce the bug?
An
/etc/hostsfile with the contents,And the following Node script,
If the
/etc/hostsfile instead looks like this,Then the same node script will instead print out
null, ['my-domain.local', 'sub.my-domain.local' /* etc */ ]How often does it reproduce? Is there a required condition?
This is 100% reproduceable and confirmed with another person over Discord.
What is the expected behavior? Why is that the expected behavior?
This expected behavior would either to have
dns.reversereturn no results at all, as per the documentation, or to have it return all records associated an address, and not just the aliases.What do you see instead?
Instead, I see the results from the
/etc/hostsfile sans the canonical name.null, ['my-domain.com', /* etc */]Additional information
The documentation for the dns module states that
dns.resolvestates that this function doesn't use the "configuration" from theetc/hostsfile. Evidently it does use this file, but it ignores the canonical name of an address there, and instead only shows aliases.From the documentation it is unclear if this is intended behavior or not