19 VarCheckReserved = -1,
35#define MACADDRMAXSIZE 32
36#define PREFIXMAXLEN 16
70 VAR_CHECK_FLAG_TYPE FlagType;
163 while (List->Next !=
NULL) {
192 if ((String ==
NULL) || (*String == L
'\0')) {
210 if (ArgNode ==
NULL) {
219 while (*Str != L
'\0') {
220 if (*Str == Separator) {
222 ArgNode->Arg = ArgStr;
225 if (ArgNode->Next ==
NULL) {
234 ArgNode = ArgNode->Next;
240 ArgNode->Arg = ArgStr;
241 ArgNode->Next =
NULL;
263 STATIC UINT32 CheckDuplicate;
264 STATIC UINT32 CheckConflict;
265 VAR_CHECK_CODE RtCode;
277 Arg = CheckList[Index];
282 while (Arg.FlagStr !=
NULL) {
283 if (
StrCmp (Arg.FlagStr, Name) == 0) {
284 if (CheckDuplicate & Arg.FlagID) {
285 RtCode = VarCheckDuplicate;
289 if (CheckConflict & Arg.ConflictMask) {
290 RtCode = VarCheckConflict;
294 CheckDuplicate |= Arg.FlagID;
295 CheckConflict |= Arg.ConflictMask;
299 Arg = CheckList[++Index];
302 if (Arg.FlagStr ==
NULL) {
303 RtCode = VarCheckUnknown;
323 *((BOOLEAN *)Context) =
TRUE;
341 ASSERT (Size <= MACADDRMAXSIZE);
343 for (Index = 0; Index < Size; Index++) {
345 if (Index + 1 < Size) {
371 for (Index = 0; Index < PREFIXMAXLEN; Index = Index + 2) {
372 if (!Short && (Index + 1 < PREFIXMAXLEN) && (Index % 2 == 0) && (Ip->Addr[Index] == 0) && (Ip->Addr[Index + 1] == 0)) {
385 while ((Index < PREFIXMAXLEN) && (Ip->Addr[Index] == 0) && (Ip->Addr[Index + 1] == 0)) {
387 if (Index > PREFIXMAXLEN - 2) {
394 if (Index == PREFIXMAXLEN) {
402 if (Index < PREFIXMAXLEN - 1) {
407 if (Index + 2 < PREFIXMAXLEN) {
412 if (PrefixLen !=
NULL) {
452 while ((!EFI_ERROR (Status)) && (VarArg !=
NULL)) {
455 if (EFI_ERROR (Status)) {
462 VarArg = VarArg->Next;
467 return EFI_INVALID_PARAMETER;
471 if (AddrBuf ==
NULL) {
472 ASSERT (AddrBuf !=
NULL);
473 return EFI_OUT_OF_RESOURCES;
483 while ((!EFI_ERROR (Status)) && (VarArg !=
NULL)) {
486 if (EFI_ERROR (Status)) {
494 if (Prefix == 0xFF) {
500 IP6_COPY_ADDRESS (&AddrBuf[AddrCnt].Address, &Address);
501 VarArg = VarArg->Next;
507 if (EFI_ERROR (Status) && (Status != EFI_INVALID_PARAMETER)) {
556 while ((!EFI_ERROR (Status)) && (VarArg !=
NULL)) {
559 if (EFI_ERROR (Status)) {
566 VarArg = VarArg->Next;
571 return EFI_INVALID_PARAMETER;
575 if (AddrBuf ==
NULL) {
576 ASSERT (AddrBuf !=
NULL);
577 return EFI_OUT_OF_RESOURCES;
587 while ((!EFI_ERROR (Status)) && (VarArg !=
NULL)) {
590 if (EFI_ERROR (Status)) {
594 IP6_COPY_ADDRESS (&AddrBuf[AddrCnt], &Address);
596 VarArg = VarArg->Next;
602 if (EFI_ERROR (Status) && (Status != EFI_INVALID_PARAMETER)) {
638 return EFI_INVALID_PARAMETER;
643 ASSERT (IfId !=
NULL);
645 ASSERT (*IfId !=
NULL);
647 while ((*IdStr != L
'\0') && (Index < 8)) {
649 while ((*IdStr != L
':') && (*IdStr != L
'\0')) {
650 if ((*IdStr <= L
'F') && (*IdStr >= L
'A')) {
651 NodeVal = (UINT8)((NodeVal << 4) + *IdStr - L
'A' + 10);
652 }
else if ((*IdStr <= L
'f') && (*IdStr >= L
'a')) {
653 NodeVal = (UINT8)((NodeVal << 4) + *IdStr - L
'a' + 10);
654 }
else if ((*IdStr <= L
'9') && (*IdStr >= L
'0')) {
655 NodeVal = (UINT8)((NodeVal << 4) + *IdStr - L
'0');
658 return EFI_INVALID_PARAMETER;
664 (*IfId)->Id[Index++] = NodeVal;
666 if (*IdStr == L
':') {
694 return EFI_INVALID_PARAMETER;
697 ValStr = (*Arg)->Arg;
700 while (*ValStr != L
'\0') {
701 if ((*ValStr <= L
'9') && (*ValStr >= L
'0')) {
702 *Xmits = (*Xmits * 10) + (*ValStr - L
'0');
704 return EFI_INVALID_PARAMETER;
750 Status =
gBS->LocateHandleBuffer (
752 &gEfiIp6ServiceBindingProtocolGuid,
757 if (EFI_ERROR (Status) || (HandleNum == 0)) {
764 for (HandleIndex = 0; HandleIndex < HandleNum; HandleIndex++) {
773 ASSERT (HandleBuffer !=
NULL);
774 Status =
gBS->HandleProtocol (
775 HandleBuffer[HandleIndex],
776 &gEfiIp6ConfigProtocolGuid,
780 if (EFI_ERROR (Status)) {
787 Status = Ip6Cfg->GetData (
794 if (Status != EFI_BUFFER_TOO_SMALL) {
801 if (IfInfo ==
NULL) {
802 Status = EFI_OUT_OF_RESOURCES;
809 Status = Ip6Cfg->GetData (
816 if (EFI_ERROR (Status)) {
833 Status = Ip6Cfg->GetData (
840 if ((Status != EFI_BUFFER_TOO_SMALL) && (Status != EFI_NOT_FOUND)) {
848 Status = EFI_OUT_OF_RESOURCES;
852 IfCb->NicHandle = HandleBuffer[HandleIndex];
853 IfCb->IfInfo = IfInfo;
854 IfCb->IfCfg = Ip6Cfg;
861 Status = Ip6Cfg->GetData (
868 if (EFI_ERROR (Status)) {
880 if (IfCb->IfId ==
NULL) {
884 Status = Ip6Cfg->GetData (
891 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
896 if (Status == EFI_NOT_FOUND) {
905 Status = Ip6Cfg->GetData (
912 if (EFI_ERROR (Status)) {
921 Status = Ip6Cfg->GetData (
928 if (EFI_ERROR (Status)) {
945 if (HandleBuffer !=
NULL) {
953 if (IfInfo !=
NULL) {
958 if (IfCb->IfId !=
NULL) {
986 Entry = IfList->ForwardLink;
995 while (Entry != IfList) {
1022 if (IfCb->IfId !=
NULL) {
1059 for (Index = 0; Index < IfCb->DnsCnt; Index++) {
1061 &IfCb->DnsAddr[Index],
1072 for (Index = 0; Index < IfCb->IfInfo->
RouteCount; Index++) {
1086 Entry = Entry->ForwardLink;
1117 Entry = IfList->ForwardLink;
1129 while (Entry != IfList) {
1132 if ((IfName !=
NULL) && (
StrCmp (IfName, IfCb->IfInfo->
Name) == 0)) {
1135 Status = IfCb->IfCfg->SetData (
1141 if (EFI_ERROR (Status)) {
1150 Status = IfCb->IfCfg->SetData (
1157 if (EFI_ERROR (Status)) {
1163 Entry = Entry->ForwardLink;
1194 UINTN CurDadXmitsLen;
1197 VAR_CHECK_CODE CheckCode;
1200 BOOLEAN IsAddressOk;
1205 BOOLEAN IsAddressSet;
1240 Status =
gBS->CreateEvent (
1247 if (EFI_ERROR (Status)) {
1252 Status =
gBS->CreateEvent (
1259 if (EFI_ERROR (Status)) {
1267 while (VarArg !=
NULL) {
1272 mIfConfig6SetCheckList,
1277 if (VarCheckOk != CheckCode) {
1278 switch (CheckCode) {
1279 case VarCheckDuplicate:
1283 case VarCheckConflict:
1287 case VarCheckUnknown:
1295 VarArg = VarArg->Next;
1302 if (
StrCmp (VarArg->Arg, L
"auto") == 0) {
1307 Status = IfCb->IfCfg->SetData (
1314 if (EFI_ERROR (Status)) {
1319 VarArg = VarArg->Next;
1321 if (VarArg !=
NULL) {
1322 if (
StrCmp (VarArg->Arg, L
"host") == 0) {
1326 }
else if (
StrCmp (VarArg->Arg, L
"gw") == 0) {
1330 }
else if (
StrCmp (VarArg->Arg, L
"dns") == 0) {
1336 }
else if (
StrCmp (VarArg->Arg, L
"man") == 0) {
1341 Status = IfCb->IfCfg->SetData (
1348 if (EFI_ERROR (Status)) {
1353 VarArg = VarArg->Next;
1354 }
else if (
StrCmp (VarArg->Arg, L
"host") == 0) {
1358 VarArg = VarArg->Next;
1365 if (EFI_ERROR (Status)) {
1366 if (Status == EFI_INVALID_PARAMETER) {
1380 IsAddressOk =
FALSE;
1382 Status = IfCb->IfCfg->RegisterDataNotify (
1387 if (EFI_ERROR (Status)) {
1392 Status = IfCb->IfCfg->SetData (
1399 if (Status == EFI_NOT_READY) {
1404 IfCb->IfCfg->GetData (
1411 gBS->SetTimer (TimeOutEvt,
TimerRelative, 50000000 + 10000000 * CurDadXmits);
1413 while (EFI_ERROR (
gBS->CheckEvent (TimeOutEvt))) {
1421 IfCb->IfCfg->UnregisterDataNotify (
1427 if (EFI_ERROR (Status)) {
1438 Status = IfCb->IfCfg->GetData (
1445 if (Status != EFI_BUFFER_TOO_SMALL) {
1453 if (IfInfo ==
NULL) {
1458 Status = IfCb->IfCfg->GetData (
1465 if (EFI_ERROR (Status)) {
1472 IsAddressSet =
FALSE;
1476 if (CfgManAddr[Index].PrefixLength == 0) {
1484 IsAddressSet =
TRUE;
1489 if (!IsAddressSet) {
1492 &CfgManAddr[Index].Address,
1493 &CfgManAddr[Index].PrefixLength
1498 }
else if (
StrCmp (VarArg->Arg, L
"gw") == 0) {
1502 VarArg = VarArg->Next;
1509 if (EFI_ERROR (Status)) {
1510 if (Status == EFI_INVALID_PARAMETER) {
1523 Status = IfCb->IfCfg->SetData (
1530 if (EFI_ERROR (Status)) {
1535 }
else if (
StrCmp (VarArg->Arg, L
"dns") == 0) {
1539 VarArg = VarArg->Next;
1546 if (EFI_ERROR (Status)) {
1547 if (Status == EFI_INVALID_PARAMETER) {
1560 Status = IfCb->IfCfg->SetData (
1567 if (EFI_ERROR (Status)) {
1571 }
else if (
StrCmp (VarArg->Arg, L
"id") == 0) {
1575 VarArg = VarArg->Next;
1578 if (EFI_ERROR (Status)) {
1586 Status = IfCb->IfCfg->SetData (
1593 if (EFI_ERROR (Status)) {
1597 }
else if (
StrCmp (VarArg->Arg, L
"dad") == 0) {
1601 VarArg = VarArg->Next;
1604 if (EFI_ERROR (Status)) {
1612 Status = IfCb->IfCfg->SetData (
1619 if (EFI_ERROR (Status)) {
1628 if (CfgManAddr !=
NULL) {
1632 if (CfgAddr !=
NULL) {
1636 if (MappedEvt !=
NULL) {
1637 gBS->CloseEvent (MappedEvt);
1640 if (TimeOutEvt !=
NULL) {
1641 gBS->CloseEvent (TimeOutEvt);
1644 if (IfInfo !=
NULL) {
1674 Private->ImageHandle,
1679 if (EFI_ERROR (Status)) {
1684 switch (Private->OpCode) {
1685 case IfConfig6OpList:
1689 case IfConfig6OpClear:
1693 case IfConfig6OpSet:
1721 ASSERT (Private !=
NULL);
1726 if (Private->VarArg !=
NULL) {
1730 if (Private->IfName !=
NULL) {
1737 Entry = Private->IfList.ForwardLink;
1738 NextEntry = Entry->ForwardLink;
1740 while (Entry != &Private->IfList) {
1745 if (IfCb->IfId !=
NULL) {
1749 if (IfCb->IfInfo !=
NULL) {
1756 NextEntry = Entry->ForwardLink;
1783 CONST CHAR16 *ValueStr;
1785 CHAR16 *ProblemParam;
1789 Status = EFI_INVALID_PARAMETER;
1793 if (EFI_ERROR (Status)) {
1827 if (Private ==
NULL) {
1838 Private->OpCode = IfConfig6OpList;
1840 if (ValueStr !=
NULL) {
1848 Private->IfName = Str;
1856 Private->OpCode = IfConfig6OpClear;
1858 if (ValueStr !=
NULL) {
1866 Private->IfName = Str;
1875 if (ValueStr ==
NULL) {
1885 if (ArgList ==
NULL) {
1891 Private->OpCode = IfConfig6OpSet;
1892 Private->IfName = ArgList->Arg;
1894 Private->VarArg = ArgList->Next;
1896 if ((Private->IfName ==
NULL) || (Private->VarArg ==
NULL)) {
1911 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)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
VOID IfConfig6PrintIpAddr(IN EFI_IPv6_ADDRESS *Ip, IN UINT8 *PrefixLen)
VOID IfConfig6FreeArgList(ARG_LIST *List)
SHELL_STATUS IfConfig6ClearInterfaceInfo(IN LIST_ENTRY *IfList, IN CHAR16 *IfName)
EFI_STATUS IfConfig6ParseInterfaceId(IN OUT ARG_LIST **Arg, OUT EFI_IP6_CONFIG_INTERFACE_ID **IfId)
SHELL_STATUS EFIAPI ShellCommandRunIfconfig6(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS IfConfig6(IN IFCONFIG6_PRIVATE_DATA *Private)
EFI_STATUS IfConfig6ParseDadXmits(IN OUT ARG_LIST **Arg, OUT UINT32 *Xmits)
SHELL_STATUS IfConfig6SetInterfaceInfo(IN LIST_ENTRY *IfList, IN ARG_LIST *VarArg)
ARG_LIST * IfConfig6SplitStrToList(IN CONST CHAR16 *String, IN CHAR16 Separator)
EFI_STATUS IfConfig6ParseGwDnsAddressList(IN OUT ARG_LIST **Arg, OUT EFI_IPv6_ADDRESS **Buf, OUT UINTN *BufSize)
VOID EFIAPI IfConfig6ManualAddressNotify(IN EFI_EVENT Event, IN VOID *Context)
SHELL_STATUS IfConfig6ShowInterfaceInfo(IN LIST_ENTRY *IfList)
EFI_STATUS IfConfig6GetInterfaceInfo(IN EFI_HANDLE ImageHandle, IN CHAR16 *IfName, IN LIST_ENTRY *IfList)
VAR_CHECK_CODE IfConfig6RetriveCheckListByName(IN VAR_CHECK_ITEM *CheckList, IN CHAR16 *Name, IN BOOLEAN Init)
VOID IfConfig6PrintMacAddr(IN UINT8 *Node, IN UINT32 Size)
VOID IfConfig6Cleanup(IN IFCONFIG6_PRIVATE_DATA *Private)
EFI_STATUS IfConfig6ParseManualAddressList(IN OUT ARG_LIST **Arg, OUT EFI_IP6_CONFIG_MANUAL_ADDRESS **Buf, OUT UINTN *BufSize)
@ Ip6ConfigDataTypeDupAddrDetectTransmits
@ Ip6ConfigDataTypeGateway
@ Ip6ConfigDataTypeAltInterfaceId
@ Ip6ConfigDataTypeManualAddress
@ Ip6ConfigDataTypeInterfaceInfo
@ Ip6ConfigDataTypePolicy
@ Ip6ConfigDataTypeDnsServer
@ Ip6ConfigPolicyAutomatic
#define BASE_CR(Record, TYPE, Field)
@ SHELL_INVALID_PARAMETER
EFI_STATUS EFIAPI NetLibStrToIp6andPrefix(IN CONST CHAR16 *String, OUT EFI_IPv6_ADDRESS *Ip6Address, OUT UINT8 *PrefixLength)
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)
IPv6_ADDRESS EFI_IPv6_ADDRESS
UINT8 PrefixLength
The length of the prefix associated with the Address.
EFI_IPv6_ADDRESS Address
The IPv6 address.
EFI_IP6_ROUTE_TABLE * RouteTable
EFI_IP6_ADDRESS_INFO * AddressInfo
EFI_MAC_ADDRESS HwAddress
UINT8 PrefixLength
The length, in bits, of the prefix associated with this Address.
EFI_IPv6_ADDRESS Address
The IPv6 unicast address.
BOOLEAN IsAnycast
Set to TRUE if Address is anycast.
EFI_IPv6_ADDRESS Destination