ndp.h
Go to the documentation of this file.
1 /**
2  * @file ndp.h
3  * @brief NDP (Neighbor Discovery Protocol)
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _NDP_H
30 #define _NDP_H
31 
32 //Dependencies
33 #include "core/net.h"
34 
35 //NDP support
36 #ifndef NDP_SUPPORT
37  #define NDP_SUPPORT ENABLED
38 #elif (NDP_SUPPORT != ENABLED && NDP_SUPPORT != DISABLED)
39  #error NDP_SUPPORT parameter is not valid
40 #endif
41 
42 //NDP tick interval
43 #ifndef NDP_TICK_INTERVAL
44  #define NDP_TICK_INTERVAL 200
45 #elif (NDP_TICK_INTERVAL < 10)
46  #error NDP_TICK_INTERVAL parameter is not valid
47 #endif
48 
49 //Neighbor cache size
50 #ifndef NDP_NEIGHBOR_CACHE_SIZE
51  #define NDP_NEIGHBOR_CACHE_SIZE 8
52 #elif (NDP_NEIGHBOR_CACHE_SIZE < 1)
53  #error NDP_NEIGHBOR_CACHE_SIZE parameter is not valid
54 #endif
55 
56 //Destination cache size
57 #ifndef NDP_DEST_CACHE_SIZE
58  #define NDP_DEST_CACHE_SIZE 8
59 #elif (NDP_DEST_CACHE_SIZE < 1)
60  #error NDP_DEST_CACHE_SIZE parameter is not valid
61 #endif
62 
63 //Maximum number of packets waiting for address resolution to complete
64 #ifndef NDP_MAX_PENDING_PACKETS
65  #define NDP_MAX_PENDING_PACKETS 2
66 #elif (NDP_MAX_PENDING_PACKETS < 1)
67  #error NDP_MAX_PENDING_PACKETS parameter is not valid
68 #endif
69 
70 //Maximum time interval between Router Advertisements
71 #ifndef NDP_MAX_RTR_ADVERT_INTERVAL
72  #define NDP_MAX_RTR_ADVERT_INTERVAL 600000
73 #elif (NDP_MAX_RTR_ADVERT_INTERVAL < 1000)
74  #error NDP_MAX_RTR_ADVERT_INTERVAL parameter is not valid
75 #endif
76 
77 //Maximum time interval between initial Router Advertisements
78 #ifndef NDP_MAX_INITIAL_RTR_ADVERT_INTERVAL
79  #define NDP_MAX_INITIAL_RTR_ADVERT_INTERVAL 16000
80 #elif (NDP_MAX_INITIAL_RTR_ADVERT_INTERVAL < 1000)
81  #error NDP_MAX_INITIAL_RTR_ADVERT_INTERVAL parameter is not valid
82 #endif
83 
84 //Maximum number of initial Router Advertisements
85 #ifndef NDP_MAX_INITIAL_RTR_ADVERTISEMENTS
86  #define NDP_MAX_INITIAL_RTR_ADVERTISEMENTS 3
87 #elif (NDP_MAX_INITIAL_RTR_ADVERTISEMENTS < 1)
88  #error NDP_MAX_INITIAL_RTR_ADVERTISEMENTS parameter is not valid
89 #endif
90 
91 //Maximum number of final Router Advertisements
92 #ifndef NDP_MAX_FINAL_RTR_ADVERTISEMENTS
93  #define NDP_MAX_FINAL_RTR_ADVERTISEMENTS 3
94 #elif (NDP_MAX_FINAL_RTR_ADVERTISEMENTS < 1)
95  #error NDP_MAX_FINAL_RTR_ADVERTISEMENTS parameter is not valid
96 #endif
97 
98 //Minimum delay between Router Advertisements
99 #ifndef NDP_MIN_DELAY_BETWEEN_RAS
100  #define NDP_MIN_DELAY_BETWEEN_RAS 3000
101 #elif (NDP_MIN_DELAY_BETWEEN_RAS < 1000)
102  #error NDP_MIN_DELAY_BETWEEN_RAS parameter is not valid
103 #endif
104 
105 //Maximum delay for Router Advertisements sent in response to a Router Solicitation
106 #ifndef NDP_MAX_RA_DELAY_TIME
107  #define NDP_MAX_RA_DELAY_TIME 500
108 #elif (NDP_MAX_RA_DELAY_TIME < 100)
109  #error NDP_MAX_RA_DELAY_TIME parameter is not valid
110 #endif
111 
112 //Minimum delay before transmitting the first Router Solicitation message
113 #ifndef NDP_MIN_RTR_SOLICITATION_DELAY
114  #define NDP_MIN_RTR_SOLICITATION_DELAY 0
115 #elif (NDP_MIN_RTR_SOLICITATION_DELAY < 0)
116  #error NDP_MIN_RTR_SOLICITATION_DELAY parameter is not valid
117 #endif
118 
119 //Maximum delay before transmitting the first Router Solicitation message
120 #ifndef NDP_MAX_RTR_SOLICITATION_DELAY
121  #define NDP_MAX_RTR_SOLICITATION_DELAY 1000
122 #elif (NDP_MAX_RTR_SOLICITATION_DELAY < 0)
123  #error NDP_MAX_RTR_SOLICITATION_DELAY parameter is not valid
124 #endif
125 
126 //The time between retransmissions of Router Solicitation messages
127 #ifndef NDP_RTR_SOLICITATION_INTERVAL
128  #define NDP_RTR_SOLICITATION_INTERVAL 4000
129 #elif (NDP_RTR_SOLICITATION_INTERVAL < 1000)
130  #error NDP_RTR_SOLICITATION_INTERVAL parameter is not valid
131 #endif
132 
133 //Number of retransmissions for Router Solicitation messages
134 #ifndef NDP_MAX_RTR_SOLICITATIONS
135  #define NDP_MAX_RTR_SOLICITATIONS 3
136 #elif (NDP_MAX_RTR_SOLICITATIONS < 1)
137  #error NDP_MAX_RTR_SOLICITATIONS parameter is not valid
138 #endif
139 
140 //Number of retransmissions for multicast Neighbor Solicitation messages
141 #ifndef NDP_MAX_MULTICAST_SOLICIT
142  #define NDP_MAX_MULTICAST_SOLICIT 3
143 #elif (NDP_MAX_MULTICAST_SOLICIT < 1)
144  #error NDP_MAX_MULTICAST_SOLICIT parameter is not valid
145 #endif
146 
147 //Number of retransmissions for unicast Neighbor Solicitation messages
148 #ifndef NDP_MAX_UNICAST_SOLICIT
149  #define NDP_MAX_UNICAST_SOLICIT 3
150 #elif (NDP_MAX_UNICAST_SOLICIT < 1)
151  #error NDP_MAX_UNICAST_SOLICIT parameter is not valid
152 #endif
153 
154 //Maximum number of Neighbor Solicitation messages sent while performing DAD
155 #ifndef NDP_DUP_ADDR_DETECT_TRANSMITS
156  #define NDP_DUP_ADDR_DETECT_TRANSMITS 1
157 #elif (NDP_DUP_ADDR_DETECT_TRANSMITS < 0)
158  #error NDP_DUP_ADDR_DETECT_TRANSMITS parameter is not valid
159 #endif
160 
161 //Delay before sending Neighbor Advertisements if the target address is an anycast address
162 #ifndef NDP_MAX_ANYCAST_DELAY_TIME
163  #define NDP_MAX_ANYCAST_DELAY_TIME 1000
164 #elif (NDP_MAX_ANYCAST_DELAY_TIME < 100)
165  #error NDP_MAX_ANYCAST_DELAY_TIME parameter is not valid
166 #endif
167 
168 //Maximum number of unsolicited Neighbor Advertisements
169 #ifndef NDP_MAX_NEIGHBOR_ADVERTISEMENT
170  #define NDP_MAX_NEIGHBOR_ADVERTISEMENT 3
171 #elif (NDP_MAX_NEIGHBOR_ADVERTISEMENT < 0)
172  #error NDP_MAX_NEIGHBOR_ADVERTISEMENT parameter is not valid
173 #endif
174 
175 //The time a neighbor is considered reachable after receiving a reachability confirmation
176 #ifndef NDP_REACHABLE_TIME
177  #define NDP_REACHABLE_TIME 30000
178 #elif (NDP_REACHABLE_TIME < 1000)
179  #error NDP_REACHABLE_TIME parameter is not valid
180 #endif
181 
182 //The time between retransmissions of Neighbor Solicitation messages
183 #ifndef NDP_RETRANS_TIMER
184  #define NDP_RETRANS_TIMER 1000
185 #elif (NDP_RETRANS_TIMER < 100)
186  #error NDP_RETRANS_TIMER parameter is not valid
187 #endif
188 
189 //Delay before sending the first probe
190 #ifndef NDP_DELAY_FIRST_PROBE_TIME
191  #define NDP_DELAY_FIRST_PROBE_TIME 5000
192 #elif (NDP_DELAY_FIRST_PROBE_TIME < 1000)
193  #error NDP_DELAY_FIRST_PROBE_TIME parameter is not valid
194 #endif
195 
196 //Hop Limit used by NDP messages
197 #define NDP_HOP_LIMIT 255
198 
199 //Infinite lifetime
200 #define NDP_INFINITE_LIFETIME 0xFFFFFFFF
201 
202 //C++ guard
203 #ifdef __cplusplus
204  extern "C" {
205 #endif
206 
207 
208 /**
209  * @brief Neighbor Discovery options
210  **/
211 
212 typedef enum
213 {
224 } NdpOptionType;
225 
226 
227 /**
228  * @brief Router selection preferences
229  **/
230 
231 typedef enum
232 {
238 
239 
240 /**
241  * @brief Neighbor cache entry states
242  **/
243 
244 typedef enum
245 {
253 } NdpState;
254 
255 
256 //CodeWarrior or Win32 compiler?
257 #if defined(__CWCC__) || defined(_WIN32)
258  #pragma pack(push, 1)
259 #endif
260 
261 
262 /**
263  * @brief Router Solicitation message
264  **/
265 
266 typedef __start_packed struct
267 {
268  uint8_t type; //0
269  uint8_t code; //1
270  uint16_t checksum; //2-3
271  uint32_t reserved; //4-7
272  uint8_t options[]; //8
274 
275 
276 /**
277  * @brief Router Advertisement message
278  **/
279 
280 typedef __start_packed struct
281 {
282  uint8_t type; //0
283  uint8_t code; //1
284  uint16_t checksum; //2-3
285  uint8_t curHopLimit; //4
286 #ifdef _CPU_BIG_ENDIAN
287  uint8_t m : 1; //5
288  uint8_t o : 1;
289  uint8_t h : 1;
290  uint8_t prf : 2;
291  uint8_t p : 1;
292  uint8_t reserved : 2;
293 #else
294  uint8_t reserved : 2; //5
295  uint8_t p : 1;
296  uint8_t prf : 2;
297  uint8_t h : 1;
298  uint8_t o : 1;
299  uint8_t m : 1;
300 #endif
301  uint16_t routerLifetime; //6-7
302  uint32_t reachableTime; //8-11
303  uint32_t retransTimer; //12-15
304  uint8_t options[]; //16
306 
307 
308 /**
309  * @brief Neighbor Solicitation message
310  **/
311 
312 typedef __start_packed struct
313 {
314  uint8_t type; //0
315  uint8_t code; //1
316  uint16_t checksum; //2-3
317  uint32_t reserved; //4-7
319  uint8_t options[]; //24
321 
322 
323 /**
324  * @brief Neighbor Advertisement message
325  **/
326 
327 typedef __start_packed struct
328 {
329  uint8_t type; //0
330  uint8_t code; //1
331  uint16_t checksum; //2-3
332 #ifdef _CPU_BIG_ENDIAN
333  uint32_t r : 1; //4
334  uint32_t s : 1;
335  uint32_t o : 1;
336  uint32_t reserved1 : 5;
337  uint32_t reserved2 : 24; //5-7
338 #else
339  uint32_t reserved1 : 5; //4
340  uint32_t o : 1;
341  uint32_t s : 1;
342  uint32_t r : 1;
343  uint32_t reserved2 : 24; //5-7
344 #endif
345  Ipv6Addr targetAddr; //8-23
346  uint8_t options[]; //24
348 
349 
350 /**
351  * @brief Redirect message
352  **/
353 
354 typedef __start_packed struct
355 {
356  uint8_t type; //0
357  uint8_t code; //1
358  uint16_t checksum; //2-3
359  uint32_t reserved; //4-7
360  Ipv6Addr targetAddr; //8-23
362  uint8_t options[]; //40
364 
365 
366 /**
367  * @brief Neighbor Discovery option general format
368  **/
369 
370 typedef __start_packed struct
371 {
372  uint8_t type; //0
373  uint8_t length; //1
374  uint8_t value[]; //2
376 
377 
378 /**
379  * @brief Source/Target Link-Layer Address option
380  **/
381 
382 typedef __start_packed struct
383 {
384  uint8_t type; //0
385  uint8_t length; //1
388 
389 
390 /**
391  * @brief Prefix Information option (PIO)
392  **/
393 
394 typedef __start_packed struct
395 {
396  uint8_t type; //0
397  uint8_t length; //1
398  uint8_t prefixLength; //2
399 #ifdef _CPU_BIG_ENDIAN
400  uint8_t l : 1; //3
401  uint8_t a : 1;
402  uint8_t r : 1;
403  uint8_t reserved1 : 5;
404 #else
405  uint8_t reserved1 : 5; //3
406  uint8_t r : 1;
407  uint8_t a : 1;
408  uint8_t l : 1;
409 #endif
410  uint32_t validLifetime; //4-7
411  uint32_t preferredLifetime; //8-11
412  uint32_t reserved2; //12-15
413  Ipv6Addr prefix; //16-31
415 
416 
417 /**
418  * @brief Redirected Header option (RHO)
419  **/
420 
421 typedef __start_packed struct
422 {
423  uint8_t type; //0
424  uint8_t length; //1
425  uint16_t reserved1; //2-3
426  uint32_t reserved2; //4-7
427  uint8_t ipPacket[]; //8
429 
430 
431 /**
432  * @brief MTU option
433  **/
434 
435 typedef __start_packed struct
436 {
437  uint8_t type; //0
438  uint8_t length; //1
439  uint16_t reserved; //2-3
440  uint32_t mtu; //4-7
442 
443 
444 /**
445  * @brief Route Information option (RIO)
446  **/
447 
448 typedef __start_packed struct
449 {
450  uint8_t type; //0
451  uint8_t length; //1
452  uint8_t prefixLength; //2
453 #ifdef _CPU_BIG_ENDIAN
454  uint8_t reserved1 : 3; //3
455  uint8_t prf : 2;
456  uint8_t reserved2 : 3;
457 #else
458  uint8_t reserved2 : 3; //3
459  uint8_t prf : 2;
460  uint8_t reserved1 : 3;
461 #endif
462  uint32_t routeLifetime; //4-7
463  Ipv6Addr prefix; //8
465 
466 
467 /**
468  * @brief Recursive DNS Server option (RDNSS)
469  **/
470 
471 typedef __start_packed struct
472 {
473  uint8_t type; //0
474  uint8_t length; //1
475  uint16_t reserved; //2-3
476  uint32_t lifetime; //4-7
479 
480 
481 /**
482  * @brief DNS Search List option (DNSSL)
483  **/
484 
485 typedef __start_packed struct
486 {
487  uint8_t type; //0
488  uint8_t length; //1
489  uint16_t reserved; //2-3
490  uint32_t lifetime; //4-7
491  uint8_t domainNames[]; //8
493 
494 
495 /**
496  * @brief 6LoWPAN Context option (6CO)
497  **/
498 
499 typedef __start_packed struct
500 {
501  uint8_t type; //0
502  uint8_t length; //1
503  uint8_t contextLength; //2
504 #ifdef _CPU_BIG_ENDIAN
505  uint8_t reserved1 : 3; //3
506  uint8_t c : 1;
507  uint8_t cid : 4;
508 #else
509  uint8_t cid : 4; //3
510  uint8_t c : 1;
511  uint8_t reserved1 : 3;
512 #endif
513  uint16_t reserved2; //4-5
514  uint16_t validLifetime; //6-7
517 
518 
519 //CodeWarrior or Win32 compiler?
520 #if defined(__CWCC__) || defined(_WIN32)
521  #pragma pack(pop)
522 #endif
523 
524 
525 /**
526  * @brief NDP queue item
527  **/
528 
529 typedef struct
530 {
531  NetInterface *srcInterface; //<Interface from which the packet has been received
532  NetBuffer *buffer; ///<Packet waiting for address resolution
533  size_t offset; ///<Offset to the first byte of the packet
534 } NdpQueueItem;
535 
536 
537 /**
538  * @brief Neighbor cache entry
539  **/
540 
541 typedef struct
542 {
543  NdpState state; ///<Reachability state
544  Ipv6Addr ipAddr; ///<Unicast IPv6 address
545  MacAddr macAddr; ///<Link layer address associated with the IPv6 address
546  bool_t isRouter; ///<A flag indicating whether the neighbor is a router or a host
547  systime_t timestamp; ///<Timestamp to manage entry lifetime
548  systime_t timeout; ///<Timeout value
549  uint_t retransmitCount; ///<Retransmission counter
550  NdpQueueItem queue[NDP_MAX_PENDING_PACKETS]; ///<Packets waiting for address resolution to complete
551  uint_t queueSize; ///<Number of queued packets
553 
554 
555 /**
556  * @brief Destination cache entry
557  **/
558 
559 typedef struct
560 {
561  Ipv6Addr destAddr; ///<Destination IPv6 address
562  Ipv6Addr nextHop; ///<IPv6 address of the next-hop neighbor
563  size_t pathMtu; ///<Path MTU
564  systime_t timestamp; ///<Timestamp to manage entry lifetime
566 
567 
568 /**
569  * @brief NDP context
570  **/
571 
572 typedef struct
573 {
574  uint32_t reachableTime; ///<The time a node assumes a neighbor is reachable
575  uint32_t retransTimer; ///<The time between retransmissions of NS messages
576  uint_t dupAddrDetectTransmits; ///<Maximum number of NS messages sent while performing DAD
577  systime_t minRtrSolicitationDelay; ///<Minimum delay before transmitting the first RS message
578  systime_t maxRtrSolicitationDelay; ///<Maximum delay before transmitting the first RS message
579  systime_t rtrSolicitationInterval; ///<Time interval between retransmissions of RS messages
580  uint_t maxRtrSolicitations; ///<Number of retransmissions for RS messages
581  uint_t rtrSolicitationCount; ///<Retransmission counter for RS messages
582  bool_t rtrAdvReceived; ///<Valid RA message received
583  systime_t timestamp; ///<Timestamp to manage retransmissions
584  systime_t timeout; ///<Timeout value
585  NdpNeighborCacheEntry neighborCache[NDP_NEIGHBOR_CACHE_SIZE]; ///<Neighbor cache
586  NdpDestCacheEntry destCache[NDP_DEST_CACHE_SIZE]; ///<Destination cache
587 } NdpContext;
588 
589 
590 //Tick counter to handle periodic operations
592 
593 //NDP related functions
594 error_t ndpInit(NetInterface *interface);
595 
596 error_t ndpResolve(NetInterface *interface, const Ipv6Addr *ipAddr, MacAddr *macAddr);
597 
598 error_t ndpEnqueuePacket(NetInterface *srcInterface, NetInterface *destInterface,
599  const Ipv6Addr *ipAddr, NetBuffer *buffer, size_t offset);
600 
601 void ndpTick(NetInterface *interface);
602 void ndpLinkChangeEvent(NetInterface *interface);
603 
604 void ndpProcessRouterAdv(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader,
605  const NetBuffer *buffer, size_t offset, uint8_t hopLimit);
606 
607 void ndpProcessNeighborSol(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader,
608  const NetBuffer *buffer, size_t offset, uint8_t hopLimit);
609 
610 void ndpProcessNeighborAdv(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader,
611  const NetBuffer *buffer, size_t offset, uint8_t hopLimit);
612 
613 void ndpProcessRedirect(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader,
614  const NetBuffer *buffer, size_t offset, uint8_t hopLimit);
615 
617 
619  const Ipv6Addr *targetIpAddr, bool_t multicast);
620 
622  const Ipv6Addr *targetIpAddr, const Ipv6Addr *destIpAddr);
623 
625  const NetBuffer *ipPacket, size_t ipPacketOffset);
626 
632 
633 //C++ guard
634 #ifdef __cplusplus
635  }
636 #endif
637 
638 #endif
uint32_t systime_t
Definition: compiler_port.h:44
NdpState
Neighbor cache entry states.
Definition: ndp.h:244
uint32_t reserved2
Definition: ndp.h:343
uint32_t retransTimer
The time between retransmissions of NS messages.
Definition: ndp.h:575
NdpRouterSelPreference
Router selection preferences.
Definition: ndp.h:231
uint8_t c
Definition: ndp.h:510
uint_t maxRtrSolicitations
Number of retransmissions for RS messages.
Definition: ndp.h:580
TCP/IP stack core.
uint32_t reachableTime
Definition: ndp.h:302
error_t ndpResolve(NetInterface *interface, const Ipv6Addr *ipAddr, MacAddr *macAddr)
Address resolution using Neighbor Discovery protocol.
Definition: ndp.c:98
__start_packed struct @194 NdpRouterSolMessage
Router Solicitation message.
__start_packed struct @197 NdpNeighborAdvMessage
Neighbor Advertisement message.
uint8_t p
Definition: ndp.h:295
__start_packed struct @203 NdpMtuOption
MTU option.
#define NDP_MAX_PENDING_PACKETS
Definition: ndp.h:65
uint8_t message[]
Definition: chap.h:150
void ndpProcessNeighborSol(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, uint8_t hopLimit)
Neighbor Solicitation message processing.
Definition: ndp.c:683
bool_t isRouter
A flag indicating whether the neighbor is a router or a host.
Definition: ndp.h:546
void ndpDumpRouterSolMessage(const NdpRouterSolMessage *message)
Dump Router Solicitation message for debugging purpose.
Definition: ndp.c:1892
uint32_t retransTimer
Definition: ndp.h:303
NetInterface * srcInterface
Definition: ndp.h:531
NetBuffer * buffer
Packet waiting for address resolution.
Definition: ndp.h:532
void ndpProcessRedirect(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, uint8_t hopLimit)
Redirect message processing.
Definition: ndp.c:1164
error_t ndpSendRouterSol(NetInterface *interface)
Send a Router Solicitation message.
Definition: ndp.c:1364
__start_packed struct @205 NdpRdnssOption
Recursive DNS Server option (RDNSS)
__start_packed struct @183 Ipv6Addr
IPv6 network address.
uint16_t routerLifetime
Definition: ndp.h:301
void ndpDumpRouterAdvMessage(const NdpRouterAdvMessage *message)
Dump Router Advertisement message for debugging purpose.
Definition: ndp.c:1906
void ndpDumpRedirectMessage(const NdpRedirectMessage *message)
Dump Redirect message for debugging purpose.
Definition: ndp.c:1959
systime_t minRtrSolicitationDelay
Minimum delay before transmitting the first RS message.
Definition: ndp.h:577
__start_packed struct @206 NdpDnsslOption
DNS Search List option (DNSSL)
uint8_t m
Definition: ndp.h:299
__start_packed struct @200 NdpLinkLayerAddrOption
Source/Target Link-Layer Address option.
systime_t timestamp
Timestamp to manage retransmissions.
Definition: ndp.h:583
uint8_t curHopLimit
Definition: ndp.h:285
uint8_t a
Definition: ndp.h:407
bool_t rtrAdvReceived
Valid RA message received.
Definition: ndp.h:582
uint8_t prf
Definition: ndp.h:296
Destination cache entry.
Definition: ndp.h:559
uint8_t ipAddr[4]
Definition: mib_common.h:185
MacAddr macAddr
Link layer address associated with the IPv6 address.
Definition: ndp.h:545
void ndpProcessRouterAdv(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, uint8_t hopLimit)
Router Advertisement message processing.
Definition: ndp.c:401
uint32_t s
Definition: ndp.h:341
uint_t retransmitCount
Retransmission counter.
Definition: ndp.h:549
Ipv6Addr destAddr
Definition: ndp.h:361
Ipv6Addr nextHop
IPv6 address of the next-hop neighbor.
Definition: ndp.h:562
void ndpProcessNeighborAdv(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, uint8_t hopLimit)
Neighbor Advertisement message processing.
Definition: ndp.c:917
Ipv6Addr ipAddr
Unicast IPv6 address.
Definition: ndp.h:544
systime_t timestamp
Timestamp to manage entry lifetime.
Definition: ndp.h:547
void ndpDumpNeighborAdvMessage(const NdpNeighborAdvMessage *message)
Dump Neighbor Advertisement message for debugging purpose.
Definition: ndp.c:1941
NDP context.
Definition: ndp.h:572
uint32_t reserved1
Definition: ndp.h:339
NdpState state
Reachability state.
Definition: ndp.h:543
uint_t rtrSolicitationCount
Retransmission counter for RS messages.
Definition: ndp.h:581
error_t ndpInit(NetInterface *interface)
Neighbor cache initialization.
Definition: ndp.c:66
__start_packed struct @201 NdpPrefixInfoOption
Prefix Information option (PIO)
uint8_t length
Definition: ndp.h:373
uint8_t ipPacket[]
Definition: ndp.h:427
systime_t timeout
Timeout value.
Definition: ndp.h:548
Ipv6Addr prefix
Definition: ndp.h:413
NDP queue item.
Definition: ndp.h:529
uint8_t domainNames[]
Definition: ndp.h:491
error_t ndpSendRedirect(NetInterface *interface, const Ipv6Addr *targetAddr, const NetBuffer *ipPacket, size_t ipPacketOffset)
Send a Redirect message.
Definition: ndp.c:1733
#define Ipv6PseudoHeader
Definition: ipv6.h:40
uint8_t value[]
Definition: ndp.h:374
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:86
uint32_t mtu
Definition: ndp.h:440
void ndpLinkChangeEvent(NetInterface *interface)
Callback function for link change event.
Definition: ndp.c:364
void ndpTick(NetInterface *interface)
NDP timer handler.
Definition: ndp.c:274
uint32_t validLifetime
Definition: ndp.h:410
uint8_t o
Definition: ndp.h:298
__start_packed struct @198 NdpRedirectMessage
Redirect message.
__start_packed struct @196 NdpNeighborSolMessage
Neighbor Solicitation message.
__start_packed struct _Ipv4Header __end_packed
Neighbor cache entry.
Definition: ndp.h:541
__start_packed struct @204 NdpRouteInfoOption
Route Information option (RIO)
uint32_t lifetime
Definition: ndp.h:476
__start_packed struct @199 NdpOption
Neighbor Discovery option general format.
Ipv6Addr contextPrefix
Definition: ndp.h:515
error_t
Error codes.
Definition: error.h:40
Ipv6Addr destAddr
Destination IPv6 address.
Definition: ndp.h:561
size_t offset
Offset to the first byte of the packet.
Definition: ndp.h:533
error_t ndpSendNeighborSol(NetInterface *interface, const Ipv6Addr *targetIpAddr, bool_t multicast)
Send a Neighbor Solicitation message.
Definition: ndp.c:1471
systime_t timeout
Timeout value.
Definition: ndp.h:584
uint32_t reachableTime
The time a node assumes a neighbor is reachable.
Definition: ndp.h:574
uint_t dupAddrDetectTransmits
Maximum number of NS messages sent while performing DAD.
Definition: ndp.h:576
Ipv4Addr destIpAddr
Definition: ipcp.h:76
uint8_t options[]
Definition: ndp.h:272
unsigned int uint_t
Definition: compiler_port.h:43
uint_t queueSize
Number of queued packets.
Definition: ndp.h:551
Ipv6Addr targetAddr
Definition: ndp.h:318
Ipv6Addr address[]
Definition: ndp.h:477
uint8_t cid
Definition: ndp.h:509
__start_packed struct @112 MacAddr
MAC address.
size_t pathMtu
Path MTU.
Definition: ndp.h:563
systime_t rtrSolicitationInterval
Time interval between retransmissions of RS messages.
Definition: ndp.h:579
error_t ndpEnqueuePacket(NetInterface *srcInterface, NetInterface *destInterface, const Ipv6Addr *ipAddr, NetBuffer *buffer, size_t offset)
Enqueue an IPv6 packet waiting for address resolution.
Definition: ndp.c:190
#define NetInterface
Definition: net.h:34
uint32_t routeLifetime
Definition: ndp.h:462
uint32_t preferredLifetime
Definition: ndp.h:411
uint8_t type
Definition: ndp.h:268
void ndpDumpNeighborSolMessage(const NdpNeighborSolMessage *message)
Dump Neighbor Solicitation message for debugging purpose.
Definition: ndp.c:1926
__start_packed struct @207 NdpContextOption
6LoWPAN Context option (6CO)
__start_packed struct @195 NdpRouterAdvMessage
Router Advertisement message.
uint8_t prefixLength
Definition: ndp.h:398
uint32_t r
Definition: ndp.h:342
uint8_t code
Definition: ndp.h:269
uint16_t checksum
Definition: ndp.h:270
uint8_t contextLength
Definition: ndp.h:503
uint8_t l
Definition: ndp.h:408
NdpOptionType
Neighbor Discovery options.
Definition: ndp.h:212
error_t ndpSendNeighborAdv(NetInterface *interface, const Ipv6Addr *targetIpAddr, const Ipv6Addr *destIpAddr)
Send a Neighbor Advertisement message.
Definition: ndp.c:1591
MacAddr linkLayerAddr
Definition: ndp.h:386
#define NDP_NEIGHBOR_CACHE_SIZE
Definition: ndp.h:51
uint32_t reserved
Definition: ndp.h:271
uint8_t h
Definition: ndp.h:297
#define NDP_DEST_CACHE_SIZE
Definition: ndp.h:58
int bool_t
Definition: compiler_port.h:47
systime_t timestamp
Timestamp to manage entry lifetime.
Definition: ndp.h:564
systime_t ndpTickCounter
Definition: ndp.c:57
__start_packed struct @202 NdpRedirectedHeaderOption
Redirected Header option (RHO)
systime_t maxRtrSolicitationDelay
Maximum delay before transmitting the first RS message.
Definition: ndp.h:578