X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FLibrary%2FDxeUdpIoLib%2FDxeUdpIoLib.c;h=4861095435e6b13eadd2d83856219addb2344b8d;hb=9e32e97;hp=afcde8199a5ccff9eb3d1938c7bd2a0d40e3475d;hpb=e285199897e538523f762cb5b3900e81f872035a;p=mirror_edk2.git diff --git a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c index afcde8199a..4861095435 100644 --- a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c +++ b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c @@ -1,8 +1,8 @@ /** @file Help functions to access UDP service, it is used by both the DHCP and MTFTP. -Copyright (c) 2005 - 2009, Intel Corporation.
-All rights reserved. This program and the accompanying materials +Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php @@ -130,6 +130,7 @@ UdpIoOnDgramSent ( **/ VOID +EFIAPI UdpIoRecycleDgram ( IN VOID *Context ) @@ -214,6 +215,12 @@ UdpIoOnDgramRcvdDpc ( // Build a NET_BUF from the UDP receive data, then deliver it up. // if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) { + if (((EFI_UDP4_RECEIVE_DATA *) RxData)->DataLength == 0) { + // + // Discard zero length data payload packet. + // + goto Resume; + } Netbuf = NetbufFromExt ( (NET_FRAGMENT *)((EFI_UDP4_RECEIVE_DATA *) RxData)->FragmentTable, @@ -251,6 +258,12 @@ UdpIoOnDgramRcvdDpc ( EndPoint.LocalAddr.Addr[0] = NTOHL (EndPoint.LocalAddr.Addr[0]); EndPoint.RemoteAddr.Addr[0] = NTOHL (EndPoint.RemoteAddr.Addr[0]); } else { + if (((EFI_UDP6_RECEIVE_DATA *) RxData)->DataLength == 0) { + // + // Discard zero length data payload packet. + // + goto Resume; + } Netbuf = NetbufFromExt ( (NET_FRAGMENT *)((EFI_UDP6_RECEIVE_DATA *) RxData)->FragmentTable, @@ -290,6 +303,16 @@ UdpIoOnDgramRcvdDpc ( } RxToken->CallBack (Netbuf, &EndPoint, EFI_SUCCESS, RxToken->Context); + return; + +Resume: + if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) { + gBS->SignalEvent (((EFI_UDP4_RECEIVE_DATA *) RxData)->RecycleSignal); + RxToken->UdpIo->Protocol.Udp4->Receive (RxToken->UdpIo->Protocol.Udp4, &RxToken->Token.Udp4); + } else { + gBS->SignalEvent (((EFI_UDP6_RECEIVE_DATA *) RxData)->RecycleSignal); + RxToken->UdpIo->Protocol.Udp6->Receive (RxToken->UdpIo->Protocol.Udp6, &RxToken->Token.Udp6); + } } /** @@ -803,7 +826,7 @@ UdpIoFreeIo ( } // - // Close then destory the Udp4 child + // Close then destroy the Udp4 child // gBS->CloseProtocol ( UdpIo->UdpHandle, @@ -826,7 +849,7 @@ UdpIoFreeIo ( } // - // Close then destory the Udp6 child + // Close then destroy the Udp6 child // gBS->CloseProtocol ( UdpIo->UdpHandle, @@ -970,6 +993,7 @@ UdpIoSendDatagram ( @retval FALSE The packet is not to be cancelled. **/ BOOLEAN +EFIAPI UdpIoCancelSingleDgram ( IN UDP_TX_TOKEN *Token, IN VOID *Context