curl / Mailing Lists / curl-library / Single Mail


Re: [PATCH] curl: Support CURLOPT_LOCALADDR to bind to local address.

From: Christian Hägele <>
Date: Wed, 31 Jan 2018 14:24:48 +0100

Am 09.11.2017, 16:17 Uhr, schrieb <>:

> This allows a user to bind to both an interface (with CURLOPT_INTERFACE)
> and a local IP address. In doing so, it allows the user to work-around
> some serious performance issues on machines with lots of virtual interfaces
> because curl no longer has to scan all interfaces each time it makes
> a connection.

I'm very interested in this feature.
However, I think you missed one important topic. When you are using
DNS-Names you cannot know if it resolves to IPv4 or IPv6 or both. So if
you bind to a local IPv6 and the host only supports IPv4 connection will
fail. Same is true vice versa.
The only way I can think of solving this problem is by providing a local
IPv4 and a local IPv6 at the same time and let Curl choose after
DNS-Resolution which to use or maybe use both (for Happy-Eyeballs).

Any comments on this? (Disclaimer: I did not look at the code, only at the
documentation of the option)


Received on 2018-01-31