Bugs item #3105028, was opened at 2010-11-08 05:13
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3105028&group_id=976
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: bad behaviour
>Status: Closed
>Resolution: Later
Priority: 5
Private: No
Submitted By: fiderallalla (fiderallalla7)
Assigned to: Nobody/Anonymous (nobody)
Summary: Error binding to ipv4 interface when target has ipv4+ipv6
Initial Comment:
Let's assume there are two interfaces:
eth0: ipv4 AND ipv6: 1.1.1.1 / 2001:.....
eth1: only ipv4: 2.2.2.2
curl --interface 2.2.2.2 <host>
fails when <host> has both ipv6 and ipv4 adresses:
curl: (45) bind failed with errno 22: Invalid argument
To prevent that, one has to manually specify --ipv4 / -4,
In my opinion this should be implied, since we are binding to an ipv4-only interface and it makes no sense preferring ipv6 over ipv4.
----------------------------------------------------------------------
>Comment By: Daniel Stenberg (bagder)
Date: 2010-12-10 22:14
Message:
Due the nature of this, this request is on the border to a feature request.
I'm setting this bug entry as 'later' in the hope that we will get a better
approach to this problem in the future. As there's nobody working on this
now and I don't know of anyone with plans for it, I don't want this
lingering around.
Thanks anyway for bring this to our attention.
----------------------------------------------------------------------
Comment By: Daniel Stenberg (bagder)
Date: 2010-11-12 00:15
Message:
The answer to why:
curl resolves the target host first and uses the preferred IP version
there. Then it binds the local end and it then tries to do that using the
same IP version that it resolved the host name with...
----------------------------------------------------------------------
Comment By: fiderallalla (fiderallalla7)
Date: 2010-11-11 17:58
Message:
I'm on debian/lenny
curl without c-ares:
$ ./curl -V
curl 7.21.3-DEV (i686-pc-linux-gnu) libcurl/7.21.3-DEV OpenSSL/0.9.8g
zlib/1.2.3.3 libidn/1.8 libssh2/0.18
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3
pop3s rtsp scp sftp smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM SSL libz
$ ./curl --interface XX.XX.XX.XX www.google.com -v
* About to connect() to www.google.com port 80 (#0)
* Trying 2a00:1450:8001::63... getaddrinfo(3) failed for XX.XX.XX.XX:0
* Couldn't bind to 'XX.XX.XX.XX'
* Closing connection #0
curl: (45) Couldn't bind to 'XX.XX.XX.XX'
curl with c-ares:
$ ./curl -V
curl 7.21.3-DEV (i686-pc-linux-gnu) libcurl/7.21.3-DEV OpenSSL/0.9.8g
zlib/1.2.3.3 c-ares/1.7.3 libidn/1.8 libssh2/0.18
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3
pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile NTLM SSL libz
$ ./curl --interface XX.XX.XX.XX www.google.com -v
* About to connect() to www.google.com port 80 (#0)
* Trying 2a00:1450:8001::63... Name 'XX.XX.XX.XX' family 10 resolved to
'XX.XX.XX.XX' family 2
* bind failed with errno 22: Invalid argument
* Closing connection #0
curl: (45) bind failed with errno 22: Invalid argument
Adding --ipv4 to curl's commandline works just fine in both cases.
I'm just wondering why it tries ipv6 in the first place, when the
--interface specified is ipv4-only.
----------------------------------------------------------------------
Comment By: Daniel Stenberg (bagder)
Date: 2010-11-11 15:20
Message:
You didn't state what version or OS you use.
The idea is however that the resolved IP is what dictates what
interface/address to bind the local end to. Can you please try the current
git/tomorrow's daily snapshot and see how it works?
If it still fails, can you please A) show us the full -v output and B)
show use the "curl -V" output.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3105028&group_id=976
Received on 2010-12-10