20 VarCheckReserved = -1,
36#define MACADDRMAXSIZE 32
67 VAR_CHECK_FLAG_TYPE FlagType;
124STATIC CONST CHAR16 PermanentString[10] = L
"PERMANENT";
138 while (List->Next !=
NULL) {
167 if (*String == L
'\0') {
185 if (ArgNode ==
NULL) {
194 while (*Str != L
'\0') {
195 if (*Str == Separator) {
197 ArgNode->Arg = ArgStr;
200 if (ArgNode->Next ==
NULL) {
209 ArgNode = ArgNode->Next;
215 ArgNode->Arg = ArgStr;
216 ArgNode->Next =
NULL;
241 STATIC UINT32 CheckDuplicate;
242 STATIC UINT32 CheckConflict;
243 VAR_CHECK_CODE RtCode;
255 Arg = CheckList[Index];
260 while (Arg.FlagStr !=
NULL) {
261 if (
StrCmp (Arg.FlagStr, Name) == 0) {
262 if (CheckDuplicate & Arg.FlagID) {
263 RtCode = VarCheckDuplicate;
267 if (CheckConflict & Arg.ConflictMask) {
268 RtCode = VarCheckConflict;
272 CheckDuplicate |= Arg.FlagID;
273 CheckConflict |= Arg.ConflictMask;
277 Arg = CheckList[++Index];
280 if (Arg.FlagStr ==
NULL) {
281 RtCode = VarCheckUnknown;
301 *((BOOLEAN *)Context) =
TRUE;
319 ASSERT (Size <= MACADDRMAXSIZE);
321 for (Index = 0; Index < Size; Index++) {
323 if (Index + 1 < Size) {
365 Status =
gBS->LocateHandleBuffer (
367 &gEfiIp4ServiceBindingProtocolGuid,
372 if (EFI_ERROR (Status) || (HandleNum == 0)) {
379 for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) {
388 ASSERT (HandleBuffer !=
NULL);
389 Status =
gBS->HandleProtocol (
390 HandleBuffer[HandleIndex],
391 &gEfiIp4Config2ProtocolGuid,
395 if (EFI_ERROR (Status)) {
402 Status = Ip4Cfg2->GetData (
409 if (Status != EFI_BUFFER_TOO_SMALL) {
415 if (IfInfo ==
NULL) {
416 Status = EFI_OUT_OF_RESOURCES;
423 Status = Ip4Cfg2->GetData (
430 if (EFI_ERROR (Status)) {
447 Status = Ip4Cfg2->GetData (
454 if ((Status != EFI_BUFFER_TOO_SMALL) && (Status != EFI_NOT_FOUND)) {
461 Status = EFI_OUT_OF_RESOURCES;
465 IfCb->NicHandle = HandleBuffer[HandleIndex];
466 IfCb->IfInfo = IfInfo;
467 IfCb->IfCfg = Ip4Cfg2;
474 Status = Ip4Cfg2->GetData (
481 if (EFI_ERROR (Status)) {
490 Status = Ip4Cfg2->GetData (
497 if (EFI_ERROR (Status)) {
513 if (HandleBuffer !=
NULL) {
521 if (IfInfo !=
NULL) {
562 NET_LIST_FOR_EACH_SAFE (Entry, Next, IfList) {
614 gShellNetwork1HiiHandle,
631 gShellNetwork1HiiHandle,
658 gShellNetwork1HiiHandle,
659 (
UINTN)Gateway.Addr[0],
660 (
UINTN)Gateway.Addr[1],
661 (
UINTN)Gateway.Addr[2],
662 (
UINTN)Gateway.Addr[3]
678 gShellNetwork1HiiHandle,
680 (
UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[0],
681 (
UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[1],
682 (
UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[2],
683 (
UINTN)IfCb->IfInfo->RouteTable[Index].SubnetAddress.Addr[3]
691 gShellNetwork1HiiHandle,
704 gShellNetwork1HiiHandle,
706 (
UINTN)IfCb->IfInfo->RouteTable[Index].GatewayAddress.Addr[0],
707 (
UINTN)IfCb->IfInfo->RouteTable[Index].GatewayAddress.Addr[1],
708 (
UINTN)IfCb->IfInfo->RouteTable[Index].GatewayAddress.Addr[2],
709 (
UINTN)IfCb->IfInfo->RouteTable[Index].GatewayAddress.Addr[3]
718 for (Index = 0; Index < IfCb->DnsCnt; Index++) {
724 gShellNetwork1HiiHandle,
725 (
UINTN)IfCb->DnsAddr[Index].Addr[0],
726 (
UINTN)IfCb->DnsAddr[Index].Addr[1],
727 (
UINTN)IfCb->DnsAddr[Index].Addr[2],
728 (
UINTN)IfCb->DnsAddr[Index].Addr[3]
775 NET_LIST_FOR_EACH_SAFE (Entry, Next, IfList) {
778 if ((IfName !=
NULL) && (
StrCmp (IfName, IfCb->IfInfo->
Name) == 0)) {
781 Status = IfCb->IfCfg->SetData (
787 if (EFI_ERROR (Status)) {
796 Status = IfCb->IfCfg->SetData (
802 if (EFI_ERROR (Status)) {
831 VAR_CHECK_CODE CheckCode;
841 IP4_ADDR TempGateway;
846 CONST CHAR16 *TempString;
874 Status =
gBS->CreateEvent (
881 if (EFI_ERROR (Status)) {
887 Status =
gBS->CreateEvent (
894 if (EFI_ERROR (Status)) {
903 while (VarArg !=
NULL) {
913 if (VarCheckOk != CheckCode) {
915 case VarCheckDuplicate:
919 case VarCheckConflict:
923 case VarCheckUnknown:
927 TempString = PermanentString;
943 VarArg = VarArg->Next;
950 if (
StrCmp (VarArg->Arg, L
"dhcp") == 0) {
955 Status = IfCb->IfCfg->SetData (
961 if (EFI_ERROR (Status)) {
967 VarArg = VarArg->Next;
968 }
else if (
StrCmp (VarArg->Arg, L
"static") == 0) {
969 VarArg = VarArg->Next;
970 if (VarArg ==
NULL) {
976 ZeroMem (&ManualAddress,
sizeof (ManualAddress));
982 if (EFI_ERROR (Status)) {
991 VarArg = VarArg->Next;
992 if (VarArg ==
NULL) {
999 if (EFI_ERROR (Status)) {
1008 VarArg = VarArg->Next;
1009 if (VarArg ==
NULL) {
1016 if (EFI_ERROR (Status)) {
1027 CopyMem (&TempGateway, &Gateway,
sizeof (IP4_ADDR));
1028 SubnetMask = NTOHL (SubnetMask);
1029 TempGateway = NTOHL (TempGateway);
1030 if ((SubnetMask != 0) &&
1031 (SubnetMask != 0xFFFFFFFFu) &&
1043 Status = IfCb->IfCfg->SetData (
1049 if (EFI_ERROR (Status)) {
1058 IsAddressOk =
FALSE;
1060 Status = IfCb->IfCfg->RegisterDataNotify (
1065 if (EFI_ERROR (Status)) {
1073 Status = IfCb->IfCfg->SetData (
1080 if (Status == EFI_NOT_READY) {
1083 while (EFI_ERROR (
gBS->CheckEvent (TimeOutEvt))) {
1091 IfCb->IfCfg->UnregisterDataNotify (
1097 if (EFI_ERROR (Status)) {
1108 Status = IfCb->IfCfg->SetData (
1114 if (EFI_ERROR (Status)) {
1120 VarArg = VarArg->Next;
1121 }
else if (
StrCmp (VarArg->Arg, L
"dns") == 0) {
1125 VarArg = VarArg->Next;
1128 while (Tmp !=
NULL) {
1142 while (Tmp !=
NULL) {
1144 if (EFI_ERROR (Status)) {
1161 Status = IfCb->IfCfg->SetData (
1167 if (EFI_ERROR (Status)) {
1209 if (EFI_ERROR (Status)) {
1214 switch (Private->OpCode) {
1215 case IfConfigOpList:
1219 case IfConfigOpClear:
1250 ASSERT (Private !=
NULL);
1255 if (Private->VarArg !=
NULL) {
1259 if (Private->IfName !=
NULL) {
1266 NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->IfList) {
1271 if (IfCb->IfInfo !=
NULL) {
1302 CONST CHAR16 *ValueStr;
1304 CHAR16 *ProblemParam;
1307 Status = EFI_INVALID_PARAMETER;
1312 if (EFI_ERROR (Status)) {
1313 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
1357 if (Private ==
NULL) {
1368 Private->OpCode = IfConfigOpList;
1370 if (ValueStr !=
NULL) {
1378 Private->IfName = Str;
1386 Private->OpCode = IfConfigOpClear;
1388 if (ValueStr !=
NULL) {
1396 Private->IfName = Str;
1405 if (ValueStr ==
NULL) {
1415 if (ArgList ==
NULL) {
1421 Private->OpCode = IfConfigOpSet;
1422 Private->IfName = ArgList->Arg;
1424 Private->VarArg = ArgList->Next;
1426 if ((Private->IfName ==
NULL) || (Private->VarArg ==
NULL)) {
1442 if (Private !=
NULL) {
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
VOID IfConfigCleanup(IN IFCONFIG_PRIVATE_DATA *Private)
SHELL_STATUS IfConfigShowInterfaceInfo(IN LIST_ENTRY *IfList)
VOID IfConfigPrintMacAddr(IN UINT8 *Node, IN UINT32 Size)
ARG_LIST * SplitStrToList(IN CONST CHAR16 *String, IN CHAR16 Separator)
VOID EFIAPI IfConfigManualAddressNotify(IN EFI_EVENT Event, IN VOID *Context)
SHELL_STATUS EFIAPI ShellCommandRunIfconfig(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS IfConfigGetInterfaceInfo(IN CHAR16 *IfName, IN LIST_ENTRY *IfList)
VOID FreeArgList(ARG_LIST *List)
SHELL_STATUS IfConfig(IN IFCONFIG_PRIVATE_DATA *Private)
SHELL_STATUS IfConfigSetInterfaceInfo(IN LIST_ENTRY *IfList, IN ARG_LIST *VarArg)
VAR_CHECK_CODE IfConfigRetriveCheckListByName(IN VAR_CHECK_ITEM *CheckList, IN CHAR16 *Name, IN BOOLEAN Init)
SHELL_STATUS IfConfigClearInterfaceInfo(IN LIST_ENTRY *IfList, IN CHAR16 *IfName)
@ Ip4Config2DataTypeManualAddress
@ Ip4Config2DataTypeGateway
@ Ip4Config2DataTypePolicy
@ Ip4Config2DataTypeInterfaceInfo
@ Ip4Config2DataTypeDnsServer
@ SHELL_INVALID_PARAMETER
BOOLEAN EFIAPI NetIp4IsUnicast(IN IP4_ADDR Ip, IN IP4_ADDR NetMask)
EFI_STATUS EFIAPI NetLibDetectMediaWaitTimeout(IN EFI_HANDLE ServiceHandle, IN UINT64 Timeout, OUT EFI_STATUS *MediaState)
EFI_STATUS EFIAPI NetLibStrToIp4(IN CONST CHAR16 *String, OUT EFI_IPv4_ADDRESS *Ip4Address)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
@ TypeMaxValue
A flag followed by all the command line data before the next flag.
@ TypeFlag
A flag that is present or not present only (IE "-a").
EFI_STATUS EFIAPI ShellCommandLineParseEx(IN CONST SHELL_PARAM_ITEM *CheckList, OUT LIST_ENTRY **CheckPackage, OUT CHAR16 **ProblemParam OPTIONAL, IN BOOLEAN AutoPageBreak, IN BOOLEAN AlwaysAllowNumbers)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
INTN EFIAPI StringNoCaseCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
IPv4_ADDRESS EFI_IPv4_ADDRESS
EFI_MAC_ADDRESS HwAddress
CHAR16 Name[EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE]
EFI_IPv4_ADDRESS SubnetMask
EFI_IPv4_ADDRESS StationAddress
EFI_IPv4_ADDRESS SubnetMask