summaryrefslogtreecommitdiffstats
path: root/NetworkPkg
diff options
context:
space:
mode:
authorAshish Singhal <ashishsingha@nvidia.com>2023-12-14 13:17:02 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-01-19 03:30:22 +0000
commit9d3fe85fcc8ff386ee0814a4dad03bbf7dc54594 (patch)
tree8ec808c1c5b9c97218965366a9b38e658301ca4c /NetworkPkg
parent264636d8e6983e0f6dc6be2fca9d84ec81315954 (diff)
downloadedk2-9d3fe85fcc8ff386ee0814a4dad03bbf7dc54594.tar.gz
edk2-9d3fe85fcc8ff386ee0814a4dad03bbf7dc54594.tar.bz2
edk2-9d3fe85fcc8ff386ee0814a4dad03bbf7dc54594.zip
NetworkPkg/Ip4Dxe: Fix Reset To Default
Exercising reset to default does not reset the settings. Add handler code for the case where configuration is disabled. Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com> Reviewed-by: Saloni Kasbekar <saloni.kasbekar@intel.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r--NetworkPkg/Ip4Dxe/Ip4Config2Nv.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c b/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
index e0b6a4d4a9..dac5817b7c 100644
--- a/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
+++ b/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
@@ -586,6 +586,31 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
}
if (IfrFormNvData->Configure != TRUE) {
+ if (Ip4NvData->DnsAddress != NULL) {
+ FreePool (Ip4NvData->DnsAddress);
+ Ip4NvData->DnsAddress = NULL;
+ Ip4NvData->DnsAddressCount = 0;
+ }
+
+ if (Ip4NvData->GatewayAddress != NULL) {
+ FreePool (Ip4NvData->GatewayAddress);
+ Ip4NvData->GatewayAddress = NULL;
+ Ip4NvData->GatewayAddressCount = 0;
+ }
+
+ if (Ip4NvData->ManualAddress != NULL) {
+ FreePool (Ip4NvData->ManualAddress);
+ Ip4NvData->ManualAddress = NULL;
+ Ip4NvData->ManualAddressCount = 0;
+ }
+
+ Ip4NvData->Policy = Ip4Config2PolicyDhcp;
+ Status = Ip4Cfg2->SetData (
+ Ip4Cfg2,
+ Ip4Config2DataTypePolicy,
+ sizeof (EFI_IP4_CONFIG2_POLICY),
+ &Ip4NvData->Policy
+ );
return EFI_SUCCESS;
}