cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Curl has problems with virtual NICs e.g eth0:1

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 29 Nov 2009 23:39:02 +0100 (CET)

On Thu, 26 Nov 2009, Simon Loewenthal/NL/Tele2 wrote:

> ...But this does not,
> r3k-app56:/usr/local/bin # curl -v -s -S -k --interface eth0:1
> --ftp-pasv --ftp-skip-pasv-ip --ftp-ssl --ftp-ssl-ccc -u
> 'ACC50506:9f2o82sAZe' ftp://1.2.3.4:21
> * About to connect() to 1.2.3.4 port 21 (#0)
> * Trying 1.2.3.4... Bind local address to 10.254.177.92
> * SO_BINDTODEVICE eth0:1 failed
> * Local port: 45386

Did you see this actually not work or did you just assume that based on the
'failed' output?

> Curl certainly can obtain the correct IP address from the virtual device
> as shown in the second example:
> * Trying 1.2.3.4... Bind local address to 10.254.177.92
> but then is unhappy
> * SO_BINDTODEVICE eth0:1 failed

That's because the setsockopt() option SO_BINDTODEVICE returns failure on that
given device name. I don't know why or how it is supposed to work with virtual
names, but that's what happens. libcurl itself can figure out the IP address
and it can bind the local socket to that IP as well, which is why I ask what
kind of failure you actually see here.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-29