cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Binding to interface and IP

From: Ben Greear <greearb_at_candelatech.com>
Date: Wed, 07 Jul 2010 11:50:21 -0700

On 07/07/2010 11:41 AM, Petr Pisar wrote:
> On Wed, Jul 07, 2010 at 11:02:32AM -0700, Ben Greear wrote:
>> In order to support secondary IPs on an interface, I would like
>> to be able to bind to both a local IP and local interface.
>>
>> I'm thinking of passing something like this to "eth2::192.168.1.5"
>> to the CURLOPT_INTERFACE (and changing that code to parse
>> it properly).
>>
> I do not understand your idea. Do you want to bind a socket to specific
> address on specific interface (in case you have more interfaces with the same
> address)?

I want the SO_BINDTODEVICE logic, and I also want to set the specific
address because I want to support multiple addresses on each interface.

In general, just binding to the IP is usually sufficient, but when
you use SO_BINDTODEVICE it makes it harder to have connections unexpectedly
use a different interface (including 'lo').

> What about using ADDRESS "%" INTERFACE syntax that is standardized for link
> scope address selecition in RFC 4007 (IPv6 Scoped Address Architecture)? BTW,
> you should (I don't know state of support in curl) be able to pass outgoing
> interface to request URI string with the same mechanism.

I don't think the curl URL string supports parsing that currently,
but at least for the CURLOPT I'm happy to use the ADDRESS "%" INTERFACE syntax.

Thanks,
Ben

-- 
Ben Greear <greearb_at_candelatech.com>
Candela Technologies Inc  http://www.candelatech.com
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-07