X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FIp4Dxe%2FIp4Icmp.c;h=511342e786d73d9cfbcecfa10ef0a58aa3830f99;hb=3028d73e5a4073841fdfc94b1e984c92e8e8fa7a;hp=05609db185e64a5bb60ee20f12922dff18d6aa5a;hpb=1204fe8319e5e6f77df68c375ef403e9ffa9227e;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c index 05609db185..511342e786 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Icmp.c @@ -1,7 +1,7 @@ /** @file -Copyright (c) 2005 - 2009, Intel Corporation.
-All rights reserved. This program and the accompanying materials +Copyright (c) 2005 - 2018, 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 @@ -72,7 +72,7 @@ mIp4SupportedIcmp[23] = { /** Process the ICMP redirect. Find the instance then update its route cache. - + All kinds of redirect is treated as host redirect as specified by RFC1122 3.3.1.2: "Since the subnet mask appropriate to the destination @@ -80,7 +80,7 @@ mIp4SupportedIcmp[23] = { message SHOULD be treated identically to a Host Redirect message;" - @param[in] IpSb The IP4 service binding instance that received + @param[in] IpSb The IP4 service binding instance that received the packet. @param[in] Head The IP head of the received ICMPpacket. @param[in] Packet The content of the ICMP redirect packet with IP @@ -158,15 +158,15 @@ Ip4ProcessIcmpRedirect ( update call Ip4ProcessIcmpRedirect to update the IP instance's route cache, otherwise, deliver the packet to upper layer. - @param[in] IpSb The IP service that received the packet. - @param[in] Head The IP head of the ICMP error packet - @param[in] Packet The content of the ICMP error with IP head + @param[in] IpSb The IP4 service that received the packet. + @param[in] Head The IP4 head of the ICMP error packet + @param[in] Packet The content of the ICMP error with IP4 head removed. @retval EFI_SUCCESS The ICMP error is processed successfully. @retval EFI_INVALID_PARAMETER The packet is invalid @retval Others Failed to process the packet. - + **/ EFI_STATUS Ip4ProcessIcmpError ( @@ -193,16 +193,16 @@ Ip4ProcessIcmpError ( } IP4_GET_CLIP_INFO (Packet)->Status = EFI_ICMP_ERROR; - return Ip4Demultiplex (IpSb, Head, Packet); + return Ip4Demultiplex (IpSb, Head, Packet, NULL, 0); } /** Replay an ICMP echo request. - @param[in] IpSb The IP service that receivd the packet - @param[in] Head The IP head of the ICMP error packet - @param[in] Packet The content of the ICMP error with IP head + @param[in] IpSb The IP4 service that receivd the packet + @param[in] Head The IP4 head of the ICMP error packet + @param[in] Packet The content of the ICMP error with IP4 head removed. @retval EFI_OUT_OF_RESOURCES Failed to allocate resource. @@ -240,6 +240,7 @@ Ip4IcmpReplyEcho ( // update is omitted. // Icmp = (IP4_ICMP_QUERY_HEAD *) NetbufGetByte (Data, 0, NULL); + ASSERT (Icmp != NULL); Icmp->Head.Type = ICMP_ECHO_REPLY; Icmp->Head.Checksum = 0; Icmp->Head.Checksum = (UINT16) (~NetblockChecksum ((UINT8 *) Icmp, Data->TotalSize)); @@ -266,6 +267,9 @@ Ip4IcmpReplyEcho ( Ip4SysPacketSent, NULL ); + if (EFI_ERROR (Status)) { + NetbufFree (Data); + } ON_EXIT: NetbufFree (Packet); @@ -277,9 +281,9 @@ ON_EXIT: Process the ICMP query message. If it is an ICMP echo request, answer it. Otherwise deliver it to upper layer. - @param[in] IpSb The IP service that receivd the packet - @param[in] Head The IP head of the ICMP query packet - @param[in] Packet The content of the ICMP query with IP head + @param[in] IpSb The IP4 service that receivd the packet + @param[in] Head The IP4 head of the ICMP query packet + @param[in] Packet The content of the ICMP query with IP4 head removed. @retval EFI_INVALID_PARAMETER The packet is invalid @@ -307,7 +311,7 @@ Ip4ProcessIcmpQuery ( return Ip4IcmpReplyEcho (IpSb, Head, Packet); } - return Ip4Demultiplex (IpSb, Head, Packet); + return Ip4Demultiplex (IpSb, Head, Packet, NULL, 0); } @@ -316,9 +320,9 @@ Ip4ProcessIcmpQuery ( then according to the message types, process it as query or error packet. - @param[in] IpSb The IP service that receivd the packet - @param[in] Head The IP head of the ICMP query packet - @param[in] Packet The content of the ICMP query with IP head + @param[in] IpSb The IP4 service that receivd the packet. + @param[in] Head The IP4 head of the ICMP query packet. + @param[in] Packet The content of the ICMP query with IP4 head removed. @retval EFI_INVALID_PARAMETER The packet is malformated.