Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 33827 - wget doesn't work when adress is specified as IP (works with domain-adress)
Summary: wget doesn't work when adress is specified as IP (works with domain-adress)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High major
Assignee: Seemant Kulleen (RETIRED)
URL:
Whiteboard:
Keywords:
: 33833 33879 34305 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-11-19 07:32 UTC by Marcin Kryczek (RETIRED)
Modified: 2003-12-10 01:25 UTC (History)
17 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
wget_pre20031125.ebuild.tar.bz2 (wget_pre20031125.ebuild.tar.bz2,1.61 KB, application/octet-stream)
2003-11-25 15:02 UTC, Sven Wegener
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Kryczek (RETIRED) gentoo-dev 2003-11-19 07:32:46 UTC
wget from 1.9.* series doesn't download files when the adress is specified as 
IP. It just prints 'Aborted' without even try to connect. 
example:
<aye@CogES>~: wget http://127.0.0.1
--16:25:00--  http://127.0.0.1/
           => `index.html'
Aborted

but works with domain:
<aye@CogES>~: wget http://localhost
--16:25:36--  http://localhost/
           => `index.html'
Resolving localhost... 127.0.0.1
Connecting to localhost[127.0.0.1]:80... failed: Connection refused.

i've talked with people on irc and i know that i'm not alone with this problem, 
but noone could help


Reproducible: Always
Steps to Reproduce:




i've done:
<aye@CogES>~: strace wget http://127.0.0.1 > ip.log 2>&1
<aye@CogES>~: strace wget http://localhost > domena.log 2>&1

