changeset 18786:0423606f1348

8799 loader: Always issue the pxe request
author Toomas Soome <tsoome@me.com>
date Sun, 28 May 2017 09:48:07 +0300
parents 7d491a386173
children c9df1d0ea29a
files usr/src/boot/lib/libstand/bootp.c usr/src/boot/lib/libstand/bootp.h usr/src/boot/lib/libstand/net.h usr/src/boot/sys/boot/common/dev_net.c
diffstat 4 files changed, 28 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/boot/lib/libstand/bootp.c	Sun May 28 09:36:49 2017 +0300
+++ b/usr/src/boot/lib/libstand/bootp.c	Sun May 28 09:48:07 2017 +0300
@@ -90,7 +90,7 @@
 
 /* Fetch required bootp infomation */
 void
-bootp(int sock, int flag)
+bootp(int sock)
 {
 	void *pkt;
 	struct iodesc *d;
@@ -133,32 +133,29 @@
 	bp->bp_vend[6] = DHCPDISCOVER;
 
 	/*
-	 * If we are booting from PXE, we want to send the string
+	 * We are booting from PXE, we want to send the string
 	 * 'PXEClient' to the DHCP server so you have the option of
 	 * only responding to PXE aware dhcp requests.
 	 */
-	if (flag & BOOTP_PXE) {
-		bp->bp_vend[7] = TAG_CLASSID;
-		bp->bp_vend[8] = 9;
-		bcopy("PXEClient", &bp->bp_vend[9], 9);
-		bp->bp_vend[18] = TAG_USER_CLASS;
-		/* len of each user class + number of user class */
-		bp->bp_vend[19] = 8;
-		/* len of the first user class */
-		bp->bp_vend[20] = 7;
-		bcopy("illumos", &bp->bp_vend[21], 7);
-		bp->bp_vend[28] = TAG_PARAM_REQ;
-		bp->bp_vend[29] = 7;
-		bp->bp_vend[30] = TAG_ROOTPATH;
-		bp->bp_vend[31] = TAG_HOSTNAME;
-		bp->bp_vend[32] = TAG_SWAPSERVER;
-		bp->bp_vend[33] = TAG_GATEWAY;
-		bp->bp_vend[34] = TAG_SUBNET_MASK;
-		bp->bp_vend[35] = TAG_INTF_MTU;
-		bp->bp_vend[36] = TAG_SERVERID;
-		bp->bp_vend[37] = TAG_END;
-	} else
-		bp->bp_vend[7] = TAG_END;
+	bp->bp_vend[7] = TAG_CLASSID;
+	bp->bp_vend[8] = 9;
+	bcopy("PXEClient", &bp->bp_vend[9], 9);
+	bp->bp_vend[18] = TAG_USER_CLASS;
+	/* len of each user class + number of user class */
+	bp->bp_vend[19] = 8;
+	/* len of the first user class */
+	bp->bp_vend[20] = 7;
+	bcopy("illumos", &bp->bp_vend[21], 7);
+	bp->bp_vend[28] = TAG_PARAM_REQ;
+	bp->bp_vend[29] = 7;
+	bp->bp_vend[30] = TAG_ROOTPATH;
+	bp->bp_vend[31] = TAG_HOSTNAME;
+	bp->bp_vend[32] = TAG_SWAPSERVER;
+	bp->bp_vend[33] = TAG_GATEWAY;
+	bp->bp_vend[34] = TAG_SUBNET_MASK;
+	bp->bp_vend[35] = TAG_INTF_MTU;
+	bp->bp_vend[36] = TAG_SERVERID;
+	bp->bp_vend[37] = TAG_END;
 #else
 	bp->bp_vend[4] = TAG_END;
 #endif
@@ -194,13 +191,10 @@
 		bp->bp_vend[20] = 4;
 		leasetime = htonl(300);
 		bcopy(&leasetime, &bp->bp_vend[21], 4);
-		if (flag & BOOTP_PXE) {
-			bp->bp_vend[25] = TAG_CLASSID;
-			bp->bp_vend[26] = 9;
-			bcopy("PXEClient", &bp->bp_vend[27], 9);
-			bp->bp_vend[36] = TAG_END;
-		} else
-			bp->bp_vend[25] = TAG_END;
+		bp->bp_vend[25] = TAG_CLASSID;
+		bp->bp_vend[26] = 9;
+		bcopy("PXEClient", &bp->bp_vend[27], 9);
+		bp->bp_vend[36] = TAG_END;
 
 		expected_dhcpmsgtype = DHCPACK;
 
--- a/usr/src/boot/lib/libstand/bootp.h	Sun May 28 09:36:49 2017 +0300
+++ b/usr/src/boot/lib/libstand/bootp.h	Sun May 28 09:48:07 2017 +0300
@@ -1,5 +1,3 @@
-/*	$NetBSD: bootp.h,v 1.4 1997/09/06 13:55:57 drochner Exp $	*/
-
 /*
  * Bootstrap Protocol (BOOTP).  RFC951 and RFC1048.
  *
@@ -124,12 +122,6 @@
 #endif
 
 /*
- * bootp flags
- */
-#define	BOOTP_NONE		0x0000		/* No flags */
-#define	BOOTP_PXE		0x0001		/* Booting from PXE. */
-
-/*
  * "vendor" data permitted for CMU bootp clients.
  */
 
--- a/usr/src/boot/lib/libstand/net.h	Sun May 28 09:36:49 2017 +0300
+++ b/usr/src/boot/lib/libstand/net.h	Sun May 28 09:48:07 2017 +0300
@@ -1,5 +1,3 @@
-/*	$NetBSD: net.h,v 1.10 1995/10/20 00:46:30 cgd Exp $	*/
-
 /*
  * Copyright (c) 1993 Adam Glass 
  * Copyright (c) 1992 Regents of the University of California.
@@ -17,7 +15,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -32,8 +30,6 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- * $FreeBSD$
  */
 
 #ifndef _STAND_NET_H
@@ -120,7 +116,7 @@
 			void **, void **);
 
 /* bootp/DHCP */
-void	bootp(int, int);
+void	bootp(int);
 
 /* Utilities: */
 char	*ether_sprintf(u_char *);
--- a/usr/src/boot/sys/boot/common/dev_net.c	Sun May 28 09:36:49 2017 +0300
+++ b/usr/src/boot/sys/boot/common/dev_net.c	Sun May 28 09:48:07 2017 +0300
@@ -280,7 +280,7 @@
 			d->myip = myip;
 		}
 		if (rc < 0)
-			bootp(sock, BOOTP_NONE);
+			bootp(sock);
 	}
 	if (myip.s_addr != 0)
 		goto exit;