Revision: 14170
http://edk2.svn.sourceforge.net/edk2/?rev=14170&view=rev
Author: sfu5
Date: 2013-03-11 08:04:39 +0000 (Mon, 11 Mar 2013)
Log Message:
-----------
Fix a bug in IP4 driver which may cause ?\226?\128?\156reconnect
?\226?\128?\147r?\226?\128?\157 hang.
Signed-off-by: Fu Siyuan <[email protected]>
Reviewed-by: Ye Ting <[email protected]>
Reviewed-by: Ouyang Qian <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
trunk/edk2/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
Modified: trunk/edk2/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c 2013-03-11
07:49:41 UTC (rev 14169)
+++ trunk/edk2/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c 2013-03-11
08:04:39 UTC (rev 14170)
@@ -1,7 +1,7 @@
/** @file
Implement IP4 pesudo interface.
-Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -740,24 +740,11 @@
//
Ip4CancelFrames (Interface, EFI_ABORTED, Ip4CancelInstanceFrame, IpInstance);
- if (--Interface->RefCnt > 0) {
- return EFI_SUCCESS;
- }
-
//
- // Destroy the interface if this is the last IP instance that
- // has the address. Remove all the system transmitted packets
- // from this interface, cancel the receive request if there is
- // one, and destroy the ARP requests.
+ // Destroy the ARP instance if this is the last IP instance that
+ // has the address.
//
- Ip4CancelFrames (Interface, EFI_ABORTED, Ip4CancelInstanceFrame, NULL);
- Ip4CancelReceive (Interface);
-
- ASSERT (IsListEmpty (&Interface->IpInstances));
- ASSERT (IsListEmpty (&Interface->ArpQues));
- ASSERT (IsListEmpty (&Interface->SentFrames));
-
- if (Interface->Arp != NULL) {
+ if (Interface->Arp != NULL && IsListEmpty (&Interface->IpInstances)) {
gBS->CloseProtocol (
Interface->ArpHandle,
&gEfiArpProtocolGuid,
@@ -771,8 +758,25 @@
&gEfiArpServiceBindingProtocolGuid,
Interface->ArpHandle
);
+ Interface->Arp = NULL;
}
+
+ if (--Interface->RefCnt > 0) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Destroy the interface if it is not referenced by any IP instance (for
common Interface)
+ // or the IP service (for the DefaultInterface). Remove all the system
transmitted packets
+ // from this interface, cancel the receive request if there is one.
+ //
+ Ip4CancelFrames (Interface, EFI_ABORTED, Ip4CancelInstanceFrame, NULL);
+ Ip4CancelReceive (Interface);
+
+ ASSERT (IsListEmpty (&Interface->IpInstances));
+ ASSERT (IsListEmpty (&Interface->ArpQues));
+ ASSERT (IsListEmpty (&Interface->SentFrames));
+
RemoveEntryList (&Interface->Link);
FreePool (Interface);
Modified: trunk/edk2/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c 2013-03-11
07:49:41 UTC (rev 14169)
+++ trunk/edk2/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c 2013-03-11
08:04:39 UTC (rev 14170)
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -562,6 +562,9 @@
IP4_ADDR SubnetMask;
IP4_ADDR SubnetAddress;
IP4_ADDR GatewayAddress;
+ IP4_PROTOCOL *Ip4Instance;
+ EFI_ARP_PROTOCOL *Arp;
+ LIST_ENTRY *Entry;
IpSb = (IP4_SERVICE *) Context;
NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
@@ -650,11 +653,33 @@
StationAddress = EFI_NTOHL (Data->StationAddress);
SubnetMask = EFI_NTOHL (Data->SubnetMask);
Status = Ip4SetAddress (IpIf, StationAddress, SubnetMask);
-
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
+ if (IpIf->Arp != NULL) {
+ //
+ // A non-NULL IpIf->Arp here means a new ARP child is created when setting
default address,
+ // but some IP children may have referenced the default interface before
it is configured,
+ // these IP instances also consume this ARP protocol so they need to open
it BY_CHILD_CONTROLLER.
+ //
+ Arp = NULL;
+ NET_LIST_FOR_EACH (Entry, &IpIf->IpInstances) {
+ Ip4Instance = NET_LIST_USER_STRUCT_S (Entry, IP4_PROTOCOL, AddrLink,
IP4_PROTOCOL_SIGNATURE);
+ Status = gBS->OpenProtocol (
+ IpIf->ArpHandle,
+ &gEfiArpProtocolGuid,
+ (VOID **) &Arp,
+ gIp4DriverBinding.DriverBindingHandle,
+ Ip4Instance->Handle,
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
+ }
+ }
+
Ip4AddRoute (
IpSb->DefaultRouteTable,
StationAddress,
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits