Is this a libc bug ? (gethostbyaddr)
Ronald F. Guilmette
rfg at monkeys.com
Tue Apr 1 20:12:35 PST 2003
Why does the program below produce radically different results when
linked either (a) with just the libc on FreeBSD 4.7 or else (b) with
the BIND library (libbind.a) from the ISC 8.x.x BIND release, and then
with libc?
Is FreeBSD's gethostbyaddr(3) mishandling the classless in-addr.arpa
delegation in the case of 62.23.166.218 ?
======================================================================
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
int
main (void)
{
auto struct in_addr addr;
register struct hostent const *hp;
inet_aton ("62.23.166.218", &addr);
hp = gethostbyaddr ((char const *)&addr, sizeof addr, AF_INET);
if (hp)
printf ("%s\n", hp->h_name);
else
printf ("No rDNS for %s\n", inet_ntoa (addr));
return 0;
}
More information about the freebsd-questions
mailing list