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. 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]> --- NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c | 13 +++++++++++-- NetworkPkg/Ip6Dxe/Ip6Nd.c | 19 ++++++++----------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c index 9a1e3d0..75d4f23 100644 --- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c +++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c @@ -50,11 +50,12 @@ Ip6ConfigOnPolicyChanged ( LIST_ENTRY *Entry; LIST_ENTRY *Entry2; 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 -> // Manual, we have to free default router list, on-link prefix list, autonomous // prefix list, address list in all the interfaces and destroy any IPv6 child @@ -92,14 +93,22 @@ Ip6ConfigOnPolicyChanged ( 0 ); 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); if (!NetIp6IsLinkLocalAddr (&DadEntry->AddressInfo->Address)) { // diff --git a/NetworkPkg/Ip6Dxe/Ip6Nd.c b/NetworkPkg/Ip6Dxe/Ip6Nd.c index 9f30f9b..cffdcc6 100644 --- a/NetworkPkg/Ip6Dxe/Ip6Nd.c +++ b/NetworkPkg/Ip6Dxe/Ip6Nd.c @@ -980,10 +980,17 @@ Ip6InitDADProcess ( UINT32 MaxDelayTick; 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; // @@ -1575,20 +1582,10 @@ Ip6ProcessNeighborSolicit ( // process the received neighbor solicitation message but not send out response. // 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. // if (IpSb->RecvRequest.MnpToken.Packet.RxData == NULL) { goto Exit; @@ -2861,11 +2858,11 @@ Ip6NdFasterTimerTicking ( // All required solicitation has been sent out, and the RetransTime after the last // Neighbor Solicit is elapsed, finish the DAD process. // Flag = FALSE; if ((DupAddrDetect->Receive == 0) || - (DupAddrDetect->Transmit == DupAddrDetect->Receive)) { + (DupAddrDetect->Transmit >= DupAddrDetect->Receive)) { Flag = TRUE; } Ip6OnDADFinished (Flag, IpIf, DupAddrDetect); } -- 1.9.5.msysgit.1 ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