and here are diffrences:
<aye@CogES>~: diff ip.log domena.log 
1c1
< execve("/usr/bin/wget", ["wget", "http://127.0.0.1"], [/* 42 vars */]) = 0
---
> execve("/usr/bin/wget", ["wget", "http://localhost"], [/* 42 vars */]) = 0
78,79c78,79
< getpid()                                = 3051
< getpid()                                = 3051
---
> getpid()                                = 3053
> getpid()                                = 3053
82c82
< read(3, "P\t\275f\337\330C\36\342m\234\217p\227\321W\32\311\317"..., 32) = 32
---
> read(3, "\276\244\241\324I\346\265\365\314\365\375\214\265i{vk\253"..., 32) = 
32
84,85c84,85
< getpid()                                = 3051
< getpid()                                = 3051
---
> getpid()                                = 3053
> getpid()                                = 3053
87,89c87,89
< getpid()                                = 3051
< time(NULL)                              = 1069254156
< getpid()                                = 3051
---
> getpid()                                = 3053
> time(NULL)                              = 1069254166
> getpid()                                = 3053
91c91
< time(NULL)                              = 1069254156
---
> time(NULL)                              = 1069254166
98c98
< write(2, "--16:02:36--  http://127.0.0.1/\n"..., 59--16:02:36--  http://127.0.
0.1/
---
> write(2, "--16:02:46--  http://localhost/\n"..., 59--16:02:46--  http:
//localhost/
101,105c101,153
< rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
< getpid()                          
< kill(3051, SIGABRT)                     = 0
< --- SIGABRT (Aborted) @ 0 (0) ---
< +++ killed by SIGABRT +++
---
> write(2, "Resolving localhost... ", 23Resolving localhost... ) = 23
      = 3051
[...cuted...] // the rest thing is about correct connecting to localhost

my emerge info:
<aye@CogES>~: emerge info
Portage 2.0.49-r15 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r8, 2.4.22-bk37)
=================================================================
System uname: 2.4.22-bk37 i686 AMD Athlon(tm) XP 1700+
Gentoo Base System version 1.4.3.12
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon-xp -Os -pipe -mmmx -m3dnow -msse -fomit-frame-pointer 
-ffast-math"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config 
/usr/kde/2/share/config /usr/kde/3/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-march=athlon-xp -Os -pipe -mmmx -m3dnow -msse -fomit-frame-pointer 
-ffast-math"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache autoaddcvs sandbox"
GENTOO_MIRRORS="ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo ftp://ftp.
tu-clausthal.de/pub/linux/gentoo/ http://www.mirror.ac.uk/sites/www.ibiblio.
org/gentoo/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo http://ftp.
uni-erlangen.de/pub/mirrors/gentoo http://mirrors.sec.informatik.tu-darmstadt.
de/gentoo ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo ftp://ftp.easynet.
nl/mirror/gentoo/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://gentoo.
inode.at/ ftp://ftp.rhnet.is/pub/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/mnt/gentoo"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/my_ebuilds"
SYNC="rsync://rsync.gentoo.pl/gentoo-portage"
USE="x86 oss avi crypt cups encode foomaticdb gif jpeg libg++ mikmod motif mpeg 
ncurses nls pdflib png quicktime spell truetype xmms xv zlib gdbm berkdb slang 
readline arts tcltk java mysql postgres X sdl gpm tcpd pam libwww ssl perl 
python esd imlib oggvorbis opengl mozilla 3dnow acpi apache2 curl dvd fbcon 
flash javascript jikes lcms mbox memlimit mmx moznocompose moznoirc moznomail 
moznoxft nocardbus pda ppds samba sasl sse tiff v4l videos vim-with-x wmf xvid 
-apm -kde -gnome -mad -svga -xml2 -gtk -qt"
Comment 1 Neil Watson 2003-11-19 08:52:11 UTC
127.0.0.1 is a rather special IP.  Can you confirm this with a public or private IP?  I tried it an there was no problem:

wget http://216.138.221.7
--11:46:19--  http://216.138.221.7/
           => `index.html'
Connecting to 216.138.221.7:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2,238 [text/html]

100%[===============================================================================================>] 2,238         --.--K/s             

11:46:19 (21.34 MB/s) - `index.html' saved [2238/2238]
Comment 2 Marcin Kryczek (RETIRED) gentoo-dev 2003-11-19 08:59:39 UTC
hmm.. i havn't noticed it, but it doesn't work with any IP for me. 
additionaly - i know that it works on some computers and doesn't work on other, however i don't know why. Could you sen me via mail your C*FLAGS and USE flags? 
Comment 3 Neil Watson 2003-11-19 09:45:40 UTC
My flags are nothing special:
CFLAGS="-march=athlon-mp -O3 -pipe"
USE="-maildir mbox nls tcltk"
Comment 4 Greg Fitzgerald (RETIRED) gentoo-dev 2003-11-19 15:00:13 UTC
*** Bug 33833 has been marked as a duplicate of this bug. ***
Comment 5 Marcin Kryczek (RETIRED) gentoo-dev 2003-11-19 17:12:08 UTC
i was looking at sources and i've found where the bug is, but i still can't fix it (well - it's late and in the matter of fact i'm not programming in C at all).
anyway - this bug is coused by wget-1.9+ipvmisc.patch and it's connected with ip_family variable. program aborts in function 'wget_sockaddr_set_address' in host.c, where ip_family is always AF_INET6, if we specify adress as ip. 
Comment 6 Mr. Bones. (RETIRED) gentoo-dev 2003-11-19 17:15:15 UTC
*** Bug 33879 has been marked as a duplicate of this bug. ***
Comment 7 Piotr Bieniaszewski 2003-11-20 03:01:11 UTC
in my case, it doesn't matter if i give a domain name or ip address. in  both cases it aborts. i'm only able to download something when i give "-Y off" option (even if using of proxy is turned off in wgetrc).
Comment 8 barthek 2003-11-20 04:08:51 UTC
for me also the problem does not depend on whether i use ip or fqdn.
indeed the problem comes from the wget-1.9+ipvmisc.patch:

unpatched wget's function wget_sockaddr_set_address gets called with these params:
wget_sockaddr_set_address (sa=0xbfffd750, ip_family=2, port=8080, addr=0xbfffd790) at host.c:284

patched version:
wget_sockaddr_set_address (sa=0xbfffdc50, ip_family=10, port=0, addr=0x402469a0) at host.c:342

ip_family=10 is ipv6 family which wget was not compiled with (the
'ENABLE_IPV6' stuff)
ARI's patch assumes that default family used is that of IPv6's,
unless --with-ipv4-default is used during configure.

dunno what to do next nor whether my findings are correct. :)
Comment 9 Imad R. Faiad 2003-11-20 05:42:03 UTC
there used to be a USE flag to disable ipv6, namely "ipv6", the new ebuild
doesn't have it anymore.  this ipv6 patch is breaking things down, I suggest
that it either be removed or somehow allow the user to disable it.
Comment 10 André Terpstra 2003-11-20 07:34:06 UTC
I also have this problem. I've been searching like wild, thinking that my local FTP server had broken down... I finally decided to return to wget 1.9 with

"emerge -v /usr/portage/net-misc/wget/wget-1.9.ebuild"

and now all is well again (I think).
Comment 11 Martin Holzer (RETIRED) gentoo-dev 2003-11-21 04:37:21 UTC
with updated /etc/hosts which contains
 127.0.0.1      localhost
