node icon indicating copy to clipboard operation
node copied to clipboard

Tracking Issue: DNS features requiring c-ares support

Open tniessen opened this issue 6 years ago • 24 comments

There is a growing list of feature requests for the DNS module which require upstream changes for an efficient implementation within node.

  • [ ] https://github.com/nodejs/node/issues/14648: c-ares does not support multiple response messages for a single question, making AXFR queries impossible to implement within node.
  • [ ] https://github.com/nodejs/node/issues/14475: c-ares does not support DNSSEC, making it difficult to implement DNSSEC within node.
  • [ ] https://github.com/nodejs/help/issues/634: c-ares does not appear to support parsing the additional and authority sections of DNS messages, at least not directly. An upstream API would be helpful at this point, even though it is possible to implement this within node.
  • [ ] https://github.com/nodejs/node/issues/19239: c-ares does not support CAA RRs.
  • [ ] It is impossible to implement iterative DNS when using the dns module.
  • [ ] c-ares appears to restrict the number of concurrent queries per resolver by using a single port per channel
  • [ ] c-ares does not expose TTL values except for A and AAAA rrtypes.
  • [ ] https://github.com/nodejs/node/issues/27724 support ANAME questions.

FYI @bagder @daviddrysdale

cc @addaleax @refack @silverwind @alexte

tniessen avatar Aug 09 '17 14:08 tniessen

IMHO a native implementation of DNS without c-ares would be more future proof.

alexte avatar Aug 10 '17 20:08 alexte

It was attempted to write a JS resolver in the past, but performance wasn't up to par back then. Anyone aware of other libraries we could consider?

silverwind avatar Aug 11 '17 12:08 silverwind

I considered writing a small DNS library tailored for Node.js as c-ares comes with some downsides and I did not find any alternatives. Our main concerns are portability (c-ares has a lot of code just to support Windows 95), performance (we should not allow significant regression) and dependability (c-ares has been tested for years). I could try to put something together, but it will take some time and we would need to test it extensively before shipping it in release lines.

tniessen avatar Aug 11 '17 13:08 tniessen

Just as a question: what DNS resolvers do browsers use?

TimothyGu avatar Aug 11 '17 14:08 TimothyGu

@TimothyGu Usually the one of the network router which most likely forwards the requests to the caching resolvers of the ISP.

fvdm avatar Aug 11 '17 15:08 fvdm

Browsers use getaddrinfo which is implemented in the OS core libraries like glibc, which is also what dns.lookup uses. The issue with getaddrinfo is that it's only purpose is name to IP resolution, and for more advanced DNS use cases (record types other than A and AAAA, or if you'd like to avoid caching) you need a actual resolver capable of constructing and parsing DNS packets.

silverwind avatar Aug 11 '17 15:08 silverwind

@fvdm I believe you are referring to DNS servers (routers usually act as DNS servers in local networks), this is not what this issue is about.

tniessen avatar Aug 11 '17 15:08 tniessen

@tniessen I misinterpreted resolvers in the question as the part of DNS that provides the requested answers, instead of the client software that performs the requests. My apologies.

fvdm avatar Aug 13 '17 12:08 fvdm

I think there are two different topics:

  1. Resolving names to numbers, a function most applications need.
  2. In depth DNS queries with full tweekability and full DNS response parsing, only needed for few applications.

For 1) I would see this in the core and as standard as possible, perhaps even using libc getaddr* functions, and optimized for speed. 2) a separate library (NPM) with full control, implemented natively, that implements all DNS protocol features, even DNSSEC etc

alexte avatar Aug 14 '17 09:08 alexte

This is coming up on two years of inactivity. @tniessen Anything new to add here? I'm guessing not.

Trott avatar Aug 11 '19 03:08 Trott

We can consider https://github.com/getdnsapi/getdns/blob/develop/README.md as alternative, maintained, DNSSEC-capable, TTL-capable library: https://github.com/getdnsapi/getdns/blob/develop/README.md

ad-m avatar Sep 16 '19 22:09 ad-m

@ad-m I think that would require quite a bit of porting work, but if somebody’s up for that, why not.

addaleax avatar Sep 16 '19 22:09 addaleax

Interestingly getdns has first-class support for libuv :eyes:

devsnek avatar Sep 16 '19 22:09 devsnek

@devsnek, there's NodeJS binding too 👀 https://github.com/getdnsapi/getdns-node

ad-m avatar Sep 16 '19 23:09 ad-m

I've started looking into using getdns in core.

devsnek avatar May 08 '20 07:05 devsnek

NodeJS currently use c-ares to resolve queries DNS but is not so good it because it doesn't support all queries types. Even so, I thought we replacing it to another approach I have two ideas:

1 - We use the module miekg/dns in Golang Ask: Can we import the module of Golang on NodeJS core?

2 - We find another package with this support to all queries types.

Another problem we have those third-party libs to DNS in NodeJS is bad.

Refer issue https://github.com/nodejs/node/issues/33299

renanbastos93 avatar May 08 '20 16:05 renanbastos93

@renanbastos93 that would require us adding a dependency on golang's compiler, and it also seems that library doesn't have a stable c api.

devsnek avatar May 08 '20 18:05 devsnek

that would require us adding a dependency on golang's compiler, and it also seems that library doesn't have a stable c api.

it's okay, thanks for explaining to me. Another approach we can implement these features to make a fork origin c-ares.

renanbastos93 avatar May 08 '20 18:05 renanbastos93

@nodejs/node-gyp @nodejs/gyp could i get some assistance with porting getdns's cmake config to gyp? I have stripped out a bunch of the unneeded config (tests and libev support and such): https://gist.github.com/devsnek/04666f858ae6c3ebbc43c04edd1c6a38. I'm not sure what to do with those configure_file parts.

devsnek avatar May 08 '20 19:05 devsnek

@devsnek One solution: generate them for different targets, then check them in and tweak include_dirs based on OS and/or target_arch. That's how we vendor c-ares and openssl.

bnoordhuis avatar May 09 '20 09:05 bnoordhuis

This is coming up on one year of inactivity and open for more than 3 years. @tniessen, any update on this issue?

marsonya avatar Mar 18 '21 05:03 marsonya

There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

For more information on how the project manages feature requests, please consult the feature request management document.

github-actions[bot] avatar Mar 22 '22 21:03 github-actions[bot]

do not close pls

devsnek avatar Mar 22 '22 23:03 devsnek

There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

For more information on how the project manages feature requests, please consult the feature request management document.

github-actions[bot] avatar Sep 21 '22 01:09 github-actions[bot]