]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/Ip6Dxe/Ip6Nd.h
NetworkPkg/Ip6Dxe: Improve Neightbor Discovery message validation.
[mirror_edk2.git] / NetworkPkg / Ip6Dxe / Ip6Nd.h
1 /** @file
2 Definition of Neighbor Discovery support routines.
3
4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef __EFI_IP6_ND_H__
11 #define __EFI_IP6_ND_H__
12
13 #define IP6_GET_TICKS(Ms) (((Ms) + IP6_TIMER_INTERVAL_IN_MS - 1) / IP6_TIMER_INTERVAL_IN_MS)
14
15 enum {
16 IP6_INF_ROUTER_LIFETIME = 0xFFFF,
17
18 IP6_MAX_RTR_SOLICITATION_DELAY = 1000, ///< 1000 milliseconds
19 IP6_MAX_RTR_SOLICITATIONS = 3,
20 IP6_RTR_SOLICITATION_INTERVAL = 4000,
21
22 IP6_MIN_RANDOM_FACTOR_SCALED = 1,
23 IP6_MAX_RANDOM_FACTOR_SCALED = 3,
24 IP6_RANDOM_FACTOR_SCALE = 2,
25
26 IP6_MAX_MULTICAST_SOLICIT = 3,
27 IP6_MAX_UNICAST_SOLICIT = 3,
28 IP6_MAX_ANYCAST_DELAY_TIME = 1,
29 IP6_MAX_NEIGHBOR_ADV = 3,
30 IP6_REACHABLE_TIME = 30000,
31 IP6_RETRANS_TIMER = 1000,
32 IP6_DELAY_FIRST_PROBE_TIME = 5000,
33
34 IP6_MIN_LINK_MTU = 1280,
35 IP6_MAX_LINK_MTU = 1500,
36
37 IP6_IS_ROUTER_FLAG = 0x80,
38 IP6_SOLICITED_FLAG = 0x40,
39 IP6_OVERRIDE_FLAG = 0x20,
40
41 IP6_M_ADDR_CONFIG_FLAG = 0x80,
42 IP6_O_CONFIG_FLAG = 0x40,
43
44 IP6_ON_LINK_FLAG = 0x80,
45 IP6_AUTO_CONFIG_FLAG = 0x40,
46
47 IP6_ND_LENGTH = 24,
48 IP6_RA_LENGTH = 16,
49 IP6_REDITECT_LENGTH = 40,
50 IP6_DAD_ENTRY_SIGNATURE = SIGNATURE_32 ('I', 'P', 'D', 'E')
51 };
52
53 typedef
54 VOID
55 (*IP6_ARP_CALLBACK) (
56 VOID *Context
57 );
58
59 typedef struct _IP6_OPTION_HEADER {
60 UINT8 Type;
61 UINT8 Length;
62 } IP6_OPTION_HEADER;
63
64 STATIC_ASSERT (sizeof (IP6_OPTION_HEADER) == 2, "IP6_OPTION_HEADER is expected to be exactly 2 bytes long.");
65
66 typedef struct _IP6_ETHE_ADDR_OPTION {
67 UINT8 Type;
68 UINT8 Length;
69 UINT8 EtherAddr[6];
70 } IP6_ETHER_ADDR_OPTION;
71
72 STATIC_ASSERT (sizeof (IP6_ETHER_ADDR_OPTION) == 8, "IP6_ETHER_ADDR_OPTION is expected to be exactly 8 bytes long.");
73
74 typedef struct _IP6_MTU_OPTION {
75 UINT8 Type;
76 UINT8 Length;
77 UINT16 Reserved;
78 UINT32 Mtu;
79 } IP6_MTU_OPTION;
80
81 STATIC_ASSERT (sizeof (IP6_MTU_OPTION) == 8, "IP6_MTU_OPTION is expected to be exactly 8 bytes long.");
82
83 typedef struct _IP6_PREFIX_INFO_OPTION {
84 UINT8 Type;
85 UINT8 Length;
86 UINT8 PrefixLength;
87 UINT8 Reserved1;
88 UINT32 ValidLifetime;
89 UINT32 PreferredLifetime;
90 UINT32 Reserved2;
91 EFI_IPv6_ADDRESS Prefix;
92 } IP6_PREFIX_INFO_OPTION;
93
94 STATIC_ASSERT (sizeof (IP6_PREFIX_INFO_OPTION) == 32, "IP6_PREFIX_INFO_OPTION is expected to be exactly 32 bytes long.");
95
96 typedef
97 VOID
98 (*IP6_DAD_CALLBACK) (
99 IN BOOLEAN IsDadPassed,
100 IN EFI_IPv6_ADDRESS *TargetAddress,
101 IN VOID *Context
102 );
103
104 typedef struct _IP6_DAD_ENTRY {
105 UINT32 Signature;
106 LIST_ENTRY Link;
107 UINT32 MaxTransmit;
108 UINT32 Transmit;
109 UINT32 Receive;
110 UINT32 RetransTick;
111 IP6_ADDRESS_INFO *AddressInfo;
112 EFI_IPv6_ADDRESS Destination;
113 IP6_DAD_CALLBACK Callback;
114 VOID *Context;
115 } IP6_DAD_ENTRY;
116
117 typedef struct _IP6_DELAY_JOIN_LIST {
118 LIST_ENTRY Link;
119 UINT32 DelayTime; ///< in tick per 50 milliseconds
120 IP6_INTERFACE *Interface;
121 IP6_ADDRESS_INFO *AddressInfo;
122 IP6_DAD_CALLBACK DadCallback;
123 VOID *Context;
124 } IP6_DELAY_JOIN_LIST;
125
126 typedef struct _IP6_NEIGHBOR_ENTRY {
127 LIST_ENTRY Link;
128 LIST_ENTRY ArpList;
129 INTN RefCnt;
130 BOOLEAN IsRouter;
131 BOOLEAN ArpFree;
132 BOOLEAN Dynamic;
133 EFI_IPv6_ADDRESS Neighbor;
134 EFI_MAC_ADDRESS LinkAddress;
135 EFI_IP6_NEIGHBOR_STATE State;
136 UINT32 Transmit;
137 UINT32 Ticks;
138
139 LIST_ENTRY Frames;
140 IP6_INTERFACE *Interface;
141 IP6_ARP_CALLBACK CallBack;
142 } IP6_NEIGHBOR_ENTRY;
143
144 typedef struct _IP6_DEFAULT_ROUTER {
145 LIST_ENTRY Link;
146 INTN RefCnt;
147 UINT16 Lifetime;
148 EFI_IPv6_ADDRESS Router;
149 IP6_NEIGHBOR_ENTRY *NeighborCache;
150 } IP6_DEFAULT_ROUTER;
151
152 typedef struct _IP6_PREFIX_LIST_ENTRY {
153 LIST_ENTRY Link;
154 INTN RefCnt;
155 UINT32 ValidLifetime;
156 UINT32 PreferredLifetime;
157 UINT8 PrefixLength;
158 EFI_IPv6_ADDRESS Prefix;
159 } IP6_PREFIX_LIST_ENTRY;
160
161 /**
162 Build a array of EFI_IP6_NEIGHBOR_CACHE to be returned to the caller. The number
163 of EFI_IP6_NEIGHBOR_CACHE is also returned.
164
165 @param[in] IpInstance The pointer to IP6_PROTOCOL instance.
166 @param[out] NeighborCount The number of returned neighbor cache entries.
167 @param[out] NeighborCache The pointer to the array of EFI_IP6_NEIGHBOR_CACHE.
168
169 @retval EFI_SUCCESS The EFI_IP6_NEIGHBOR_CACHE successfully built.
170 @retval EFI_OUT_OF_RESOURCES Failed to allocate the memory for the route table.
171
172 **/
173 EFI_STATUS
174 Ip6BuildEfiNeighborCache (
175 IN IP6_PROTOCOL *IpInstance,
176 OUT UINT32 *NeighborCount,
177 OUT EFI_IP6_NEIGHBOR_CACHE **NeighborCache
178 );
179
180 /**
181 Build a array of EFI_IP6_ADDRESS_INFO to be returned to the caller. The number
182 of prefix entries is also returned.
183
184 @param[in] IpInstance The pointer to IP6_PROTOCOL instance.
185 @param[out] PrefixCount The number of returned prefix entries.
186 @param[out] PrefixTable The pointer to the array of PrefixTable.
187
188 @retval EFI_SUCCESS The prefix table successfully built.
189 @retval EFI_OUT_OF_RESOURCES Failed to allocate the memory for the prefix table.
190
191 **/
192 EFI_STATUS
193 Ip6BuildPrefixTable (
194 IN IP6_PROTOCOL *IpInstance,
195 OUT UINT32 *PrefixCount,
196 OUT EFI_IP6_ADDRESS_INFO **PrefixTable
197 );
198
199 /**
200 Allocate and initialize an IP6 default router entry.
201
202 @param[in] IpSb The pointer to the IP6_SERVICE instance.
203 @param[in] Ip6Address The IPv6 address of the default router.
204 @param[in] RouterLifetime The lifetime associated with the default
205 router, in units of seconds.
206
207 @return NULL if it failed to allocate memory for the default router node.
208 Otherwise, point to the created default router node.
209
210 **/
211 IP6_DEFAULT_ROUTER *
212 Ip6CreateDefaultRouter (
213 IN IP6_SERVICE *IpSb,
214 IN EFI_IPv6_ADDRESS *Ip6Address,
215 IN UINT16 RouterLifetime
216 );
217
218 /**
219 Destroy an IP6 default router entry.
220
221 @param[in] IpSb The pointer to the IP6_SERVICE instance.
222 @param[in] DefaultRouter The to be destroyed IP6_DEFAULT_ROUTER.
223
224 **/
225 VOID
226 Ip6DestroyDefaultRouter (
227 IN IP6_SERVICE *IpSb,
228 IN IP6_DEFAULT_ROUTER *DefaultRouter
229 );
230
231 /**
232 Clean an IP6 default router list.
233
234 @param[in] IpSb The pointer to the IP6_SERVICE instance.
235
236 **/
237 VOID
238 Ip6CleanDefaultRouterList (
239 IN IP6_SERVICE *IpSb
240 );
241
242 /**
243 Search a default router node from an IP6 default router list.
244
245 @param[in] IpSb The pointer to the IP6_SERVICE instance.
246 @param[in] Ip6Address The IPv6 address of the to be searched default router node.
247
248 @return NULL if it failed to find the matching default router node.
249 Otherwise, point to the found default router node.
250
251 **/
252 IP6_DEFAULT_ROUTER *
253 Ip6FindDefaultRouter (
254 IN IP6_SERVICE *IpSb,
255 IN EFI_IPv6_ADDRESS *Ip6Address
256 );
257
258 /**
259 The function to be called after DAD (Duplicate Address Detection) is performed.
260
261 @param[in] IsDadPassed If TRUE, the DAD operation succeed. Otherwise, the DAD operation failed.
262 @param[in] IpIf Points to the IP6_INTERFACE.
263 @param[in] DadEntry The DAD entry which already performed DAD.
264
265 **/
266 VOID
267 Ip6OnDADFinished (
268 IN BOOLEAN IsDadPassed,
269 IN IP6_INTERFACE *IpIf,
270 IN IP6_DAD_ENTRY *DadEntry
271 );
272
273 /**
274 Create a DAD (Duplicate Address Detection) entry and queue it to be performed.
275
276 @param[in] IpIf Points to the IP6_INTERFACE.
277 @param[in] AddressInfo The address information which needs DAD performed.
278 @param[in] Callback The callback routine that will be called after DAD
279 is performed. This is an optional parameter that
280 may be NULL.
281 @param[in] Context The opaque parameter for a DAD callback routine.
282 This is an optional parameter that may be NULL.
283
284 @retval EFI_SUCCESS The DAD entry was created and queued.
285 @retval EFI_OUT_OF_RESOURCES Failed to allocate the memory to complete the
286 operation.
287
288
289 **/
290 EFI_STATUS
291 Ip6InitDADProcess (
292 IN IP6_INTERFACE *IpIf,
293 IN IP6_ADDRESS_INFO *AddressInfo,
294 IN IP6_DAD_CALLBACK Callback OPTIONAL,
295 IN VOID *Context OPTIONAL
296 );
297
298 /**
299 Search IP6_DAD_ENTRY from the Duplicate Address Detection List.
300
301 @param[in] IpSb The pointer to the IP6_SERVICE instance.
302 @param[in] Target The address information which needs DAD performed .
303 @param[out] Interface If not NULL, output the IP6 interface that configures
304 the tentative address.
305
306 @return NULL if failed to find the matching DAD entry.
307 Otherwise, point to the found DAD entry.
308
309 **/
310 IP6_DAD_ENTRY *
311 Ip6FindDADEntry (
312 IN IP6_SERVICE *IpSb,
313 IN EFI_IPv6_ADDRESS *Target,
314 OUT IP6_INTERFACE **Interface OPTIONAL
315 );
316
317 /**
318 Allocate and initialize a IP6 prefix list entry.
319
320 @param[in] IpSb The pointer to IP6_SERVICE instance.
321 @param[in] OnLinkOrAuto If TRUE, the entry is created for the on link prefix list.
322 Otherwise, it is created for the autoconfiguration prefix list.
323 @param[in] ValidLifetime The length of time in seconds that the prefix
324 is valid for the purpose of on-link determination.
325 @param[in] PreferredLifetime The length of time in seconds that addresses
326 generated from the prefix via stateless address
327 autoconfiguration remain preferred.
328 @param[in] PrefixLength The prefix length of the Prefix.
329 @param[in] Prefix The prefix address.
330
331 @return NULL if it failed to allocate memory for the prefix node. Otherwise, point
332 to the created or existing prefix list entry.
333
334 **/
335 IP6_PREFIX_LIST_ENTRY *
336 Ip6CreatePrefixListEntry (
337 IN IP6_SERVICE *IpSb,
338 IN BOOLEAN OnLinkOrAuto,
339 IN UINT32 ValidLifetime,
340 IN UINT32 PreferredLifetime,
341 IN UINT8 PrefixLength,
342 IN EFI_IPv6_ADDRESS *Prefix
343 );
344
345 /**
346 Destroy a IP6 prefix list entry.
347
348 @param[in] IpSb The pointer to IP6_SERVICE instance.
349 @param[in] PrefixEntry The to be destroyed prefix list entry.
350 @param[in] OnLinkOrAuto If TRUE, the entry is removed from on link prefix list.
351 Otherwise remove from autoconfiguration prefix list.
352 @param[in] ImmediateDelete If TRUE, remove the entry directly.
353 Otherwise, check the reference count to see whether
354 it should be removed.
355
356 **/
357 VOID
358 Ip6DestroyPrefixListEntry (
359 IN IP6_SERVICE *IpSb,
360 IN IP6_PREFIX_LIST_ENTRY *PrefixEntry,
361 IN BOOLEAN OnLinkOrAuto,
362 IN BOOLEAN ImmediateDelete
363 );
364
365 /**
366 Search the list array to find an IP6 prefix list entry.
367
368 @param[in] IpSb The pointer to IP6_SERVICE instance.
369 @param[in] OnLinkOrAuto If TRUE, the search the link prefix list,
370 Otherwise search the autoconfiguration prefix list.
371 @param[in] PrefixLength The prefix length of the Prefix
372 @param[in] Prefix The prefix address.
373
374 @return NULL if cannot find the IP6 prefix list entry. Otherwise, return the
375 pointer to the IP6 prefix list entry.
376
377 **/
378 IP6_PREFIX_LIST_ENTRY *
379 Ip6FindPrefixListEntry (
380 IN IP6_SERVICE *IpSb,
381 IN BOOLEAN OnLinkOrAuto,
382 IN UINT8 PrefixLength,
383 IN EFI_IPv6_ADDRESS *Prefix
384 );
385
386 /**
387 Release the resource in prefix list table, and destroy the list entry and
388 corresponding addresses or route entries.
389
390 @param[in] IpSb The pointer to the IP6_SERVICE instance.
391 @param[in] ListHead The list entry head of the prefix list table.
392
393 **/
394 VOID
395 Ip6CleanPrefixListTable (
396 IN IP6_SERVICE *IpSb,
397 IN LIST_ENTRY *ListHead
398 );
399
400 /**
401 Allocate and initialize an IP6 neighbor cache entry.
402
403 @param[in] IpSb The pointer to the IP6_SERVICE instance.
404 @param[in] CallBack The callback function to be called when
405 address resolution is finished.
406 @param[in] Ip6Address Points to the IPv6 address of the neighbor.
407 @param[in] LinkAddress Points to the MAC address of the neighbor.
408 Ignored if NULL.
409
410 @return NULL if failed to allocate memory for the neighbor cache entry.
411 Otherwise, point to the created neighbor cache entry.
412
413 **/
414 IP6_NEIGHBOR_ENTRY *
415 Ip6CreateNeighborEntry (
416 IN IP6_SERVICE *IpSb,
417 IN IP6_ARP_CALLBACK CallBack,
418 IN EFI_IPv6_ADDRESS *Ip6Address,
419 IN EFI_MAC_ADDRESS *LinkAddress OPTIONAL
420 );
421
422 /**
423 Search a IP6 neighbor cache entry.
424
425 @param[in] IpSb The pointer to the IP6_SERVICE instance.
426 @param[in] Ip6Address Points to the IPv6 address of the neighbor.
427
428 @return NULL if it failed to find the matching neighbor cache entry.
429 Otherwise, point to the found neighbor cache entry.
430
431 **/
432 IP6_NEIGHBOR_ENTRY *
433 Ip6FindNeighborEntry (
434 IN IP6_SERVICE *IpSb,
435 IN EFI_IPv6_ADDRESS *Ip6Address
436 );
437
438 /**
439 Free a IP6 neighbor cache entry and remove all the frames on the address
440 resolution queue that pass the FrameToCancel. That is, either FrameToCancel
441 is NULL, or it returns true for the frame.
442
443 @param[in] IpSb The pointer to the IP6_SERVICE instance.
444 @param[in] NeighborCache The to be free neighbor cache entry.
445 @param[in] SendIcmpError If TRUE, send out ICMP error.
446 @param[in] FullFree If TRUE, remove the neighbor cache entry.
447 Otherwise remove the pending frames.
448 @param[in] IoStatus The status returned to the cancelled frames'
449 callback function.
450 @param[in] FrameToCancel Function to select which frame to cancel.
451 This is an optional parameter that may be NULL.
452 @param[in] Context Opaque parameter to the FrameToCancel.
453 Ignored if FrameToCancel is NULL.
454
455 @retval EFI_INVALID_PARAMETER The input parameter is invalid.
456 @retval EFI_SUCCESS The operation finished successfully.
457
458 **/
459 EFI_STATUS
460 Ip6FreeNeighborEntry (
461 IN IP6_SERVICE *IpSb,
462 IN IP6_NEIGHBOR_ENTRY *NeighborCache,
463 IN BOOLEAN SendIcmpError,
464 IN BOOLEAN FullFree,
465 IN EFI_STATUS IoStatus,
466 IN IP6_FRAME_TO_CANCEL FrameToCancel OPTIONAL,
467 IN VOID *Context OPTIONAL
468 );
469
470 /**
471 Add Neighbor cache entries. It is a work function for EfiIp6Neighbors().
472
473 @param[in] IpSb The IP6 service binding instance.
474 @param[in] TargetIp6Address Pointer to Target IPv6 address.
475 @param[in] TargetLinkAddress Pointer to link-layer address of the target. Ignored if NULL.
476 @param[in] Timeout Time in 100-ns units that this entry will remain in the neighbor
477 cache. It will be deleted after Timeout. A value of zero means that
478 the entry is permanent. A non-zero value means that the entry is
479 dynamic.
480 @param[in] Override If TRUE, the cached link-layer address of the matching entry will
481 be overridden and updated; if FALSE, and if a
482 corresponding cache entry already existed, EFI_ACCESS_DENIED
483 will be returned.
484
485 @retval EFI_SUCCESS The neighbor cache entry has been added.
486 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the neighbor cache
487 due to insufficient resources.
488 @retval EFI_NOT_FOUND TargetLinkAddress is NULL.
489 @retval EFI_ACCESS_DENIED The to-be-added entry is already defined in the neighbor cache,
490 and that entry is tagged as un-overridden (when DeleteFlag
491 is FALSE).
492
493 **/
494 EFI_STATUS
495 Ip6AddNeighbor (
496 IN IP6_SERVICE *IpSb,
497 IN EFI_IPv6_ADDRESS *TargetIp6Address,
498 IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,
499 IN UINT32 Timeout,
500 IN BOOLEAN Override
501 );
502
503 /**
504 Delete or update Neighbor cache entries. It is a work function for EfiIp6Neighbors().
505
506 @param[in] IpSb The IP6 service binding instance.
507 @param[in] TargetIp6Address Pointer to Target IPv6 address.
508 @param[in] TargetLinkAddress Pointer to link-layer address of the target. Ignored if NULL.
509 @param[in] Timeout Time in 100-ns units that this entry will remain in the neighbor
510 cache. It will be deleted after Timeout. A value of zero means that
511 the entry is permanent. A non-zero value means that the entry is
512 dynamic.
513 @param[in] Override If TRUE, the cached link-layer address of the matching entry will
514 be overridden and updated; if FALSE, and if a
515 corresponding cache entry already existed, EFI_ACCESS_DENIED
516 will be returned.
517
518 @retval EFI_SUCCESS The neighbor cache entry has been updated or deleted.
519 @retval EFI_NOT_FOUND This entry is not in the neighbor cache.
520
521 **/
522 EFI_STATUS
523 Ip6DelNeighbor (
524 IN IP6_SERVICE *IpSb,
525 IN EFI_IPv6_ADDRESS *TargetIp6Address,
526 IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,
527 IN UINT32 Timeout,
528 IN BOOLEAN Override
529 );
530
531 /**
532 Process the Neighbor Solicitation message. The message may be sent for Duplicate
533 Address Detection or Address Resolution.
534
535 @param[in] IpSb The IP service that received the packet.
536 @param[in] Head The IP head of the message.
537 @param[in] Packet The content of the message with IP head removed.
538
539 @retval EFI_SUCCESS The packet processed successfully.
540 @retval EFI_INVALID_PARAMETER The packet is invalid.
541 @retval EFI_ICMP_ERROR The packet indicates that DAD is failed.
542 @retval Others Failed to process the packet.
543
544 **/
545 EFI_STATUS
546 Ip6ProcessNeighborSolicit (
547 IN IP6_SERVICE *IpSb,
548 IN EFI_IP6_HEADER *Head,
549 IN NET_BUF *Packet
550 );
551
552 /**
553 Process the Neighbor Advertisement message.
554
555 @param[in] IpSb The IP service that received the packet.
556 @param[in] Head The IP head of the message.
557 @param[in] Packet The content of the message with IP head removed.
558
559 @retval EFI_SUCCESS The packet processed successfully.
560 @retval EFI_INVALID_PARAMETER The packet is invalid.
561 @retval EFI_ICMP_ERROR The packet indicates that DAD is failed.
562 @retval Others Failed to process the packet.
563
564 **/
565 EFI_STATUS
566 Ip6ProcessNeighborAdvertise (
567 IN IP6_SERVICE *IpSb,
568 IN EFI_IP6_HEADER *Head,
569 IN NET_BUF *Packet
570 );
571
572 /**
573 Process the Router Advertisement message according to RFC4861.
574
575 @param[in] IpSb The IP service that received the packet.
576 @param[in] Head The IP head of the message.
577 @param[in] Packet The content of the message with the IP head removed.
578
579 @retval EFI_SUCCESS The packet processed successfully.
580 @retval EFI_INVALID_PARAMETER The packet is invalid.
581 @retval EFI_OUT_OF_RESOURCES Insufficient resources to complete the operation.
582 @retval Others Failed to process the packet.
583
584 **/
585 EFI_STATUS
586 Ip6ProcessRouterAdvertise (
587 IN IP6_SERVICE *IpSb,
588 IN EFI_IP6_HEADER *Head,
589 IN NET_BUF *Packet
590 );
591
592 /**
593 Process the ICMPv6 redirect message. Find the instance, then update
594 its route cache.
595
596 @param[in] IpSb The IP6 service binding instance that received
597 the packet.
598 @param[in] Head The IP head of the received ICMPv6 packet.
599 @param[in] Packet The content of the ICMPv6 redirect packet with
600 the IP head removed.
601
602 @retval EFI_INVALID_PARAMETER The parameter is invalid.
603 @retval EFI_OUT_OF_RESOURCES Insufficient resources to complete the
604 operation.
605 @retval EFI_SUCCESS Successfully updated the route caches.
606
607 **/
608 EFI_STATUS
609 Ip6ProcessRedirect (
610 IN IP6_SERVICE *IpSb,
611 IN EFI_IP6_HEADER *Head,
612 IN NET_BUF *Packet
613 );
614
615 /**
616 Generate router solicit message and send it out to Destination Address or
617 All Router Link Local scope multicast address.
618
619 @param[in] IpSb The IP service to send the packet.
620 @param[in] Interface If not NULL, points to the IP6 interface to send
621 the packet.
622 @param[in] SourceAddress If not NULL, the source address of the message.
623 @param[in] DestinationAddress If not NULL, the destination address of the message.
624 @param[in] SourceLinkAddress If not NULL, the MAC address of the source.
625 A source link-layer address option will be appended
626 to the message.
627
628 @retval EFI_OUT_OF_RESOURCES Insufficient resources to complete the operation.
629 @retval EFI_SUCCESS The router solicit message was successfully sent.
630
631 **/
632 EFI_STATUS
633 Ip6SendRouterSolicit (
634 IN IP6_SERVICE *IpSb,
635 IN IP6_INTERFACE *Interface OPTIONAL,
636 IN EFI_IPv6_ADDRESS *SourceAddress OPTIONAL,
637 IN EFI_IPv6_ADDRESS *DestinationAddress OPTIONAL,
638 IN EFI_MAC_ADDRESS *SourceLinkAddress OPTIONAL
639 );
640
641 /**
642 Generate the Neighbor Solicitation message and send it to the Destination Address.
643
644 @param[in] IpSb The IP service to send the packet
645 @param[in] SourceAddress The source address of the message.
646 @param[in] DestinationAddress The destination address of the message.
647 @param[in] TargetIp6Address The IP address of the target of the solicitation.
648 It must not be a multicast address.
649 @param[in] SourceLinkAddress The MAC address for the sender. If not NULL,
650 a source link-layer address option will be appended
651 to the message.
652
653 @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
654 @retval EFI_OUT_OF_RESOURCES Insufficient resources to complete the
655 operation.
656 @retval EFI_SUCCESS The Neighbor Advertise message was successfully sent.
657
658 **/
659 EFI_STATUS
660 Ip6SendNeighborSolicit (
661 IN IP6_SERVICE *IpSb,
662 IN EFI_IPv6_ADDRESS *SourceAddress,
663 IN EFI_IPv6_ADDRESS *DestinationAddress,
664 IN EFI_IPv6_ADDRESS *TargetIp6Address,
665 IN EFI_MAC_ADDRESS *SourceLinkAddress OPTIONAL
666 );
667
668 /**
669 Set the interface's address. This will trigger the DAD process for the
670 address to set. To set an already set address, the lifetimes wil be
671 updated to the new value passed in.
672
673 @param[in] Interface The interface to set the address.
674 @param[in] Ip6Addr The interface's to be assigned IPv6 address.
675 @param[in] IsAnycast If TRUE, the unicast IPv6 address is anycast.
676 Otherwise, it is not anycast.
677 @param[in] PrefixLength The prefix length of the Ip6Addr.
678 @param[in] ValidLifetime The valid lifetime for this address.
679 @param[in] PreferredLifetime The preferred lifetime for this address.
680 @param[in] DadCallback The caller's callback to trigger when DAD finishes.
681 This is an optional parameter that may be NULL.
682 @param[in] Context The context that will be passed to DadCallback.
683 This is an optional parameter that may be NULL.
684
685 @retval EFI_SUCCESS The interface is scheduled to be configured with
686 the specified address.
687 @retval EFI_OUT_OF_RESOURCES Failed to set the interface's address due to
688 lack of resources.
689
690 **/
691 EFI_STATUS
692 Ip6SetAddress (
693 IN IP6_INTERFACE *Interface,
694 IN EFI_IPv6_ADDRESS *Ip6Addr,
695 IN BOOLEAN IsAnycast,
696 IN UINT8 PrefixLength,
697 IN UINT32 ValidLifetime,
698 IN UINT32 PreferredLifetime,
699 IN IP6_DAD_CALLBACK DadCallback OPTIONAL,
700 IN VOID *Context OPTIONAL
701 );
702
703 /**
704 The heartbeat timer of ND module in IP6_TIMER_INTERVAL_IN_MS milliseconds.
705 This time routine handles DAD module and neighbor state transition.
706 It is also responsible for sending out router solicitations.
707
708 @param[in] Event The IP6 service instance's heartbeat timer.
709 @param[in] Context The IP6 service instance.
710
711 **/
712 VOID
713 EFIAPI
714 Ip6NdFasterTimerTicking (
715 IN EFI_EVENT Event,
716 IN VOID *Context
717 );
718
719 /**
720 The heartbeat timer of ND module in 1 second. This time routine handles following
721 things: 1) maintain default router list; 2) maintain prefix options;
722 3) maintain route caches.
723
724 @param[in] IpSb The IP6 service binding instance.
725
726 **/
727 VOID
728 Ip6NdTimerTicking (
729 IN IP6_SERVICE *IpSb
730 );
731
732 /**
733 Callback function when address resolution is finished. It will cancel
734 all the queued frames if the address resolution failed, or transmit them
735 if the request succeeded.
736
737 @param[in] Context The context of the callback, a pointer to IP6_NEIGHBOR_ENTRY.
738
739 **/
740 VOID
741 Ip6OnArpResolved (
742 IN VOID *Context
743 );
744
745 /**
746 Update the ReachableTime in IP6 service binding instance data, in milliseconds.
747
748 @param[in, out] IpSb Points to the IP6_SERVICE.
749
750 **/
751 VOID
752 Ip6UpdateReachableTime (
753 IN OUT IP6_SERVICE *IpSb
754 );
755
756 #endif