-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
No RD bit in request - DNS Query Randomly Fails #29
Comments
@song940 Any thoughts on how the syntax/API should look for this? I'd be happy to submit a PR once I get some guidance on how it should work. |
@fishcharlie just curious, is it possible to have a screenshot of a tcpdump, one with native node dns code, the other one with dns2 (with npm install, not with a git clone of the current master branch, see #31) ? I'd like to see if you have a FailErr in the reply, to compare with a potential problem i have on my side. Thank you. |
After testing, the purposale of @fishcharlie solve #33. Let me PR. |
@eviltik #33 should fix the issue. One thing that I mentioned above:
For my personal use I hard code it to 1 (just like your PR), but that is a question worth asking I think. |
Good question ! Let's go deeper, https://tools.ietf.org/html/rfc1034
I'm not sure to perfectly understand, but i think that having RD bit with value 1 by default is OK : it only change the server side behavior depending if it support recursive service or not. @fishcharlie perhaps you can double check wit Cloudflare ? On my side, it fix Virtualbox issue too. |
Mhh well ... perhaps a PR with an option to enable RD bit is better, so we can implement this without effect side and document it. Give me few minutes ;) |
https://tools.ietf.org/html/bcp123
|
Seem's that RD flag is 1 in nslookup.c |
Got it. It's enable in dig and nslookup by default, but can be disabled. dig man page
|
Dropping my PR, working on a new one |
@eviltik I think you are correct that It's more of a question about how the syntax and API looks for that. |
After discussing with a member of the 1.1.1.1 team at Cloudflare, the reason for this problem is that dns2 is not passing in the
RD
bit in the request header.I added the following line right above the
client.send
call inclient/udp.js
, and it seems to have fixed the problem completely.According to the member at Cloudflare, the
RD
bit is required by the Cloudflare resolver, and is also required by most other resolvers.I'd be happy to submit a PR to fix this @song940, however, I'm not sure we want to hard code it to 1. Should this be a dynamic option passed in by the user? If so, how should the syntax/API look for this?
Original report below.
If you run the following code.
It results in:
As you can see, when running the command through the native Node.js DNS client I get 4 answers back, whereas when running it through
dns2
I get 0 answers back in the array.It looks like part of the problem is the
ancount
is 0 for some reason. Thercode
is also 2. Which according to the spec means:However, this doesn't make sense. I'm hitting the same name server (1.1.1.1) for both the native Node.js DNS client (where it's obviously successful), and the
dns2
query.Is there a problem with the request being made in
dns2
where the name server can't understand it? Or is there a problem with parsing the response indns2
?Any ideas what is going on here?
I will also mention, this issue occurs the majority of the time. But every once in a while (rarely). It succeeds and works just fine (with no code changes on my part).
The text was updated successfully, but these errors were encountered: