cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Make DNS requests follow the CURLOPT_INTERFACE if c-ares is in use

From: Ben Greear <greearb_at_candelatech.com>
Date: Sun, 07 Apr 2013 19:02:13 -0700

On 04/07/2013 04:18 PM, Gisle Vanem wrote:
> "Vandry" <vandry_at_TZoNE.ORG> wrote:
>
>> If c-ares is in use, this is actually easy to implement because c-ares already has a hook for it. I propose a small change that would make DNS requests also
>> follow the CURLOPT_INTERFACE binding if c-ares is in use. If c-ares is not in use or if the c-ares version is too old to support this, the behaviour would be
>> the same as it is now. I could have made it fail with CURLE_NOT_BUILT_IN but I don't think that's a good idea.
>
> And also for Windows since 'ares_set_local_dev()' boils down to
> 'setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE)' which Winsock
> doesn't support. There should be another neater way to at least
> send DNS-requests to a specific interface on Windows.

Please do not force c-ares to use the same interface as curl....normally it should
be the same, but not in all cases, so you can just give users more options
to explicitly bind c-ares.

I have patches in my repo that does this, though they could use
some cleanup:

https://github.com/greearb/curl

You also need a patch to c-ares:

https://github.com/greearb/c-ares

As for binding on windows, you can bind to a local IP, which
is about as good as it gets on Windows I think. c-ares can bind
to local IPs as well, so the features are already there I think.

Thanks,
Ben

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

-- 
Ben Greear <greearb_at_candelatech.com>
Candela Technologies Inc  http://www.candelatech.com
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-08