summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2003-11-03 19:45:05 +0000
committeriedowse <iedowse@FreeBSD.org>2003-11-03 19:45:05 +0000
commita7ae26004a3f799f5fa3f68b0b9ddf810f68cd3c (patch)
treec5ea92c45206bdf795ad0a9440feb1aad63eb92c /sys/boot/common
parent2ef58bb97d0ceff4cc4b6e0623e4da3b185a0f1b (diff)
downloadFreeBSD-src-a7ae26004a3f799f5fa3f68b0b9ddf810f68cd3c.zip
FreeBSD-src-a7ae26004a3f799f5fa3f68b0b9ddf810f68cd3c.tar.gz
Override the root server address if an IP address is specified in
the root path. This is reported to make non-PXE netbooting, such as is used on sparc64 systems, work correctly when the TFTP server is not the same as the root server. PR: kern/57328 Submitted by: Per Kristian Hove <Per.Hove@math.ntnu.no>
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/dev_net.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/boot/common/dev_net.c b/sys/boot/common/dev_net.c
index 6e97f63..b7ccbca 100644
--- a/sys/boot/common/dev_net.c
+++ b/sys/boot/common/dev_net.c
@@ -270,22 +270,22 @@ net_getparams(sock)
return (EIO);
}
exit:
- printf("net_open: server addr: %s\n", inet_ntoa(rootip));
-
/*
* If present, strip the server's address off of the rootpath
* before passing it along. This allows us to be compatible with
* the kernel's diskless (BOOTP_NFSROOT) booting conventions
*/
-
- for(i=0; i<FNAME_SIZE; i++)
- if(rootpath[i] == ':')
+ for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
+ if (rootpath[i] == ':')
break;
- if(i && i != FNAME_SIZE) {
- i++;
+ if (i && i != FNAME_SIZE && rootpath[i] == ':') {
+ rootpath[i++] = '\0';
+ if (inet_addr(&rootpath[0]) != INADDR_NONE)
+ rootip.s_addr = inet_addr(&rootpath[0]);
bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1);
bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1);
}
+ printf("net_open: server addr: %s\n", inet_ntoa(rootip));
printf("net_open: server path: %s\n", rootpath);
d = socktodesc(sock);
@@ -294,6 +294,8 @@ net_getparams(sock)
setenv("boot.netif.netmask", intoa(netmask), 1);
setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
setenv("boot.netif.hwaddr", temp, 1);
+ setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
+ setenv("boot.nfsroot.path", rootpath, 1);
return (0);
}
OpenPOWER on IntegriCloud