From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 20 Mar 1996 16:28:39 -0500 From: Paul Borman prb@bsdi.com Subject: Mods to BSD/OS 2.1's bootp to support Plan 9 Topicbox-Message-UUID: 41073476-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19960320212839.KsFDvNA4UUL08KP1zWJ4AVvd4JzdP0S18mbV7xsWsjw@z> Below are context diffs to the bootpd that is shipped with BSD/OS 2.1. These diffs allow BSD/OS to support Plan 9 bootp requests. The use of strcat is pretty cheesy, but it was sure easy to write :-) The "magic" in the /etc/bootptab is the following mappings: :sm=your_subnet_mask:\ :sw=your_fileserver:\ :ys=your_auth_server:\ :gw=your_ipgateway:\ :vm=auto: Even though the ys and gw fields can take a list of addresses, only the first address will be used. Along with Pace Willisson's auth server, which compiles "out of the box" on BSD/OS 2.1, this can pretty much take care of things you might not have an extra machine around for. -Paul Borman prb@bsdi.com Index: Makefile =================================================================== RCS file: /master/libexec/bootpd/bootpd/Makefile,v retrieving revision 2.1 diff -c -r2.1 Makefile *** Makefile 1995/02/03 06:36:05 2.1 --- Makefile 1996/03/20 21:21:57 *************** *** 3,9 **** PROG= bootpd SRCS= bootpd.c dovend.c readfile.c hash.c dumptab.c \ lookup.c getif.c hwaddr.c report.c tzone.c ethers.c ! CFLAGS+=-DETC_ETHERS -DSYSLOG -DDEBUG -DVEND_CMU MAN8= bootpd.0 MAN5= bootptab.0 --- 3,9 ---- PROG= bootpd SRCS= bootpd.c dovend.c readfile.c hash.c dumptab.c \ lookup.c getif.c hwaddr.c report.c tzone.c ethers.c ! CFLAGS+=-DETC_ETHERS -DSYSLOG -DDEBUG -DVEND_CMU -DVEND_P9 MAN8= bootpd.0 MAN5= bootptab.0 Index: bootpd.c =================================================================== RCS file: /master/libexec/bootpd/bootpd/bootpd.c,v retrieving revision 2.1 diff -c -r2.1 bootpd.c *** bootpd.c 1995/02/03 06:36:13 2.1 --- bootpd.c 1996/03/20 21:22:03 *************** *** 121,126 **** --- 121,129 ---- #ifdef VEND_CMU PRIVATE void dovend_cmu P((struct bootp *, struct host *)); #endif + #ifdef VEND_P9 + PRIVATE void dovend_p9 P((struct bootp *, struct host *)); + #endif PRIVATE void dovend_rfc1048 P((struct bootp *, struct host *, int32)); PRIVATE void handle_reply P((void)); PRIVATE void handle_request P((void)); *************** *** 953,958 **** --- 956,969 ---- } } #endif + #ifdef VEND_P9 + else if (!bcmp(bp->bp_vend, "p9 ", 4)) { + dovend_p9(bp, hp); + if (debug > 1) { + report(LOG_INFO, "sending reply (with P9 options)"); + } + } + #endif else { if (debug > 1) { report(LOG_INFO, "sending reply (with no options)"); *************** *** 1185,1190 **** --- 1196,1230 ---- } /* dovend_cmu */ #endif /* VEND_CMU */ + + #ifdef VEND_P9 + + /* + * Insert the P9 "vendor" data for the host pointed to by "hp" into the + * bootp packet pointed to by "bp". + */ + + PRIVATE void + dovend_p9(bp, hp) + struct bootp *bp; + struct host *hp; + { + struct cmu_vend *vendp; + struct in_addr_list *taddr; + + bzero(bp->bp_vend, sizeof(bp->bp_vend)); + + strcpy((char *)bp->bp_vend, "p9 "); + strcat((char *)bp->bp_vend, inet_ntoa(hp->subnet_mask)); + strcat((char *)bp->bp_vend, " "); + strcat((char *)bp->bp_vend, inet_ntoa(hp->swap_server)); + strcat((char *)bp->bp_vend, " "); + strcat((char *)bp->bp_vend, inet_ntoa(hp->nis_server->addr[0])); + strcat((char *)bp->bp_vend, " "); + strcat((char *)bp->bp_vend, inet_ntoa(hp->gateway->addr[0])); + } /* dovend_p9 */ + + #endif /* VEND_P9 */