cURL / Mailing Lists / curl-library / Single Mail

curl-library

PATCH: Handle DNS timeouts on multi-interfaces better

From: Jason Glasgow <jglasgow_at_google.com>
Date: Wed, 30 Nov 2011 15:43:03 -0500

Attached is a patch to fix a problem I've been having with the
multi-interface. The problem that I've observed is that if the first name
server is not available, the multi interface does not invoke the socket_cb
when the DNS request to the first name server timesout.

This bug can be reproduced if Curl is complied with --enable_ares and your
code uses the multi socket interfaces and the CURLMOPT_SOCKETFUNCTION
option. The way I test is to set up an iptables rule that discards the
name server reply from the first name server. This forces a timeout and
then cares tries to use the secondary name server. Without the patch, the
client code is never informed of the new socket that cares is using.

To test try:
      iptables -I INPUT \
               -s $(sed -n -e '/name/{s/.* //p;q}' /etc/resolv.conf)/32 \
               -j REJECT
and then run a program which uses the multi-interface

-Jason

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2011-11-30