[GH-ISSUE #605] Is get_name_servers() on windows useful? #245

Open
opened 2026-03-07 22:58:56 +03:00 by kerem · 9 comments
Owner

Originally created by @kolbma on GitHub (Nov 6, 2018).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/605

Is get_name_servers() in this way really useful?

It returns all name servers for all adapters. Adapters which are also deactivated or not connected. So you get a long list of name servers which are not connectable, because the networks are not reachable.

Isn't there any possibility to get the list of name servers used by the windows system right now?!

Originally created by @kolbma on GitHub (Nov 6, 2018). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/605 Is [get_name_servers()](https://github.com/bluejekyll/trust-dns/blob/34b02fcff7ff19e804b3b8128fc85a8101873d0e/crates/resolver/src/system_conf/windows.rs#L22) in this way really useful? It returns all name servers for all adapters. Adapters which are also deactivated or not connected. So you get a long list of name servers which are not connectable, because the networks are not reachable. Isn't there any possibility to get the list of name servers used by the windows system right now?!
Author
Owner

@bluejekyll commented on GitHub (Nov 7, 2018):

What is your concern about the current usage, beyond the "long" list? Is there a significant cost associated with this that you're concerned about? The Resolver will promote working connections over non-working connections.

Also, I don't personally use Windows, the support was added by @liranringel a while back. I'm not sure if the underlying library can evaluated active/inactive connections, but this could be an optimization. It would be useful on other platforms as well.

<!-- gh-comment-id:436509218 --> @bluejekyll commented on GitHub (Nov 7, 2018): What is your concern about the current usage, beyond the "long" list? Is there a significant cost associated with this that you're concerned about? The Resolver will promote working connections over non-working connections. Also, I don't personally use Windows, the support was added by @liranringel a while back. I'm not sure if the underlying library can evaluated active/inactive connections, but this could be an optimization. It would be useful on other platforms as well.
Author
Owner

@liranringel commented on GitHub (Nov 7, 2018):

I can expose that info.
I'll update you when it happened.

<!-- gh-comment-id:436738703 --> @liranringel commented on GitHub (Nov 7, 2018): I can expose that info. I'll update you when it happened.
Author
Owner

@bluejekyll commented on GitHub (Nov 7, 2018):

Thanks, @liranringel. I still don't know of any root issue here, other than an optimization that may not have a huge effect. Also, it might be a big change to incorporate interfaces into the IP/routes for the nameservers, so I don't know when that work would even occur.

<!-- gh-comment-id:436796247 --> @bluejekyll commented on GitHub (Nov 7, 2018): Thanks, @liranringel. I still don't know of any root issue here, other than an optimization that may not have a huge effect. Also, it might be a big change to incorporate interfaces into the IP/routes for the nameservers, so I don't know when that work would even occur.
Author
Owner

@kolbma commented on GitHub (Nov 8, 2018):

@bluejekyll Benjamin, yeah, maybe not much improvement. The story behind is, that I'm using trust-dns without resolver-part to do different DNS work. For this I'd like to base on the DNS settings of the system. So resolver got a dependency just for reading the config. I don't know what is your solution for resolver to get a working DNS server! The default is to use the one from Google. I know. But Google is evil. ;-) DNS shouldn't become so centralised. If you prefer the system config? How does it work? Does each client try to connect this list of servers until a connect works? Here I've many virtual interfaces for VMs. All provide a DNS server address for internal usage. So it needs some time to get through the list with connect-timeout to find the one between which can be used by the host. Sure this can be cached afterwards, but this information should be available by the system and the ugly try-and-error part could be skipped. The ipconfig crate seems to be very rudimentary and doesn't provide this, too.

<!-- gh-comment-id:436900900 --> @kolbma commented on GitHub (Nov 8, 2018): @bluejekyll Benjamin, yeah, maybe not much improvement. The story behind is, that I'm using trust-dns without resolver-part to do different DNS work. For this I'd like to base on the DNS settings of the system. So resolver got a dependency just for reading the config. I don't know what is your solution for resolver to get a working DNS server! The default is to use the one from Google. I know. But Google is evil. ;-) DNS shouldn't become so centralised. If you prefer the system config? How does it work? Does each client try to connect this list of servers until a connect works? Here I've many virtual interfaces for VMs. All provide a DNS server address for internal usage. So it needs some time to get through the list with connect-timeout to find the one between which can be used by the host. Sure this can be cached afterwards, but this information should be available by the system and the ugly try-and-error part could be skipped. The ipconfig crate seems to be very rudimentary and doesn't provide this, too.
Author
Owner

@bluejekyll commented on GitHub (Nov 8, 2018):

Please see the response from @liranringel for potential support in the underlying library. I definitely see the benefit here, but I’m not totally clear on your usecase. It sounds pretty specific to a specialized scenario.

As to some of your questions, there are 4 options for DNS recursive resolvers, google, cloudflare, quad9 and your system config. The pre configured ones are just an ease of use thing, not meant to encourage people to use them one way or another.

In terms of usage, yes, each nameserver listed in the config of the resolver will be tried. After an initial pass, they will be sorted on usage based on connection status and then after that successes vs. failures. So yes, if this list is excessively long with many failed or down paths, then there could be a large expense to picking a working nameserver IP.

Mind you, all interface routing is performed by the OS and it’s own route tables, trust-dns-resolver does nothing special for that, it just selects an IP, and then the OS is responsible for selecting an active route to that IP.

<!-- gh-comment-id:437067453 --> @bluejekyll commented on GitHub (Nov 8, 2018): Please see the response from @liranringel for potential support in the underlying library. I definitely see the benefit here, but I’m not totally clear on your usecase. It sounds pretty specific to a specialized scenario. As to some of your questions, there are 4 options for DNS recursive resolvers, google, cloudflare, quad9 and your system config. The pre configured ones are just an ease of use thing, not meant to encourage people to use them one way or another. In terms of usage, yes, each nameserver listed in the config of the resolver will be tried. After an initial pass, they will be sorted on usage based on connection status and then after that successes vs. failures. So yes, if this list is excessively long with many failed or down paths, then there could be a large expense to picking a working nameserver IP. Mind you, all interface routing is performed by the OS and it’s own route tables, trust-dns-resolver does nothing special for that, it just selects an IP, and then the OS is responsible for selecting an active route to that IP.
Author
Owner

@seanmonstar commented on GitHub (Jan 11, 2019):

It seems this may be causing issues with reqwest on Windows, as reported here: https://github.com/seanmonstar/reqwest/issues/431

<!-- gh-comment-id:453394494 --> @seanmonstar commented on GitHub (Jan 11, 2019): It seems this may be causing issues with reqwest on Windows, as reported here: https://github.com/seanmonstar/reqwest/issues/431
Author
Owner

@liranringel commented on GitHub (Jan 11, 2019):

Adapter.oper_status was added to ipconfig.
I think you also need the routing table to know which dns server you should use.

<!-- gh-comment-id:453506211 --> @liranringel commented on GitHub (Jan 11, 2019): `Adapter.oper_status` was added to `ipconfig`. I think you also need the routing table to know which dns server you should use.
Author
Owner

@bluejekyll commented on GitHub (Jan 11, 2019):

As I meantioned above, trust-dns isn’t tracking anything related to routing tables today. I also don’t have access to a Windows system to reproduce this.

Can we filter during initialization of the system configuration based on active interfaces? Or is this something that could change at various times due to laptops joining and leaving networks?

For other reasons, like mDNS support, I have considered starting to track NameServers against network routes, but that work is as yet unplanned and undesigned.

<!-- gh-comment-id:453545949 --> @bluejekyll commented on GitHub (Jan 11, 2019): As I meantioned above, trust-dns isn’t tracking anything related to routing tables today. I also don’t have access to a Windows system to reproduce this. Can we filter during initialization of the system configuration based on active interfaces? Or is this something that could change at various times due to laptops joining and leaving networks? For other reasons, like mDNS support, I have considered starting to track NameServers against network routes, but that work is as yet unplanned and undesigned.
Author
Owner

@Arnavion commented on GitHub (Jan 11, 2019):

Specifically for the reqwest issue, I don't think filtering out inactive adapters will help since the adapter contributing the IPv6 DNS server IP is up.

<!-- gh-comment-id:453632682 --> @Arnavion commented on GitHub (Jan 11, 2019): Specifically for the reqwest issue, I don't think filtering out inactive adapters will help since the adapter contributing the IPv6 DNS server IP is up.
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#245
No description provided.