X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=NetworkPkg%2FIp6Dxe%2FIp6Nd.c;h=2c8be42f093f63e0961f62d3a0aa0c9930b567cc;hb=8cfd008ef8da26d97314816e0635691955d475d5;hp=47ef74be52a866f3eec7ac40d3197745b959f37c;hpb=76389e18c04833a87811550ed6db06f1790aacde;p=mirror_edk2.git diff --git a/NetworkPkg/Ip6Dxe/Ip6Nd.c b/NetworkPkg/Ip6Dxe/Ip6Nd.c index 47ef74be52..2c8be42f09 100644 --- a/NetworkPkg/Ip6Dxe/Ip6Nd.c +++ b/NetworkPkg/Ip6Dxe/Ip6Nd.c @@ -1,7 +1,7 @@ /** @file Implementation of Neighbor Discovery support routines. - Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -261,7 +261,7 @@ Ip6CreatePrefixListEntry ( } /** - Destory a IP6 prefix list entry. + Destroy a IP6 prefix list entry. @param[in] IpSb The pointer to IP6_SERVICE instance. @param[in] PrefixEntry The to be destroyed prefix list entry. @@ -821,7 +821,8 @@ Ip6OnDADFinished ( UINT16 OptBuf[4]; EFI_DHCP6_PACKET_OPTION *Oro; EFI_DHCP6_RETRANSMISSION InfoReqReXmit; - + EFI_IPv6_ADDRESS AllNodes; + IpSb = IpIf->Service; AddrInfo = DadEntry->AddressInfo; @@ -922,6 +923,11 @@ Ip6OnDADFinished ( RemoveEntryList (&DadEntry->Link); FreePool (DadEntry); // + // Leave link-scope all-nodes multicast address (FF02::1) + // + Ip6SetToAllNodeMulticast (FALSE, IP6_LINK_LOCAL_SCOPE, &AllNodes); + Ip6LeaveGroup (IpSb, &AllNodes); + // // Disable IP operation since link-local address is a duplicate address. // IpSb->LinkLocalDadFail = TRUE; @@ -976,6 +982,13 @@ Ip6InitDADProcess ( 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; @@ -1497,13 +1510,16 @@ Ip6ProcessNeighborSolicit ( goto Exit; } else { OptionLen = (UINT16) (Head->PayloadLength - IP6_ND_LENGTH); - Option = NetbufGetByte (Packet, IP6_ND_LENGTH, NULL); + if (OptionLen != 0) { + Option = NetbufGetByte (Packet, IP6_ND_LENGTH, NULL); + ASSERT (Option != NULL); - // - // All included options should have a length that is greater than zero. - // - if (!Ip6IsNDOptionValid (Option, OptionLen)) { - goto Exit; + // + // All included options should have a length that is greater than zero. + // + if (!Ip6IsNDOptionValid (Option, OptionLen)) { + goto Exit; + } } } @@ -1568,16 +1584,6 @@ Ip6ProcessNeighborSolicit ( 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. // @@ -1733,13 +1739,16 @@ Ip6ProcessNeighborAdvertise ( goto Exit; } else { OptionLen = (UINT16) (Head->PayloadLength - IP6_ND_LENGTH); - Option = NetbufGetByte (Packet, IP6_ND_LENGTH, NULL); + if (OptionLen != 0) { + Option = NetbufGetByte (Packet, IP6_ND_LENGTH, NULL); + ASSERT (Option != NULL); - // - // All included options should have a length that is greater than zero. - // - if (!Ip6IsNDOptionValid (Option, OptionLen)) { - goto Exit; + // + // All included options should have a length that is greater than zero. + // + if (!Ip6IsNDOptionValid (Option, OptionLen)) { + goto Exit; + } } } @@ -1982,10 +1991,13 @@ Ip6ProcessRouterAdvertise ( // All included options have a length that is greater than zero. // OptionLen = (UINT16) (Head->PayloadLength - IP6_RA_LENGTH); - Option = NetbufGetByte (Packet, IP6_RA_LENGTH, NULL); + if (OptionLen != 0) { + Option = NetbufGetByte (Packet, IP6_RA_LENGTH, NULL); + ASSERT (Option != NULL); - if (!Ip6IsNDOptionValid (Option, OptionLen)) { - goto Exit; + if (!Ip6IsNDOptionValid (Option, OptionLen)) { + goto Exit; + } } // @@ -2428,10 +2440,13 @@ Ip6ProcessRedirect ( // All included options have a length that is greater than zero. // OptionLen = (UINT16) (Head->PayloadLength - IP6_REDITECT_LENGTH); - Option = NetbufGetByte (Packet, IP6_REDITECT_LENGTH, NULL); + if (OptionLen != 0) { + Option = NetbufGetByte (Packet, IP6_REDITECT_LENGTH, NULL); + ASSERT (Option != NULL); - if (!Ip6IsNDOptionValid (Option, OptionLen)) { - goto Exit; + if (!Ip6IsNDOptionValid (Option, OptionLen)) { + goto Exit; + } } Target = (EFI_IPv6_ADDRESS *) (Icmp + 1); @@ -2845,7 +2860,7 @@ Ip6NdFasterTimerTicking ( // Flag = FALSE; if ((DupAddrDetect->Receive == 0) || - (DupAddrDetect->Transmit == DupAddrDetect->Receive)) { + (DupAddrDetect->Transmit <= DupAddrDetect->Receive)) { Flag = TRUE; }