aboutsummaryrefslogtreecommitdiffstats
path: root/efi/udp.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-11-10 08:44:06 -0500
committerGene Cumm <gene.cumm@gmail.com>2014-01-29 11:55:14 -0500
commit73c4268bd1399273b295f899087cef6aabf0721d (patch)
tree1ed92a84914086b2a283eab7bf3b21e87c079117 /efi/udp.c
parentdfca8e0548c1597afd9b505b41ac26e9e52b7494 (diff)
downloadsyslinux-73c4268bd1399273b295f899087cef6aabf0721d.tar.gz
syslinux-73c4268bd1399273b295f899087cef6aabf0721d.tar.xz
syslinux-73c4268bd1399273b295f899087cef6aabf0721d.zip
efi/udp.c: Save UDP Port in core_udp_open()
core_udp_open() should obtain a UDP port allocation and save it for core_udp_connect() and core_udp_sendto() to reuse. Author: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
Diffstat (limited to 'efi/udp.c')
-rw-r--r--efi/udp.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/efi/udp.c b/efi/udp.c
index 59bb4263..8169025a 100644
--- a/efi/udp.c
+++ b/efi/udp.c
@@ -50,6 +50,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:
@@ -112,21 +124,6 @@ void core_udp_connect(struct pxe_pvt_inode *socket, uint32_t ip,
Print(L"Failed to configure UDP: %d\n", status);
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;
- }
}
/**