Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs If server name field is overloaded for other purpose...
details: https://anonhg.NetBSD.org/src/rev/d9083d5cb485
branches: trunk
changeset: 480796:d9083d5cb485
user: enami <enami%NetBSD.org@localhost>
date: Thu Jan 20 08:34:52 2000 +0000
description:
If server name field is overloaded for other purpose, or it just contains
NULL string, don't use it as server name.
diffstat:
sys/nfs/nfs_bootdhcp.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diffs (54 lines):
diff -r 3b7dfdb167c2 -r d9083d5cb485 sys/nfs/nfs_bootdhcp.c
--- a/sys/nfs/nfs_bootdhcp.c Thu Jan 20 04:55:52 2000 +0000
+++ b/sys/nfs/nfs_bootdhcp.c Thu Jan 20 08:34:52 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_bootdhcp.c,v 1.12 1999/05/07 15:10:03 drochner Exp $ */
+/* $NetBSD: nfs_bootdhcp.c,v 1.13 2000/01/20 08:34:52 enami Exp $ */
/*-
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
@@ -637,6 +637,7 @@
int mynamelen;
int mydomainlen;
int rootpathlen;
+ int overloaded;
u_int tag, len;
u_char *p, *limit;
@@ -647,6 +648,8 @@
mydomainlen = mynamelen = rootpathlen = 0;
/* default root server to bootp next-server */
rootserver = bootp->bp_siaddr;
+ /* assume that server name field is not overloaded by default */
+ overloaded = 0;
p = &bootp->bp_vend[4];
limit = ((char*)bootp) + replylen;
@@ -703,6 +706,17 @@
/* override NFS server address */
memcpy(&rootserver, p, 4);
break;
+#ifdef NFS_BOOT_DHCP
+ case TAG_OVERLOAD:
+ if (len > 0 && ((*p & 0x02) != 0))
+ /*
+ * The server name field in the dhcp packet
+ * is overloaded and we can't find server
+ * name there.
+ */
+ overloaded = 1;
+ break;
+#endif
default:
break;
}
@@ -748,7 +762,8 @@
sin->sin_family = AF_INET;
sin->sin_addr = rootserver;
/* Server name. */
- if (!memcmp(&rootserver, &bootp->bp_siaddr,
+ if (!overloaded && bootp->bp_sname[0] != 0 &&
+ !memcmp(&rootserver, &bootp->bp_siaddr,
sizeof(struct in_addr))) {
/* standard root server, we have the name */
strncpy(ndm->ndm_host, bootp->bp_sname, BP_SNAME_LEN-1);
Home |
Main Index |
Thread Index |
Old Index