9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Paul Borman prb@bsdi.com
Subject: Mods to BSD/OS 2.1's bootp to support Plan 9
Date: Wed, 20 Mar 1996 16:28:39 -0500	[thread overview]
Message-ID: <19960320212839.KsFDvNA4UUL08KP1zWJ4AVvd4JzdP0S18mbV7xsWsjw@z> (raw)

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 */
  \f
  
  






                 reply	other threads:[~1996-03-20 21:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19960320212839.KsFDvNA4UUL08KP1zWJ4AVvd4JzdP0S18mbV7xsWsjw@z \
    --to=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).