cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: CURLOPT_LOCALPORT option broken ?!

From: Senthil Raja Velu <Senthil.Raja_at_SS8.com>
Date: Mon, 23 Feb 2009 15:34:24 -0800

Hi Markus,
I tried all your suggestions but unfortunately none of them work for me.
Here are the outputs;

testsvr% curl --verbose --interface 10.0.110.131 --local-port
60027-60028 https://10.20.4.19/cgi-bin/TEST/TEST.py
* About to connect() to 10.20.4.19 port 443 (#0)
* Trying 10.20.4.19... Domain 10.0.110.131 is ip
* Couldn't bind to ''
* couldn't connect to host
* Closing connection #0
curl: (7) Couldn't bind to ''

testsvr% curl --verbose --interface bge0 --local-port 60027-60028
https://10.20.4.19/cgi-bin/TEST/TEST.py
* About to connect() to 10.20.4.19 port 443 (#0)
* Trying 10.20.4.19... getaddrinfo(3) failed for bge0:0
* Couldn't bind to ''
* couldn't connect to host
* Closing connection #0
curl: (7) Couldn't bind to ''

I don't know why it says failure for bge0, here is my ifconfig which
says I have bge0

testsvr% ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu
8232 index 1
        inet 127.0.0.1 netmask ff000000
bge0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index
2
        inet 10.0.110.131 netmask ffffff00 broadcast 10.0.110.255

testsvr% curl --verbose --interface testsvr --local-port 60027-60028
https://10.20.4.19/cgi-bin/TEST/TEST.py
* About to connect() to 10.20.4.19 port 443 (#0)
* Trying 10.20.4.19... Domain testsvr is ip
* Couldn't bind to ''
* couldn't connect to host
* Closing connection #0
curl: (7) Couldn't bind to ''

But if I try with the original code with the same curl commandline, I
see it binding as given bellow;

testsvr% curl --verbose --interface 10.0.110.131 --local-port
60027-60028 https://10.20.4.19/cgi-bin/TEST/TEST.py
* About to connect() to 10.20.4.19 port 443 (#0)
* Trying 10.20.4.19... Bind local address to 10.0.110.131
* Local port: 43239
* connected
* Connected to 10.20.4.19 (10.20.4.19) port 443 (#0)

testsvr% curl --verbose --interface bge0 --local-port 60027-60028
https://10.20.4.19/cgi-bin/TEST/TEST.py
* About to connect() to 10.20.4.19 port 443 (#0)
* Trying 10.20.4.19... getaddrinfo(3) failed for bge0:0
* Couldn't bind to 'bge0'
* couldn't connect to host
* Closing connection #0
curl: (7) Couldn't bind to 'bge0'

Here also bge0 fails.

tetsvr% curl --verbose --interface testsvr --local-port 60027-60028
https://10.20.4.19/cgi-bin/CSCF/CSCF.py
* About to connect() to 10.20.4.19 port 443 (#0)
* Trying 10.20.4.19... Bind local address to 10.0.110.131
* Local port: 43286
* connected
* Connected to 10.20.4.19 (10.20.4.19) port 443 (#0)

Thank you.
Senthil.

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of
koettermarkus_at_gmx.de
Sent: Friday, February 20, 2009 5:35 PM
To: libcurl development
Subject: Re: CURLOPT_LOCALPORT option broken ?!

Hi,

I hope you took the second patch.
I tested this using the curl cli, and would be glad if you could too.

curl --interface 10.0.110.131 --local-port 60027-60028
https://10.20.4.19/cgi-bin/TEST/TEST.py

Would match your query.

As I do not have 10.20.4.19 here, here is a slightly different output
when asking for curl.haxx.se.

/opt/curl/bin/curl --verbose --interface 192.168.53.20 --local-port
41022-41023 http://curl.haxx.se > /dev/null
* About to connect() to curl.haxx.se port 80 (#0)
* Trying 91.191.140.28... Domain 192.168.53.20 is ip 192.168.53.20
* Local port: 41022
* connected
* Connected to curl.haxx.se (91.191.140.28) port 80 (#0)
...
works

If I take your output correct, "10.0.110.131" was not 'resolved' to an
ip address correctly.

> CURL: Trying 10.20.4.19... CURL: Domain 10.0.110.131 is ip

that line should look like:

"CURL: Trying 10.20.4.19... CURL: Domain 10.0.110.131 is ip
10.0.110.131"

Maybe Daniel can tell help me out on Curl_resolv and Curl_resolv_unlock?
Curl_resolv returns, h is not NULL, but the result is empty string?
Which resolver do you use?

Additionally, please try

curl --interface eth0 --local-port 60027-60028
https://10.20.4.19/cgi-bin/TEST/TEST.py

and replace eth0 by your interface

as well as

curl --interface myhostname --local-port 60027-60028
https://10.20.4.19/cgi-bin/TEST/TEST.py

and replace the hostname with your hostname.

and include the output with your mail.

MfG
Markus
Received on 2009-02-24