Skip to content

Commit f83a25a

Browse files
ashishsinghajgarver
authored andcommitted
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 <[email protected]> Reviewed-by: Saloni Kasbekar <[email protected]> Acked-by: Michael D Kinney <[email protected]>
1 parent 53ded68 commit f83a25a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

NetworkPkg/Ip4Dxe/Ip4Config2Nv.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,31 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
586586
}
587587

588588
if (IfrFormNvData->Configure != TRUE) {
589+
if (Ip4NvData->DnsAddress != NULL) {
590+
FreePool (Ip4NvData->DnsAddress);
591+
Ip4NvData->DnsAddress = NULL;
592+
Ip4NvData->DnsAddressCount = 0;
593+
}
594+
595+
if (Ip4NvData->GatewayAddress != NULL) {
596+
FreePool (Ip4NvData->GatewayAddress);
597+
Ip4NvData->GatewayAddress = NULL;
598+
Ip4NvData->GatewayAddressCount = 0;
599+
}
600+
601+
if (Ip4NvData->ManualAddress != NULL) {
602+
FreePool (Ip4NvData->ManualAddress);
603+
Ip4NvData->ManualAddress = NULL;
604+
Ip4NvData->ManualAddressCount = 0;
605+
}
606+
607+
Ip4NvData->Policy = Ip4Config2PolicyDhcp;
608+
Status = Ip4Cfg2->SetData (
609+
Ip4Cfg2,
610+
Ip4Config2DataTypePolicy,
611+
sizeof (EFI_IP4_CONFIG2_POLICY),
612+
&Ip4NvData->Policy
613+
);
589614
return EFI_SUCCESS;
590615
}
591616

0 commit comments

Comments
 (0)