telnet always tries 255.255.255.255

Andrei A. Voropaev av at simcon-mt.com
Thu Jan 27 08:28:55 PST 2005


On Thu, Jan 27, 2005 at 10:56:55AM -0500, Richard Betel wrote:
> On Thu, 27 Jan 2005 13:43:19 +0100, Andrei A. Voropaev <av at simcon-mt.com> wrote:
> 
> > I've figured this out myself. There's bug in inetutils-1.4.2. There they
> > use inet_addr function (which is marked as obsolete) and compare return
> > from this function with (unsigned long)-1. Which works perfectly on 32
> > bit systems and fails miserably on 64-bit systems. Here's the patch, if
> > anyone is interested.
> 
> Very interesting! Has anyone on this list tried telnet on something
> 64bit other than AMD/Intel? I'll have to try my alpha tonight, but I
> haven't been having problems with any net tools yet, despite being on
> a 64bit platform.

Hm. True, on my alpha telnet works. Though I don't know which version is
that. On the other hand the code is obviosly incorrect. Well. Provided
that inet_addr is supposed to return (unsinged int)-1, which it does on
the latest glibc that I have. In some other versions of libc I've seen
that man page specifies that it should return (unsigned long)-1, in
which case this code would work correctly. But again, all man pages
aggree that return value is INADDR_NONE (usually -1)

So I guess it became bug with latest glibc that declares inet_addr as

in_addr_t inet_addr(const char *cp);

and then /usr/include/netinet/in.h defines it as

typedef uint32_t in_addr_t;

So, most likely this is newly introduced bug. :)

-- 
Minds, like parachutes, function best when open



More information about the lfs-support mailing list