H. Peter Anvin
2013-Nov-08 19:57 UTC
[syslinux] syslinux.efi pxeboot across multiple subnets
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; - } } /**
Jason Matthews
2013-Nov-08 22:08 UTC
[syslinux] syslinux.efi pxeboot across multiple subnets
I attempted the patch, but had to add a declaration to get it to compile. I also added the gateway like before. Here's a link to the modified diff I used and the pcaps from tftpserver and mirrored port from boot to reset. http://ge.tt/136167y/v/0 I'm also not sure about if I'm building correctly or not. Considering that I get a different syslinux.efi when I compile without making modifications to the source (one that doesn't work with same subnet) makes me wonder if some of my libraries are bad or something. At any rate, thanks for all the help. I think I've learned more trying to figure out what's going on with this than I have in the past year. On Fri, Nov 8, 2013 at 2:57 PM, H. Peter Anvin <hpa at zytor.com> wrote:> Here is a completely untested patch if someone wants to try and take it > for a spin? > > -hpa > > > _______________________________________________ > Syslinux mailing list > Submissions to Syslinux at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux > Please do not send private replies to mailing list traffic. > > >
H. Peter Anvin
2013-Nov-08 22:30 UTC
[syslinux] syslinux.efi pxeboot across multiple subnets
On 11/08/2013 02:08 PM, Jason Matthews wrote:> I attempted the patch, but had to add a declaration to get it to compile. I > also added the gateway like before. Here's a link to the modified diff I > used and the pcaps from tftpserver and mirrored port from boot to reset. > > http://ge.tt/136167y/v/0 > > I'm also not sure about if I'm building correctly or not. Considering that > I get a different syslinux.efi when I compile without making modifications > to the source (one that doesn't work with same subnet) makes me wonder if > some of my libraries are bad or something. >It could be a gnu-efi version mismatch, certainly.> At any rate, thanks for all the help. I think I've learned more trying to > figure out what's going on with this than I have in the past year.Hmmm... looks like it never gets the request packet out. Not good. -hpa
On Fri, Nov 8, 2013 at 5:08 PM, Jason Matthews <jason.david.matthews at gmail.com> wrote:> I attempted the patch, but had to add a declaration to get it to compile. I > also added the gateway like before. Here's a link to the modified diff I > used and the pcaps from tftpserver and mirrored port from boot to reset. > > http://ge.tt/136167y/v/0 > > I'm also not sure about if I'm building correctly or not. Considering that > I get a different syslinux.efi when I compile without making modifications > to the source (one that doesn't work with same subnet) makes me wonder if > some of my libraries are bad or something. > > At any rate, thanks for all the help. I think I've learned more trying to > figure out what's going on with this than I have in the past year.It appears it's not so simple. Setting the gateway unnecessarily breaks my 1 subnet test. -- -Gene A: Because it messes up the order in which people normally read text, especially the archives of mailing lists. Q: Why is Top-posting such a bad thing?> On Fri, Nov 8, 2013 at 2:57 PM, H. Peter Anvin <hpa at zytor.com> wrote: > >> Here is a completely untested patch if someone wants to try and take it >> for a spin?
On Fri, Nov 8, 2013 at 5:08 PM, Jason Matthews <jason.david.matthews at gmail.com> wrote:> I attempted the patch, but had to add a declaration to get it to compile. I > also added the gateway like before. Here's a link to the modified diff I > used and the pcaps from tftpserver and mirrored port from boot to reset. > > http://ge.tt/136167y/v/0 > > I'm also not sure about if I'm building correctly or not. Considering that > I get a different syslinux.efi when I compile without making modifications > to the source (one that doesn't work with same subnet) makes me wonder if > some of my libraries are bad or something. > > At any rate, thanks for all the help. I think I've learned more trying to > figure out what's going on with this than I have in the past year.Try txdata->GatewayAddress = &IPInfo.gateway; not txdata->GatewayAddress = IPInfo.gateway; -- -Gene> On Fri, Nov 8, 2013 at 2:57 PM, H. Peter Anvin <hpa at zytor.com> wrote: >> Here is a completely untested patch if someone wants to try and take it >> for a spin?