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 <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
This commit is contained in:
Fu Siyuan 2015-04-29 05:47:03 +00:00 committed by sfu5
parent ba2c052791
commit cca5e4221b
2 changed files with 19 additions and 13 deletions

View File

@ -52,7 +52,8 @@ Ip6ConfigOnPolicyChanged (
LIST_ENTRY *Next; LIST_ENTRY *Next;
IP6_INTERFACE *IpIf; IP6_INTERFACE *IpIf;
IP6_DAD_ENTRY *DadEntry; IP6_DAD_ENTRY *DadEntry;
IP6_DELAY_JOIN_LIST *DelayNode;
// //
// Currently there are only two policies: Manual and Automatic. Regardless of // Currently there are only two policies: Manual and Automatic. Regardless of
// what transition is going on, i.e., Manual -> Automatic and Automatic -> // what transition is going on, i.e., Manual -> Automatic and Automatic ->
@ -94,10 +95,18 @@ Ip6ConfigOnPolicyChanged (
NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) { 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); 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) { NET_LIST_FOR_EACH_SAFE (Entry2, Next, &IpIf->DupAddrDetectList) {
DadEntry = NET_LIST_USER_STRUCT_S (Entry2, IP6_DAD_ENTRY, Link, IP6_DAD_ENTRY_SIGNATURE); DadEntry = NET_LIST_USER_STRUCT_S (Entry2, IP6_DAD_ENTRY, Link, IP6_DAD_ENTRY_SIGNATURE);

View File

@ -982,6 +982,13 @@ Ip6InitDADProcess (
NET_CHECK_SIGNATURE (IpIf, IP6_INTERFACE_SIGNATURE); NET_CHECK_SIGNATURE (IpIf, IP6_INTERFACE_SIGNATURE);
ASSERT (AddressInfo != NULL); 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; Status = EFI_SUCCESS;
IpSb = IpIf->Service; IpSb = IpIf->Service;
DadXmits = &IpSb->Ip6ConfigInstance.DadXmits; DadXmits = &IpSb->Ip6ConfigInstance.DadXmits;
@ -1577,16 +1584,6 @@ Ip6ProcessNeighborSolicit (
if (IsDAD && !IsMaintained) { if (IsDAD && !IsMaintained) {
DupAddrDetect = Ip6FindDADEntry (IpSb, &Target, &IpIf); DupAddrDetect = Ip6FindDADEntry (IpSb, &Target, &IpIf);
if (DupAddrDetect != NULL) { 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. // Check the MAC address of the incoming packet.
// //
@ -2863,7 +2860,7 @@ Ip6NdFasterTimerTicking (
// //
Flag = FALSE; Flag = FALSE;
if ((DupAddrDetect->Receive == 0) || if ((DupAddrDetect->Receive == 0) ||
(DupAddrDetect->Transmit == DupAddrDetect->Receive)) { (DupAddrDetect->Transmit <= DupAddrDetect->Receive)) {
Flag = TRUE; Flag = TRUE;
} }