Last bad IPv6 query response can make c-ares to report resolution failure even if there is previously successful IPv4 response

Brad House brad at brad-house.com
Wed Apr 27 15:58:09 CEST 2022


On 4/21/22 3:49 PM, Dmitry Karpov via c-ares wrote:
>
> Hi,
>
>
> I recently stepped on an issue with curl using c-ares 
> ares_getaddrinfo() with PF_UNSPEC family, when AAAA response from DNS 
> server contained some bad data resulting into ARES_EBADRESP status 
> code whereas A response was good.
>
> The problem was that when AAAA response was the last received, it made 
> c-ares to ignore previously received good A response and fail the host 
> resolution with ARES_EBADRESP status code.
> But if A response was the last received, then c-ares ignored the bad 
> AAAA response and the host resolution was successful.
>
> I looked at the c-ares code, and found the problem in the 
> host_callback() function (src\lib\ares_getaddrinfo.c: 528)
>
...
>
> When there are no remaining queries, the ARES_EBADRESP parsing error 
> is reported immediately, even though the previous query might be 
> successful.
>
...
>
> I am also attaching a patch file with the potential fix.
>
> Thanks,
> Dmitry Karpov
>


Thanks! This patch has been applied to main.

-Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.haxx.se/pipermail/c-ares/attachments/20220427/c75b2538/attachment.htm>


More information about the c-ares mailing list