kczekirda created this revision.

REVISION SUMMARY
  Don't use DHCP 150 option to decide which protocol use to netboot. When 
root-path includes ip address - go thru NFS, if ip address not exists in 
root-path - go thru TFTP from server which ip address is in next-server. 
  But there is one limitation - only one tftp server in network to provide 
loader and everything else. 
  Does enybody use more than only one?
  
  Sponsored by: Oktawave
  Relnote: Yes

REVISION DETAIL
  https://reviews.freebsd.org/D10603

AFFECTED FILES
  /usr/src/lib/libstand/bootp.c
  /usr/src/lib/libstand/bootp.h
  /usr/src/lib/libstand/globals.c
  /usr/src/lib/libstand/net.h
  /usr/src/sys/boot/common/dev_net.c
  /usr/src/sys/boot/i386/libi386/pxe.c

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: kczekirda, oshogbo, tsoome, bapt, sbruno, freebsd-net-list, #network
diff --git a//usr/src/sys/boot/common/dev_net.c b//usr/src/sys/boot/common/dev_net.c
--- a//usr/src/sys/boot/common/dev_net.c
+++ b//usr/src/sys/boot/common/dev_net.c
@@ -312,8 +312,11 @@
 		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) {
@@ -365,13 +368,6 @@
 	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/lib/libstand/net.h b//usr/src/lib/libstand/net.h
--- a//usr/src/lib/libstand/net.h
+++ b//usr/src/lib/libstand/net.h
@@ -91,7 +91,6 @@
 extern	struct in_addr swapip;
 extern	struct in_addr gateip;
 extern	struct in_addr nameip;
-extern	struct in_addr tftpip;
 extern	n_long netmask;
 extern	u_int intf_mtu;
 
diff --git a//usr/src/lib/libstand/globals.c b//usr/src/lib/libstand/globals.c
--- a//usr/src/lib/libstand/globals.c
+++ b//usr/src/lib/libstand/globals.c
@@ -32,7 +32,6 @@
 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/lib/libstand/bootp.c b//usr/src/lib/libstand/bootp.c
--- a//usr/src/lib/libstand/bootp.c
+++ b//usr/src/lib/libstand/bootp.c
@@ -148,16 +148,15 @@
 		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
@@ -438,10 +437,6 @@
 			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/lib/libstand/bootp.h b//usr/src/lib/libstand/bootp.h
--- a//usr/src/lib/libstand/bootp.h
+++ b//usr/src/lib/libstand/bootp.h
@@ -108,7 +108,6 @@
 #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/sys/boot/i386/libi386/pxe.c b//usr/src/sys/boot/i386/libi386/pxe.c
--- a//usr/src/sys/boot/i386/libi386/pxe.c
+++ b//usr/src/sys/boot/i386/libi386/pxe.c
@@ -309,22 +309,20 @@
 			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++)
 				if (rootpath[i] == ':')
 					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);
 			}

_______________________________________________
freebsd-net@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to