Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jun 2003 20:15:24 -0700
From:      John-Mark Gurney <gurney_j@efn.org>
To:        FreeBSD Current <freebsd-current@freebsd.org>, sparc64@freebsd.org
Cc:        Mark Murray <mark@grondar.org>
Subject:   bootpd also broke :(
Message-ID:  <20030614031524.GB32701@funkthat.com>

next in thread | raw e-mail | index | archive | help

--XOIedfhf+7KOe/yw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Well, my further diving into netbooting an Ultra 2 I have found that
bootpd doesn't do select too well.  It doesn't use fd_set or anything
which for some reason causes it not to function on Sparc.  A simple
switch to using FD_* makes it function.

I have also fixed a couple comments that NetBSD had already fixed.

Comments?

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."

--XOIedfhf+7KOe/yw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="bootpd.patch"

? bootpd
? bootpd.8.gz
? bootptab.5.gz
? bootpgw/bootpgw
? tools/bootpef/bootpef
? tools/bootpef/bootpef.8.gz
? tools/bootptest/bootptest
? tools/bootptest/bootptest.8.gz
Index: bootpd.c
===================================================================
RCS file: /home/ncvs/src/libexec/bootpd/bootpd.c,v
retrieving revision 1.19
diff -u -r1.19 bootpd.c
--- bootpd.c	2003/02/05 13:45:25	1.19
+++ bootpd.c	2003/06/14 03:06:40
@@ -186,7 +186,8 @@
 	struct hostent *hep;
 	char *stmp;
 	int n, ba_len, ra_len;
-	int nfound, readfds;
+	int nfound;
+	fd_set readfds;
 	int standalone;
 #ifdef	SA_NOCLDSTOP	/* Have POSIX sigaction(2). */
 	struct sigaction sa;
@@ -503,14 +504,15 @@
 	/*
 	 * Process incoming requests.
 	 */
+	FD_ZERO(&readfds);
 	for (;;) {
 		struct timeval tv;
 
-		readfds = 1 << s;
+		FD_SET(s, &readfds);
 		if (timeout)
 			tv = *timeout;
 
-		nfound = select(s + 1, (fd_set *)&readfds, NULL, NULL,
+		nfound = select(s + 1, &readfds, NULL, NULL,
 						(timeout) ? &tv : NULL);
 		if (nfound < 0) {
 			if (errno != EINTR) {
@@ -530,7 +532,7 @@
 			}
 			continue;
 		}
-		if (!(readfds & (1 << s))) {
+		if (!FD_ISSET(s, &readfds)) {
 			if (debug > 1)
 				report(LOG_INFO, "exiting after %ld minutes of inactivity",
 					   actualtimeout.tv_sec / 60);
@@ -667,7 +669,7 @@
 		}
 		hlen = haddrlength(bp->bp_htype);
 		if (hlen != bp->bp_hlen) {
-			report(LOG_NOTICE, "bad addr len from from %s address %s",
+			report(LOG_NOTICE, "bad addr len from %s address %s",
 				   netname(bp->bp_htype),
 				   haddrtoa(bp->bp_chaddr, hlen));
 		}
@@ -1024,7 +1026,7 @@
 
 	/*
 	 * If the destination address was specified explicitly
-	 * (i.e. the broadcast address for HP compatiblity)
+	 * (i.e. the broadcast address for HP compatibility)
 	 * then send the response to that address.  Otherwise,
 	 * act in accordance with RFC951:
 	 *   If the client IP address is specified, use that

--XOIedfhf+7KOe/yw--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030614031524.GB32701>