2 * numtohost - convert network number to host name.
7 #ifdef HAVE_NETINET_IN_H
8 #include <netinet/in.h> /* ntohl */
12 #include "ntp_stdlib.h"
13 #include "lib_strbuf.h"
15 #define LOOPBACKNET 0x7f000000
16 #define LOOPBACKHOST 0x7f000001
17 #define LOOPBACKNETMASK 0xff000000
28 * This is really gross, but saves lots of hanging looking for
29 * hostnames for the radio clocks. Don't bother looking up
30 * addresses on the loopback network except for the loopback
33 if ((((ntohl(netnum) & LOOPBACKNETMASK) == LOOPBACKNET)
34 && (ntohl(netnum) != LOOPBACKHOST))
35 || ((hp = gethostbyaddr((char *)&netnum, sizeof netnum, AF_INET))
37 return numtoa(netnum);
40 strlcpy(bp, hp->h_name, LIB_BUFLENGTH);