curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

RE: IPv6 resolution problems for IPv4 resolve mode

From: Dmitry Karpov via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 19 May 2022 18:42:01 +0000

As we have the feature window open now, can I get some input on my proposal?


Thanks,
Dmitry Karpov


From: curl-library <curl-library-bounces_at_lists.haxx.se> On Behalf Of Dmitry Karpov via curl-library
Sent: Monday, May 9, 2022 2:25 PM
To: libcurl development <curl-library_at_lists.haxx.se>
Cc: Dmitry Karpov <dkarpov_at_roku.com>
Subject: IPv6 resolution problems for IPv4 resolve mode


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
Received on 2022-05-19