003 File Manager
Current Path:
/usr/src/libexec/bootpd
usr
/
src
/
libexec
/
bootpd
/
📁
..
📄
Announce
(2.36 KB)
📄
Changes
(9.82 KB)
📄
ConvOldTab.sh
(3.69 KB)
📄
Installation
(742 B)
📄
Makefile
(322 B)
📄
Makefile.UNIX
(5.33 KB)
📄
Makefile.depend
(289 B)
📄
Makefile.inc
(52 B)
📄
Problems
(2.59 KB)
📄
README
(5.18 KB)
📄
ToDo
(2.18 KB)
📄
bootp.h
(5.05 KB)
📄
bootpd.8
(7.63 KB)
📄
bootpd.c
(33.69 KB)
📄
bootpd.h
(5.2 KB)
📁
bootpgw
📄
bootptab.5
(10.33 KB)
📄
bootptab.cmu
(4.14 KB)
📄
bootptab.mcs
(2.49 KB)
📄
bptypes.h
(303 B)
📄
dovend.c
(9.87 KB)
📄
dovend.h
(213 B)
📄
dumptab.c
(8.79 KB)
📄
getether.c
(9.06 KB)
📄
getether.h
(82 B)
📄
getif.c
(3.04 KB)
📄
getif.h
(82 B)
📄
hash.c
(9.95 KB)
📄
hash.h
(4.72 KB)
📄
hwaddr.c
(8.8 KB)
📄
hwaddr.h
(900 B)
📄
lookup.c
(2.28 KB)
📄
lookup.h
(243 B)
📄
patchlevel.h
(86 B)
📄
readfile.c
(46.45 KB)
📄
readfile.h
(288 B)
📄
report.c
(2.47 KB)
📄
report.h
(168 B)
📄
rtmsg.c
(6.17 KB)
📄
syslog.conf
(2.08 KB)
📁
tools
📄
trygetea.c
(940 B)
📄
trygetif.c
(1.34 KB)
📄
trylook.c
(817 B)
📄
tzone.c
(951 B)
📄
tzone.h
(66 B)
Editing: lookup.c
/* * lookup.c - Lookup IP address, HW address, netmask * * $FreeBSD$ */ #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> /* for struct timeval in net/if.h */ #include <net/if.h> #include <netinet/in.h> #ifdef ETC_ETHERS #include <net/ethernet.h> extern int ether_hostton(); #endif #include <netdb.h> #include <syslog.h> #ifndef USE_BFUNCS #include <memory.h> /* Yes, memcpy is OK here (no overlapped copies). */ #define bcopy(a,b,c) memcpy(b,a,c) #endif #include "bootp.h" #include "lookup.h" #include "report.h" /* * Lookup an Ethernet address and return it. * Return NULL if addr not found. */ u_char * lookup_hwa(hostname, htype) char *hostname; int htype; { switch (htype) { /* XXX - How is this done on other systems? -gwr */ #ifdef ETC_ETHERS case HTYPE_ETHERNET: case HTYPE_IEEE802: { static struct ether_addr ea; /* This does a lookup in /etc/ethers */ if (ether_hostton(hostname, &ea)) { report(LOG_ERR, "no HW addr for host \"%s\"", hostname); return (u_char *) 0; } return (u_char *) & ea; } #endif /* ETC_ETHERS */ default: report(LOG_ERR, "no lookup for HW addr type %d", htype); } /* switch */ /* If the system can't do it, just return an error. */ return (u_char *) 0; } /* * Lookup an IP address. * Return non-zero on failure. */ int lookup_ipa(hostname, result) char *hostname; u_int32 *result; { struct hostent *hp; hp = gethostbyname(hostname); if (!hp) return -1; bcopy(hp->h_addr, result, sizeof(*result)); return 0; } /* * Lookup a netmask * Return non-zero on failure. * * XXX - This is OK as a default, but to really make this automatic, * we would need to get the subnet mask from the ether interface. * If this is wrong, specify the correct value in the bootptab. */ int lookup_netmask(addr, result) u_int32 addr; /* both in network order */ u_int32 *result; { int32 m, a; a = ntohl(addr); m = 0; if (IN_CLASSA(a)) m = IN_CLASSA_NET; if (IN_CLASSB(a)) m = IN_CLASSB_NET; if (IN_CLASSC(a)) m = IN_CLASSC_NET; if (!m) return -1; *result = htonl(m); return 0; } /* * Local Variables: * tab-width: 4 * c-indent-level: 4 * c-argdecl-indent: 4 * c-continued-statement-offset: 4 * c-continued-brace-offset: -4 * c-label-offset: -4 * c-brace-offset: 0 * End: */
Upload File
Create Folder