summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2002-09-26 19:56:43 +0000
committerrwatson <rwatson@FreeBSD.org>2002-09-26 19:56:43 +0000
commit2fed42cd45234f5ee34dfed00c3f41d084c39a96 (patch)
treeb4c0e3a0aabb66370f070545b5b7050dc9b482d1 /sys/nfsclient
parente668d0b2f283996efa0ffa831d37e7f31c219e80 (diff)
downloadFreeBSD-src-2fed42cd45234f5ee34dfed00c3f41d084c39a96.zip
FreeBSD-src-2fed42cd45234f5ee34dfed00c3f41d084c39a96.tar.gz
Apparently pxeboot passes in a mygateway of non-zero sin length
from DHCP in the event that no gateway is returned from DHCP, breaking the assumption that we skip the routing insertion of the gateway if the sin length is zero. Check also for s_addr of 0 to avoid the "Oh no, adding my default route failed" panic, making it possible to pxeboot machines on segments without default routes. Arguably this could be a bug in pxeboot, or in the TUNABLE code, but this makes my boxes boot.
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_vfsops.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index 04deade..f30690a 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -443,8 +443,13 @@ nfs_mountroot(struct mount *mp, struct thread *td)
/*
* If the gateway field is filled in, set it as the default route.
+ * Note that pxeboot will set a default route of 0 if the route
+ * is not set by the DHCP server. Check also for a value of 0
+ * to avoid panicking inappropriately in that situation.
*/
- if (nd->mygateway.sin_len != 0) {
+ printf("gateway: %d bytes\n", nd->mygateway.sin_len);
+ if (nd->mygateway.sin_len != 0 &&
+ nd->mygateway.sin_addr.s_addr != 0) {
struct sockaddr_in mask, sin;
bzero((caddr_t)&mask, sizeof(mask));
OpenPOWER on IntegriCloud