curl / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Ben Greear <greearb_at_candelatech.com>
Date: Wed, 13 Dec 2017 08:14:43 -0800

On 12/13/2017 12:19 AM, Daniel Stenberg wrote:
> On Thu, 9 Nov 2017, greearb_at_candelatech.com wrote:
>
> Hi Ben!
>
>> 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.
>
> This patch has clearly been neglected by me, and while I'm not quite ready to take it on just yet[*] I wanted to ask if you could consider pushing this to github as a PR?

I attempted to do this just now...

>
> That way we'd get it tested and verified much better before merge, and it also helps out to tell us when it starts to get merge confliects (and it makes it harder for us/me to forget it). Like it does now: the changes in lib/connect.c needs a rebase/edit to apply on current git master.
>
> Further: I would like to get a clearer view on what exactly CURLOPT_LOCALADDR provides and offers that CURLOPT_INTERFACE prefixed with "host!" doesn't do? And if so, can't we instead make CURLOPT_INTERFACE use that? Or perhaps even add another prefix for CURLOPT_INTERFACE if it truly has to be different. To me, this feels like adding an entirely new easy option for a very minor variation of an already existing option.

The problem is that you need to be able to specify both an interface and an IP address in some
cases. Think about a system with multiple interfaces, and with at least some interfaces holding
multiple IP addresses.

Also, in cases where you have thousands of interfaces and thousands of IP addresses on a system,
it can be much more efficient to not have to do an exhaustive linear search of the IP addresses
when binding to a particular interface.

Thanks,
Ben

>
> [*] = I'll take off on an extended vacation now for a few weeks ahead so I personally won't work on anything larger until I get back.
>

-- 
Ben Greear <greearb_at_candelatech.com>
Candela Technologies Inc  http://www.candelatech.com
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-12-13