31 OUT UINT32 *AddressCount,
40 if (AddressCount ==
NULL) {
41 return EFI_INVALID_PARAMETER;
44 if (IpSb->LinkLocalOk) {
45 Count = 1 + IpSb->DefaultInterface->AddressCount;
50 *AddressCount = Count;
52 if ((AddressList ==
NULL) || (Count == 0)) {
56 if (*AddressList ==
NULL) {
58 if (*AddressList ==
NULL) {
59 return EFI_OUT_OF_RESOURCES;
63 EfiAddrInfo = *AddressList;
65 IP6_COPY_ADDRESS (&EfiAddrInfo->
Address, &IpSb->LinkLocalAddr);
66 EfiAddrInfo->
PrefixLength = IP6_LINK_LOCAL_PREFIX_LENGTH;
71 NET_LIST_FOR_EACH (Entry, &IpSb->DefaultInterface->AddressList) {
72 AddrInfo = NET_LIST_USER_STRUCT_S (Entry,
IP6_ADDRESS_INFO, Link, IP6_ADDR_INFO_SIGNATURE);
74 IP6_COPY_ADDRESS (&EfiAddrInfo->
Address, &AddrInfo->Address);
81 ASSERT (Count == *AddressCount);
109 if (Ip6Addr ==
NULL) {
110 return EFI_INVALID_PARAMETER;
113 if (!Router && (Scope == IP6_SITE_LOCAL_SCOPE)) {
114 return EFI_INVALID_PARAMETER;
118 Ip6Addr->Addr[0] = 0xFF;
119 Ip6Addr->Addr[1] = Scope;
122 Ip6Addr->Addr[15] = 0x1;
124 Ip6Addr->Addr[15] = 0x2;
146 UINT8 InterfaceId[8];
151 NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE);
153 AddrLen = IpSb->SnpMode.HwAddressSize;
158 if ((AddrLen != IP6_MAC_LEN) || (IpSb->InterfaceIdLen != IP6_IF_ID_LEN)) {
162 MacAddr = &IpSb->SnpMode.CurrentAddress;
169 CopyMem (InterfaceId, MacAddr, 3);
170 InterfaceId[3] = 0xFF;
171 InterfaceId[4] = 0xFE;
172 CopyMem (&InterfaceId[5], &MacAddr->Addr[3], 3);
174 Byte = (UINT8)(InterfaceId[0] & IP6_U_BIT);
175 if (Byte == IP6_U_BIT) {
176 InterfaceId[0] &= ~IP6_U_BIT;
178 InterfaceId[0] |= IP6_U_BIT;
210 NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE);
212 if (IpSb->InterfaceId !=
NULL) {
219 Ip6Config = &IpSb->Ip6ConfigInstance.Ip6Config;
221 ZeroMem (&InterfaceId, DataSize);
223 Status = Ip6Config->GetData (
229 if (Status == EFI_NOT_FOUND) {
235 if (IpSb->InterfaceId ==
NULL) {
239 CopyMem (&InterfaceId, IpSb->InterfaceId, IpSb->InterfaceIdLen);
243 Status = Ip6Config->SetData (
249 if (EFI_ERROR (Status)) {
251 IpSb->InterfaceId =
NULL;
254 }
else if (!EFI_ERROR (Status)) {
256 if (IpSb->InterfaceId ==
NULL) {
267 if (Ip6Addr ==
NULL) {
269 IpSb->InterfaceId =
NULL;
273 CopyMem (&Ip6Addr->Addr[8], IpSb->InterfaceId, IpSb->InterfaceIdLen);
274 Ip6Addr->Addr[1] = 0x80;
275 Ip6Addr->Addr[0] = 0xFE;
296 ASSERT (Ip6Addr !=
NULL && MulticastAddr !=
NULL);
300 MulticastAddr->Addr[0] = 0xFF;
301 MulticastAddr->Addr[1] = 0x02;
302 MulticastAddr->Addr[11] = 0x1;
303 MulticastAddr->Addr[12] = 0xFF;
305 CopyMem (&MulticastAddr->Addr[13], &Ip6Addr->Addr[13], 3);
322 IpIf->AddressCount++;
346 Instance = NET_LIST_USER_STRUCT_S (Entry,
IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);
350 if ((Instance->State == IP6_STATE_CONFIGED) && EFI_IP6_EQUAL (&Instance->ConfigData.
StationAddress, Address)) {
351 return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
374 NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE);
376 List = &IpSb->Children;
377 Context.ServiceBinding = &IpSb->ServiceBinding;
378 Context.Address = Address;
414 IN OUT UINT32 *AddressCount,
416 IN UINT8 PrefixLength
425 if (
IsListEmpty (AddressList) || (*AddressCount < 1) || (PrefixLength > IP6_PREFIX_MAX)) {
426 return EFI_INVALID_PARAMETER;
429 Status = EFI_NOT_FOUND;
431 NET_LIST_FOR_EACH_SAFE (Entry, Next, AddressList) {
432 AddrInfo = NET_LIST_USER_STRUCT_S (Entry,
IP6_ADDRESS_INFO, Link, IP6_ADDR_INFO_SIGNATURE);
434 if ((Prefix ==
NULL) ||
435 ((PrefixLength == 128) && EFI_IP6_EQUAL (Prefix, &AddrInfo->Address)) ||
436 ((PrefixLength == AddrInfo->PrefixLength) &&
NetIp6IsNetEqual (Prefix, &AddrInfo->Address, PrefixLength))
440 NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE);
481 if (
CompareMem (Sn.Addr, Ip6->Addr, 13) == 0) {
519 if (IpSb->LinkLocalOk && EFI_IP6_EQUAL (&IpSb->LinkLocalAddr, Address)) {
520 if (Interface !=
NULL) {
521 *Interface = IpSb->DefaultInterface;
524 if (AddressInfo !=
NULL) {
531 NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
532 IpIf = NET_LIST_USER_STRUCT_S (Entry,
IP6_INTERFACE, Link, IP6_INTERFACE_SIGNATURE);
534 NET_LIST_FOR_EACH (Entry2, &IpIf->AddressList) {
535 TmpAddressInfo = NET_LIST_USER_STRUCT_S (Entry2,
IP6_ADDRESS_INFO, Link, IP6_ADDR_INFO_SIGNATURE);
537 if (EFI_IP6_EQUAL (&TmpAddressInfo->Address, Address)) {
538 if (Interface !=
NULL) {
542 if (AddressInfo !=
NULL) {
543 *AddressInfo = TmpAddressInfo;
575 for (Index = IpSb->SnpMode.HwAddressSize; Index < sizeof (
EFI_MAC_ADDRESS); Index++) {
576 if (LinkAddress->Addr[Index] != 0) {
596 IN UINT8 PrefixLength
603 ASSERT (Dest !=
NULL && Src !=
NULL);
604 ASSERT (PrefixLength <= IP6_PREFIX_MAX);
606 Byte = (UINT8)(PrefixLength / 8);
607 Bit = (UINT8)(PrefixLength % 8);
614 Mask = (UINT8)(0xFF << (8 - Bit));
616 Dest->Addr[Byte] = (UINT8)(Src->Addr[Byte] & Mask);
643 IP6_COPY_ADDRESS (&EfiIp.v6, Multicast);
645 return Mnp->McastIpToMac (Mnp,
TRUE, &EfiIp, Mac);
663 Head->FlowLabelL = NTOHS (Head->FlowLabelL);
664 Head->PayloadLength = NTOHS (Head->PayloadLength);
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InsertHeadList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST 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 Ip6CreateSNMulticastAddr(IN EFI_IPv6_ADDRESS *Ip6Addr, OUT EFI_IPv6_ADDRESS *MulticastAddr)
EFI_STATUS Ip6GetMulticastMac(IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp, IN EFI_IPv6_ADDRESS *Multicast, OUT EFI_MAC_ADDRESS *Mac)
EFI_STATUS Ip6SetToAllNodeMulticast(IN BOOLEAN Router, IN UINT8 Scope, OUT EFI_IPv6_ADDRESS *Ip6Addr)
EFI_IP6_HEADER * Ip6NtohHead(IN OUT EFI_IP6_HEADER *Head)
BOOLEAN Ip6IsSNMulticastAddr(IN EFI_IPv6_ADDRESS *Ip6)
EFI_STATUS Ip6RemoveAddr(IN IP6_SERVICE *IpSb OPTIONAL, IN OUT LIST_ENTRY *AddressList, IN OUT UINT32 *AddressCount, IN EFI_IPv6_ADDRESS *Prefix OPTIONAL, IN UINT8 PrefixLength)
VOID Ip6AddAddr(IN OUT IP6_INTERFACE *IpIf, IN IP6_ADDRESS_INFO *AddrInfo)
BOOLEAN Ip6IsOneOfSetAddress(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Address, OUT IP6_INTERFACE **Interface OPTIONAL, OUT IP6_ADDRESS_INFO **AddressInfo OPTIONAL)
VOID Ip6DestroyInstanceByAddress(IN OUT IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Address)
UINT8 * Ip6CreateInterfaceID(IN OUT IP6_SERVICE *IpSb)
BOOLEAN Ip6IsValidLinkAddress(IN IP6_SERVICE *IpSb, IN EFI_MAC_ADDRESS *LinkAddress)
EFI_IPv6_ADDRESS * Ip6CreateLinkLocalAddr(IN OUT IP6_SERVICE *IpSb)
EFI_STATUS Ip6BuildEfiAddressList(IN IP6_SERVICE *IpSb, OUT UINT32 *AddressCount, OUT EFI_IP6_ADDRESS_INFO **AddressList OPTIONAL)
VOID Ip6CopyAddressByPrefix(OUT EFI_IPv6_ADDRESS *Dest, IN EFI_IPv6_ADDRESS *Src, IN UINT8 PrefixLength)
EFI_STATUS EFIAPI Ip6DestroyChildEntryByAddr(IN LIST_ENTRY *Entry, IN VOID *Context)
@ Ip6ConfigDataTypeAltInterfaceId
EFI_STATUS Ip6LeaveGroup(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Address)
BOOLEAN EFIAPI NetIp6IsNetEqual(EFI_IPv6_ADDRESS *Ip1, EFI_IPv6_ADDRESS *Ip2, UINT8 PrefixLength)
EFI_STATUS EFIAPI NetDestroyLinkList(IN LIST_ENTRY *List, IN NET_DESTROY_LINK_LIST_CALLBACK CallBack, IN VOID *Context OPTIONAL, OUT UINTN *ListLength OPTIONAL)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
UINT8 PrefixLength
The length of the prefix associated with the Address.
EFI_IPv6_ADDRESS Address
The IPv6 address.
EFI_IPv6_ADDRESS StationAddress