From 0b2a54e2af94504c4c450fa8efda92121e1eecb6 Mon Sep 17 00:00:00 2001 From: tye1 Date: Sat, 28 Apr 2012 09:43:31 +0000 Subject: Fixes issues with "Discard Changes and Exit" option in IPv6 driver's Advance Configuration menu. Signed-off-by: Ye Ting Reviewed-by: Qianouyang Reviewed-by: Fu, Siyuan git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13229 6f19259b-4bc3-4df7-8a09-765794883524 --- NetworkPkg/Ip6Dxe/Ip6ConfigNv.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'NetworkPkg/Ip6Dxe') diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c b/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c index db2155e14c..d4f25d0301 100644 --- a/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c +++ b/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c @@ -1,7 +1,7 @@ /** @file Helper functions for configuring or obtaining the parameters relating to IP6. - Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 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 @@ -928,11 +928,11 @@ Ip6ConvertConfigNvDataToIfrNvData ( IN IP6_CONFIG_INSTANCE *Instance ) { + IP6_CONFIG_NVDATA *Ip6NvData; EFI_IP6_CONFIG_PROTOCOL *Ip6Config; UINTN DataSize; VOID *Data; EFI_STATUS Status; - EFI_IP6_CONFIG_INTERFACE_ID InterfaceId; EFI_IP6_CONFIG_POLICY Policy; EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits; EFI_HII_HANDLE HiiHandle; @@ -944,6 +944,7 @@ Ip6ConvertConfigNvDataToIfrNvData ( NET_CHECK_SIGNATURE (Instance, IP6_CONFIG_INSTANCE_SIGNATURE); Ip6Config = &Instance->Ip6Config; + Ip6NvData = &Instance->Ip6NvData; Data = NULL; DataSize = 0; HiiHandle = Instance->CallbackInfo.RegisteredHandle; @@ -977,18 +978,18 @@ Ip6ConvertConfigNvDataToIfrNvData ( // Get the interface id. // DataSize = sizeof (EFI_IP6_CONFIG_INTERFACE_ID); - ZeroMem (&InterfaceId, DataSize); + ZeroMem (&Ip6NvData->InterfaceId, DataSize); Status = Ip6Config->GetData ( Ip6Config, Ip6ConfigDataTypeAltInterfaceId, &DataSize, - &InterfaceId + &Ip6NvData->InterfaceId ); if (EFI_ERROR (Status)) { goto Exit; } - Ip6ConvertInterfaceIdToString (IfrNvData->InterfaceId, &InterfaceId); + Ip6ConvertInterfaceIdToString (IfrNvData->InterfaceId, &Ip6NvData->InterfaceId); // // Get current policy. @@ -1627,7 +1628,6 @@ Ip6FormCallback ( IP6_FORM_CALLBACK_INFO *Private; UINTN BufferSize; IP6_CONFIG_IFR_NVDATA *IfrNvData; - IP6_CONFIG_IFR_NVDATA OldIfrNvData; EFI_STATUS Status; EFI_INPUT_KEY Key; IP6_CONFIG_INSTANCE *Instance; @@ -1671,12 +1671,8 @@ Ip6FormCallback ( Status = EFI_SUCCESS; - ZeroMem (&OldIfrNvData, BufferSize); - HiiGetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData); - CopyMem (&OldIfrNvData, IfrNvData, BufferSize); - if (Action == EFI_BROWSER_ACTION_CHANGING) { switch (QuestionId) { case KEY_GET_CURRENT_SETTING: @@ -1817,12 +1813,18 @@ Ip6FormCallback ( } else if (Action == EFI_BROWSER_ACTION_CHANGED) { switch (QuestionId) { case KEY_SAVE_CONFIG_CHANGES: - CopyMem (&OldIfrNvData, IfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA)); *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; break; case KEY_IGNORE_CONFIG_CHANGES: - CopyMem (IfrNvData, &OldIfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA)); + Ip6FreeAddressInfoList (&Ip6NvData->ManualAddress); + Ip6FreeAddressInfoList (&Ip6NvData->GatewayAddress); + Ip6FreeAddressInfoList (&Ip6NvData->DnsAddress); + + Ip6NvData->ManualAddressCount = 0; + Ip6NvData->GatewayAddressCount = 0; + Ip6NvData->DnsAddressCount = 0; + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT; break; -- cgit v1.2.3