TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip6Impl.c
Go to the documentation of this file.
1
11#include "Ip6Impl.h"
12
14
15EFI_IP6_PROTOCOL mEfiIp6ProtocolTemplete = {
25};
26
45EFIAPI
47 IN EFI_IP6_PROTOCOL *This,
48 OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
49 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
50 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
51 )
52{
53 IP6_PROTOCOL *IpInstance;
54 IP6_SERVICE *IpSb;
55 IP6_INTERFACE *IpIf;
56 EFI_IP6_CONFIG_DATA *Config;
57 EFI_STATUS Status;
58 EFI_TPL OldTpl;
59
60 if (This == NULL) {
61 return EFI_INVALID_PARAMETER;
62 }
63
64 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
65 IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
66 IpSb = IpInstance->Service;
67 IpIf = IpInstance->Interface;
68
69 if (IpSb->LinkLocalDadFail) {
70 return EFI_INVALID_PARAMETER;
71 }
72
73 if (Ip6ModeData != NULL) {
74 //
75 // IsStarted is "whether the EfiIp6Configure has been called".
76 // IsConfigured is "whether the station address has been configured"
77 //
78 Ip6ModeData->IsStarted = (BOOLEAN)(IpInstance->State == IP6_STATE_CONFIGED);
79 Ip6ModeData->MaxPacketSize = IpSb->MaxPacketSize;
80 CopyMem (&Ip6ModeData->ConfigData, &IpInstance->ConfigData, sizeof (EFI_IP6_CONFIG_DATA));
81 Ip6ModeData->IsConfigured = FALSE;
82
83 Ip6ModeData->AddressCount = 0;
84 Ip6ModeData->AddressList = NULL;
85
86 Ip6ModeData->GroupCount = IpInstance->GroupCount;
87 Ip6ModeData->GroupTable = NULL;
88
89 Ip6ModeData->RouteCount = 0;
90 Ip6ModeData->RouteTable = NULL;
91
92 Ip6ModeData->NeighborCount = 0;
93 Ip6ModeData->NeighborCache = NULL;
94
95 Ip6ModeData->PrefixCount = 0;
96 Ip6ModeData->PrefixTable = NULL;
97
98 Ip6ModeData->IcmpTypeCount = 23;
99 Ip6ModeData->IcmpTypeList = AllocateCopyPool (
100 Ip6ModeData->IcmpTypeCount * sizeof (EFI_IP6_ICMP_TYPE),
101 mIp6SupportedIcmp
102 );
103 if (Ip6ModeData->IcmpTypeList == NULL) {
104 Status = EFI_OUT_OF_RESOURCES;
105 goto Error;
106 }
107
108 //
109 // Return the currently configured IPv6 addresses and corresponding prefix lengths.
110 //
111 Status = Ip6BuildEfiAddressList (
112 IpSb,
113 &Ip6ModeData->AddressCount,
114 &Ip6ModeData->AddressList
115 );
116 if (EFI_ERROR (Status)) {
117 goto Error;
118 }
119
120 //
121 // Return the current station address for this IP child.
122 // If UseAnyStationAddress is set to TRUE, IP6 driver will
123 // select a source address from its address list. Otherwise use the
124 // StationAddress in config data.
125 //
126 if (Ip6ModeData->IsStarted) {
127 Config = &Ip6ModeData->ConfigData;
128
129 if (IpIf->Configured || NetIp6IsUnspecifiedAddr (&Config->DestinationAddress)) {
130 Ip6ModeData->IsConfigured = TRUE;
131 } else {
132 Ip6ModeData->IsConfigured = FALSE;
133 }
134
135 //
136 // Build a EFI route table for user from the internal route table.
137 //
138 Status = Ip6BuildEfiRouteTable (
139 IpSb->RouteTable,
140 &Ip6ModeData->RouteCount,
141 &Ip6ModeData->RouteTable
142 );
143
144 if (EFI_ERROR (Status)) {
145 goto Error;
146 }
147 }
148
149 if (Ip6ModeData->IsConfigured) {
150 //
151 // Return the joined multicast group addresses.
152 //
153 if (IpInstance->GroupCount != 0) {
154 Ip6ModeData->GroupTable = AllocateCopyPool (
155 IpInstance->GroupCount * sizeof (EFI_IPv6_ADDRESS),
156 IpInstance->GroupList
157 );
158 if (Ip6ModeData->GroupTable == NULL) {
159 Status = EFI_OUT_OF_RESOURCES;
160 goto Error;
161 }
162 }
163
164 //
165 // Return the neighbor cache entries
166 //
167 Status = Ip6BuildEfiNeighborCache (
168 IpInstance,
169 &Ip6ModeData->NeighborCount,
170 &Ip6ModeData->NeighborCache
171 );
172 if (EFI_ERROR (Status)) {
173 goto Error;
174 }
175
176 //
177 // Return the prefix table entries
178 //
179 Status = Ip6BuildPrefixTable (
180 IpInstance,
181 &Ip6ModeData->PrefixCount,
182 &Ip6ModeData->PrefixTable
183 );
184 if (EFI_ERROR (Status)) {
185 goto Error;
186 }
187 }
188 }
189
190 //
191 // Get fresh mode data from MNP, since underlying media status may change
192 //
193 Status = IpSb->Mnp->GetModeData (IpSb->Mnp, MnpConfigData, SnpModeData);
194
195 goto Exit;
196
197Error:
198 if (Ip6ModeData != NULL) {
199 if (Ip6ModeData->AddressList != NULL) {
200 FreePool (Ip6ModeData->AddressList);
201 }
202
203 if (Ip6ModeData->GroupTable != NULL) {
204 FreePool (Ip6ModeData->GroupTable);
205 }
206
207 if (Ip6ModeData->RouteTable != NULL) {
208 FreePool (Ip6ModeData->RouteTable);
209 }
210
211 if (Ip6ModeData->NeighborCache != NULL) {
212 FreePool (Ip6ModeData->NeighborCache);
213 }
214
215 if (Ip6ModeData->PrefixTable != NULL) {
216 FreePool (Ip6ModeData->PrefixTable);
217 }
218
219 if (Ip6ModeData->IcmpTypeList != NULL) {
220 FreePool (Ip6ModeData->IcmpTypeList);
221 }
222 }
223
224Exit:
225 gBS->RestoreTPL (OldTpl);
226 return Status;
227}
228
243BOOLEAN
245 IN IP6_SERVICE *IpSb,
247 IN BOOLEAN Flag
248 )
249{
250 if (!NetIp6IsUnspecifiedAddr (Ip)) {
251 if (!NetIp6IsValidUnicast (Ip)) {
252 return FALSE;
253 }
254
255 if (Ip6IsOneOfSetAddress (IpSb, Ip, NULL, NULL)) {
256 return Flag;
257 }
258 } else {
259 return Flag;
260 }
261
262 return (BOOLEAN) !Flag;
263}
264
275BOOLEAN
277 IN UINT8 Protocol
278 )
279{
280 if ((Protocol == IP6_HOP_BY_HOP) || (Protocol == EFI_IP_PROTO_ICMP) || (Protocol == IP4_PROTO_IGMP)) {
281 return TRUE;
282 }
283
284 if ((Protocol == 41) || (Protocol == 43) || (Protocol == 44) || (Protocol == 59) || (Protocol == 60) || (Protocol == 124)) {
285 return TRUE;
286 }
287
288 return FALSE;
289}
290
298VOID
300 IN IP6_SERVICE *IpSb,
301 IN OUT IP6_PROTOCOL *IpInstance
302 )
303{
304 ASSERT ((IpSb != NULL) && (IpInstance != NULL));
305
306 ZeroMem (IpInstance, sizeof (IP6_PROTOCOL));
307
308 IpInstance->Signature = IP6_PROTOCOL_SIGNATURE;
309 IpInstance->State = IP6_STATE_UNCONFIGED;
310 IpInstance->Service = IpSb;
311 IpInstance->GroupList = NULL;
312 CopyMem (&IpInstance->Ip6Proto, &mEfiIp6ProtocolTemplete, sizeof (EFI_IP6_PROTOCOL));
313
314 NetMapInit (&IpInstance->RxTokens);
315 NetMapInit (&IpInstance->TxTokens);
316 InitializeListHead (&IpInstance->Received);
317 InitializeListHead (&IpInstance->Delivered);
318
319 EfiInitializeLock (&IpInstance->RecycleLock, TPL_NOTIFY);
320}
321
344 IN OUT IP6_PROTOCOL *IpInstance,
345 IN EFI_IP6_CONFIG_DATA *Config
346 )
347{
348 IP6_SERVICE *IpSb;
349 IP6_INTERFACE *IpIf;
350 EFI_STATUS Status;
351 EFI_IP6_CONFIG_DATA *Current;
352 IP6_ADDRESS_INFO *AddressInfo;
353 BOOLEAN StationZero;
354 BOOLEAN DestZero;
355 EFI_IPv6_ADDRESS Source;
356 BOOLEAN AddrOk;
357
358 IpSb = IpInstance->Service;
359 Current = &IpInstance->ConfigData;
360
361 //
362 // User is changing packet filters. It must be stopped
363 // before the station address can be changed.
364 //
365 if (IpInstance->State == IP6_STATE_CONFIGED) {
366 //
367 // Cancel all the pending transmit/receive from upper layer
368 //
369 Status = Ip6Cancel (IpInstance, NULL);
370
371 if (EFI_ERROR (Status)) {
372 return EFI_DEVICE_ERROR;
373 }
374
375 CopyMem (Current, Config, sizeof (EFI_IP6_CONFIG_DATA));
376 return EFI_SUCCESS;
377 }
378
379 //
380 // Set up the interface.
381 //
382 StationZero = NetIp6IsUnspecifiedAddr (&Config->StationAddress);
383 DestZero = NetIp6IsUnspecifiedAddr (&Config->DestinationAddress);
384
385 if (StationZero && DestZero) {
386 //
387 // StationAddress is still zero.
388 //
389
390 NET_GET_REF (IpSb->DefaultInterface);
391 IpInstance->Interface = IpSb->DefaultInterface;
392 InsertTailList (&IpSb->DefaultInterface->IpInstances, &IpInstance->AddrLink);
393
394 CopyMem (Current, Config, sizeof (EFI_IP6_CONFIG_DATA));
395 IpInstance->State = IP6_STATE_CONFIGED;
396
397 return EFI_SUCCESS;
398 }
399
400 if (StationZero && !DestZero) {
401 Status = Ip6SelectSourceAddress (IpSb, &Config->DestinationAddress, &Source);
402 if (EFI_ERROR (Status)) {
403 return Status;
404 }
405 } else {
406 IP6_COPY_ADDRESS (&Source, &Config->StationAddress);
407 }
408
409 AddrOk = Ip6IsOneOfSetAddress (IpSb, &Source, &IpIf, &AddressInfo);
410 if (AddrOk) {
411 if (AddressInfo != NULL) {
412 IpInstance->PrefixLength = AddressInfo->PrefixLength;
413 } else {
414 IpInstance->PrefixLength = IP6_LINK_LOCAL_PREFIX_LENGTH;
415 }
416 } else {
417 //
418 // The specified source address is not one of the addresses IPv6 maintains.
419 //
420 return EFI_INVALID_PARAMETER;
421 }
422
423 NET_GET_REF (IpIf);
424 IpInstance->Interface = IpIf;
425 InsertTailList (&IpIf->IpInstances, &IpInstance->AddrLink);
426
427 CopyMem (Current, Config, sizeof (EFI_IP6_CONFIG_DATA));
428 IP6_COPY_ADDRESS (&Current->StationAddress, &Source);
429 IpInstance->State = IP6_STATE_CONFIGED;
430
431 return EFI_SUCCESS;
432}
433
445 IN OUT IP6_PROTOCOL *IpInstance
446 )
447{
448 if (EFI_ERROR (Ip6Cancel (IpInstance, NULL))) {
449 return EFI_DEVICE_ERROR;
450 }
451
452 if (EFI_ERROR (Ip6Groups (IpInstance, FALSE, NULL))) {
453 return EFI_DEVICE_ERROR;
454 }
455
456 //
457 // Some packets haven't been recycled. It is because either the
458 // user forgets to recycle the packets, or because the callback
459 // hasn't been called. Just leave it alone.
460 //
461 if (!IsListEmpty (&IpInstance->Delivered)) {
462 }
463
464 if (IpInstance->Interface != NULL) {
465 RemoveEntryList (&IpInstance->AddrLink);
466 Ip6CleanInterface (IpInstance->Interface, IpInstance);
467 IpInstance->Interface = NULL;
468 }
469
470 if (IpInstance->GroupList != NULL) {
471 FreePool (IpInstance->GroupList);
472 IpInstance->GroupList = NULL;
473 IpInstance->GroupCount = 0;
474 }
475
476 NetMapClean (&IpInstance->TxTokens);
477
478 NetMapClean (&IpInstance->RxTokens);
479
480 return EFI_SUCCESS;
481}
482
503 IN IP6_SERVICE *IpSb,
504 IN BOOLEAN Force
505 )
506{
507 LIST_ENTRY *Entry;
508 LIST_ENTRY *ProtoEntry;
509 IP6_INTERFACE *IpIf;
510 IP6_PROTOCOL *IpInstance;
511 BOOLEAN Reconfig;
512 BOOLEAN PromiscReceive;
513 EFI_STATUS Status;
514
515 Reconfig = FALSE;
516 PromiscReceive = FALSE;
517
518 if (!Force) {
519 //
520 // Iterate through the IP children to check whether promiscuous
521 // receive setting has been changed. Update the interface's receive
522 // filter also.
523 //
524 NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
525 IpIf = NET_LIST_USER_STRUCT (Entry, IP6_INTERFACE, Link);
526 IpIf->PromiscRecv = FALSE;
527
528 NET_LIST_FOR_EACH (ProtoEntry, &IpIf->IpInstances) {
529 IpInstance = NET_LIST_USER_STRUCT (ProtoEntry, IP6_PROTOCOL, AddrLink);
530
531 if (IpInstance->ConfigData.AcceptPromiscuous) {
532 IpIf->PromiscRecv = TRUE;
533 PromiscReceive = TRUE;
534 }
535 }
536 }
537
538 //
539 // If promiscuous receive isn't changed, it isn't necessary to reconfigure.
540 //
541 if (PromiscReceive == IpSb->MnpConfigData.EnablePromiscuousReceive) {
542 return EFI_SUCCESS;
543 }
544
545 Reconfig = TRUE;
546 IpSb->MnpConfigData.EnablePromiscuousReceive = PromiscReceive;
547 }
548
549 Status = IpSb->Mnp->Configure (IpSb->Mnp, &IpSb->MnpConfigData);
550
551 //
552 // recover the original configuration if failed to set the configure.
553 //
554 if (EFI_ERROR (Status) && Reconfig) {
555 IpSb->MnpConfigData.EnablePromiscuousReceive = (BOOLEAN) !PromiscReceive;
556 }
557
558 return Status;
559}
560
609EFIAPI
611 IN EFI_IP6_PROTOCOL *This,
612 IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL
613 )
614{
615 IP6_PROTOCOL *IpInstance;
616 EFI_IP6_CONFIG_DATA *Current;
617 EFI_TPL OldTpl;
618 EFI_STATUS Status;
619 IP6_SERVICE *IpSb;
620
621 //
622 // First, validate the parameters
623 //
624 if (This == NULL) {
625 return EFI_INVALID_PARAMETER;
626 }
627
628 IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
629 IpSb = IpInstance->Service;
630
631 if (IpSb->LinkLocalDadFail && (Ip6ConfigData != NULL)) {
632 return EFI_DEVICE_ERROR;
633 }
634
635 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
636
637 Status = EFI_INVALID_PARAMETER;
638
639 //
640 // Validate the configuration first.
641 //
642 if (Ip6ConfigData != NULL) {
643 //
644 // Check whether the station address is valid.
645 //
646 if (!Ip6IsValidAddress (IpSb, &Ip6ConfigData->StationAddress, TRUE)) {
647 goto Exit;
648 }
649
650 //
651 // Check whether the default protocol is valid.
652 //
653 if (Ip6IsIllegalProtocol (Ip6ConfigData->DefaultProtocol)) {
654 goto Exit;
655 }
656
657 //
658 // User can only update packet filters when already configured.
659 // If it wants to change the station address, it must configure(NULL)
660 // the instance firstly.
661 //
662 if (IpInstance->State == IP6_STATE_CONFIGED) {
663 Current = &IpInstance->ConfigData;
664
665 if (!EFI_IP6_EQUAL (&Current->StationAddress, &Ip6ConfigData->StationAddress)) {
666 Status = EFI_ALREADY_STARTED;
667 goto Exit;
668 }
669
670 if (NetIp6IsUnspecifiedAddr (&Current->StationAddress) && IP6_NO_MAPPING (IpInstance)) {
671 Status = EFI_NO_MAPPING;
672 goto Exit;
673 }
674 }
675 }
676
677 //
678 // Configure the instance or clean it up.
679 //
680 if (Ip6ConfigData != NULL) {
681 Status = Ip6ConfigProtocol (IpInstance, Ip6ConfigData);
682 } else {
683 Status = Ip6CleanProtocol (IpInstance);
684
685 //
686 // Don't change the state if it is DESTROY, consider the following
687 // valid sequence: Mnp is unloaded-->Ip Stopped-->Udp Stopped,
688 // Configure (ThisIp, NULL). If the state is changed to UNCONFIGED,
689 // the unload fails miserably.
690 //
691 if (IpInstance->State == IP6_STATE_CONFIGED) {
692 IpInstance->State = IP6_STATE_UNCONFIGED;
693 }
694 }
695
696 //
697 // Update the MNP's configure data. Ip6ServiceConfigMnp will check
698 // whether it is necessary to reconfigure the MNP.
699 //
700 Ip6ServiceConfigMnp (IpInstance->Service, FALSE);
701
702Exit:
703 gBS->RestoreTPL (OldTpl);
704 return Status;
705}
706
739EFIAPI
741 IN EFI_IP6_PROTOCOL *This,
742 IN BOOLEAN JoinFlag,
743 IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL
744 )
745{
746 EFI_TPL OldTpl;
747 EFI_STATUS Status;
748 IP6_PROTOCOL *IpInstance;
749 IP6_SERVICE *IpSb;
750
751 if ((This == NULL) || (JoinFlag && (GroupAddress == NULL))) {
752 return EFI_INVALID_PARAMETER;
753 }
754
755 if ((GroupAddress != NULL) && !IP6_IS_MULTICAST (GroupAddress)) {
756 return EFI_INVALID_PARAMETER;
757 }
758
759 IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
760 IpSb = IpInstance->Service;
761
762 if (IpSb->LinkLocalDadFail) {
763 return EFI_DEVICE_ERROR;
764 }
765
766 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
767
768 if (IpInstance->State != IP6_STATE_CONFIGED) {
769 Status = EFI_NOT_STARTED;
770 goto ON_EXIT;
771 }
772
773 Status = Ip6Groups (IpInstance, JoinFlag, GroupAddress);
774
775ON_EXIT:
776 gBS->RestoreTPL (OldTpl);
777 return Status;
778}
779
824EFIAPI
826 IN EFI_IP6_PROTOCOL *This,
827 IN BOOLEAN DeleteRoute,
828 IN EFI_IPv6_ADDRESS *Destination OPTIONAL,
829 IN UINT8 PrefixLength,
830 IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL
831 )
832{
833 IP6_PROTOCOL *IpInstance;
834 EFI_STATUS Status;
835 EFI_TPL OldTpl;
836 IP6_SERVICE *IpSb;
837
838 if ((This == NULL) || (PrefixLength > IP6_PREFIX_MAX)) {
839 return EFI_INVALID_PARAMETER;
840 }
841
842 IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
843 IpSb = IpInstance->Service;
844
845 if (IpSb->LinkLocalDadFail) {
846 return EFI_DEVICE_ERROR;
847 }
848
849 if (IpInstance->State != IP6_STATE_CONFIGED) {
850 return EFI_NOT_STARTED;
851 }
852
853 if (DeleteRoute && (Destination == NULL) && (GatewayAddress == NULL)) {
854 return EFI_INVALID_PARAMETER;
855 }
856
857 if (!DeleteRoute && ((Destination == NULL) || (GatewayAddress == NULL))) {
858 return EFI_INVALID_PARAMETER;
859 }
860
861 if (GatewayAddress != NULL) {
862 if (!Ip6IsValidAddress (IpSb, GatewayAddress, FALSE)) {
863 return EFI_INVALID_PARAMETER;
864 }
865
866 if (!NetIp6IsUnspecifiedAddr (GatewayAddress) &&
867 !NetIp6IsNetEqual (GatewayAddress, &IpInstance->ConfigData.StationAddress, PrefixLength)
868 )
869 {
870 return EFI_INVALID_PARAMETER;
871 }
872 }
873
874 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
875
876 //
877 // Update the route table
878 //
879 if (DeleteRoute) {
880 Status = Ip6DelRoute (IpSb->RouteTable, Destination, PrefixLength, GatewayAddress);
881 } else {
882 Status = Ip6AddRoute (IpSb->RouteTable, Destination, PrefixLength, GatewayAddress);
883 }
884
885 gBS->RestoreTPL (OldTpl);
886 return Status;
887}
888
936EFIAPI
938 IN EFI_IP6_PROTOCOL *This,
939 IN BOOLEAN DeleteFlag,
940 IN EFI_IPv6_ADDRESS *TargetIp6Address,
941 IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,
942 IN UINT32 Timeout,
943 IN BOOLEAN Override
944 )
945{
946 EFI_TPL OldTpl;
947 EFI_STATUS Status;
948 IP6_PROTOCOL *IpInstance;
949 IP6_SERVICE *IpSb;
950
951 if ((This == NULL) || (TargetIp6Address == NULL)) {
952 return EFI_INVALID_PARAMETER;
953 }
954
955 if (NetIp6IsUnspecifiedAddr (TargetIp6Address)) {
956 return EFI_INVALID_PARAMETER;
957 }
958
959 IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
960 IpSb = IpInstance->Service;
961
962 if (IpSb->LinkLocalDadFail) {
963 return EFI_DEVICE_ERROR;
964 }
965
966 if (!Ip6IsValidAddress (IpSb, TargetIp6Address, FALSE)) {
967 return EFI_INVALID_PARAMETER;
968 }
969
970 if (TargetLinkAddress != NULL) {
971 if (!Ip6IsValidLinkAddress (IpSb, TargetLinkAddress)) {
972 return EFI_INVALID_PARAMETER;
973 }
974 }
975
976 if (Ip6IsOneOfSetAddress (IpSb, TargetIp6Address, NULL, NULL)) {
977 return EFI_INVALID_PARAMETER;
978 }
979
980 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
981 if (IpInstance->State != IP6_STATE_CONFIGED) {
982 Status = EFI_NOT_STARTED;
983 goto Exit;
984 }
985
986 if (DeleteFlag) {
987 Status = Ip6DelNeighbor (IpInstance->Service, TargetIp6Address, TargetLinkAddress, Timeout, Override);
988 } else {
989 Status = Ip6AddNeighbor (IpInstance->Service, TargetIp6Address, TargetLinkAddress, Timeout, Override);
990 }
991
992Exit:
993 gBS->RestoreTPL (OldTpl);
994 return Status;
995}
996
1012EFIAPI
1014 IN NET_MAP *Map,
1015 IN NET_MAP_ITEM *Item,
1016 IN VOID *Context
1017 )
1018{
1020 EFI_IP6_COMPLETION_TOKEN *TokenInItem;
1021
1022 Token = (EFI_IP6_COMPLETION_TOKEN *)Context;
1023 TokenInItem = (EFI_IP6_COMPLETION_TOKEN *)Item->Key;
1024
1025 if ((Token == TokenInItem) || (Token->Event == TokenInItem->Event)) {
1026 return EFI_ACCESS_DENIED;
1027 }
1028
1029 return EFI_SUCCESS;
1030}
1031
1045 )
1046{
1047 EFI_IP6_TRANSMIT_DATA *TxData;
1048 UINT32 Index;
1049 UINT32 DataLength;
1050
1051 if ((Token == NULL) || (Token->Event == NULL)) {
1052 return EFI_INVALID_PARAMETER;
1053 }
1054
1055 TxData = Token->Packet.TxData;
1056
1057 if ((TxData == NULL) || ((TxData->ExtHdrsLength != 0) && (TxData->ExtHdrs == NULL))) {
1058 return EFI_INVALID_PARAMETER;
1059 }
1060
1061 if ((TxData->FragmentCount == 0) || (TxData->DataLength == 0)) {
1062 return EFI_INVALID_PARAMETER;
1063 }
1064
1065 for (DataLength = 0, Index = 0; Index < TxData->FragmentCount; Index++) {
1066 if ((TxData->FragmentTable[Index].FragmentLength == 0) || (TxData->FragmentTable[Index].FragmentBuffer == NULL)) {
1067 return EFI_INVALID_PARAMETER;
1068 }
1069
1070 DataLength += TxData->FragmentTable[Index].FragmentLength;
1071 }
1072
1073 if (TxData->DataLength != DataLength) {
1074 return EFI_INVALID_PARAMETER;
1075 }
1076
1077 //
1078 // TODO: Token.Packet.TxData.DataLength is too short to transmit.
1079 // return EFI_BUFFER_TOO_SMALL;
1080 //
1081
1082 //
1083 // If Token.Packet.TxData.DataLength is beyond the maximum that which can be
1084 // described through the Fragment Offset field in Fragment header when performing
1085 // fragmentation.
1086 //
1087 if (TxData->DataLength > 64 * 1024) {
1088 return EFI_BAD_BUFFER_SIZE;
1089 }
1090
1091 return EFI_SUCCESS;
1092}
1093
1115VOID
1116EFIAPI
1118 IN VOID *Context
1119 )
1120{
1121 IP6_TXTOKEN_WRAP *Wrap;
1122 NET_MAP_ITEM *Item;
1123
1124 Wrap = (IP6_TXTOKEN_WRAP *)Context;
1125
1126 //
1127 // Signal IpSecRecycleEvent to inform IPsec free the memory
1128 //
1129 if (Wrap->IpSecRecycleSignal != NULL) {
1130 gBS->SignalEvent (Wrap->IpSecRecycleSignal);
1131 }
1132
1133 //
1134 // Find the token in the instance's map. EfiIp6Transmit put the
1135 // token to the map. If that failed, NetMapFindKey will return NULL.
1136 //
1137 Item = NetMapFindKey (&Wrap->IpInstance->TxTokens, Wrap->Token);
1138
1139 if (Item != NULL) {
1140 NetMapRemoveItem (&Wrap->IpInstance->TxTokens, Item, NULL);
1141 }
1142
1143 if (Wrap->Sent) {
1144 gBS->SignalEvent (Wrap->Token->Event);
1145
1146 //
1147 // Dispatch the DPC queued by the NotifyFunction of Token->Event.
1148 //
1149 DispatchDpc ();
1150 }
1151
1152 FreePool (Wrap);
1153}
1154
1164VOID
1166 IN NET_BUF *Packet,
1167 IN EFI_STATUS IoStatus,
1168 IN UINT32 Flag,
1169 IN VOID *Context
1170 )
1171{
1172 IP6_TXTOKEN_WRAP *Wrap;
1173
1174 //
1175 // This is the transmission request from upper layer,
1176 // not the IP6 driver itself.
1177 //
1178 Wrap = (IP6_TXTOKEN_WRAP *)Context;
1179 Wrap->Token->Status = IoStatus;
1180
1181 NetbufFree (Wrap->Packet);
1182}
1183
1237EFIAPI
1239 IN EFI_IP6_PROTOCOL *This,
1241 )
1242{
1243 IP6_SERVICE *IpSb;
1244 IP6_PROTOCOL *IpInstance;
1245 EFI_IP6_CONFIG_DATA *Config;
1246 EFI_STATUS Status;
1247 EFI_TPL OldTpl;
1248 EFI_IP6_HEADER Head;
1249 EFI_IP6_TRANSMIT_DATA *TxData;
1250 EFI_IP6_OVERRIDE_DATA *Override;
1251 IP6_TXTOKEN_WRAP *Wrap;
1252 UINT8 *ExtHdrs;
1253
1254 //
1255 // Check input parameters.
1256 //
1257 if (This == NULL) {
1258 return EFI_INVALID_PARAMETER;
1259 }
1260
1261 ExtHdrs = NULL;
1262
1263 Status = Ip6TxTokenValid (Token);
1264 if (EFI_ERROR (Status)) {
1265 return Status;
1266 }
1267
1268 IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
1269 IpSb = IpInstance->Service;
1270
1271 if (IpSb->LinkLocalDadFail) {
1272 return EFI_DEVICE_ERROR;
1273 }
1274
1275 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
1276
1277 if (IpInstance->State != IP6_STATE_CONFIGED) {
1278 Status = EFI_NOT_STARTED;
1279 goto Exit;
1280 }
1281
1282 Config = &IpInstance->ConfigData;
1283
1284 //
1285 // Check whether the token or signal already existed.
1286 //
1287 if (EFI_ERROR (NetMapIterate (&IpInstance->TxTokens, Ip6TokenExist, Token))) {
1288 Status = EFI_ACCESS_DENIED;
1289 goto Exit;
1290 }
1291
1292 //
1293 // Build the IP header, fill in the information from ConfigData or OverrideData
1294 //
1295 ZeroMem (&Head, sizeof (EFI_IP6_HEADER));
1296 TxData = Token->Packet.TxData;
1297 IP6_COPY_ADDRESS (&Head.SourceAddress, &Config->StationAddress);
1298 IP6_COPY_ADDRESS (&Head.DestinationAddress, &Config->DestinationAddress);
1299
1300 Status = EFI_INVALID_PARAMETER;
1301
1304 goto Exit;
1305 }
1306
1307 ASSERT (!NetIp6IsUnspecifiedAddr (&Config->StationAddress));
1308 } else {
1309 //
1310 // StationAddress is unspecified only when ConfigData.Dest is unspecified.
1311 // Use TxData.Dest to override the DestinationAddress.
1312 //
1314 goto Exit;
1315 }
1316
1317 if (NetIp6IsUnspecifiedAddr (&Config->StationAddress)) {
1318 Status = Ip6SelectSourceAddress (
1319 IpSb,
1320 &TxData->DestinationAddress,
1321 &Head.SourceAddress
1322 );
1323 if (EFI_ERROR (Status)) {
1324 goto Exit;
1325 }
1326 }
1327
1328 IP6_COPY_ADDRESS (&Head.DestinationAddress, &TxData->DestinationAddress);
1329 }
1330
1331 //
1332 // Fill in Head infos.
1333 //
1334 Head.NextHeader = Config->DefaultProtocol;
1335 if (TxData->ExtHdrsLength != 0) {
1336 Head.NextHeader = TxData->NextHeader;
1337 }
1338
1339 if (TxData->OverrideData != NULL) {
1340 Override = TxData->OverrideData;
1341 Head.NextHeader = Override->Protocol;
1342 Head.HopLimit = Override->HopLimit;
1343 Head.FlowLabelL = HTONS ((UINT16)Override->FlowLabel);
1344 Head.FlowLabelH = (UINT8)((Override->FlowLabel >> 16) & 0x0F);
1345 } else {
1346 Head.HopLimit = Config->HopLimit;
1347 Head.FlowLabelL = HTONS ((UINT16)Config->FlowLabel);
1348 Head.FlowLabelH = (UINT8)((Config->FlowLabel >> 16) & 0x0F);
1349 }
1350
1351 Head.PayloadLength = HTONS ((UINT16)(TxData->ExtHdrsLength + TxData->DataLength));
1352
1353 //
1354 // OK, it survives all the validation check. Wrap the token in
1355 // a IP6_TXTOKEN_WRAP and the data in a netbuf
1356 //
1357 Status = EFI_OUT_OF_RESOURCES;
1358 Wrap = AllocateZeroPool (sizeof (IP6_TXTOKEN_WRAP));
1359 if (Wrap == NULL) {
1360 goto Exit;
1361 }
1362
1363 Wrap->IpInstance = IpInstance;
1364 Wrap->Token = Token;
1365 Wrap->Sent = FALSE;
1366 Wrap->Life = IP6_US_TO_SEC (Config->TransmitTimeout);
1367 Wrap->Packet = NetbufFromExt (
1368 (NET_FRAGMENT *)TxData->FragmentTable,
1369 TxData->FragmentCount,
1370 IP6_MAX_HEADLEN,
1371 0,
1373 Wrap
1374 );
1375
1376 if (Wrap->Packet == NULL) {
1377 FreePool (Wrap);
1378 goto Exit;
1379 }
1380
1381 Token->Status = EFI_NOT_READY;
1382
1383 Status = NetMapInsertTail (&IpInstance->TxTokens, Token, Wrap);
1384 if (EFI_ERROR (Status)) {
1385 //
1386 // NetbufFree will call Ip6FreeTxToken, which in turn will
1387 // free the IP6_TXTOKEN_WRAP. Now, the token wrap hasn't been
1388 // enqueued.
1389 //
1390 NetbufFree (Wrap->Packet);
1391 goto Exit;
1392 }
1393
1394 //
1395 // Allocate a new buffer to store IPv6 extension headers to avoid updating
1396 // the original data in EFI_IP6_COMPLETION_TOKEN.
1397 //
1398 if ((TxData->ExtHdrsLength != 0) && (TxData->ExtHdrs != NULL)) {
1399 ExtHdrs = (UINT8 *)AllocateCopyPool (TxData->ExtHdrsLength, TxData->ExtHdrs);
1400 if (ExtHdrs == NULL) {
1401 Status = EFI_OUT_OF_RESOURCES;
1402 goto Exit;
1403 }
1404 }
1405
1406 //
1407 // Mark the packet sent before output it. Mark it not sent again if the
1408 // returned status is not EFI_SUCCESS;
1409 //
1410 Wrap->Sent = TRUE;
1411
1412 Status = Ip6Output (
1413 IpSb,
1414 NULL,
1415 IpInstance,
1416 Wrap->Packet,
1417 &Head,
1418 ExtHdrs,
1419 TxData->ExtHdrsLength,
1421 Wrap
1422 );
1423 if (EFI_ERROR (Status)) {
1424 Wrap->Sent = FALSE;
1425 NetbufFree (Wrap->Packet);
1426 }
1427
1428Exit:
1429 gBS->RestoreTPL (OldTpl);
1430
1431 if (ExtHdrs != NULL) {
1432 FreePool (ExtHdrs);
1433 }
1434
1435 return Status;
1436}
1437
1480EFIAPI
1482 IN EFI_IP6_PROTOCOL *This,
1484 )
1485{
1486 IP6_PROTOCOL *IpInstance;
1487 EFI_STATUS Status;
1488 EFI_TPL OldTpl;
1489 IP6_SERVICE *IpSb;
1490
1491 if ((This == NULL) || (Token == NULL) || (Token->Event == NULL)) {
1492 return EFI_INVALID_PARAMETER;
1493 }
1494
1495 IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
1496 IpSb = IpInstance->Service;
1497
1498 if (IpSb->LinkLocalDadFail) {
1499 return EFI_DEVICE_ERROR;
1500 }
1501
1502 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
1503
1504 if (IpInstance->State != IP6_STATE_CONFIGED) {
1505 Status = EFI_NOT_STARTED;
1506 goto Exit;
1507 }
1508
1509 //
1510 // Check whether the toke is already on the receive queue.
1511 //
1512 Status = NetMapIterate (&IpInstance->RxTokens, Ip6TokenExist, Token);
1513
1514 if (EFI_ERROR (Status)) {
1515 Status = EFI_ACCESS_DENIED;
1516 goto Exit;
1517 }
1518
1519 //
1520 // Queue the token then check whether there is pending received packet.
1521 //
1522 Status = NetMapInsertTail (&IpInstance->RxTokens, Token, NULL);
1523
1524 if (EFI_ERROR (Status)) {
1525 goto Exit;
1526 }
1527
1528 Status = Ip6InstanceDeliverPacket (IpInstance);
1529
1530 //
1531 // Dispatch the DPC queued by the NotifyFunction of this instane's receive
1532 // event.
1533 //
1534 DispatchDpc ();
1535
1536Exit:
1537 gBS->RestoreTPL (OldTpl);
1538 return Status;
1539}
1540
1559EFIAPI
1561 IN NET_MAP *Map,
1562 IN NET_MAP_ITEM *Item,
1563 IN VOID *Context
1564 )
1565{
1567 IP6_TXTOKEN_WRAP *Wrap;
1568
1569 Token = (EFI_IP6_COMPLETION_TOKEN *)Context;
1570
1571 //
1572 // Return EFI_SUCCESS to check the next item in the map if
1573 // this one doesn't match.
1574 //
1575 if ((Token != NULL) && (Token != Item->Key)) {
1576 return EFI_SUCCESS;
1577 }
1578
1579 Wrap = (IP6_TXTOKEN_WRAP *)Item->Value;
1580 ASSERT (Wrap != NULL);
1581
1582 //
1583 // Don't access the Item, Wrap and Token's members after this point.
1584 // Item and wrap has been freed. And we no longer own the Token.
1585 //
1586 Ip6CancelPacket (Wrap->IpInstance->Interface, Wrap->Packet, EFI_ABORTED);
1587
1588 //
1589 // If only one item is to be cancel, return EFI_ABORTED to stop
1590 // iterating the map any more.
1591 //
1592 if (Token != NULL) {
1593 return EFI_ABORTED;
1594 }
1595
1596 return EFI_SUCCESS;
1597}
1598
1615EFIAPI
1617 IN NET_MAP *Map,
1618 IN NET_MAP_ITEM *Item,
1619 IN VOID *Context
1620 )
1621{
1624
1625 Token = (EFI_IP6_COMPLETION_TOKEN *)Context;
1626 This = Item->Key;
1627
1628 if ((Token != NULL) && (Token != This)) {
1629 return EFI_SUCCESS;
1630 }
1631
1632 NetMapRemoveItem (Map, Item, NULL);
1633
1634 This->Status = EFI_ABORTED;
1635 This->Packet.RxData = NULL;
1636 gBS->SignalEvent (This->Event);
1637
1638 if (Token != NULL) {
1639 return EFI_ABORTED;
1640 }
1641
1642 return EFI_SUCCESS;
1643}
1644
1661 IN IP6_PROTOCOL *IpInstance,
1662 IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
1663 )
1664{
1665 EFI_STATUS Status;
1666
1667 //
1668 // First check the transmitted packet. Ip6CancelTxTokens returns
1669 // EFI_ABORTED to mean that the token has been cancelled when
1670 // token != NULL. So, return EFI_SUCCESS for this condition.
1671 //
1672 Status = NetMapIterate (&IpInstance->TxTokens, Ip6CancelTxTokens, Token);
1673 if (EFI_ERROR (Status)) {
1674 if ((Token != NULL) && (Status == EFI_ABORTED)) {
1675 return EFI_SUCCESS;
1676 }
1677
1678 return Status;
1679 }
1680
1681 //
1682 // Check the receive queue. Ip6CancelRxTokens also returns EFI_ABORT
1683 // for Token!=NULL and it is cancelled.
1684 //
1685 Status = NetMapIterate (&IpInstance->RxTokens, Ip6CancelRxTokens, Token);
1686 //
1687 // Dispatch the DPCs queued by the NotifyFunction of the canceled rx token's
1688 // events.
1689 //
1690 DispatchDpc ();
1691 if (EFI_ERROR (Status)) {
1692 if ((Token != NULL) && (Status == EFI_ABORTED)) {
1693 return EFI_SUCCESS;
1694 }
1695
1696 return Status;
1697 }
1698
1699 //
1700 // OK, if the Token is found when Token != NULL, the NetMapIterate
1701 // will return EFI_ABORTED, which has been interrupted as EFI_SUCCESS.
1702 //
1703 if (Token != NULL) {
1704 return EFI_NOT_FOUND;
1705 }
1706
1707 //
1708 // If Token == NULL, cancel all the tokens. return error if not
1709 // all of them are cancelled.
1710 //
1711 if (!NetMapIsEmpty (&IpInstance->TxTokens) || !NetMapIsEmpty (&IpInstance->RxTokens)) {
1712 return EFI_DEVICE_ERROR;
1713 }
1714
1715 return EFI_SUCCESS;
1716}
1717
1747EFIAPI
1749 IN EFI_IP6_PROTOCOL *This,
1750 IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
1751 )
1752{
1753 IP6_PROTOCOL *IpInstance;
1754 EFI_STATUS Status;
1755 EFI_TPL OldTpl;
1756
1757 if (This == NULL) {
1758 return EFI_INVALID_PARAMETER;
1759 }
1760
1761 IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
1762
1763 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
1764
1765 if (IpInstance->State != IP6_STATE_CONFIGED) {
1766 Status = EFI_NOT_STARTED;
1767 goto Exit;
1768 }
1769
1770 Status = Ip6Cancel (IpInstance, Token);
1771
1772Exit:
1773 gBS->RestoreTPL (OldTpl);
1774 return Status;
1775}
1776
1803EFIAPI
1805 IN EFI_IP6_PROTOCOL *This
1806 )
1807{
1808 IP6_PROTOCOL *IpInstance;
1809 IP6_SERVICE *IpSb;
1811
1812 if (This == NULL) {
1813 return EFI_INVALID_PARAMETER;
1814 }
1815
1816 IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
1817 IpSb = IpInstance->Service;
1818
1819 if (IpSb->LinkLocalDadFail) {
1820 return EFI_DEVICE_ERROR;
1821 }
1822
1823 if (IpInstance->State == IP6_STATE_UNCONFIGED) {
1824 return EFI_NOT_STARTED;
1825 }
1826
1827 Mnp = IpInstance->Service->Mnp;
1828
1829 //
1830 // Don't lock the Poll function to enable the deliver of
1831 // the packet polled up.
1832 //
1833 return Mnp->Poll (Mnp);
1834}
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
Definition: LinkedList.c:403
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
Definition: LinkedList.c:590
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
Definition: LinkedList.c:182
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
Definition: LinkedList.c:259
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS EFIAPI DispatchDpc(VOID)
Definition: DpcLib.c:86
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
BOOLEAN Ip6IsOneOfSetAddress(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Address, OUT IP6_INTERFACE **Interface OPTIONAL, OUT IP6_ADDRESS_INFO **AddressInfo OPTIONAL)
Definition: Ip6Common.c:504
BOOLEAN Ip6IsValidLinkAddress(IN IP6_SERVICE *IpSb, IN EFI_MAC_ADDRESS *LinkAddress)
Definition: Ip6Common.c:565
EFI_STATUS Ip6BuildEfiAddressList(IN IP6_SERVICE *IpSb, OUT UINT32 *AddressCount, OUT EFI_IP6_ADDRESS_INFO **AddressList OPTIONAL)
Definition: Ip6Common.c:29
VOID Ip6CleanInterface(IN IP6_INTERFACE *Interface, IN IP6_PROTOCOL *IpInstance OPTIONAL)
Definition: Ip6If.c:297
EFI_STATUS EFIAPI EfiIp6Receive(IN EFI_IP6_PROTOCOL *This, IN EFI_IP6_COMPLETION_TOKEN *Token)
Definition: Ip6Impl.c:1481
EFI_STATUS EFIAPI EfiIp6Transmit(IN EFI_IP6_PROTOCOL *This, IN EFI_IP6_COMPLETION_TOKEN *Token)
Definition: Ip6Impl.c:1238
EFI_STATUS EFIAPI EfiIp6Routes(IN EFI_IP6_PROTOCOL *This, IN BOOLEAN DeleteRoute, IN EFI_IPv6_ADDRESS *Destination OPTIONAL, IN UINT8 PrefixLength, IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL)
Definition: Ip6Impl.c:825
EFI_STATUS EFIAPI EfiIp6Poll(IN EFI_IP6_PROTOCOL *This)
Definition: Ip6Impl.c:1804
EFI_STATUS EFIAPI Ip6CancelRxTokens(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
Definition: Ip6Impl.c:1616
EFI_STATUS Ip6Cancel(IN IP6_PROTOCOL *IpInstance, IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL)
Definition: Ip6Impl.c:1660
BOOLEAN Ip6IsIllegalProtocol(IN UINT8 Protocol)
Definition: Ip6Impl.c:276
EFI_STATUS EFIAPI Ip6CancelTxTokens(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
Definition: Ip6Impl.c:1560
EFI_STATUS EFIAPI EfiIp6Neighbors(IN EFI_IP6_PROTOCOL *This, IN BOOLEAN DeleteFlag, IN EFI_IPv6_ADDRESS *TargetIp6Address, IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL, IN UINT32 Timeout, IN BOOLEAN Override)
Definition: Ip6Impl.c:937
EFI_STATUS Ip6TxTokenValid(IN EFI_IP6_COMPLETION_TOKEN *Token)
Definition: Ip6Impl.c:1043
EFI_STATUS Ip6CleanProtocol(IN OUT IP6_PROTOCOL *IpInstance)
Definition: Ip6Impl.c:444
EFI_STATUS EFIAPI EfiIp6Groups(IN EFI_IP6_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL)
Definition: Ip6Impl.c:740
EFI_STATUS Ip6ConfigProtocol(IN OUT IP6_PROTOCOL *IpInstance, IN EFI_IP6_CONFIG_DATA *Config)
Definition: Ip6Impl.c:343
VOID Ip6OnPacketSent(IN NET_BUF *Packet, IN EFI_STATUS IoStatus, IN UINT32 Flag, IN VOID *Context)
Definition: Ip6Impl.c:1165
EFI_STATUS Ip6ServiceConfigMnp(IN IP6_SERVICE *IpSb, IN BOOLEAN Force)
Definition: Ip6Impl.c:502
VOID EFIAPI Ip6FreeTxToken(IN VOID *Context)
Definition: Ip6Impl.c:1117
EFI_STATUS EFIAPI EfiIp6GetModeData(IN EFI_IP6_PROTOCOL *This, OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL, OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL)
Definition: Ip6Impl.c:46
EFI_STATUS EFIAPI Ip6TokenExist(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
Definition: Ip6Impl.c:1013
VOID Ip6InitProtocol(IN IP6_SERVICE *IpSb, IN OUT IP6_PROTOCOL *IpInstance)
Definition: Ip6Impl.c:299
EFI_STATUS EFIAPI EfiIp6Configure(IN EFI_IP6_PROTOCOL *This, IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL)
Definition: Ip6Impl.c:610
EFI_STATUS EFIAPI EfiIp6Cancel(IN EFI_IP6_PROTOCOL *This, IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL)
Definition: Ip6Impl.c:1748
BOOLEAN Ip6IsValidAddress(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Ip, IN BOOLEAN Flag)
Definition: Ip6Impl.c:244
EFI_STATUS Ip6InstanceDeliverPacket(IN IP6_PROTOCOL *IpInstance)
Definition: Ip6Input.c:1466
EFI_STATUS Ip6Groups(IN IP6_PROTOCOL *IpInstance, IN BOOLEAN JoinFlag, IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL)
Definition: Ip6Mld.c:613
EFI_STATUS Ip6AddNeighbor(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *TargetIp6Address, IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL, IN UINT32 Timeout, IN BOOLEAN Override)
Definition: Ip6Nd.c:2703
EFI_STATUS Ip6DelNeighbor(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *TargetIp6Address, IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL, IN UINT32 Timeout, IN BOOLEAN Override)
Definition: Ip6Nd.c:2765
EFI_STATUS Ip6BuildPrefixTable(IN IP6_PROTOCOL *IpInstance, OUT UINT32 *PrefixCount, OUT EFI_IP6_ADDRESS_INFO **PrefixTable)
Definition: Ip6Nd.c:122
EFI_STATUS Ip6BuildEfiNeighborCache(IN IP6_PROTOCOL *IpInstance, OUT UINT32 *NeighborCount, OUT EFI_IP6_NEIGHBOR_CACHE **NeighborCache)
Definition: Ip6Nd.c:56
EFI_STATUS Ip6Output(IN IP6_SERVICE *IpSb, IN IP6_INTERFACE *Interface OPTIONAL, IN IP6_PROTOCOL *IpInstance OPTIONAL, IN NET_BUF *Packet, IN EFI_IP6_HEADER *Head, IN UINT8 *ExtHdrs, IN UINT32 ExtHdrsLen, IN IP6_FRAME_CALLBACK Callback, IN VOID *Context)
Definition: Ip6Output.c:476
VOID Ip6CancelPacket(IN IP6_INTERFACE *IpIf, IN NET_BUF *Packet, IN EFI_STATUS IoStatus)
Definition: Ip6Output.c:1081
EFI_STATUS Ip6SelectSourceAddress(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Destination, OUT EFI_IPv6_ADDRESS *Source)
Definition: Ip6Output.c:153
EFI_STATUS Ip6BuildEfiRouteTable(IN IP6_ROUTE_TABLE *RouteTable, OUT UINT32 *EfiRouteCount, OUT EFI_IP6_ROUTE_TABLE **EfiRouteTable OPTIONAL)
Definition: Ip6Route.c:261
EFI_STATUS Ip6AddRoute(IN OUT IP6_ROUTE_TABLE *RtTable, IN EFI_IPv6_ADDRESS *Destination, IN UINT8 PrefixLength, IN EFI_IPv6_ADDRESS *GatewayAddress)
Definition: Ip6Route.c:446
EFI_STATUS Ip6DelRoute(IN OUT IP6_ROUTE_TABLE *RtTable, IN EFI_IPv6_ADDRESS *Destination, IN UINT8 PrefixLength, IN EFI_IPv6_ADDRESS *GatewayAddress)
Definition: Ip6Route.c:506
#define NULL
Definition: Base.h:319
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
VOID EFIAPI NetbufFree(IN NET_BUF *Nbuf)
Definition: NetBuffer.c:195
BOOLEAN EFIAPI NetIp6IsValidUnicast(IN EFI_IPv6_ADDRESS *Ip6)
Definition: DxeNetLib.c:725
VOID EFIAPI NetMapClean(IN OUT NET_MAP *Map)
Definition: DxeNetLib.c:1368
BOOLEAN EFIAPI NetIp6IsNetEqual(EFI_IPv6_ADDRESS *Ip1, EFI_IPv6_ADDRESS *Ip2, UINT8 PrefixLength)
Definition: DxeNetLib.c:837
NET_MAP_ITEM *EFIAPI NetMapFindKey(IN NET_MAP *Map, IN VOID *Key)
Definition: DxeNetLib.c:1629
VOID EFIAPI NetMapInit(IN OUT NET_MAP *Map)
Definition: DxeNetLib.c:1343
NET_BUF *EFIAPI NetbufFromExt(IN NET_FRAGMENT *ExtFragment, IN UINT32 ExtNum, IN UINT32 HeadSpace, IN UINT32 HeadLen, IN NET_VECTOR_EXT_FREE ExtFree, IN VOID *Arg OPTIONAL)
Definition: NetBuffer.c:693
BOOLEAN EFIAPI NetIp6IsUnspecifiedAddr(IN EFI_IPv6_ADDRESS *Ip6)
Definition: DxeNetLib.c:766
BOOLEAN EFIAPI NetMapIsEmpty(IN NET_MAP *Map)
Definition: DxeNetLib.c:1413
VOID *EFIAPI NetMapRemoveItem(IN OUT NET_MAP *Map, IN OUT NET_MAP_ITEM *Item, OUT VOID **Value OPTIONAL)
Definition: DxeNetLib.c:1671
EFI_STATUS EFIAPI NetMapInsertTail(IN OUT NET_MAP *Map, IN VOID *Key, IN VOID *Value OPTIONAL)
Definition: DxeNetLib.c:1556
EFI_STATUS EFIAPI NetMapIterate(IN NET_MAP *Map, IN NET_MAP_CALLBACK CallBack, IN VOID *Arg OPTIONAL)
Definition: DxeNetLib.c:1800
VOID EFIAPI Exit(IN EFI_STATUS Status)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINTN EFI_TPL
Definition: UefiBaseType.h:41
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_LOCK *EFIAPI EfiInitializeLock(IN OUT EFI_LOCK *Lock, IN EFI_TPL Priority)
Definition: UefiLib.c:405
VOID * FragmentBuffer
Pointer to fragment data. This field may not be set to NULL.
Definition: Ip6.h:416
UINT32 FragmentLength
Length of fragment data. This field may not be set to zero.
Definition: Ip6.h:415
UINT8 HopLimit
Hop-Limit override.
Definition: Ip6.h:466
UINT32 FlowLabel
Flow-Label override.
Definition: Ip6.h:467
UINT8 Protocol
Protocol type override.
Definition: Ip6.h:465
UINT32 DataLength
Definition: Ip6.h:502
UINT32 ExtHdrsLength
Definition: Ip6.h:487
EFI_IP6_FRAGMENT_DATA FragmentTable[1]
Definition: Ip6.h:510
EFI_IP6_OVERRIDE_DATA * OverrideData
Definition: Ip6.h:482
UINT32 FragmentCount
Definition: Ip6.h:506
EFI_IPv6_ADDRESS DestinationAddress
Definition: Ip6.h:478
EFI_STATUS Status
Definition: Ip6.h:536
EFI_EVENT Event
Definition: Ip6.h:522
EFI_IP6_RECEIVE_DATA * RxData
Definition: Ip6.h:541
UINT32 FlowLabel
Definition: Ip6.h:202
UINT8 DefaultProtocol
Definition: Ip6.h:144
UINT8 HopLimit
Definition: Ip6.h:197
EFI_IPv6_ADDRESS DestinationAddress
Definition: Ip6.h:168
EFI_IPv6_ADDRESS StationAddress
Definition: Ip6.h:188
UINT32 TransmitTimeout
Definition: Ip6.h:214
BOOLEAN AcceptPromiscuous
Definition: Ip6.h:163