X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FArpDxe%2FArpMain.c;h=f06121fed452cf0b4bcb0763123a1d4a4cb6b290;hp=46aa19226b3914c1e8abb9099d7a21c3e88e5938;hb=c0fd7f734e2d33e22215899b40a47b843129541d;hpb=e48e37fce2611df7a52aff271835ff72ee396d9b diff --git a/MdeModulePkg/Universal/Network/ArpDxe/ArpMain.c b/MdeModulePkg/Universal/Network/ArpDxe/ArpMain.c index 46aa19226b..f06121fed4 100644 --- a/MdeModulePkg/Universal/Network/ArpDxe/ArpMain.c +++ b/MdeModulePkg/Universal/Network/ArpDxe/ArpMain.c @@ -1,20 +1,8 @@ /** @file + Implementation of EFI Address Resolution Protocol (ARP) Protocol interface functions. -Copyright (c) 2006, 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 - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - ArpMain.c - -Abstract: - +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -23,8 +11,15 @@ Abstract: /** This function is used to assign a station address to the ARP cache for this instance - of the ARP driver. A call to this function with the ConfigData field set to NULL - will reset this ARP instance. + of the ARP driver. + + Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will + respond to ARP requests that match this registered station address. A call to + this function with the ConfigData field set to NULL will reset this ARP instance. + + Once a protocol type and station address have been assigned to this ARP instance, + all the following ARP functions will use this information. Attempting to change + the protocol type or station address to a configured ARP instance will result in errors. @param This Pointer to the EFI_ARP_PROTOCOL instance. @param ConfigData Pointer to the EFI_ARP_CONFIG_DATA structure. @@ -82,6 +77,17 @@ ArpConfigure ( /** This function is used to insert entries into the ARP cache. + ARP cache entries are typically inserted and updated by network protocol drivers + as network traffic is processed. Most ARP cache entries will time out and be + deleted if the network traffic stops. ARP cache entries that were inserted + by the Add() function may be static (will not time out) or dynamic (will time out). + Default ARP cache timeout values are not covered in most network protocol + specifications (although RFC 1122 comes pretty close) and will only be + discussed in general in this specification. The timeout values that are + used in the EFI Sample Implementation should be used only as a guideline. + Final product implementations of the EFI network stack should be tuned for + their expected network environments. + @param This Pointer to the EFI_ARP_PROTOCOL instance. @param DenyFlag Set to TRUE if this entry is a deny entry. Set to FALSE if this entry is a normal entry. @@ -270,6 +276,13 @@ UNLOCK_EXIT: This function searches the ARP cache for matching entries and allocates a buffer into which those entries are copied. + The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which + are protocol address pairs and hardware address pairs. + When finding a specific protocol address (BySwAddress is TRUE and AddressBuffer + is not NULL), the ARP cache timeout for the found entry is reset if Refresh is + set to TRUE. If the found ARP cache entry is a permanent entry, it is not + affected by Refresh. + @param This Pointer to the EFI_ARP_PROTOCOL instance. @param BySwAddress Set to TRUE to look for matching software protocol addresses. Set to FALSE to look for matching @@ -495,7 +508,7 @@ ArpRequest ( SnpMode = &ArpService->SnpMode; if ((TargetSwAddress == NULL) || - ((Instance->ConfigData.SwAddressType == IPv4_ETHER_PROTO_TYPE) && + ((Instance->ConfigData.SwAddressType == IPV4_ETHER_PROTO_TYPE) && IP4_IS_LOCAL_BROADCAST (*((UINT32 *)TargetSwAddress)))) { // // Return the hardware broadcast address. @@ -505,7 +518,7 @@ ArpRequest ( goto SIGNAL_USER; } - if ((Instance->ConfigData.SwAddressType == IPv4_ETHER_PROTO_TYPE) && + if ((Instance->ConfigData.SwAddressType == IPV4_ETHER_PROTO_TYPE) && IP4_IS_MULTICAST (NTOHL (*((UINT32 *)TargetSwAddress)))) { // // If the software address is an IPv4 multicast address, invoke Mnp to @@ -609,7 +622,7 @@ ArpRequest ( CacheEntry = ArpAllocCacheEntry (Instance); if (CacheEntry == NULL) { DEBUG ((EFI_D_ERROR, "ArpRequest: Allocate memory for CacheEntry failed.\n")); - gBS->FreePool (RequestContext); + FreePool (RequestContext); Status = EFI_OUT_OF_RESOURCES; goto UNLOCK_EXIT; @@ -649,7 +662,7 @@ SIGNAL_USER: // // Dispatch the DPC queued by the NotifyFunction of ResolvedEvent. // - NetLibDispatchDpc (); + DispatchDpc (); } return Status; @@ -660,6 +673,12 @@ SIGNAL_USER: This function aborts the previous ARP request (identified by This, TargetSwAddress and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request(). + If the request is in the internal ARP request queue, the request is aborted + immediately and its ResolvedEvent is signaled. Only an asynchronous address + request needs to be canceled. If TargeSwAddress and ResolveEvent are both + NULL, all the pending asynchronous requests that have been issued by This + instance will be cancelled and their corresponding events will be signaled. + @param This Pointer to the EFI_ARP_PROTOCOL instance. @param TargetSwAddress Pointer to the protocol address in previous request session. @@ -712,7 +731,7 @@ ArpCancel ( // Dispatch the DPCs queued by the NotifyFunction of the events signaled // by ArpCancleRequest. // - NetLibDispatchDpc (); + DispatchDpc (); gBS->RestoreTPL (OldTpl);