22BOOLEAN mIpSec2Installed =
FALSE;
44 Status =
gBS->LocateProtocol (&gEfiIpSec2ProtocolGuid,
NULL, (VOID **)&mIpSec);
49 gBS->CloseEvent (Event);
51 mIpSec2Installed =
TRUE;
80 &gEfiIpSec2ProtocolGuid,
121 return gBS->OpenProtocol (
123 &gEfiManagedNetworkServiceBindingProtocolGuid,
125 This->DriverBindingHandle,
127 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
153 IpSb->State = IP6_SERVICE_DESTROY;
155 if (IpSb->Timer !=
NULL) {
157 gBS->CloseEvent (IpSb->Timer);
162 if (IpSb->FasterTimer !=
NULL) {
164 gBS->CloseEvent (IpSb->FasterTimer);
166 IpSb->FasterTimer =
NULL;
171 if (!IpSb->LinkLocalDadFail) {
178 if (EFI_ERROR (Status)) {
183 if (IpSb->DefaultInterface !=
NULL) {
185 IpSb->DefaultInterface =
NULL;
193 if (IpSb->RouteTable !=
NULL) {
195 IpSb->RouteTable =
NULL;
198 if (IpSb->InterfaceId !=
NULL) {
202 IpSb->InterfaceId =
NULL;
206 if (IpSb->MnpChildHandle !=
NULL) {
207 if (IpSb->Mnp !=
NULL) {
208 IpSb->Mnp->Cancel (IpSb->Mnp,
NULL);
209 IpSb->Mnp->Configure (IpSb->Mnp,
NULL);
211 IpSb->MnpChildHandle,
212 &gEfiManagedNetworkProtocolGuid,
223 &gEfiManagedNetworkServiceBindingProtocolGuid,
227 IpSb->MnpChildHandle =
NULL;
230 if (IpSb->RecvRequest.MnpToken.Event !=
NULL) {
231 gBS->CloseEvent (IpSb->RecvRequest.MnpToken.Event);
270 ASSERT (Service !=
NULL);
282 return EFI_OUT_OF_RESOURCES;
285 IpSb->Signature = IP6_SERVICE_SIGNATURE;
288 IpSb->State = IP6_SERVICE_UNSTARTED;
290 IpSb->NumChildren = 0;
294 IpSb->DefaultInterface =
NULL;
295 IpSb->RouteTable =
NULL;
297 IpSb->RecvRequest.Signature = IP6_LINK_RX_SIGNATURE;
298 IpSb->RecvRequest.CallBack =
NULL;
299 IpSb->RecvRequest.Context =
NULL;
300 MnpToken = &IpSb->RecvRequest.MnpToken;
302 MnpToken->
Status = EFI_NOT_READY;
307 IpSb->MldCtrl.Mldv1QuerySeen = 0;
311 IpSb->LinkLocalOk =
FALSE;
312 IpSb->LinkLocalDadFail =
FALSE;
313 IpSb->Dhcp6NeedStart =
FALSE;
314 IpSb->Dhcp6NeedInfoRequest =
FALSE;
316 IpSb->CurHopLimit = IP6_HOP_LIMIT;
317 IpSb->LinkMTU = IP6_MIN_LINK_MTU;
318 IpSb->BaseReachableTime = IP6_REACHABLE_TIME;
320 if (EFI_ERROR (Status)) {
327 IpSb->RetransTimer = IP6_RETRANS_TIMER;
329 IpSb->RoundRobin = 0;
336 IpSb->InterfaceIdLen = IP6_IF_ID_LEN;
337 IpSb->InterfaceId =
NULL;
339 IpSb->RouterAdvertiseReceived =
FALSE;
340 IpSb->SolicitTimer = IP6_MAX_RTR_SOLICITATIONS;
343 IpSb->Image = ImageHandle;
344 IpSb->Controller = Controller;
346 IpSb->MnpChildHandle =
NULL;
349 Config = &IpSb->MnpConfigData;
364 IpSb->FasterTimer =
NULL;
368 IpSb->MacString =
NULL;
376 if (IpSb->RouteTable ==
NULL) {
377 Status = EFI_OUT_OF_RESOURCES;
381 Status =
gBS->CreateEvent (
382 EVT_NOTIFY_SIGNAL | EVT_TIMER,
388 if (EFI_ERROR (Status)) {
392 Status =
gBS->CreateEvent (
393 EVT_NOTIFY_SIGNAL | EVT_TIMER,
399 if (EFI_ERROR (Status)) {
406 &gEfiManagedNetworkServiceBindingProtocolGuid,
407 &IpSb->MnpChildHandle
409 if (EFI_ERROR (Status)) {
413 Status =
gBS->OpenProtocol (
414 IpSb->MnpChildHandle,
415 &gEfiManagedNetworkProtocolGuid,
416 (VOID **)(&IpSb->Mnp),
419 EFI_OPEN_PROTOCOL_BY_DRIVER
421 if (EFI_ERROR (Status)) {
426 if (EFI_ERROR (Status)) {
430 Status = IpSb->Mnp->GetModeData (IpSb->Mnp,
NULL, &IpSb->SnpMode);
431 if (EFI_ERROR (Status)) {
440 IpSb->MaxPacketSize -= NET_VLAN_TAG_LEN;
443 IpSb->OldMaxPacketSize = IpSb->MaxPacketSize;
450 if (IpSb->SnpMode.
IfType != NET_IFTYPE_ETHERNET) {
451 Status = EFI_UNSUPPORTED;
456 if (EFI_ERROR (Status)) {
461 if (EFI_ERROR (Status)) {
466 if (EFI_ERROR (Status)) {
471 if (IpSb->DefaultInterface ==
NULL) {
472 Status = EFI_DEVICE_ERROR;
476 Status =
gBS->CreateEvent (
483 if (EFI_ERROR (Status)) {
487 InsertHeadList (&IpSb->Interfaces, &IpSb->DefaultInterface->Link);
530 if (EFI_ERROR (Status)) {
531 DEBUG ((DEBUG_ERROR,
"%a failed to generate random number: %r\n", __func__, Status));
538 Status =
gBS->OpenProtocol (
540 &gEfiIp6ServiceBindingProtocolGuid,
542 This->DriverBindingHandle,
544 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
548 return EFI_ALREADY_STARTED;
551 Status =
Ip6CreateService (ControllerHandle, This->DriverBindingHandle, &IpSb);
553 if (EFI_ERROR (Status)) {
557 ASSERT (IpSb !=
NULL);
559 Ip6Cfg = &IpSb->Ip6ConfigInstance.Ip6Config;
564 Status =
gBS->InstallMultipleProtocolInterfaces (
566 &gEfiIp6ServiceBindingProtocolGuid,
567 &IpSb->ServiceBinding,
568 &gEfiIp6ConfigProtocolGuid,
572 if (EFI_ERROR (Status)) {
581 if (EFI_ERROR (Status)) {
582 goto UNINSTALL_PROTOCOL;
589 if (DataItem->Data.Ptr !=
NULL) {
590 Status = Ip6Cfg->SetData (
596 if ((Status == EFI_INVALID_PARAMETER) || (Status == EFI_BAD_BUFFER_SIZE)) {
600 Status = Ip6Cfg->SetData (
606 DEBUG ((DEBUG_WARN,
"Ip6DriverBindingStart: Clean the invalid ManualAddress configuration.\n"));
614 if (DataItem->Data.Ptr !=
NULL) {
615 Status = Ip6Cfg->SetData (
621 if ((Status == EFI_INVALID_PARAMETER) || (Status == EFI_BAD_BUFFER_SIZE)) {
625 Status = Ip6Cfg->SetData (
631 DEBUG ((DEBUG_WARN,
"Ip6DriverBindingStart: Clean the invalid Gateway configuration.\n"));
639 if (EFI_ERROR (Status)) {
640 goto UNINSTALL_PROTOCOL;
646 Status =
gBS->SetTimer (
649 TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS
651 if (EFI_ERROR (Status)) {
652 goto UNINSTALL_PROTOCOL;
658 Status =
gBS->SetTimer (
661 TICKS_PER_MS * IP6_ONE_SECOND_IN_MS
663 if (EFI_ERROR (Status)) {
664 goto UNINSTALL_PROTOCOL;
675 gBS->UninstallMultipleProtocolInterfaces (
677 &gEfiIp6ServiceBindingProtocolGuid,
678 &IpSb->ServiceBinding,
679 &gEfiIp6ConfigProtocolGuid,
709 UINTN NumberOfChildren;
712 if ((Entry ==
NULL) || (Context ==
NULL)) {
713 return EFI_INVALID_PARAMETER;
716 IpInstance = NET_LIST_USER_STRUCT_S (Entry,
IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);
725 return ServiceBinding->DestroyChild (ServiceBinding, IpInstance->Handle);
762 if (NicHandle ==
NULL) {
764 if (NicHandle !=
NULL) {
771 Status =
gBS->OpenProtocol (
773 &gEfiIp6ServiceBindingProtocolGuid,
774 (VOID **)&ServiceBinding,
775 This->DriverBindingHandle,
777 EFI_OPEN_PROTOCOL_GET_PROTOCOL
779 if (EFI_ERROR (Status)) {
780 return EFI_DEVICE_ERROR;
783 IpSb = IP6_SERVICE_FROM_PROTOCOL (ServiceBinding);
787 gBS->CloseEvent (IpSb->Ip6ConfigInstance.Dhcp6Event);
788 IpSb->Ip6ConfigInstance.Dhcp6Event =
NULL;
789 }
else if (NumberOfChildren != 0) {
793 List = &IpSb->Children;
794 Context.ServiceBinding = ServiceBinding;
795 Context.NumberOfChildren = NumberOfChildren;
796 Context.ChildHandleBuffer = ChildHandleBuffer;
806 if (EFI_ERROR (Status)) {
811 Status =
gBS->UninstallMultipleProtocolInterfaces (
813 &gEfiIp6ServiceBindingProtocolGuid,
815 &gEfiIp6ConfigProtocolGuid,
816 &IpSb->Ip6ConfigInstance.Ip6Config,
856 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
857 return EFI_INVALID_PARAMETER;
860 IpSb = IP6_SERVICE_FROM_PROTOCOL (This);
862 if (IpSb->LinkLocalDadFail) {
863 return EFI_DEVICE_ERROR;
868 if (IpInstance ==
NULL) {
869 return EFI_OUT_OF_RESOURCES;
877 Status =
gBS->InstallMultipleProtocolInterfaces (
879 &gEfiIp6ProtocolGuid,
880 &IpInstance->Ip6Proto,
883 if (EFI_ERROR (Status)) {
887 IpInstance->Handle = *ChildHandle;
892 Status =
gBS->OpenProtocol (
893 IpSb->MnpChildHandle,
894 &gEfiManagedNetworkProtocolGuid,
898 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
900 if (EFI_ERROR (Status)) {
901 gBS->UninstallMultipleProtocolInterfaces (
903 &gEfiIp6ProtocolGuid,
904 &IpInstance->Ip6Proto,
914 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
919 gBS->RestoreTPL (OldTpl);
923 if (EFI_ERROR (Status)) {
961 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
962 return EFI_INVALID_PARAMETER;
968 IpSb = IP6_SERVICE_FROM_PROTOCOL (This);
970 Status =
gBS->OpenProtocol (
972 &gEfiIp6ProtocolGuid,
976 EFI_OPEN_PROTOCOL_GET_PROTOCOL
979 if (EFI_ERROR (Status)) {
980 return EFI_UNSUPPORTED;
983 IpInstance = IP6_INSTANCE_FROM_PROTOCOL (Ip6);
985 if (IpInstance->Service != IpSb) {
986 return EFI_INVALID_PARAMETER;
989 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
997 if (IpInstance->InDestroy) {
998 gBS->RestoreTPL (OldTpl);
1002 IpInstance->InDestroy =
TRUE;
1007 gBS->CloseProtocol (
1008 IpSb->MnpChildHandle,
1009 &gEfiManagedNetworkProtocolGuid,
1028 gBS->RestoreTPL (OldTpl);
1029 Status =
gBS->UninstallProtocolInterface (
1031 &gEfiIp6ProtocolGuid,
1032 &IpInstance->Ip6Proto
1034 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
1035 if (EFI_ERROR (Status)) {
1040 if (EFI_ERROR (Status)) {
1041 gBS->InstallMultipleProtocolInterfaces (
1043 &gEfiIp6ProtocolGuid,
1052 ASSERT (IpSb->NumChildren > 0);
1053 IpSb->NumChildren--;
1055 gBS->RestoreTPL (OldTpl);
1061 gBS->RestoreTPL (OldTpl);
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)
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 ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
struct _EFI_IP6_HEADER EFI_IP6_HEADER
EFI_STATUS Ip6SetToAllNodeMulticast(IN BOOLEAN Router, IN UINT8 Scope, OUT EFI_IPv6_ADDRESS *Ip6Addr)
@ Ip6ConfigDataTypeGateway
@ Ip6ConfigDataTypeManualAddress
VOID Ip6ConfigCleanInstance(IN OUT IP6_CONFIG_INSTANCE *Instance)
EFI_STATUS Ip6ConfigInitInstance(OUT IP6_CONFIG_INSTANCE *Instance)
EFI_STATUS Ip6ConfigDestroyDhcp6(IN OUT IP6_CONFIG_INSTANCE *Instance)
EFI_STATUS Ip6ConfigReadConfigData(IN CHAR16 *VarName, IN OUT IP6_CONFIG_INSTANCE *Instance)
EFI_STATUS EFIAPI Ip6DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID EFIAPI IpSec2InstalledCallback(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI Ip6DriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI Ip6DestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context)
EFI_STATUS EFIAPI Ip6ServiceBindingDestroyChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE ChildHandle)
EFI_STATUS Ip6CreateService(IN EFI_HANDLE Controller, IN EFI_HANDLE ImageHandle, OUT IP6_SERVICE **Service)
EFI_STATUS EFIAPI Ip6ServiceBindingCreateChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE *ChildHandle)
EFI_STATUS Ip6CleanService(IN IP6_SERVICE *IpSb)
EFI_STATUS EFIAPI Ip6DriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI Ip6DriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
EFI_STATUS Ip6ReceiveFrame(IN IP6_FRAME_CALLBACK CallBack, IN IP6_SERVICE *IpSb)
IP6_INTERFACE * Ip6CreateInterface(IN IP6_SERVICE *IpSb, IN BOOLEAN LinkLocal)
VOID EFIAPI Ip6TimerTicking(IN EFI_EVENT Event, IN VOID *Context)
VOID Ip6CleanInterface(IN IP6_INTERFACE *Interface, IN IP6_PROTOCOL *IpInstance OPTIONAL)
VOID EFIAPI Ip6OnFrameReceived(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS Ip6CleanProtocol(IN OUT IP6_PROTOCOL *IpInstance)
EFI_STATUS Ip6ServiceConfigMnp(IN IP6_SERVICE *IpSb, IN BOOLEAN Force)
VOID Ip6InitProtocol(IN IP6_SERVICE *IpSb, IN OUT IP6_PROTOCOL *IpInstance)
EFI_STATUS Ip6LeaveGroup(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Address)
EFI_STATUS Ip6InitMld(IN IP6_SERVICE *IpSb)
VOID Ip6CleanDefaultRouterList(IN IP6_SERVICE *IpSb)
VOID Ip6CleanPrefixListTable(IN IP6_SERVICE *IpSb, IN LIST_ENTRY *ListHead)
EFI_STATUS Ip6UpdateReachableTime(IN OUT IP6_SERVICE *IpSb)
VOID EFIAPI Ip6NdFasterTimerTicking(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS Ip6FreeNeighborEntry(IN IP6_SERVICE *IpSb, IN IP6_NEIGHBOR_ENTRY *NeighborCache, IN BOOLEAN SendIcmpError, IN BOOLEAN FullFree, IN EFI_STATUS IoStatus, IN IP6_FRAME_TO_CANCEL FrameToCancel OPTIONAL, IN VOID *Context OPTIONAL)
VOID Ip6CleanRouteTable(IN OUT IP6_ROUTE_TABLE *RtTable)
IP6_ROUTE_TABLE * Ip6CreateRouteTable(VOID)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
EFI_STATUS EFIAPI NetLibGetMacString(IN EFI_HANDLE ServiceHandle, IN EFI_HANDLE ImageHandle OPTIONAL, OUT CHAR16 **MacString)
EFI_STATUS EFIAPI NetLibCreateServiceChild(IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_GUID *ServiceBindingGuid, IN OUT EFI_HANDLE *ChildHandle)
EFI_STATUS EFIAPI NetLibDestroyServiceChild(IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_GUID *ServiceBindingGuid, IN EFI_HANDLE ChildHandle)
BOOLEAN EFIAPI NetIsInHandleBuffer(IN EFI_HANDLE Handle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
EFI_STATUS EFIAPI PseudoRandomU32(OUT UINT32 *Output)
EFI_HANDLE EFIAPI NetLibGetNicHandle(IN EFI_HANDLE Controller, IN EFI_GUID *ProtocolGuid)
EFI_STATUS EFIAPI NetDestroyLinkList(IN LIST_ENTRY *List, IN NET_DESTROY_LINK_LIST_CALLBACK CallBack, IN VOID *Context OPTIONAL, OUT UINTN *ListLength OPTIONAL)
UINT16 EFIAPI NetLibGetVlanId(IN EFI_HANDLE ServiceHandle)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
VOID EFIAPI Exit(IN EFI_STATUS Status)
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
EFI_HANDLE DriverBindingHandle
EFI_MANAGED_NETWORK_RECEIVE_DATA * RxData
BOOLEAN EnableBroadcastReceive
BOOLEAN EnableMulticastReceive
BOOLEAN FlushQueuesOnReset
UINT32 ReceivedQueueTimeoutValue
UINT16 ProtocolTypeFilter
UINT32 TransmitQueueTimeoutValue
BOOLEAN DisableBackgroundPolling
BOOLEAN EnableUnicastReceive
BOOLEAN EnablePromiscuousReceive
BOOLEAN EnableReceiveTimestamps