X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=NetworkPkg%2FIp6Dxe%2FIp6ConfigImpl.c;h=9b6a62e9ec885b3894fc3d9a6211e15ed659134c;hb=df8c2668d7277030cf98e7b218549e0466fa5f6b;hp=ddb8dcd379846503cca842ca10010b61f300ea1c;hpb=fdc4b0b147b386e966e99893526181dfae9eaeef;p=mirror_edk2.git
diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
index ddb8dcd379..9b6a62e9ec 100644
--- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
+++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
@@ -1,7 +1,7 @@
/** @file
The implementation of EFI IPv6 Configuration Protocol.
- Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2016, 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
@@ -52,7 +52,8 @@ Ip6ConfigOnPolicyChanged (
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 @@ Ip6ConfigOnPolicyChanged (
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);
@@ -112,7 +121,7 @@ Ip6ConfigOnPolicyChanged (
if (NewPolicy == Ip6ConfigPolicyAutomatic) {
//
- // Set paramters to trigger router solicitation sending in timer handler.
+ // Set parameters to trigger router solicitation sending in timer handler.
//
IpSb->RouterAdvertiseReceived = FALSE;
IpSb->SolicitTimer = IP6_MAX_RTR_SOLICITATIONS;
@@ -210,9 +219,9 @@ Ip6ConfigStartStatefulAutoConfig (
// with DNS SERVERS.
//
Oro = (EFI_DHCP6_PACKET_OPTION *) OptBuf;
- Oro->OpCode = HTONS (IP6_CONFIG_DHCP6_OPTION_ORO);
+ Oro->OpCode = HTONS (DHCP6_OPT_ORO);
Oro->OpLen = HTONS (2);
- *((UINT16 *) &Oro->Data[0]) = HTONS (IP6_CONFIG_DHCP6_OPTION_DNS_SERVERS);
+ *((UINT16 *) &Oro->Data[0]) = HTONS (DHCP6_OPT_DNS_SERVERS);
OptList[0] = Oro;
Status = EFI_SUCCESS;
@@ -656,36 +665,35 @@ Ip6ConfigSetPolicy (
return EFI_ABORTED;
} else {
-
- if (NewPolicy == Ip6ConfigPolicyAutomatic) {
- //
- // Clean the ManualAddress, Gateway and DnsServers, shrink the variable
- // data size, and fire up all the related events.
- //
- DataItem = &Instance->DataItem[Ip6ConfigDataTypeManualAddress];
- if (DataItem->Data.Ptr != NULL) {
- FreePool (DataItem->Data.Ptr);
- }
- DataItem->Data.Ptr = NULL;
- DataItem->DataSize = 0;
- DataItem->Status = EFI_NOT_FOUND;
- NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
-
- DataItem = &Instance->DataItem[Ip6ConfigDataTypeGateway];
- if (DataItem->Data.Ptr != NULL) {
- FreePool (DataItem->Data.Ptr);
- }
- DataItem->Data.Ptr = NULL;
- DataItem->DataSize = 0;
- DataItem->Status = EFI_NOT_FOUND;
- NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
-
- DataItem = &Instance->DataItem[Ip6ConfigDataTypeDnsServer];
- DataItem->Data.Ptr = NULL;
- DataItem->DataSize = 0;
- DataItem->Status = EFI_NOT_FOUND;
- NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
- } else {
+ //
+ // Clean the ManualAddress, Gateway and DnsServers, shrink the variable
+ // data size, and fire up all the related events.
+ //
+ DataItem = &Instance->DataItem[Ip6ConfigDataTypeManualAddress];
+ if (DataItem->Data.Ptr != NULL) {
+ FreePool (DataItem->Data.Ptr);
+ }
+ DataItem->Data.Ptr = NULL;
+ DataItem->DataSize = 0;
+ DataItem->Status = EFI_NOT_FOUND;
+ NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
+
+ DataItem = &Instance->DataItem[Ip6ConfigDataTypeGateway];
+ if (DataItem->Data.Ptr != NULL) {
+ FreePool (DataItem->Data.Ptr);
+ }
+ DataItem->Data.Ptr = NULL;
+ DataItem->DataSize = 0;
+ DataItem->Status = EFI_NOT_FOUND;
+ NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
+
+ DataItem = &Instance->DataItem[Ip6ConfigDataTypeDnsServer];
+ DataItem->Data.Ptr = NULL;
+ DataItem->DataSize = 0;
+ DataItem->Status = EFI_NOT_FOUND;
+ NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
+
+ if (NewPolicy == Ip6ConfigPolicyManual) {
//
// The policy is changed from automatic to manual. Stop the DHCPv6 process
// and destroy the DHCPv6 child.
@@ -1012,6 +1020,14 @@ Ip6ConfigSetMaunualAddress (
128
);
+ //
+ // If the new address's prefix length is not specified, just use the previous configured
+ // prefix length for this address.
+ //
+ if (NewAddress->PrefixLength == 0) {
+ NewAddress->PrefixLength = CurrentAddrInfo->PrefixLength;
+ }
+
//
// This manual address is already in use, see whether prefix length is changed.
//
@@ -1491,7 +1507,7 @@ Ip6ConfigParseDhcpReply (
CopyMem (&OpCode, &OptList[Index]->OpCode, sizeof (OpCode));
OpCode = NTOHS (OpCode);
- if (OpCode == IP6_CONFIG_DHCP6_OPTION_DNS_SERVERS) {
+ if (OpCode == DHCP6_OPT_DNS_SERVERS) {
CopyMem (&Length, &OptList[Index]->OpLen, sizeof (Length));
Length = NTOHS (Length);
@@ -1594,11 +1610,13 @@ Ip6ConfigSetStatefulAddrCallback (
//
// Decline those duplicates.
//
- Instance->Dhcp6->Decline (
- Instance->Dhcp6,
- Instance->DeclineAddressCount,
- Instance->DeclineAddress
- );
+ if (Instance->Dhcp6 != NULL) {
+ Instance->Dhcp6->Decline (
+ Instance->Dhcp6,
+ Instance->DeclineAddressCount,
+ Instance->DeclineAddress
+ );
+ }
}
if (Instance->DeclineAddress != NULL) {
@@ -2190,7 +2208,7 @@ Ip6ConfigInitInstance (
DataItem->SetData = Ip6ConfigSetPolicy;
DataItem->Data.Ptr = &Instance->Policy;
DataItem->DataSize = sizeof (Instance->Policy);
- Instance->Policy = Ip6ConfigPolicyAutomatic;
+ Instance->Policy = Ip6ConfigPolicyManual;
SET_DATA_ATTRIB (DataItem->Attribute, DATA_ATTRIB_SIZE_FIXED);
DataItem = &Instance->DataItem[Ip6ConfigDataTypeDupAddrDetectTransmits];