summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2016-09-21 15:13:37 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2016-09-26 21:25:23 +0800
commit00df35fe4146b6ceb39bf55df1fabec955cd08a6 (patch)
tree07d96510a4ef7affcdde6da05cb48b40529f4b3a
parent24b41b75f883a948f6844e455b9de020e23c72d4 (diff)
downloadedk2-00df35fe4146b6ceb39bf55df1fabec955cd08a6.zip
edk2-00df35fe4146b6ceb39bf55df1fabec955cd08a6.tar.gz
edk2-00df35fe4146b6ceb39bf55df1fabec955cd08a6.tar.bz2
NetworkPkg: Clean the previous address since the policy changed
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> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Tested-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
-rw-r--r--NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c59
1 files 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
@@ -665,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.