mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/Ip4Dxe: Trigger Ip4Config2 to retrieve the default address.
According the UEFI spec 2.7 A: In section 28.3.2 for the IpConfigData.UseDefaultAddress, "While set to TRUE, Configure() will trigger the EFI_IP4_CONFIG2_PROTOCOL to retrieve the default IPv4 address if it is not available yet." In section 28.5 for the Ip4Config2PolicyDhcp, "...All of these configurations are retrieved from DHCP server or other auto-configuration mechanism." This patch is to align with the above description. When the default IPv4 address is not available and IpConfigData.UseDefaultAddress is set to TRUE, Ip4Config2 protocol will be called to retrieve the default address by setting the policy to Ip4Config2PolicyDhcp. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
This commit is contained in:
parent
4c19e1d2e1
commit
ad1484c3c4
|
@ -596,9 +596,13 @@ Ip4ConfigProtocol (
|
||||||
IP4_ADDR Ip;
|
IP4_ADDR Ip;
|
||||||
IP4_ADDR Netmask;
|
IP4_ADDR Netmask;
|
||||||
EFI_ARP_PROTOCOL *Arp;
|
EFI_ARP_PROTOCOL *Arp;
|
||||||
|
EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
|
||||||
|
EFI_IP4_CONFIG2_POLICY Policy;
|
||||||
|
|
||||||
IpSb = IpInstance->Service;
|
IpSb = IpInstance->Service;
|
||||||
|
|
||||||
|
Ip4Config2 = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// User is changing packet filters. It must be stopped
|
// User is changing packet filters. It must be stopped
|
||||||
// before the station address can be changed.
|
// before the station address can be changed.
|
||||||
|
@ -677,12 +681,25 @@ Ip4ConfigProtocol (
|
||||||
// Use the default address. Check the state.
|
// Use the default address. Check the state.
|
||||||
//
|
//
|
||||||
if (IpSb->State == IP4_SERVICE_UNSTARTED) {
|
if (IpSb->State == IP4_SERVICE_UNSTARTED) {
|
||||||
Status = Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);
|
//
|
||||||
|
// Trigger the EFI_IP4_CONFIG2_PROTOCOL to retrieve the
|
||||||
|
// default IPv4 address if it is not available yet.
|
||||||
|
//
|
||||||
|
Policy = IpSb->Ip4Config2Instance.Policy;
|
||||||
|
if (Policy != Ip4Config2PolicyDhcp) {
|
||||||
|
Ip4Config2 = &IpSb->Ip4Config2Instance.Ip4Config2;
|
||||||
|
Policy = Ip4Config2PolicyDhcp;
|
||||||
|
Status= Ip4Config2->SetData (
|
||||||
|
Ip4Config2,
|
||||||
|
Ip4Config2DataTypePolicy,
|
||||||
|
sizeof (EFI_IP4_CONFIG2_POLICY),
|
||||||
|
&Policy
|
||||||
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IpIf = IpSb->DefaultInterface;
|
IpIf = IpSb->DefaultInterface;
|
||||||
NET_GET_REF (IpSb->DefaultInterface);
|
NET_GET_REF (IpSb->DefaultInterface);
|
||||||
|
|
Loading…
Reference in New Issue