From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 72FB31A1E6E for ; Wed, 21 Sep 2016 00:23:33 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 21 Sep 2016 00:23:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,372,1470726000"; d="scan'208";a="1054209653" Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.121]) by orsmga002.jf.intel.com with ESMTP; 21 Sep 2016 00:23:16 -0700 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Hegde Nagaraj P , Subramanian Sriram , Ye Ting Date: Wed, 21 Sep 2016 15:23:12 +0800 Message-Id: <1474442592-84980-3-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1474442592-84980-1-git-send-email-jiaxin.wu@intel.com> References: <1474442592-84980-1-git-send-email-jiaxin.wu@intel.com> Subject: [Patch 2/2] NetworkPkg: Clean the previous address since the policy changed X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2016 07:23:33 -0000 The previous DNS server data will be retained after the policy changes from Auto to Manual. This patch is used to clean the previous dhcp configuration data. Cc: Hegde Nagaraj P Cc: Subramanian Sriram Cc: Ye Ting Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu --- NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c | 59 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c index 54522f9..75ecec1 100644 --- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c +++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c @@ -663,40 +663,39 @@ Ip6ConfigSetPolicy ( if (NewPolicy == Instance->Policy) { 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. // if (Instance->Dhcp6Handle != NULL) { -- 1.9.5.msysgit.1