Cause:
The code handling errors while connecting to remote host didn't backed up the error value until checking it. The error value was therefore overwritten by a different error value before checking.
Consequence:
As a result, lftp failed to connect to a remote host if the client host didn't have IPv6 connection, but the remote host domain name was resolved also to IPv6 addresses. Therefore lftp failed to connect to the first IPv6 remote host address and existed.
The error checking code was fixed to back up the appropriate error value before checking. Therefore the value is now not overwritten and the right error value is checked later on.
Result:
As a result lftp is not able to connect to a remote host which domain name resolves to also IPv6 addresses, from the client which has only IPv4 connectivity.
lftp uses ipv6 addresses even when ipv6 is not available
Version-Release number of selected component (if applicable):
$ rpm -q lftp
lftp-4.0.9-1.el6.i686
How reproducible:
Always
Steps to Reproduce:
1. $ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:1B:72:D9
inet addr:192.168.120.2 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3060 errors:0 dropped:0 overruns:0 frame:0
TX packets:2885 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:607125 (592.8 KiB) TX bytes:386040 (376.9 KiB)
Interrupt:19 Base address:0x2000
2. $ lftp -d
http://ftp.twaren.net/Linux/
---- Connecting to ftp.twaren.net (2001:e10:5c00:5::9) port 80
**** connect: Network is unreachable
---- Closing HTTP connection
cd: Success
3. $ lftp -d
http://releases.ubuntu.com/
---- Connecting to releases.ubuntu.com (2001:7b8:3:37::21:1) port 80
**** connect: Network is unreachable
---- Closing HTTP connection
cd: Success
Actual results:
As above.
Expected results:
$ lftp
http://ftp.twaren.net/Linux/
cd ok, cwd=/Linux
Additional info:
1. Similar bug report is available here:
https://bugs.launchpad.net/ubuntu/+source/lftp/+bug/736479
2. After switching to lftp-4.2.1-1.fc15.i686.rpm or lftp-4.0.5-2.fc13.i686.rpm, this issue is gone.