mirror of https://github.com/acidanthera/audk.git
ShellPkg: Revert git 'd6cf1af9' fix
'd6cf1af9' is associated with '3d0a49ad' commit. So, this patch is used to respond the revert for '3d0a49ad' to adapt the Ipv4 config policy update. Cc: Subramanian Sriram <sriram-s@hpe.com> Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
This commit is contained in:
parent
e19ce3a277
commit
db54ae0845
|
@ -273,86 +273,6 @@ IfConfigManualAddressNotify (
|
||||||
*((BOOLEAN *) Context) = TRUE;
|
*((BOOLEAN *) Context) = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Create an IP child, use it to start the auto configuration, then destroy it.
|
|
||||||
|
|
||||||
@param[in] Controller The controller which has the service installed.
|
|
||||||
@param[in] Image The image handle used to open service.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The configuration is done.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
IfConfigStartIp4(
|
|
||||||
IN EFI_HANDLE Controller,
|
|
||||||
IN EFI_HANDLE Image
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_IP4_PROTOCOL *Ip4;
|
|
||||||
EFI_HANDLE Ip4Handle;
|
|
||||||
EFI_IP4_CONFIG_DATA Ip4ConfigData;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get the Ip4ServiceBinding Protocol
|
|
||||||
//
|
|
||||||
Ip4Handle = NULL;
|
|
||||||
Ip4 = NULL;
|
|
||||||
|
|
||||||
Status = NetLibCreateServiceChild (
|
|
||||||
Controller,
|
|
||||||
Image,
|
|
||||||
&gEfiIp4ServiceBindingProtocolGuid,
|
|
||||||
&Ip4Handle
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
Ip4Handle,
|
|
||||||
&gEfiIp4ProtocolGuid,
|
|
||||||
(VOID **) &Ip4,
|
|
||||||
Controller,
|
|
||||||
Image,
|
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
|
||||||
);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_EXIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ip4ConfigData.DefaultProtocol = EFI_IP_PROTO_ICMP;
|
|
||||||
Ip4ConfigData.AcceptAnyProtocol = FALSE;
|
|
||||||
Ip4ConfigData.AcceptIcmpErrors = FALSE;
|
|
||||||
Ip4ConfigData.AcceptBroadcast = FALSE;
|
|
||||||
Ip4ConfigData.AcceptPromiscuous = FALSE;
|
|
||||||
Ip4ConfigData.UseDefaultAddress = TRUE;
|
|
||||||
ZeroMem (&Ip4ConfigData.StationAddress, sizeof (EFI_IPv4_ADDRESS));
|
|
||||||
ZeroMem (&Ip4ConfigData.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
|
||||||
Ip4ConfigData.TypeOfService = 0;
|
|
||||||
Ip4ConfigData.TimeToLive = 1;
|
|
||||||
Ip4ConfigData.DoNotFragment = FALSE;
|
|
||||||
Ip4ConfigData.RawData = FALSE;
|
|
||||||
Ip4ConfigData.ReceiveTimeout = 0;
|
|
||||||
Ip4ConfigData.TransmitTimeout = 0;
|
|
||||||
|
|
||||||
Ip4->Configure (Ip4, &Ip4ConfigData);
|
|
||||||
|
|
||||||
ON_EXIT:
|
|
||||||
NetLibDestroyServiceChild (
|
|
||||||
Controller,
|
|
||||||
Image,
|
|
||||||
&gEfiIp4ServiceBindingProtocolGuid,
|
|
||||||
Ip4Handle
|
|
||||||
);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Print MAC address.
|
Print MAC address.
|
||||||
|
|
||||||
|
@ -974,29 +894,20 @@ IfConfigSetInterfaceInfo (
|
||||||
// Process valid variables.
|
// Process valid variables.
|
||||||
//
|
//
|
||||||
if (StrCmp(VarArg->Arg, L"dhcp") == 0) {
|
if (StrCmp(VarArg->Arg, L"dhcp") == 0) {
|
||||||
if (IfCb->Policy == Ip4Config2PolicyDhcp) {
|
//
|
||||||
Status = IfConfigStartIp4 (IfCb->NicHandle, gImageHandle);
|
// Set dhcp config policy
|
||||||
if (EFI_ERROR(Status)) {
|
//
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig");
|
Policy = Ip4Config2PolicyDhcp;
|
||||||
ShellStatus = SHELL_ACCESS_DENIED;
|
Status = IfCb->IfCfg->SetData (
|
||||||
goto ON_EXIT;
|
IfCb->IfCfg,
|
||||||
}
|
Ip4Config2DataTypePolicy,
|
||||||
} else {
|
sizeof (EFI_IP4_CONFIG2_POLICY),
|
||||||
//
|
&Policy
|
||||||
// Set dhcp config policy
|
);
|
||||||
//
|
if (EFI_ERROR(Status)) {
|
||||||
Policy = Ip4Config2PolicyDhcp;
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig");
|
||||||
Status = IfCb->IfCfg->SetData (
|
ShellStatus = SHELL_ACCESS_DENIED;
|
||||||
IfCb->IfCfg,
|
goto ON_EXIT;
|
||||||
Ip4Config2DataTypePolicy,
|
|
||||||
sizeof (EFI_IP4_CONFIG2_POLICY),
|
|
||||||
&Policy
|
|
||||||
);
|
|
||||||
if (EFI_ERROR(Status)) {
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig");
|
|
||||||
ShellStatus = SHELL_ACCESS_DENIED;
|
|
||||||
goto ON_EXIT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VarArg= VarArg->Next;
|
VarArg= VarArg->Next;
|
||||||
|
|
Loading…
Reference in New Issue