2 * lookup.c - Lookup IP address, HW address, netmask
8 #include <sys/socket.h>
10 #include <sys/time.h> /* for struct timeval in net/if.h */
12 #include <netinet/in.h>
15 #include <net/ethernet.h>
16 extern int ether_hostton();
28 * Lookup an Ethernet address and return it.
29 * Return NULL if addr not found.
32 lookup_hwa(hostname, htype)
38 /* XXX - How is this done on other systems? -gwr */
43 static struct ether_addr ea;
44 /* This does a lookup in /etc/ethers */
45 if (ether_hostton(hostname, &ea)) {
46 report(LOG_ERR, "no HW addr for host \"%s\"",
50 return (u_char *) & ea;
52 #endif /* ETC_ETHERS */
55 report(LOG_ERR, "no lookup for HW addr type %d", htype);
58 /* If the system can't do it, just return an error. */
64 * Lookup an IP address.
65 * Return non-zero on failure.
68 lookup_ipa(hostname, result)
73 hp = gethostbyname(hostname);
76 bcopy(hp->h_addr, result, sizeof(*result));
83 * Return non-zero on failure.
85 * XXX - This is OK as a default, but to really make this automatic,
86 * we would need to get the subnet mask from the ether interface.
87 * If this is wrong, specify the correct value in the bootptab.
90 lookup_netmask(addr, result)
91 u_int32 addr; /* both in network order */
118 * c-argdecl-indent: 4
119 * c-continued-statement-offset: 4
120 * c-continued-brace-offset: -4