# IPV6 versions of localhost and co
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

i'm able to reproduce this too on one box.

>>> Downloading http://192.168.10.1/gentoo//distfiles/mysql-4.0.16.tar.gz
--16:23:09--  http://192.168.10.1/gentoo/distfiles/mysql-4.0.16.tar.gz
           => `/usr/portage/distfiles/mysql-4.0.16.tar.gz'
Connecting to 192.168.10.1:80... failed: Address family not supported by protocol.
Retrying.
Comment 12 Andrea Barisani (RETIRED) gentoo-dev 2003-11-21 15:59:03 UTC
This also causes problems if http_proxy is configured with a numerical IP address,
even if the target URL is a name.
Comment 13 Thomas R. (TRauMa) 2003-11-24 05:35:04 UTC
Fine, now the -1.9.ebuild ist gone. So you have to manually throw out the ipv6 patch from the -r1.ebuild before emerging wget.
Comment 14 Thomas R. (TRauMa) 2003-11-24 05:47:57 UTC
It doesn't work with 1.9.1-r1, too.

trauma development-sources # ACCEPT_KEYWORDS="~x86" emerge -pv wget

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] net-misc/wget-1.9.1-r1  +ssl +nls -static -ipv6 -debug +socks5 

trauma development-sources # wget  217.72.195.42
--14:41:30--  http://217.72.195.42/
           => `index.html'
Abgebrochen
Comment 15 Martin Holzer (RETIRED) gentoo-dev 2003-11-24 23:27:26 UTC
*** Bug 34305 has been marked as a duplicate of this bug. ***
Comment 16 Eldad Zack (RETIRED) gentoo-dev 2003-11-25 03:30:07 UTC
I've done some tracing and testing.

On a machine with ipv6 compiled in the kernel, with the ipv6 USE flag, wget correctly.
Without ipv6 in the kernel - I get "failed: Address family not supported by protocol."

without the ipv6 use flag the process gets SIGABRT on both machines.

I think it got something to do with the map_ipv4_to_ip function.
Comment 17 Eldad Zack (RETIRED) gentoo-dev 2003-11-25 04:04:51 UTC
Ok, the problem is that wget_sockaddr_set_address (on host.c) is called with ip_family=10 (ipv6).

since it is not matched, it wget gets abort()'d.

this is introduced by the ipvmisc patch, I've compiled without the patch and it works for ipv6 and ipv4 with ipv6 supported turned off or on.

I am trying to fetch localhost with wget ::1 but I get "Unsupported scheme" so it doesn't work for ipv6 (with or without the ipvmisc patch.)





Comment 18 Sven Wegener gentoo-dev 2003-11-25 15:02:17 UTC
Created attachment 21292 [details]
wget_pre20031125.ebuild.tar.bz2

I just checked out the current cvs code of wget and it contains support for
dual protocol operation. Seems to be fully functional and works without a hitch
for me. Feel free to try.

Attached files is a .tar.bz2 archive containing the ebuild and a needed patch.
Comment 19 Pedro B. 2003-12-02 03:54:01 UTC
still broken on 1.9-r2. the temporary trick is to add something like

1.2.3.4 mysite
and make the command line wget -r -m mysite for example.

but its still broken...
Comment 20 Josh Grebe (RETIRED) gentoo-dev 2003-12-02 20:24:03 UTC
I figured it out.

The patch, /usr/portage/distfiles/wget-1.9, line 717, explicitly sets any IP url to AF_INET6, it should be setting to AF_INET on this line, it is outside of the #ifdef block for inet6 support. I have emailed the patch author as well. This has been tested on x86 as well as sparc64 platforms.

Comment 21 Seemant Kulleen (RETIRED) gentoo-dev 2003-12-04 18:14:00 UTC
thanks Josh -- checked in 1.9-r2

does this problem exist in wget 1.9.1?
Comment 22 Seemant Kulleen (RETIRED) gentoo-dev 2003-12-04 18:14:24 UTC
closing this bug as 1.9 is fixed in portage
Comment 23 Henry Jen 2003-12-09 17:10:13 UTC
Not fix in current portage tree, the patch file, wget-1.9.1+ipvmisc.patch, still contains wrong AF_INET6 instead of AF_INET at line 717.
Comment 24 Seemant Kulleen (RETIRED) gentoo-dev 2003-12-09 20:48:38 UTC
reopening to remind me to fix wget-1.9.1
Comment 25 Seemant Kulleen (RETIRED) gentoo-dev 2003-12-10 01:25:22 UTC
1.9.1 is fixed as well now, closing bug