public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiaxin Wu <jiaxin.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>,
	Subramanian Sriram <sriram-s@hpe.com>,
	Ye Ting <ting.ye@intel.com>
Subject: [Patch 2/2] NetworkPkg: Clean the previous address since the policy changed
Date: Wed, 21 Sep 2016 15:23:12 +0800	[thread overview]
Message-ID: <1474442592-84980-3-git-send-email-jiaxin.wu@intel.com> (raw)
In-Reply-To: <1474442592-84980-1-git-send-email-jiaxin.wu@intel.com>

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 <nagaraj-p.hegde@hpe.com>
Cc: Subramanian Sriram <sriram-s@hpe.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
---
 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



  parent reply	other threads:[~2016-09-21  7:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21  7:23 [Patch 0/2] Clean the previous address since the policy changed Jiaxin Wu
2016-09-21  7:23 ` [Patch 1/2] MdeModulePkg: " Jiaxin Wu
2016-09-21  7:23 ` Jiaxin Wu [this message]
2016-09-21  9:59 ` [Patch 0/2] " Hegde, Nagaraj P
2016-09-21 10:29 ` Subramanian, Sriram (EG Servers Platform SW)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474442592-84980-3-git-send-email-jiaxin.wu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox