cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Re: Re: [libcurl 7.24.0] AAAA DNS query with --disable-ipv6

From: Jongman Heo <jongman.heo_at_samsung.com>
Date: Wed, 05 Dec 2012 06:17:23 +0000 (GMT)
Samsung Enterprise Portal mySingle

>
> Hi, Daniel,
>
> I tried, but CURL_IPRESOLVE_V4 doesn't help.
>
> As I already stated, I have a --disable-ipv6 --enable-threaded-resolver flag.
>
> I put some debug messages and now know where the problem comes.
> In lib/asyn-thread.c,
>
> Curl_resolver_getaddrinfo(...)
> {
> ...
>   memset(&hints, 0, sizeof(hints));
>   hints.ai_family = pf;                                // Here, ai_family is AF_INET (2), as I expected...
>   hints.ai_socktype = conn->socktype;
> ...
>   /* fire up a new resolver thread! */
>   if(init_resolve_thread(conn, hostname, port, &hints)) {
>     *waitp = 1; /* expect asynchronous response */
>     return NULL;
>   }
> ...
> }
>
> init_resolve_thread() above calls init_thread_sync_data() internally but init_thread_sync_data() does not sync tsd->hints if  CURLRES_IPV6 is not defined (which is my case). So, tsd->hints remains NULL. So, it seems that default AF_UNSPEC is used.
>
> I didn't expect AF_UNSPEC might be used though I specified --disable-ipv6.
> In my environment, I should not issue IPv6 AAAA DNS query due to some environmental problem.
> Could you give me a hint how to disable IPv6 thing entirely if --disable-ipv6 is not enough?
>
> Following change solves issue for me, but I'm not sure it is appropriate and don't know its side effect.
>
> static
> int init_thread_sync_data()
> {
>    memset(tsd, 0, sizeof(*tsd));

>    tsd->port = port;
> #ifdef CURLRES_IPV6
>    DEBUGASSERT(hints);
>    tsd->hints = *hints;
> #else
>    (void) hints;
> +  tsd->hints = *hints; // Adding this line makes getaddrinfo() use AF_INET...
> #endif
>
>
> Best regards,
> Jongman Heo.

Update :

  Switching back to 'c-ares' fixes my issue. I'd stick to use c-ares for my environment for a while.

 

Thanks,

Jongman Heo.

 

 

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-12-05