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 <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17263
6f19259b-4bc3-4df7-8a09-
765794883524
LIST_ENTRY *Next;\r
IP6_INTERFACE *IpIf;\r
IP6_DAD_ENTRY *DadEntry;\r
LIST_ENTRY *Next;\r
IP6_INTERFACE *IpIf;\r
IP6_DAD_ENTRY *DadEntry;\r
+ IP6_DELAY_JOIN_LIST *DelayNode;\r
+ \r
//\r
// Currently there are only two policies: Manual and Automatic. Regardless of\r
// what transition is going on, i.e., Manual -> Automatic and Automatic ->\r
//\r
// Currently there are only two policies: Manual and Automatic. Regardless of\r
// what transition is going on, i.e., Manual -> Automatic and Automatic ->\r
\r
NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {\r
//\r
\r
NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {\r
//\r
- // remove all pending DAD entries for the global addresses.\r
+ // remove all pending delay node and DAD entries for the global addresses.\r
//\r
IpIf = NET_LIST_USER_STRUCT_S (Entry, IP6_INTERFACE, Link, IP6_INTERFACE_SIGNATURE);\r
\r
//\r
IpIf = NET_LIST_USER_STRUCT_S (Entry, IP6_INTERFACE, Link, IP6_INTERFACE_SIGNATURE);\r
\r
+ NET_LIST_FOR_EACH_SAFE (Entry2, Next, &IpIf->DelayJoinList) {\r
+ DelayNode = NET_LIST_USER_STRUCT (Entry2, IP6_DELAY_JOIN_LIST, Link);\r
+ if (!NetIp6IsLinkLocalAddr (&DelayNode->AddressInfo->Address)) {\r
+ RemoveEntryList (&DelayNode->Link);\r
+ FreePool (DelayNode);\r
+ }\r
+ }\r
+\r
NET_LIST_FOR_EACH_SAFE (Entry2, Next, &IpIf->DupAddrDetectList) {\r
DadEntry = NET_LIST_USER_STRUCT_S (Entry2, IP6_DAD_ENTRY, Link, IP6_DAD_ENTRY_SIGNATURE);\r
\r
NET_LIST_FOR_EACH_SAFE (Entry2, Next, &IpIf->DupAddrDetectList) {\r
DadEntry = NET_LIST_USER_STRUCT_S (Entry2, IP6_DAD_ENTRY, Link, IP6_DAD_ENTRY_SIGNATURE);\r
\r
NET_CHECK_SIGNATURE (IpIf, IP6_INTERFACE_SIGNATURE);\r
ASSERT (AddressInfo != NULL);\r
\r
NET_CHECK_SIGNATURE (IpIf, IP6_INTERFACE_SIGNATURE);\r
ASSERT (AddressInfo != NULL);\r
\r
+ //\r
+ // Do nothing if we have already started DAD on the address.\r
+ //\r
+ if (Ip6FindDADEntry (IpIf->Service, &AddressInfo->Address, NULL) != NULL) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ \r
Status = EFI_SUCCESS;\r
IpSb = IpIf->Service;\r
DadXmits = &IpSb->Ip6ConfigInstance.DadXmits;\r
Status = EFI_SUCCESS;\r
IpSb = IpIf->Service;\r
DadXmits = &IpSb->Ip6ConfigInstance.DadXmits;\r
if (IsDAD && !IsMaintained) {\r
DupAddrDetect = Ip6FindDADEntry (IpSb, &Target, &IpIf);\r
if (DupAddrDetect != NULL) {\r
if (IsDAD && !IsMaintained) {\r
DupAddrDetect = Ip6FindDADEntry (IpSb, &Target, &IpIf);\r
if (DupAddrDetect != NULL) {\r
- if (DupAddrDetect->Transmit == 0) {\r
- //\r
- // The NS is from another node to performing DAD on the same address since\r
- // we haven't send out any NS yet. Fail DAD for the tentative address.\r
- //\r
- Ip6OnDADFinished (FALSE, IpIf, DupAddrDetect);\r
- Status = EFI_ICMP_ERROR;\r
- goto Exit;\r
- }\r
-\r
//\r
// Check the MAC address of the incoming packet.\r
//\r
//\r
// Check the MAC address of the incoming packet.\r
//\r
//\r
Flag = FALSE;\r
if ((DupAddrDetect->Receive == 0) ||\r
//\r
Flag = FALSE;\r
if ((DupAddrDetect->Receive == 0) ||\r
- (DupAddrDetect->Transmit == DupAddrDetect->Receive)) {\r
+ (DupAddrDetect->Transmit <= DupAddrDetect->Receive)) {\r