Fix one issue: Some last IP settings may be lost when IP setting was re-set.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10720 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2010-07-30 07:49:21 +00:00
parent 6401e5ff13
commit 4ad858e0f3
1 changed files with 8 additions and 0 deletions

View File

@ -154,18 +154,26 @@ Ip4ConfigConvertDeviceConfigDataToIfrNvData (
NicConfig = EfiNicIp4ConfigGetInfo (Ip4ConfigInstance);
if (NicConfig != NULL) {
IfrFormNvData->Configure = 1;
Ip4ConfigInstance->Ip4ConfigCallbackInfo.Configured = TRUE;
if (NicConfig->Source == IP4_CONFIG_SOURCE_DHCP) {
IfrFormNvData->DhcpEnable = 1;
Ip4ConfigInstance->Ip4ConfigCallbackInfo.DhcpEnabled = TRUE;
} else {
IfrFormNvData->DhcpEnable = 0;
Ip4ConfigIpToStr (&NicConfig->Ip4Info.StationAddress, IfrFormNvData->StationAddress);
Ip4ConfigIpToStr (&NicConfig->Ip4Info.SubnetMask, IfrFormNvData->SubnetMask);
Ip4ConfigIpToStr (&NicConfig->Ip4Info.RouteTable[1].GatewayAddress, IfrFormNvData->GatewayAddress);
Ip4ConfigInstance->Ip4ConfigCallbackInfo.DhcpEnabled = FALSE;
CopyMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo.LocalIp, &NicConfig->Ip4Info.StationAddress, sizeof (EFI_IPv4_ADDRESS));
CopyMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo.SubnetMask, &NicConfig->Ip4Info.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
CopyMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo.Gateway, &NicConfig->Ip4Info.RouteTable[1].GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
}
FreePool (NicConfig);
} else {
IfrFormNvData->Configure = 0;
Ip4ConfigInstance->Ip4ConfigCallbackInfo.Configured = FALSE;
}
}