ShellPkg: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
The implementation for Shell command ifconfig based on IP4Config2 protocol.
|
||||
|
||||
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
|
||||
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
@ -45,7 +45,7 @@ typedef struct _IFCONFIG_INTERFACE_CB {
|
||||
EFI_HANDLE NicHandle;
|
||||
LIST_ENTRY Link;
|
||||
EFI_IP4_CONFIG2_PROTOCOL *IfCfg;
|
||||
EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
|
||||
EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
|
||||
EFI_IP4_CONFIG2_POLICY Policy;
|
||||
UINT32 DnsCnt;
|
||||
EFI_IPv4_ADDRESS DnsAddr[1];
|
||||
@ -399,7 +399,7 @@ IfConfigGetInterfaceInfo (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Get the interface information size.
|
||||
//
|
||||
@ -420,7 +420,7 @@ IfConfigGetInterfaceInfo (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Get the interface info.
|
||||
//
|
||||
@ -434,7 +434,7 @@ IfConfigGetInterfaceInfo (
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Check the interface name if required.
|
||||
//
|
||||
@ -444,7 +444,7 @@ IfConfigGetInterfaceInfo (
|
||||
}
|
||||
|
||||
DataSize = 0;
|
||||
|
||||
|
||||
//
|
||||
// Get the size of dns server list.
|
||||
//
|
||||
@ -553,7 +553,7 @@ IfConfigShowInterfaceInfo (
|
||||
EFI_STATUS MediaStatus;
|
||||
EFI_IPv4_ADDRESS Gateway;
|
||||
UINT32 Index;
|
||||
|
||||
|
||||
MediaStatus = EFI_SUCCESS;
|
||||
|
||||
if (IsListEmpty (IfList)) {
|
||||
@ -571,7 +571,7 @@ IfConfigShowInterfaceInfo (
|
||||
//
|
||||
// Print interface name.
|
||||
//
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_IF_NAME), gShellNetwork1HiiHandle, IfCb->IfInfo->Name);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_IF_NAME), gShellNetwork1HiiHandle, IfCb->IfInfo->Name);
|
||||
|
||||
//
|
||||
// Get Media State.
|
||||
@ -611,10 +611,10 @@ IfConfigShowInterfaceInfo (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_HEAD), gShellNetwork1HiiHandle);
|
||||
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_BODY),
|
||||
STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_BODY),
|
||||
gShellNetwork1HiiHandle,
|
||||
(UINTN)IfCb->IfInfo->StationAddress.Addr[0],
|
||||
(UINTN)IfCb->IfInfo->StationAddress.Addr[1],
|
||||
@ -628,10 +628,10 @@ IfConfigShowInterfaceInfo (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_SUBNET_MASK_HEAD), gShellNetwork1HiiHandle);
|
||||
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_BODY),
|
||||
STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_BODY),
|
||||
gShellNetwork1HiiHandle,
|
||||
(UINTN)IfCb->IfInfo->SubnetMask.Addr[0],
|
||||
(UINTN)IfCb->IfInfo->SubnetMask.Addr[1],
|
||||
@ -645,26 +645,26 @@ IfConfigShowInterfaceInfo (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_GATEWAY_HEAD), gShellNetwork1HiiHandle);
|
||||
|
||||
ZeroMem (&Gateway, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
|
||||
for (Index = 0; Index < IfCb->IfInfo->RouteTableSize; Index++) {
|
||||
if ((CompareMem (&IfCb->IfInfo->RouteTable[Index].SubnetAddress, &mZeroIp4Addr, sizeof (EFI_IPv4_ADDRESS)) == 0) &&
|
||||
(CompareMem (&IfCb->IfInfo->RouteTable[Index].SubnetMask , &mZeroIp4Addr, sizeof (EFI_IPv4_ADDRESS)) == 0) ){
|
||||
CopyMem (&Gateway, &IfCb->IfInfo->RouteTable[Index].GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_BODY),
|
||||
STRING_TOKEN (STR_IFCONFIG_INFO_IP_ADDR_BODY),
|
||||
gShellNetwork1HiiHandle,
|
||||
(UINTN)Gateway.Addr[0],
|
||||
(UINTN)Gateway.Addr[1],
|
||||
(UINTN)Gateway.Addr[2],
|
||||
(UINTN)Gateway.Addr[3]
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Print route table entry.
|
||||
//
|
||||
@ -674,11 +674,11 @@ IfConfigShowInterfaceInfo (
|
||||
ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_ROUTES_ENTRY_INDEX), gShellNetwork1HiiHandle, Index);
|
||||
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_IFCONFIG_SHOW_IP_ADDR),
|
||||
gShellNetwork1HiiHandle,
|
||||
STRING_TOKEN (STR_IFCONFIG_SHOW_IP_ADDR),
|
||||
gShellNetwork1HiiHandle,
|
||||
L"Subnet ",
|
||||
(UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[0],
|
||||
(UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[1],
|
||||
@ -687,11 +687,11 @@ IfConfigShowInterfaceInfo (
|
||||
);
|
||||
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_IFCONFIG_SHOW_IP_ADDR),
|
||||
gShellNetwork1HiiHandle,
|
||||
STRING_TOKEN (STR_IFCONFIG_SHOW_IP_ADDR),
|
||||
gShellNetwork1HiiHandle,
|
||||
L"Netmask",
|
||||
(UINTN)IfCb->IfInfo->RouteTable[Index].SubnetMask.Addr[0],
|
||||
(UINTN)IfCb->IfInfo->RouteTable[Index].SubnetMask.Addr[1],
|
||||
@ -700,11 +700,11 @@ IfConfigShowInterfaceInfo (
|
||||
);
|
||||
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_IFCONFIG_SHOW_IP_ADDR),
|
||||
gShellNetwork1HiiHandle,
|
||||
STRING_TOKEN (STR_IFCONFIG_SHOW_IP_ADDR),
|
||||
gShellNetwork1HiiHandle,
|
||||
L"Gateway",
|
||||
(UINTN)IfCb->IfInfo->RouteTable[Index].GatewayAddress.Addr[0],
|
||||
(UINTN)IfCb->IfInfo->RouteTable[Index].GatewayAddress.Addr[1],
|
||||
@ -720,10 +720,10 @@ IfConfigShowInterfaceInfo (
|
||||
|
||||
for (Index = 0; Index < IfCb->DnsCnt; Index++) {
|
||||
ShellPrintHiiEx(
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_IFCONFIG_INFO_DNS_ADDR_BODY),
|
||||
STRING_TOKEN (STR_IFCONFIG_INFO_DNS_ADDR_BODY),
|
||||
gShellNetwork1HiiHandle,
|
||||
(UINTN) IfCb->DnsAddr[Index].Addr[0],
|
||||
(UINTN) IfCb->DnsAddr[Index].Addr[1],
|
||||
@ -734,7 +734,7 @@ IfConfigShowInterfaceInfo (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_NEWLINE), gShellNetwork1HiiHandle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INFO_BREAK), gShellNetwork1HiiHandle);
|
||||
|
||||
return SHELL_SUCCESS;
|
||||
@ -756,13 +756,13 @@ IfConfigClearInterfaceInfo (
|
||||
IN CHAR16 *IfName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
SHELL_STATUS ShellStatus;
|
||||
LIST_ENTRY *Entry;
|
||||
LIST_ENTRY *Next;
|
||||
IFCONFIG_INTERFACE_CB *IfCb;
|
||||
EFI_IP4_CONFIG2_POLICY Policy;
|
||||
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
@ -772,7 +772,7 @@ IfConfigClearInterfaceInfo (
|
||||
|
||||
//
|
||||
// Go through the interface list.
|
||||
// If the interface name is specified, DHCP DORA process will be
|
||||
// If the interface name is specified, DHCP DORA process will be
|
||||
// triggered by the policy transition (static -> dhcp).
|
||||
//
|
||||
NET_LIST_FOR_EACH_SAFE (Entry, Next, IfList) {
|
||||
@ -780,7 +780,7 @@ IfConfigClearInterfaceInfo (
|
||||
|
||||
if ((IfName != NULL) && (StrCmp (IfName, IfCb->IfInfo->Name) == 0)) {
|
||||
Policy = Ip4Config2PolicyStatic;
|
||||
|
||||
|
||||
Status = IfCb->IfCfg->SetData (
|
||||
IfCb->IfCfg,
|
||||
Ip4Config2DataTypePolicy,
|
||||
@ -791,11 +791,11 @@ IfConfigClearInterfaceInfo (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig");
|
||||
ShellStatus = SHELL_ACCESS_DENIED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Policy = Ip4Config2PolicyDhcp;
|
||||
|
||||
|
||||
Status = IfCb->IfCfg->SetData (
|
||||
IfCb->IfCfg,
|
||||
Ip4Config2DataTypePolicy,
|
||||
@ -854,7 +854,7 @@ IfConfigSetInterfaceInfo (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle);
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Make sure to set only one interface each time.
|
||||
//
|
||||
@ -944,7 +944,7 @@ IfConfigSetInterfaceInfo (
|
||||
}
|
||||
|
||||
VarArg = VarArg->Next;
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
@ -966,8 +966,8 @@ IfConfigSetInterfaceInfo (
|
||||
ShellStatus = SHELL_ACCESS_DENIED;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
VarArg= VarArg->Next;
|
||||
|
||||
VarArg= VarArg->Next;
|
||||
|
||||
} else if (StrCmp (VarArg->Arg, L"static") == 0) {
|
||||
VarArg= VarArg->Next;
|
||||
@ -978,7 +978,7 @@ IfConfigSetInterfaceInfo (
|
||||
}
|
||||
|
||||
ZeroMem (&ManualAddress, sizeof (ManualAddress));
|
||||
|
||||
|
||||
//
|
||||
// Get manual IP address.
|
||||
//
|
||||
@ -991,14 +991,14 @@ IfConfigSetInterfaceInfo (
|
||||
|
||||
//
|
||||
// Get subnetmask.
|
||||
//
|
||||
//
|
||||
VarArg = VarArg->Next;
|
||||
if (VarArg == NULL) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_LACK_COMMAND), gShellNetwork1HiiHandle);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
Status = NetLibStrToIp4 (VarArg->Arg, &ManualAddress.SubnetMask);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg);
|
||||
@ -1015,7 +1015,7 @@ IfConfigSetInterfaceInfo (
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
Status = NetLibStrToIp4 (VarArg->Arg, &Gateway);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INVALID_IPADDRESS), gShellNetwork1HiiHandle, VarArg->Arg);
|
||||
@ -1053,7 +1053,7 @@ IfConfigSetInterfaceInfo (
|
||||
ShellStatus = SHELL_ACCESS_DENIED;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Set Manual Address.
|
||||
//
|
||||
@ -1095,7 +1095,7 @@ IfConfigSetInterfaceInfo (
|
||||
Ip4Config2DataTypeManualAddress,
|
||||
MappedEvt
|
||||
);
|
||||
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG_SET_ADDR_FAILED), gShellNetwork1HiiHandle, Status);
|
||||
ShellStatus = SHELL_ACCESS_DENIED;
|
||||
@ -1118,9 +1118,9 @@ IfConfigSetInterfaceInfo (
|
||||
ShellStatus = SHELL_ACCESS_DENIED;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
VarArg = VarArg->Next;
|
||||
|
||||
|
||||
} else if (StrCmp (VarArg->Arg, L"dns") == 0) {
|
||||
//
|
||||
// Get DNS addresses.
|
||||
@ -1151,7 +1151,7 @@ IfConfigSetInterfaceInfo (
|
||||
Index ++;
|
||||
Tmp = Tmp->Next;
|
||||
}
|
||||
|
||||
|
||||
VarArg = Tmp;
|
||||
|
||||
//
|
||||
@ -1177,7 +1177,7 @@ ON_EXIT:
|
||||
if (Dns != NULL) {
|
||||
FreePool (Dns);
|
||||
}
|
||||
|
||||
|
||||
return ShellStatus;
|
||||
|
||||
}
|
||||
@ -1209,7 +1209,7 @@ IfConfig (
|
||||
&Private->IfList
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
@ -1289,7 +1289,7 @@ IfConfigCleanup (
|
||||
|
||||
@retval EFI_SUCCESS ifconfig command processed successfully.
|
||||
@retval others The ifconfig command process failed.
|
||||
|
||||
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
@ -1306,7 +1306,7 @@ ShellCommandRunIfconfig (
|
||||
ARG_LIST *ArgList;
|
||||
CHAR16 *ProblemParam;
|
||||
CHAR16 *Str;
|
||||
|
||||
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
Private = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
@ -1320,7 +1320,7 @@ ShellCommandRunIfconfig (
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
|
||||
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
@ -1395,7 +1395,7 @@ ShellCommandRunIfconfig (
|
||||
Private->IfName = Str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// To get interface name and corresponding Args for the set option.
|
||||
//
|
||||
@ -1406,7 +1406,7 @@ ShellCommandRunIfconfig (
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// To split the configuration into multi-section.
|
||||
//
|
||||
@ -1428,7 +1428,7 @@ ShellCommandRunIfconfig (
|
||||
goto ON_EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Main process of ifconfig.
|
||||
//
|
||||
@ -1437,7 +1437,7 @@ ShellCommandRunIfconfig (
|
||||
ON_EXIT:
|
||||
|
||||
ShellCommandLineFreeVarList (ParamPackage);
|
||||
|
||||
|
||||
if (Private != NULL) {
|
||||
IfConfigCleanup (Private);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
The implementation for Ping shell command.
|
||||
|
||||
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
||||
Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
@ -24,25 +24,25 @@ UINT64 mCurrentTick = 0;
|
||||
//
|
||||
// Function templates to match the IPv4 and IPv6 commands that we use.
|
||||
//
|
||||
typedef
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *PING_IPX_POLL)(
|
||||
IN VOID *This
|
||||
);
|
||||
);
|
||||
|
||||
typedef
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *PING_IPX_TRANSMIT)(
|
||||
IN VOID *This,
|
||||
IN VOID *Token
|
||||
);
|
||||
|
||||
typedef
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *PING_IPX_RECEIVE)(
|
||||
IN VOID *This,
|
||||
IN VOID *Token
|
||||
);
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
@ -52,7 +52,7 @@ EFI_STATUS
|
||||
);
|
||||
|
||||
///
|
||||
/// A set of pointers to either IPv6 or IPv4 functions.
|
||||
/// A set of pointers to either IPv6 or IPv4 functions.
|
||||
/// Unknown which one to the ping command.
|
||||
///
|
||||
typedef struct {
|
||||
@ -70,7 +70,7 @@ typedef union {
|
||||
|
||||
//
|
||||
// PING_IPX_COMPLETION_TOKEN
|
||||
// structures are used for both transmit and receive operations.
|
||||
// structures are used for both transmit and receive operations.
|
||||
// This version is IP-unaware.
|
||||
//
|
||||
typedef struct {
|
||||
@ -119,7 +119,7 @@ typedef struct _PING_PRIVATE_DATA {
|
||||
EFI_EVENT Timer;
|
||||
|
||||
UINT32 TimerPeriod;
|
||||
UINT32 RttTimerTick;
|
||||
UINT32 RttTimerTick;
|
||||
EFI_EVENT RttTimer;
|
||||
|
||||
EFI_STATUS Status;
|
||||
@ -149,7 +149,7 @@ typedef struct _PING_PRIVATE_DATA {
|
||||
@param[in] Packet Buffer which contains the data to be checksummed.
|
||||
@param[in] Length Length to be checksummed.
|
||||
|
||||
@retval Checksum Returns the 16 bit ones complement of
|
||||
@retval Checksum Returns the 16 bit ones complement of
|
||||
ones complement sum of 16 bit words
|
||||
**/
|
||||
UINT16
|
||||
@ -325,7 +325,7 @@ PingInitRttTimer (
|
||||
if (Private->TimerPeriod == 0) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
|
||||
Private->RttTimerTick = 0;
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
||||
@ -370,7 +370,7 @@ PingFreeRttTimer (
|
||||
|
||||
/**
|
||||
Read the current time.
|
||||
|
||||
|
||||
@param[in] Private The pointer to PING_PRIVATE_DATA.
|
||||
|
||||
@retval the current tick value.
|
||||
@ -563,7 +563,7 @@ Ping6OnEchoReplyReceived (
|
||||
if (((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->NextHeader != IP6_ICMP) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
if (!IP6_IS_MULTICAST ((EFI_IPv6_ADDRESS*)&Private->DstAddress) &&
|
||||
if (!IP6_IS_MULTICAST ((EFI_IPv6_ADDRESS*)&Private->DstAddress) &&
|
||||
!EFI_IP6_EQUAL (&((EFI_IP6_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->SourceAddress, (EFI_IPv6_ADDRESS*)&Private->DstAddress)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
@ -574,7 +574,7 @@ Ping6OnEchoReplyReceived (
|
||||
} else {
|
||||
Reply = ((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->FragmentTable[0].FragmentBuffer;
|
||||
PayLoad = ((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->DataLength;
|
||||
if (!IP4_IS_MULTICAST (EFI_IP4(*(EFI_IPv4_ADDRESS*)Private->DstAddress)) &&
|
||||
if (!IP4_IS_MULTICAST (EFI_IP4(*(EFI_IPv4_ADDRESS*)Private->DstAddress)) &&
|
||||
!EFI_IP4_EQUAL (&((EFI_IP4_RECEIVE_DATA*)Private->RxToken.Packet.RxData)->Header->SourceAddress, (EFI_IPv4_ADDRESS*)&Private->DstAddress)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
@ -583,7 +583,7 @@ Ping6OnEchoReplyReceived (
|
||||
goto ON_EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (PayLoad != Private->BufferSize) {
|
||||
goto ON_EXIT;
|
||||
@ -689,7 +689,7 @@ PingGenerateToken (
|
||||
//
|
||||
Request->Type = (UINT8)(Private->IpChoice==PING_IP_CHOICE_IP6?ICMP_V6_ECHO_REQUEST:ICMP_V4_ECHO_REQUEST);
|
||||
Request->Code = 0;
|
||||
Request->SequenceNum = SequenceNum;
|
||||
Request->SequenceNum = SequenceNum;
|
||||
Request->Identifier = 0;
|
||||
Request->Checksum = 0;
|
||||
|
||||
@ -1003,11 +1003,11 @@ PingCreateIpInstance (
|
||||
if (Private->IpChoice == PING_IP_CHOICE_IP6 ? NetIp6IsUnspecifiedAddr ((EFI_IPv6_ADDRESS*)&Private->SrcAddress) : \
|
||||
PingNetIp4IsUnspecifiedAddr ((EFI_IPv4_ADDRESS*)&Private->SrcAddress)) {
|
||||
//
|
||||
// SrcAddress is unspecified. So, both connected and configured interface will be automatic selected.
|
||||
// SrcAddress is unspecified. So, both connected and configured interface will be automatic selected.
|
||||
//
|
||||
UnspecifiedSrc = TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Source address is required when pinging a link-local address.
|
||||
//
|
||||
@ -1020,12 +1020,12 @@ PingCreateIpInstance (
|
||||
} else {
|
||||
ASSERT(Private->IpChoice == PING_IP_CHOICE_IP4);
|
||||
if (PingNetIp4IsLinkLocalAddr ((EFI_IPv4_ADDRESS*)&Private->DstAddress) && UnspecifiedSrc) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_INVALID_SOURCE), gShellNetwork1HiiHandle);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_INVALID_SOURCE), gShellNetwork1HiiHandle);
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto ON_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// For each ip6 protocol, check interface addresses list.
|
||||
//
|
||||
@ -1087,7 +1087,7 @@ PingCreateIpInstance (
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Skip the ones not in current use.
|
||||
//
|
||||
@ -1160,7 +1160,7 @@ PingCreateIpInstance (
|
||||
}
|
||||
} else {
|
||||
if (UnspecifiedSrc) {
|
||||
if (!PingNetIp4IsUnspecifiedAddr (&((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress) &&
|
||||
if (!PingNetIp4IsUnspecifiedAddr (&((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress) &&
|
||||
!PingNetIp4IsLinkLocalAddr (&((EFI_IP4_CONFIG2_INTERFACE_INFO*)IpXInterfaceInfo)->StationAddress)) {
|
||||
//
|
||||
// Select the interface automatically.
|
||||
@ -1183,7 +1183,7 @@ PingCreateIpInstance (
|
||||
//
|
||||
|
||||
if (HandleIndex == HandleNum) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_CONFIGD_NIC_NF), gShellNetwork1HiiHandle, L"ping");
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_CONFIGD_NIC_NF), gShellNetwork1HiiHandle, L"ping");
|
||||
Status = EFI_NOT_FOUND;
|
||||
goto ON_ERROR;
|
||||
}
|
||||
@ -1281,7 +1281,7 @@ PingCreateIpInstance (
|
||||
Private->ProtocolPointers.Transmit = (PING_IPX_TRANSMIT )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Transmit;
|
||||
Private->ProtocolPointers.Receive = (PING_IPX_RECEIVE )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Receive;
|
||||
Private->ProtocolPointers.Cancel = (PING_IPX_CANCEL )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Cancel;
|
||||
Private->ProtocolPointers.Poll = (PING_IPX_POLL )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Poll;
|
||||
Private->ProtocolPointers.Poll = (PING_IPX_POLL )((EFI_IP4_PROTOCOL*)Private->IpProtocol)->Poll;
|
||||
}
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
@ -1432,7 +1432,7 @@ ShellPing (
|
||||
ShellStatus = SHELL_ACCESS_DENIED;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Create a ipv6 token to send the first icmp6 echo request packet.
|
||||
//
|
||||
@ -1447,7 +1447,7 @@ ShellPing (
|
||||
} else if (Status == RETURN_NO_MAPPING) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NOROUTE_FOUND), gShellNetwork1HiiHandle, mDstString, mSrcString);
|
||||
} else {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NETWORK_ERROR), gShellNetwork1HiiHandle, L"ping", Status);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NETWORK_ERROR), gShellNetwork1HiiHandle, L"ping", Status);
|
||||
}
|
||||
|
||||
goto ON_EXIT;
|
||||
@ -1562,7 +1562,7 @@ ON_EXIT:
|
||||
|
||||
@retval SHELL_SUCCESS The ping processed successfullly.
|
||||
@retval others The ping processed unsuccessfully.
|
||||
|
||||
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
@ -1584,7 +1584,7 @@ ShellCommandRunPing (
|
||||
CHAR16 *ProblemParam;
|
||||
|
||||
//
|
||||
// we use IPv6 buffers to hold items...
|
||||
// we use IPv6 buffers to hold items...
|
||||
// make sure this is enough space!
|
||||
//
|
||||
ASSERT(sizeof(EFI_IPv4_ADDRESS ) <= sizeof(EFI_IPv6_ADDRESS ));
|
||||
@ -1617,7 +1617,7 @@ ShellCommandRunPing (
|
||||
// ShellStrToUintn will return 0 when input is 0 or an invalid input string.
|
||||
//
|
||||
if ((SendNumber == 0) || (SendNumber > MAX_SEND_NUMBER)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
@ -1635,7 +1635,7 @@ ShellCommandRunPing (
|
||||
// ShellStrToUintn will return 0 when input is 0 or an invalid input string.
|
||||
//
|
||||
if ((BufferSize < 16) || (BufferSize > MAX_BUFFER_SIZE)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
@ -1653,7 +1653,7 @@ ShellCommandRunPing (
|
||||
if (ValueStr == NULL) {
|
||||
ValueStr = ShellCommandLineGetValue (ParamPackage, L"-_s");
|
||||
}
|
||||
|
||||
|
||||
if (ValueStr != NULL) {
|
||||
mSrcString = ValueStr;
|
||||
if (IpChoice == PING_IP_CHOICE_IP6) {
|
||||
@ -1662,7 +1662,7 @@ ShellCommandRunPing (
|
||||
Status = NetLibStrToIp4 (ValueStr, (EFI_IPv4_ADDRESS*)&SrcAddress);
|
||||
}
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
@ -1672,12 +1672,12 @@ ShellCommandRunPing (
|
||||
//
|
||||
NonOptionCount = ShellCommandLineGetCount(ParamPackage);
|
||||
if (NonOptionCount < 2) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellNetwork1HiiHandle, L"ping");
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellNetwork1HiiHandle, L"ping");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
if (NonOptionCount > 2) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellNetwork1HiiHandle, L"ping");
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellNetwork1HiiHandle, L"ping");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
@ -1690,7 +1690,7 @@ ShellCommandRunPing (
|
||||
Status = NetLibStrToIp4 (ValueStr, (EFI_IPv4_ADDRESS*)&DstAddress);
|
||||
}
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Provides shell network1 functions
|
||||
#
|
||||
# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved. <BR>
|
||||
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@ -63,6 +63,6 @@
|
||||
gEfiIp4ProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiIp4ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiIp4Config2ProtocolGuid ## SOMETIMES_CONSUMES
|
||||
|
||||
|
||||
[Guids]
|
||||
gShellNetwork1HiiGuid ## SOMETIMES_CONSUMES ## HII
|
||||
gShellNetwork1HiiGuid ## SOMETIMES_CONSUMES ## HII
|
||||
|
@ -1,7 +1,7 @@
|
||||
// /**
|
||||
//
|
||||
// (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
|
||||
// Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved. <BR>
|
||||
// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
|
||||
// (C) Copyright 2017 Hewlett Packard Enterprise Development LP<BR>
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
@ -73,7 +73,7 @@
|
||||
#string STR_IFCONFIG_CONFLICT_COMMAND #language en-US "Conflict commands. Bad command %H%s%N is skipped.\n"
|
||||
#string STR_IFCONFIG_UNKNOWN_COMMAND #language en-US "Unknown commands. Bad command %H%s%N is skipped.\n"
|
||||
#string STR_IFCONFIG_SET_ADDR_FAILED #language en-US "Failed to set address.\n"
|
||||
#string STR_IFCONFIG_ROUTES_SIZE #language en-US "\n%H Routes (%d entries):\n"
|
||||
#string STR_IFCONFIG_ROUTES_SIZE #language en-US "\n%H Routes (%d entries):\n"
|
||||
#string STR_IFCONFIG_ROUTES_ENTRY_INDEX #language en-US "%H Entry[%d]\n"
|
||||
#string STR_IFCONFIG_SHOW_IP_ADDR #language en-US "%12s: %N%d.%d.%d.%d\n"
|
||||
#string STR_IFCONFIG_INFO_NEWLINE #language en-US "\n"
|
||||
@ -177,6 +177,6 @@
|
||||
" \r\n"
|
||||
" * To configure DNS server address for the eth0 interface:\r\n"
|
||||
" fs0:\> ifconfig -s eth0 dns 192.168.0.8 192.168.0.9\r\n"
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user