1. Allow to set a netmask (option NFS_BOOT_NETMASK) for the booting trunk
authordrochner <drochner@NetBSD.org>
Thu, 14 Aug 1997 15:50:05 +0000
branchtrunk
changeset 30783 149c9d02cdbb
parent 30782 7f27ba470bb3
child 30784 e5f28dd3e086
1. Allow to set a netmask (option NFS_BOOT_NETMASK) for the booting interface. Without this, NFS_BOOT_NETMASK could be useless in subnetting envirinment. 2. Comment out unneeded NFS swap related stuff. Closes PR kern/3918.
sys/nfs/nfs_boot.c
sys/nfs/nfsdiskless.h
--- a/sys/nfs/nfs_boot.c	Thu Aug 14 15:41:49 1997 +0000
+++ b/sys/nfs/nfs_boot.c	Thu Aug 14 15:50:05 1997 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_boot.c,v 1.33 1997/05/27 23:37:39 gwr Exp $	*/
+/*	$NetBSD: nfs_boot.c,v 1.34 1997/08/14 15:50:05 drochner Exp $	*/
 
 /*
  * Copyright (c) 1995 Adam Glass, Gordon Ross
@@ -115,6 +115,7 @@
 	struct proc *procp;
 {
 	struct ifreq ireq;
+	struct ifaliasreq iareq;
 	struct in_addr my_ip, gw_ip;
 	struct sockaddr_in bp_sin;
 	struct sockaddr_in *sin;
@@ -183,12 +184,19 @@
 	 * Do enough of ifconfig(8) so that the chosen interface
 	 * can talk to the servers.  (just set the address)
 	 */
-	sin = (struct sockaddr_in *)&ireq.ifr_addr;
-	bzero((caddr_t)sin, sizeof(*sin));
+	bzero(&iareq, sizeof(iareq));
+	bcopy(ifp->if_xname, iareq.ifra_name, IFNAMSIZ);
+	sin = (struct sockaddr_in *)&iareq.ifra_addr;
 	sin->sin_len = sizeof(*sin);
 	sin->sin_family = AF_INET;
 	sin->sin_addr.s_addr = my_ip.s_addr;
-	error = ifioctl(so, SIOCSIFADDR, (caddr_t)&ireq, procp);
+#ifdef NFS_BOOT_NETMASK
+	sin = (struct sockaddr_in *)&iareq.ifra_mask;
+	sin->sin_len = sizeof(*sin);
+	sin->sin_family = AF_INET;
+	sin->sin_addr.s_addr = htonl(NFS_BOOT_NETMASK);
+#endif
+	error = ifioctl(so, SIOCAIFADDR, (caddr_t)&iareq, procp);
 	if (error) {
 		printf("nfs_boot: set if addr, error=%d\n", error);
 		goto out;
@@ -268,11 +276,13 @@
 		goto out;
 	}
 
+#if 0
 	error = bp_getfile(&nd->nd_boot, "swap", &nd->nd_swap);
 	if (error) {
 		printf("nfs_boot: bootparam get swap: %d", error);
 		error = 0;
 	}
+#endif
 
  out:
 	if (so) soclose(so);
--- a/sys/nfs/nfsdiskless.h	Thu Aug 14 15:41:49 1997 +0000
+++ b/sys/nfs/nfsdiskless.h	Thu Aug 14 15:50:05 1997 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsdiskless.h,v 1.11 1997/05/27 23:37:43 gwr Exp $	*/
+/*	$NetBSD: nfsdiskless.h,v 1.12 1997/08/14 15:50:06 drochner Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -58,7 +58,9 @@
 struct nfs_diskless {
 	struct sockaddr_in nd_boot; 	/* Address of boot server */
 	struct nfs_dlmount nd_root; 	/* Mount info for root */
+#if 0
 	struct nfs_dlmount nd_swap; 	/* Mount info for swap */
+#endif
 };
 
 int nfs_boot_init __P((struct nfs_diskless *nd, struct proc *procp));