From 9625abb35977c6e36ca65fa322005aa8c6674600 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Wed, 9 Nov 2016 21:51:48 +0000 Subject: [PATCH] make pxeboot consistent with common/dev_net.c Always define boot.netif.server in kenv in pxeboot Add "boot.tftproot.server" to kenv when pxeboot uses tftpfs Change the code order when setting env for TFTP or NFS to be the same as common/dev_net.c Reported by: tsoome --- sys/boot/i386/libi386/pxe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/boot/i386/libi386/pxe.c b/sys/boot/i386/libi386/pxe.c index a1bb693eeb85..a246e8356247 100644 --- a/sys/boot/i386/libi386/pxe.c +++ b/sys/boot/i386/libi386/pxe.c @@ -311,6 +311,7 @@ pxe_open(struct open_file *f, ...) setenv("boot.netif.ip", inet_ntoa(myip), 1); setenv("boot.netif.netmask", intoa(netmask), 1); setenv("boot.netif.gateway", inet_ntoa(gateip), 1); + setenv("boot.netif.server", inet_ntoa(rootip), 1); if (bootplayer.Hardware == ETHER_TYPE) { sprintf(temp, "%6D", bootplayer.CAddr, ":"); setenv("boot.netif.hwaddr", temp, 1); @@ -324,12 +325,12 @@ pxe_open(struct open_file *f, ...) printf("pxe_open: server path: %s\n", rootpath); printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip)); - if (netproto == NET_NFS) { + if (netproto == NET_TFTP) { + setenv("boot.tftproot.server", inet_ntoa(rootip), 1); + setenv("boot.tftproot.path", rootpath, 1); + } else if (netproto == NET_NFS) { setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); setenv("boot.nfsroot.path", rootpath, 1); - } else if (netproto == NET_TFTP) { - setenv("boot.netif.server", inet_ntoa(rootip), 1); - setenv("boot.tftproot.path", rootpath, 1); } setenv("dhcp.host-name", hostname, 1);