Revision: 17263
          http://sourceforge.net/p/edk2/code/17263
Author:   sfu5
Date:     2015-04-29 05:47:03 +0000 (Wed, 29 Apr 2015)
Log Message:
-----------
Remove duplicate DAD entry in IP6 driver to fix DAD fail issue.

The IP6 driver may create duplicate IP6_DAD_ENTRY in DupAddrDetectList in some 
situation like:
1. Address policy switch but not clear the delay node list, OR
2. Set manual address repeatedly before the previous DAD is finished.
The NS sent out by duplicate DAD entry will mix up with the loop back multicast 
packet, result in DAD fail.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <[email protected]>
Reviewed-by: Ye Ting <[email protected]>
Reviewed-by: Wu Jiaxin <[email protected]>

Modified Paths:
--------------
    trunk/edk2/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
    trunk/edk2/NetworkPkg/Ip6Dxe/Ip6Nd.c

Modified: trunk/edk2/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
===================================================================
--- trunk/edk2/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c        2015-04-29 05:45:44 UTC 
(rev 17262)
+++ trunk/edk2/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c        2015-04-29 05:47:03 UTC 
(rev 17263)
@@ -52,7 +52,8 @@
   LIST_ENTRY      *Next;
   IP6_INTERFACE   *IpIf;
   IP6_DAD_ENTRY   *DadEntry;
-
+  IP6_DELAY_JOIN_LIST       *DelayNode;
+  
   //
   // Currently there are only two policies: Manual and Automatic. Regardless of
   // what transition is going on, i.e., Manual -> Automatic and Automatic ->
@@ -94,10 +95,18 @@
 
   NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
     //
-    // remove all pending DAD entries for the global addresses.
+    // remove all pending delay node and DAD entries for the global addresses.
     //
     IpIf = NET_LIST_USER_STRUCT_S (Entry, IP6_INTERFACE, Link, 
IP6_INTERFACE_SIGNATURE);
 
+    NET_LIST_FOR_EACH_SAFE (Entry2, Next, &IpIf->DelayJoinList) {
+      DelayNode = NET_LIST_USER_STRUCT (Entry2, IP6_DELAY_JOIN_LIST, Link);
+      if (!NetIp6IsLinkLocalAddr (&DelayNode->AddressInfo->Address)) {
+        RemoveEntryList (&DelayNode->Link);
+        FreePool (DelayNode);
+      }
+    }
+
     NET_LIST_FOR_EACH_SAFE (Entry2, Next, &IpIf->DupAddrDetectList) {
       DadEntry = NET_LIST_USER_STRUCT_S (Entry2, IP6_DAD_ENTRY, Link, 
IP6_DAD_ENTRY_SIGNATURE);
 

Modified: trunk/edk2/NetworkPkg/Ip6Dxe/Ip6Nd.c
===================================================================
--- trunk/edk2/NetworkPkg/Ip6Dxe/Ip6Nd.c        2015-04-29 05:45:44 UTC (rev 
17262)
+++ trunk/edk2/NetworkPkg/Ip6Dxe/Ip6Nd.c        2015-04-29 05:47:03 UTC (rev 
17263)
@@ -982,6 +982,13 @@
   NET_CHECK_SIGNATURE (IpIf, IP6_INTERFACE_SIGNATURE);
   ASSERT (AddressInfo != NULL);
 
+  //
+  // Do nothing if we have already started DAD on the address.
+  //
+  if (Ip6FindDADEntry (IpIf->Service, &AddressInfo->Address, NULL) != NULL) {
+    return EFI_SUCCESS;
+  }
+  
   Status   = EFI_SUCCESS;
   IpSb     = IpIf->Service;
   DadXmits = &IpSb->Ip6ConfigInstance.DadXmits;
@@ -1577,16 +1584,6 @@
   if (IsDAD && !IsMaintained) {
     DupAddrDetect = Ip6FindDADEntry (IpSb, &Target, &IpIf);
     if (DupAddrDetect != NULL) {
-      if (DupAddrDetect->Transmit == 0) {
-        //
-        // The NS is from another node to performing DAD on the same address 
since
-        // we haven't send out any NS yet. Fail DAD for the tentative address.
-        //
-        Ip6OnDADFinished (FALSE, IpIf, DupAddrDetect);
-        Status = EFI_ICMP_ERROR;
-        goto Exit;
-      }
-
       //
       // Check the MAC address of the incoming packet.
       //
@@ -2863,7 +2860,7 @@
           //
           Flag = FALSE;
           if ((DupAddrDetect->Receive == 0) ||
-              (DupAddrDetect->Transmit == DupAddrDetect->Receive)) {
+              (DupAddrDetect->Transmit <= DupAddrDetect->Receive)) {
             Flag = TRUE;
           }
 


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to