Subject: allow writing empty value in bootparams
To: None <current-users@netbsd.org>
From: MOCHIDA Shuji <mochid@netside.co.jp>
List: current-users
Date: 06/27/2002 22:53:46
----Next_Part(Thu_Jun_27_22:53:46_2002_052)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


 This patch for rpc.bootparamd enables writing empty value 
in /etc/bootparams like "gateway=". I don't know this behaviour is 
right or not, but I found that src/sys/nfs/nfs_bootparam.c:212,

        if (sin->sin_addr.s_addr == 0)
                goto out;       /* no gateway */

and this eliminates 3 "nfs_boot: timeout..." messages from 
net-boot SPARCstation. 

-mochid


----Next_Part(Thu_Jun_27_22:53:46_2002_052)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Description: bootparamd.c.diff
Content-Disposition: inline; filename="bootparamd.c.diff"

--- src/usr.sbin/rcp.bootparamd/bootparamd.c.ORIG	Sat Mar 23 03:10:26 2002
+++ src/usr.sbin/rcp.bootparamd/bootparamd.c	Thu Jun 27 22:33:03 2002
@@ -260,6 +260,7 @@
 	err = lookup_bootparam(askname, NULL, getfile->file_id,
 	    &res.server_name, &res.server_path);
 	if (err == 0) {
+	    if (res.server_name[0] != '\0') {
 		he = gethostbyname(res.server_name);
 		if (!he) {
 			if (debug)
@@ -274,6 +275,10 @@
 		}
 		memmove(&res.server_address.bp_address_u.ip_addr,
 		    he->h_addr, 4);
+	    }
+	    else
+		memset(&res.server_address.bp_address_u.ip_addr, 0, 4);
+
 		res.server_address.address_type = IP_ADDR_TYPE;
 	} else if (err == ENOENT && !strcmp(getfile->file_id, "dump")) {
 		/* Special for dump, answer with null strings. */
@@ -446,9 +451,10 @@
 				*server = &word[idlen + 1];
 				*path = strchr(*server, ':');
 				if (*path == NULL)
-					/* Malformed entry */
-					continue;
-				*(*path)++ = '\0';
+					/* empty. */
+					*path = strchr(*server, '\0');
+				else
+					*(*path)++ = '\0';
 				(void) fclose(f);
 				return 0;
 			}

----Next_Part(Thu_Jun_27_22:53:46_2002_052)----