Subject: Re: need information : option to set network interface for the DNS requests.

Re: need information : option to set network interface for the DNS requests.

From: Ben Greear <greearb_at_candelatech.com>
Date: Fri, 30 Sep 2011 08:59:50 -0700

On 09/30/2011 06:33 AM, arjun sj wrote:
> Hi All,
> Is there a way in which you can set the network interface to which the DNS requests can be bound to.
> We have a project which requires to use a highpriority streaming session go through one interface and all the other requests channeled through the second one.
> example: setting 'eth0' so that all the ares requests will go through 'eth0' and not on 'wlan0'.
> I was not able to find any API in c-ares (in ares_init_options() API) that gives this option of setting interface.
> Can you please let me know if there is some way to achive this or if I missed something.
> Thanks,
> Arjun

Yes, there is:

These are some snippets from my curl patches at:
https://github.com/greearb/curl

You don't need any of my curl patches, but they could be
an example of how to set these things in c-ares. You should
be able to search through the c-ares code and man pages to
find info on these methods as well.

  ares_set_local_dev((ares_channel)data->state.resolver, va_arg(param, char *));
  ares_set_local_ip4((ares_channel)data->state.resolver, va_arg(param, uint32_t));
  ares_set_servers_csv((ares_channel)data->state.resolver, va_arg(param, const char*));

Thanks,
Ben

-- 
Ben Greear <greearb_at_candelatech.com>
Candela Technologies Inc  http://www.candelatech.com
Received on 2011-09-30