https://bugs.winehq.org/show_bug.cgi?id=54819
Bug ID: 54819 Summary: DnsQuery_A() mishandles CNAME DNS records Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: dnsapi Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com Distribution: ---
Specifically this breaks the wpad auto-proxy lookups through this chain: InternetQueryOptionW(NULL,...) + INTERNET_PER_CONN_FLAGS (as per wininet:internet) -> calls query_global_option() -> calls get_proxy_autoconfig_url() -> calls detect_proxy_autoconfig_url_dns() -> calls getaddrinfo(AI_DNS_ONLY) -> calls DnsQuery_A()
Removing AI_DNS_ONLY bypasses DnsQuery_A() and gets more sensible results... but see bug 52133.
So anyway, if you have something like this in your DNS configuration:
ns A 192.168.3.1 wpad CNAME ns
You get nonsensical results like:
0024:trace:wininet:detect_proxy_autoconfig_url_dns family=2 addr={ family AF_INET, address 192.159.62.1, port 0 } canon=(null) 0024:trace:wininet:detect_proxy_autoconfig_url_dns family=2 addr={ family AF_INET, address 192.168.3.1, port 0 } canon=(null) 0024:trace:wininet:detect_proxy_autoconfig_url_dns family=23 addr={ family AF_INET6, address 20a0:3e01::7800:7800:7800:7800, flow label 0, port 0, scope 0 } canon=(null)
The 192.168.3.1 is as expected but the 192.159.62.1 result should not be there and, because it comes first, detect_proxy_autoconfig_url_dns() returns the wrong URL! Also one gets a different bad IP address for wpad.foo and wpad.bar.
Furthermore this issue can be fixed by changing the DNS confguration to:
ns A 192.168.3.1 wpad A 192.168.3.1
So this issue is specific to CNAMEs.
Additional notes: * I found this issue while debugging bug 54818 but it actually makes no difference there, it just results in the wrong url getting returned. * I don't think the IPv6 result makes sense but I'm not sure yet.