diff options
Diffstat (limited to 'sys/boot/common/dev_net.c')
-rw-r--r-- | sys/boot/common/dev_net.c | 16 |
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); } |