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>
This commit is contained in:
Ian Dowse 2003-11-03 19:45:05 +00:00
parent 3de758d3e3
commit a69c45087c

View File

@ -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);
}