diff options
author | Toomas Soome <tsoome@me.com> | 2017-05-06 14:56:43 +0300 |
---|---|---|
committer | Gordon Ross <gwr@nexenta.com> | 2017-05-27 22:21:03 -0400 |
commit | 84e6955df14dc7f06618ed336ac0a78ba258feb6 (patch) | |
tree | 11fe4cfdcd4dc1a18fab675ed41a3febfadeb62b /usr/src | |
parent | d993cb83958d44b76c7c56393113c24811dde5f7 (diff) | |
download | illumos-joyent-84e6955df14dc7f06618ed336ac0a78ba258feb6.tar.gz |
8171 loader: distinguish NFS versus TFTP boot by rootpath
Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Yuri Pankov <yuripv@gmx.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/boot/Makefile.version | 2 | ||||
-rw-r--r-- | usr/src/boot/lib/libstand/bootp.c | 21 | ||||
-rw-r--r-- | usr/src/boot/lib/libstand/bootp.h | 1 | ||||
-rw-r--r-- | usr/src/boot/lib/libstand/globals.c | 2 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/common/dev_net.c | 12 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/i386/libi386/pxe.c | 12 | ||||
-rw-r--r-- | usr/src/man/man5/pxeboot.5 | 15 |
7 files changed, 29 insertions, 36 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index 4f0316219d..4c2ac95fd9 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2017.4.23.3 +BOOT_VERSION = $(LOADER_VERSION)-2017.5.6.1 diff --git a/usr/src/boot/lib/libstand/bootp.c b/usr/src/boot/lib/libstand/bootp.c index effe074dce..98ecb2750b 100644 --- a/usr/src/boot/lib/libstand/bootp.c +++ b/usr/src/boot/lib/libstand/bootp.c @@ -145,16 +145,15 @@ bootp(int sock, int flag) bp->bp_vend[8] = 9; bcopy("PXEClient", &bp->bp_vend[9], 9); bp->bp_vend[18] = TAG_PARAM_REQ; - bp->bp_vend[19] = 8; + bp->bp_vend[19] = 7; bp->bp_vend[20] = TAG_ROOTPATH; - bp->bp_vend[21] = TAG_TFTP_SERVER; - bp->bp_vend[22] = TAG_HOSTNAME; - bp->bp_vend[23] = TAG_SWAPSERVER; - bp->bp_vend[24] = TAG_GATEWAY; - bp->bp_vend[25] = TAG_SUBNET_MASK; - bp->bp_vend[26] = TAG_INTF_MTU; - bp->bp_vend[27] = TAG_SERVERID; - bp->bp_vend[28] = TAG_END; + bp->bp_vend[21] = TAG_HOSTNAME; + bp->bp_vend[22] = TAG_SWAPSERVER; + bp->bp_vend[23] = TAG_GATEWAY; + bp->bp_vend[24] = TAG_SUBNET_MASK; + bp->bp_vend[25] = TAG_INTF_MTU; + bp->bp_vend[26] = TAG_SERVERID; + bp->bp_vend[27] = TAG_END; } else bp->bp_vend[7] = TAG_END; #else @@ -426,10 +425,6 @@ vend_rfc1048(u_char *cp, u_int len) bcopy(cp, &dhcp_serverip.s_addr, sizeof(dhcp_serverip.s_addr)); } - if (tag == TAG_TFTP_SERVER) { - bcopy(cp, &tftpip.s_addr, - sizeof(tftpip.s_addr)); - } #endif cp += size; } diff --git a/usr/src/boot/lib/libstand/bootp.h b/usr/src/boot/lib/libstand/bootp.h index 6ed7032c0e..3c5c333180 100644 --- a/usr/src/boot/lib/libstand/bootp.h +++ b/usr/src/boot/lib/libstand/bootp.h @@ -106,7 +106,6 @@ struct bootp { #define TAG_T2 ((unsigned char) 59) #define TAG_CLASSID ((unsigned char) 60) #define TAG_CLIENTID ((unsigned char) 61) -#define TAG_TFTP_SERVER ((unsigned char) 150) #endif #define TAG_END ((unsigned char) 255) diff --git a/usr/src/boot/lib/libstand/globals.c b/usr/src/boot/lib/libstand/globals.c index 83b9f777a8..81453c3dd0 100644 --- a/usr/src/boot/lib/libstand/globals.c +++ b/usr/src/boot/lib/libstand/globals.c @@ -8,7 +8,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); #include <sys/param.h> #include <netinet/in.h> @@ -32,7 +31,6 @@ struct in_addr nameip; /* DNS server ip address */ struct in_addr rootip; /* root ip address */ struct in_addr swapip; /* swap ip address */ struct in_addr gateip; /* gateway ip address */ -struct in_addr tftpip; /* TFTP ip address */ n_long netmask = 0xffffff00; /* subnet or net mask */ u_int intf_mtu; /* interface mtu from bootp/dhcp */ int errno; /* our old friend */ diff --git a/usr/src/boot/sys/boot/common/dev_net.c b/usr/src/boot/sys/boot/common/dev_net.c index 85d43d20e7..08ee5c8a86 100644 --- a/usr/src/boot/sys/boot/common/dev_net.c +++ b/usr/src/boot/sys/boot/common/dev_net.c @@ -310,8 +310,11 @@ net_getparams(int sock) return (EIO); } exit: - if ((rootaddr = net_parse_rootpath()) != INADDR_NONE) + netproto = NET_TFTP; + if ((rootaddr = net_parse_rootpath()) != INADDR_NONE) { + netproto = NET_NFS; rootip.s_addr = rootaddr; + } #ifdef NETIF_DEBUG if (debug) { @@ -363,13 +366,6 @@ net_parse_rootpath() int i; n_long addr = INADDR_NONE; - netproto = NET_NFS; - - if (tftpip.s_addr != 0) { - netproto = NET_TFTP; - addr = tftpip.s_addr; - } - for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) if (rootpath[i] == ':') break; diff --git a/usr/src/boot/sys/boot/i386/libi386/pxe.c b/usr/src/boot/sys/boot/i386/libi386/pxe.c index 59d0cb5b30..4a7880f64c 100644 --- a/usr/src/boot/sys/boot/i386/libi386/pxe.c +++ b/usr/src/boot/sys/boot/i386/libi386/pxe.c @@ -303,13 +303,9 @@ pxe_open(struct open_file *f, ...) if (servip.s_addr == 0) servip = rootip; - netproto = NET_NFS; - if (tftpip.s_addr != 0) { - netproto = NET_TFTP; - rootip.s_addr = tftpip.s_addr; - } + netproto = NET_TFTP; - if (netproto == NET_NFS && !rootpath[0]) + if (!rootpath[0]) strcpy(rootpath, PXENFSROOTPATH); for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) @@ -317,8 +313,10 @@ pxe_open(struct open_file *f, ...) break; if (i && i != FNAME_SIZE && rootpath[i] == ':') { rootpath[i++] = '\0'; - if (inet_addr(&rootpath[0]) != INADDR_NONE) + if (inet_addr(&rootpath[0]) != INADDR_NONE) { + netproto = NET_NFS; 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); } diff --git a/usr/src/man/man5/pxeboot.5 b/usr/src/man/man5/pxeboot.5 index b6ddfa9f5f..9d309de78a 100644 --- a/usr/src/man/man5/pxeboot.5 +++ b/usr/src/man/man5/pxeboot.5 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd Apr 21, 2017 +.Dd May 25, 2017 .Dt PXEBOOT 5 .Os .Sh NAME @@ -89,9 +89,16 @@ variable in Valid values range from 1024 to 4096 bytes. .Pp .Nm -defaults to use NFS, to use TFTP loading, DHCP server must provide -option -.Va 150 . +chooses NFS or TFTP based on the value of +.Va root-path +variable provided by the DHCP server. +.Nm +defaults to use NFS if the +.Va root-path +variable is in the +.Qq Pa ip-address Ns :/ Ns Pa path +form, otherwise TFTP is used. +.Pp TFTP block size can be controlled by setting the .Va tftp.blksize variable in |