cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Kim Vandry <vandry_at_TZoNE.ORG>
Date: Sun, 07 Apr 2013 22:16:12 -0400

On 2013-04-07 19:18 , Gisle Vanem wrote:
> 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.

Not to mention that even on POSIX platforms SO_BINDTODEVICE requires
root access, so most applications in which libcurl is embedded won't
have the ability to do it anyway (but most applications don't need it,
so that's OK).

So if it doesn't work, whether it is because the platform doesn't
support it or because the user isn't root, or because c-ares isn't in
use, we let it go without complaining and continue the request.

Note that libcurl CURLOPT_INTERFACE also has a second effect besides
SO_BINDTODEVICE: bind()ing the socket to a local IP address that comes
from the specified interface. I believe c-ares doesn't do this.

-kv
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-08