Hi All,

Dealing with some resolution and timeout problems for IPv4-only resolve mode, I 
discovered that libcurl (with IPv6 enabled) uses both A and AAAA DNS queries 
for IPv4 resolve mode if it detects that IPv6 is enabled on the OS level.
I stumbled upon several cases when such behavior created regressions for 
IPv4-only requests with ISPs/routers with bad DNS IPv6 support.

Under such conditions,  “dual-stack” DNS queries caused connection delays, and 
on several occasions when AAAA responses arrived too late or didn’t arrive at 
all, they caused connection timeouts and requests failures.
This bad effect of IPv6 functionality “leak” doesn’t look right for the IPv4 
resolve only, so I suggest fixing it using the following approach:



1.       Use only IPv4 DNS queries for IPv4-only resolve mode.

2.       For the “dual-stack” and IPv6-only resolve modes use “dual-stack” DNS 
queries.

NOTE: I don’t suggest to use IPv6 DNS queries for the IPv6-only resolve mode 
because IPv6 still has more issues than IPv4, and if some client wants to 
implement its own “happy-eye-balls” mechanism

(when IPv6 is tried first and then switching to IPv4) then “dual-stack” DNS 
queries will save on resolution time when trying IPv4 after failed IPv6.



3.       Clear DNS cache entry if the cached entry doesn’t contain address for 
the requested family and redo DNS query for the host name.
This is needed when requests using IPv4-only resolve mode are followed by 
requests to the same host but using IPv6 mode.

If this approach is agreed upon, I have implementation for these changes and 
can create a PR.



Thanks,
Dmitry Karpov
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to