Open nir2 opened 1 year ago
Ps: I just saw, in the Netty API documentation you find the line: "These defaults do not respect your host's machines defaults". So this rather is a feature request, and not a bug report.
/**
* A {@link DnsServerAddressStreamProvider} which will use predefined default DNS servers to use for DNS resolution.
* These defaults do not respect your host's machines defaults.
* <p>
* This may use the JDK's blocking DNS resolution to bootstrap the default DNS server addresses.
*/
public final class DefaultDnsServerAddressStreamProvider implements DnsServerAddressStreamProvider {
Expected behavior
On Windows, the system default DNS nameservers should be queried in same order as in the Windows operating system
Actual behavior
The DNS nameservers are queried in reverse order
Steps to reproduce
Have a setup with multiple nameservers, e.g. one nameserver from your internet provider (192.168.x.x) and one from an OpenVPN connection (172.16.x.x). In the Windows operating system first the nameserver from the OpenVPN connection is queried, and afterwards, if this fails, the ISP nameserver is queried. In Netty the opposite search order is used.
Minimal yet complete reproducer code (or URL to code)
(code example is in Scala)
and later:
I think that the problem is, that in the Netty code the nameserver search list is determined by only calling via reflection
sun.net.dns.ResolverConfiguration.nameservers
but I think that alsosun.net.dns.ResolverConfiguration.searchlist
should be used to sort the nameservers into the right orderJDK code snippet:
Netty version
4.1.86
JVM version (e.g.
java -version
)IMPLEMENTOR="Azul Systems, Inc." IMPLEMENTOR_VERSION="Zulu11.56+19-CA" JAVA_VERSION="11.0.15" JAVA_VERSION_DATE="2022-04-19"
OS version (e.g.
uname -a
)Windows 11, Build 22H2