Subject: Re: [Bug-wget] Anyone want to add libcares support to wget?

Re: [Bug-wget] Anyone want to add libcares support to wget?

From: Ben Greear <>
Date: Tue, 15 Mar 2016 09:03:19 -0700

On 03/15/2016 01:47 AM, Tim Ruehsen wrote:
> Hi Ben,
> just for my understanding:
> You want the DNS UDP packets being sent with src= and
> dst=(, this means using the interface
> IMO, this is a routing (and resolv.conf) issue.
> similar to this post:
> Maybe I am wrong, in that case could you please add a detailed explanation,
> environment, purpose ? Because if anyone is going to implement such a thing,
> (s)he will need to build up a test environment and also add automated tests (+
> extending the test suite).

I want to use wget on multi-homed machines, and I use routing rules to route pkts
out specific interfaces based on the source IP.

So, I need to be able to bind to a local IP address, including for the resolver logic,
which is why I want to use libcares.

To test, I think it would be sufficient to put two IPs on a port (,, and then
use cmd-line args to choose one or the other. Sniff and watch for proper source address.

For DNS servers, have and be specified. Sniff and watch to see that the
resolver destination IP is as specified. This should be completely independent of whatever
is in /etc/resolv.conf, etc.

I (and others) have patched libcares and curl in the past to handle all of this,
so I know libcares can do it. I think the main work is to handle new cmd-line
arguments, pass appropriate info to libcares, and make wget use libcares for it's
resolve logic.


> Regards, Tim
> On Monday 14 March 2016 14:11:46 Ben Greear wrote:
>> I have a feature request that would likely be most
>> easily implemented by adding libcares support to the wget tool.
>> The feature is basically: Allow specifying local IP to bind to,
>> and specific DNS to use on the cmd line when using wget to download a web
>> site (recursively, to emulate a browser loading a page with images, etc).
>> Something like:
>> wget -l 0 -r --bind-address --bind-dns-address
>> --dns-servers ","
>> curl can do this with one URL, but I don't think it can easily be made to
>> download image content and similar.
>> If anyone is looking for a side project and wants to give this a try, please
>> let me know.
>> Thanks,
>> Ben

Ben Greear <>
Candela Technologies Inc
Received on 2016-03-15