X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FLibrary%2FDxeUdpIoLib%2FDxeUdpIoLib.c;h=d56456afb20e59aabde2f1643e6d7c7e729dd1af;hp=b66348c284c9c7401e5f725c99c52fc7cd79cc5e;hb=b61439a709bb961f2f9dff1d1a4112e30a063f51;hpb=dc59293a36f538eb6c32517c409d5992d8c2d763 diff --git a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c index b66348c284..d56456afb2 100644 --- a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c +++ b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c @@ -30,6 +30,7 @@ Abstract: #include #include #include +#include STATIC VOID @@ -77,6 +78,7 @@ UdpIoWrapTx ( EFI_UDP4_TRANSMIT_DATA *UdpTxData; EFI_STATUS Status; UINT32 Count; + IP4_ADDR Ip; Token = NetAllocatePool (sizeof (UDP_TX_TOKEN) + sizeof (EFI_UDP4_FRAGMENT_DATA) * (Packet->BlockOpNum - 1)); @@ -116,15 +118,21 @@ UdpIoWrapTx ( UdpTxData->GatewayAddress = NULL; if (EndPoint != NULL) { - EFI_IP4 (Token->UdpSession.SourceAddress) = HTONL (EndPoint->LocalAddr); - EFI_IP4 (Token->UdpSession.DestinationAddress) = HTONL (EndPoint->RemoteAddr); - Token->UdpSession.SourcePort = EndPoint->LocalPort; - Token->UdpSession.DestinationPort = EndPoint->RemotePort; - UdpTxData->UdpSessionData = &Token->UdpSession; + Ip = HTONL (EndPoint->LocalAddr); + NetCopyMem (&Token->UdpSession.SourceAddress, &Ip, sizeof (EFI_IPv4_ADDRESS)); + + Ip = HTONL (EndPoint->RemoteAddr); + NetCopyMem (&Token->UdpSession.DestinationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS)); + + Token->UdpSession.SourcePort = EndPoint->LocalPort; + Token->UdpSession.DestinationPort = EndPoint->RemotePort; + UdpTxData->UdpSessionData = &Token->UdpSession; } if (Gateway != 0) { - EFI_IP4 (Token->Gateway) = HTONL (Gateway); + Ip = HTONL (Gateway); + NetCopyMem (&Token->Gateway, &Ip, sizeof (EFI_IPv4_ADDRESS)); + UdpTxData->GatewayAddress = &Token->Gateway; } @@ -670,11 +678,14 @@ UdpIoOnDgramRcvd ( } UdpSession = &UdpRxData->UdpSession; - Points.LocalAddr = EFI_NTOHL (UdpSession->DestinationAddress); Points.LocalPort = UdpSession->DestinationPort; - Points.RemoteAddr = EFI_NTOHL (UdpSession->SourceAddress); Points.RemotePort = UdpSession->SourcePort; + NetCopyMem (&Points.LocalAddr, &UdpSession->DestinationAddress, sizeof (IP4_ADDR)); + NetCopyMem (&Points.RemoteAddr, &UdpSession->SourceAddress, sizeof (IP4_ADDR)); + Points.LocalAddr = NTOHL (Points.LocalAddr); + Points.RemoteAddr = NTOHL (Points.RemoteAddr); + Token->CallBack (Netbuf, &Points, EFI_SUCCESS, Token->Context); ON_EXIT: