[syslinux] syslinux.efi pxeboot across multiple subnets

H. Peter Anvin hpa at zytor.com
Fri Nov 8 11:57:27 PST 2013


Here is a completely untested patch if someone wants to try and take it
for a spin?

	-hpa

-------------- next part --------------
diff --git a/efi/udp.c b/efi/udp.c
index 59bb426..60a8fe9 100644
--- a/efi/udp.c
+++ b/efi/udp.c
@@ -41,8 +41,7 @@ int core_udp_open(struct pxe_pvt_inode *socket)
     udp = (EFI_UDP4 *)udp_reader->this;
 
     memset(&udata, 0, sizeof(udata));
-    udata.AcceptPromiscuous = TRUE;
-    udata.AcceptAnyPort = TRUE;
+    udata.AcceptBroadcast = TRUE;
 
     status = uefi_call_wrapper(udp->Configure, 2, udp, &udata);
     if (status != EFI_SUCCESS)
@@ -50,6 +49,18 @@ int core_udp_open(struct pxe_pvt_inode *socket)
 
     socket->net.efi.binding = b;
 
+    /*
+     * Save the random local port number that the UDPv4 Protocol
+     * Driver picked for us. The TFTP protocol uses the local port
+     * number as the TID.
+     */
+    status = uefi_call_wrapper(udp->GetModeData, 5, udp,
+			       &udata, NULL, NULL, NULL);
+    if (status != EFI_SUCCESS)
+	Print(L"Failed to get UDP mode data: %d\n", status);
+    else
+	socket->net.efi.localport = udata.StationPort;
+
     return 0;
 
 bail:
@@ -89,7 +100,6 @@ void core_udp_close(struct pxe_pvt_inode *socket)
 void core_udp_connect(struct pxe_pvt_inode *socket, uint32_t ip,
 		      uint16_t port)
 {
-    EFI_UDP4_CONFIG_DATA udata;
     EFI_STATUS status;
     EFI_UDP4 *udp;
 
@@ -113,20 +123,6 @@ void core_udp_connect(struct pxe_pvt_inode *socket, uint32_t ip,
 	return;
     }
 
-    /*
-     * If this is the first time connecting, save the random local port
-     * number that the UDPv4 Protocol Driver picked for us. The TFTP
-     * protocol uses the local port number as the TID, and it needs to
-     * be consistent across connect()/disconnect() calls.
-     */
-    if (!socket->net.efi.localport) {
-	status = uefi_call_wrapper(udp->GetModeData, 5, udp,
-				   &udata, NULL, NULL, NULL);
-	if (status != EFI_SUCCESS)
-	    Print(L"Failed to get UDP mode data: %d\n", status);
-	else
-	    socket->net.efi.localport = udata.StationPort;
-    }
 }
 
 /**


More information about the Syslinux mailing list