[GH-ISSUE #2042] trust-dns only warns instead of returning Err when it has no nameservers listed in /etc/resolv.conf #857

Open
opened 2026-03-16 00:37:00 +03:00 by kerem · 6 comments
Owner

Originally created by @knightian on GitHub (Oct 2, 2023).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2042

Describe the bug

If a unix system has no nameserver entries in /etc/resolv.conf for some reason, trust-dns warns that it can find no nameservers, but it allows applications to continue to send DNS queries despite it having no nameservers to lookup those queries.

I think it should not just be a warning written to log, I think if trust-dns is unable to perform DNS lookups, this is not a warning, this is an error because trust-dns cannot do what it is needed to do.

Originally created by @knightian on GitHub (Oct 2, 2023). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2042 **Describe the bug** If a unix system has no nameserver entries in /etc/resolv.conf for some reason, trust-dns warns that it can find no nameservers, but it allows applications to continue to send DNS queries despite it having no nameservers to lookup those queries. I think it should not just be a warning written to log, I think if trust-dns is unable to perform DNS lookups, this is not a warning, this is an error because trust-dns cannot do what it is needed to do.
Author
Owner

@djc commented on GitHub (Oct 2, 2023):

Do you mean the daemon or one of the libraries? For the daemon, I think it could plausibly still serve other parts of the config even if it was unable to resolve via an upstream resolver?

<!-- gh-comment-id:1742871931 --> @djc commented on GitHub (Oct 2, 2023): Do you mean the daemon or one of the libraries? For the daemon, I think it could plausibly still serve other parts of the config even if it was unable to resolve via an upstream resolver?
Author
Owner

@knightian commented on GitHub (Oct 2, 2023):

Oh the rust crate used by Vaultwarden. The issue has more depth on this thread: https://github.com/dani-garcia/vaultwarden/discussions/3941#discussioncomment-7163895

[2023-10-02 00:59:53.441][trust_dns_resolver::system_conf::unix][WARN] no nameservers found in config

it is writing a warning to be logged, but it is not throwing an Err so devs are still trying to perform queries with a resolver that has no nameservers.

<!-- gh-comment-id:1742875461 --> @knightian commented on GitHub (Oct 2, 2023): Oh the rust crate used by Vaultwarden. The issue has more depth on this thread: https://github.com/dani-garcia/vaultwarden/discussions/3941#discussioncomment-7163895 `[2023-10-02 00:59:53.441][trust_dns_resolver::system_conf::unix][WARN] no nameservers found in config` it is writing a warning to be logged, but it is not throwing an `Err` so devs are still trying to perform queries with a resolver that has no nameservers.
Author
Owner

@djc commented on GitHub (Oct 2, 2023):

Ahh, so yes, if you're instantiating a resolver from trust-dns-resolver I definitely agree it makes sense to yield an error for this case. Are you able to submit a PR?

<!-- gh-comment-id:1742881970 --> @djc commented on GitHub (Oct 2, 2023): Ahh, so yes, if you're instantiating a resolver from trust-dns-resolver I definitely agree it makes sense to yield an error for this case. Are you able to submit a PR?
Author
Owner

@knightian commented on GitHub (Oct 2, 2023):

Are you able to submit a PR?

I have honestly never looked at coding in rust in my life. If I knew what I were doing I would.

<!-- gh-comment-id:1742883547 --> @knightian commented on GitHub (Oct 2, 2023): > Are you able to submit a PR? I have honestly never looked at coding in rust in my life. If I knew what I were doing I would.
Author
Owner

@knightian commented on GitHub (Oct 2, 2023):

In saying that, I'm sure I can have a crack at it, as it's just going to be a matter of finding that warning in the code and changing that log write to an exception throw, 5 minutes of google should educate me, I can have a crack at it I guess, assuming it's relatively straight forward to tool up for rust.

<!-- gh-comment-id:1742894943 --> @knightian commented on GitHub (Oct 2, 2023): In saying that, I'm sure I can have a crack at it, as it's just going to be a matter of finding that warning in the code and changing that log write to an exception throw, 5 minutes of google should educate me, I can have a crack at it I guess, assuming it's relatively straight forward to tool up for rust.
Author
Owner

@knightian commented on GitHub (Oct 2, 2023):

@djc I think I have done it, this is the result of me googling how to raise an Err https://github.com/bluejekyll/trust-dns/pull/2043

<!-- gh-comment-id:1743179261 --> @knightian commented on GitHub (Oct 2, 2023): @djc I think I have done it, this is the result of me googling how to raise an Err https://github.com/bluejekyll/trust-dns/pull/2043
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#857
No description provided.