Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Apr 2003 20:12:34 -0800
From:      "Ronald F. Guilmette" <rfg@monkeys.com>
To:        freebsd-questions@freebsd.org
Subject:   Is this a libc bug ? (gethostbyaddr)
Message-ID:  <26986.1049256754@monkeys.com>

next in thread | raw e-mail | index | archive | help


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;
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?26986.1049256754>