Package: tcputils Version: 0.6.2-6 Severity: important Tags: patch
The 64-bit binary of "tcpconnect" is failing to connect when given a hostname, reporting "Network is unreachable". It works fine when given an ip address. It appears this is because the code in ip/tcp_open.c:tcp_open() is comparing the result of a call to inet_addr() with "(unsigned long)-1)" where I'm thinking it should be comparing instead to "INADDR_NONE" according to the docs for inet_addr I found on the web (I didn't seem to have a manpage for inet_addr on the debian box). There might well be other parts of the code that have issues with 64-bit, though. -- System Information: Debian Release: 4.0 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16.29-xen Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Versions of packages tcputils depends on: ii libc6 2.3.6.ds1-13etch2 GNU C Library: Shared libraries tcputils recommends no packages. -- no debconf information
--- tcputils-0.6.2/ip/tcp_open.c.orig 1996-07-04 10:44:56.000000000 -0400 +++ tcputils-0.6.2/ip/tcp_open.c 2007-12-13 15:21:05.000000000 -0500 @@ -65,7 +65,7 @@ /* Check for numerical IP address */ server.sin_addr.s_addr = inet_addr(remote_host); - if (server.sin_addr.s_addr != (unsigned long)-1) + if (server.sin_addr.s_addr != INADDR_NONE) { if (connect(s, (struct sockaddr*)&server, sizeof server) < 0) ERRORRET(-1);