Skip to content

Commit

Permalink
NetworkPkg/Ip4Dxe: Fix Reset To Default
Browse files Browse the repository at this point in the history
Exercising reset to default does not reset the settings.
Add handler code for the case where configuration is
disabled.

Signed-off-by: Ashish Singhal <[email protected]>
Reviewed-by: Saloni Kasbekar <[email protected]>
Acked-by: Michael D Kinney <[email protected]>
  • Loading branch information
ashishsingha authored and mergify[bot] committed Jan 19, 2024
1 parent 264636d commit 9d3fe85
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 9d3fe85

Please sign in to comment.