-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DNS lookup should try to avoid IPv6 link-local addresses #51732
Comments
I wish to take this up |
I guess it can be fixed with something like this:
|
I am willing to work on this, but I am a little confused about one aspect: should I remove ALL the local IPV6 links from |
You often have more than one ipv6 address, this is pretty normal. So all link-local ones should be skipped, not just the first one. |
that's what I thought as well, but I got confused by the examples 😄 |
I am struggling with automated tests: the function is working fine, but I noticed that the DNS resolution is actually real and not mocked anywhere (at least I could not find it anywhere in this huge codebase). fe80::1 zen and, of course, this is not doeable or even a good idea :) the test looks something like this: TEST(function test_lookup_ip_all_promise(done) {
const req = util.promisify(dns.lookup)('zen', { all: true, family: 6 })
.then(function(ips) {
assert.ok(Array.isArray(ips));
assert.ok(ips.length === 1);
assert.strictEqual(ips[0], 'fe80::1');
done();
});
checkWrap(req);
}); the best solution would be to mock the call to Thanks in advance! |
…ult is a loopback link Fixes: nodejs#51732
…ult is a loopback link Fixes: nodejs#51732
What is the problem this feature will solve?
Naive calls to createServer happily resolve host names to link-local addresses, which then fail to listen:
What is the feature you are proposing to solve the problem?
DNS lookup randomly picks the first available entry
if there are multiple addresses returned by getaddrinfo
Instead, it should pick the first non-link-local address. It is extremely unlikely that you want to listen to a link-local address (starting with
fe80::
). And in the unlikely case that you do, you certainly would call withoptions.all
to get all resolutions.What alternatives have you considered?
We could alter all client code to always add
options.all
and filter, but it seems like node is the correct way to fix this once and for all.Related issues
The text was updated successfully, but these errors were encountered: