Loading...
Searching...
No Matches
ndp.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef NET_NDP_H
21#define NET_NDP_H
22
23#include <stdint.h>
24
25#include "byteorder.h"
26#include "net/ipv6/addr.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
37#define NDP_RTR_ADV_FLAGS_MASK (0xc0)
38#define NDP_RTR_ADV_FLAGS_M (0x80)
39#define NDP_RTR_ADV_FLAGS_O (0x40)
49#define NDP_RTR_ADV_CUR_HL_UNSPEC (0)
55#define NDP_RTR_ADV_LTIME_SEC_MAX (9000)
56
61#define NDP_NBR_ADV_LTIME_NOT_DR (0)
62
63#define NDP_NBR_ADV_REACH_TIME (0)
64#define NDP_NBR_ADV_RETRANS_TIMER (0)
72#define NDP_NBR_ADV_FLAGS_MASK (0xe0)
73#define NDP_NBR_ADV_FLAGS_R (0x80)
74#define NDP_NBR_ADV_FLAGS_S (0x40)
75#define NDP_NBR_ADV_FLAGS_O (0x20)
86#define NDP_OPT_SL2A (1)
87#define NDP_OPT_TL2A (2)
88#define NDP_OPT_PI (3)
89#define NDP_OPT_RH (4)
90#define NDP_OPT_MTU (5)
91#define NDP_OPT_RI (24)
92#define NDP_OPT_RDNSS (25)
93#define NDP_OPT_AR (33)
94#define NDP_OPT_6CTX (34)
95#define NDP_OPT_ABR (35)
102#define NDP_OPT_PI_FLAGS_MASK (0xc0)
103#define NDP_OPT_PI_FLAGS_L (0x80)
104#define NDP_OPT_PI_FLAGS_A (0x40)
111#define NDP_OPT_RI_FLAGS_MASK (0x18)
112#define NDP_OPT_RI_FLAGS_PRF_NONE (0x10)
113#define NDP_OPT_RI_FLAGS_PRF_NEG (0x18)
114#define NDP_OPT_RI_FLAGS_PRF_ZERO (0x0)
115#define NDP_OPT_RI_FLAGS_PRF_POS (0x8)
123#define NDP_OPT_PI_VALID_LTIME_INF (UINT32_MAX)
124#define NDP_OPT_PI_PREF_LTIME_INF (UINT32_MAX)
132#define NDP_OPT_PI_LEN (4U)
133#define NDP_OPT_MTU_LEN (1U)
140#define NDP_OPT_RDNSS_MIN_LEN (3U)
141
148#define NDP_MAX_INIT_RA_INTERVAL (16000U)
149#define NDP_MAX_INIT_RA_NUMOF (3U)
150#define NDP_MAX_FIN_RA_NUMOF (3U)
151#define NDP_MIN_MS_DELAY_BETWEEN_RAS (3000U)
152#define NDP_MAX_RA_DELAY (500U)
153#define NDP_MAX_RA_INTERVAL_MS (600000U)
154#define NDP_MIN_RA_INTERVAL_MS (198000U)
155#define NDP_RTR_LTIME_SEC (1800U)
163#define NDP_MAX_RS_MS_DELAY (1000U)
164#define NDP_RS_MS_INTERVAL (4000U)
165#define NDP_MAX_RS_NUMOF (3U)
173#define NDP_MAX_MC_SOL_NUMOF (3U)
174#define NDP_MAX_UC_SOL_NUMOF (3U)
183#define NDP_DAD_TRANSMIT_NUMOF (1U)
184#define NDP_MAX_ANYCAST_MS_DELAY (1000U)
185#define NDP_MAX_NA_NUMOF (3U)
186#define NDP_REACH_MS (30000U)
187#define NDP_RETRANS_TIMER_MS (1000U)
193#define NDP_MAX_RETRANS_TIMER_MS (60000U)
194
202#define NDP_MAX_NS_NUMOF (17U)
203#define NDP_DELAY_FIRST_PROBE_MS (5000U)
204#define NDP_MIN_RANDOM_FACTOR (500U)
205#define NDP_MAX_RANDOM_FACTOR (1500U)
218#define NDP_HOP_LIMIT (255U)
219
226typedef struct __attribute__((packed)) {
227 uint8_t type;
228 uint8_t code;
232
249
256typedef struct __attribute__((packed)) {
257 uint8_t type;
258 uint8_t code;
263
270typedef struct __attribute__((packed)) {
271 uint8_t type;
272 uint8_t code;
274 uint8_t flags;
275 uint8_t resv[3];
278
285typedef struct __attribute__((packed)) {
286 uint8_t type;
287 uint8_t code;
293
298typedef struct __attribute__((packed)) {
299 uint8_t type;
300 uint8_t len;
301} ndp_opt_t;
302
303/* XXX: slla and tlla are just ndp_opt_t with variable link layer address
304 * appended */
305
322
329typedef struct __attribute__((packed)) {
330 uint8_t type;
331 uint8_t len;
332 uint8_t prefix_len;
333 uint8_t flags;
337
344typedef struct __attribute__((packed)) {
345 uint8_t type;
346 uint8_t len;
347 uint8_t resv[6];
349
356typedef struct __attribute__((packed)) {
357 uint8_t type;
358 uint8_t len;
362
370typedef struct __attribute__((packed)) {
371 uint8_t type;
372 uint8_t len;
376
377#ifndef __cplusplus
386typedef struct __attribute__((packed)) {
387 uint8_t type;
388 uint8_t len;
391 ipv6_addr_t addrs[];
393#endif
394
395#ifdef __cplusplus
396}
397#endif
398
399#endif /* NET_NDP_H */
Functions to work with different byte orders.
Definitions for IPv6 addresses.
Neighbor advertisement message format.
Definition ndp.h:270
network_uint16_t csum
checksum
Definition ndp.h:273
ipv6_addr_t tgt
target address
Definition ndp.h:276
uint8_t code
message code
Definition ndp.h:272
uint8_t flags
flags
Definition ndp.h:274
uint8_t type
message type
Definition ndp.h:271
Neighbor solicitation message format.
Definition ndp.h:256
uint8_t type
message type
Definition ndp.h:257
network_uint16_t csum
checksum
Definition ndp.h:259
network_uint32_t resv
reserved field
Definition ndp.h:260
uint8_t code
message code
Definition ndp.h:258
ipv6_addr_t tgt
target address
Definition ndp.h:261
MTU option format.
Definition ndp.h:356
uint8_t type
option type
Definition ndp.h:357
network_uint16_t resv
reserved field
Definition ndp.h:359
network_uint32_t mtu
MTU.
Definition ndp.h:360
uint8_t len
length in units of 8 octets
Definition ndp.h:358
Prefix information option format.
Definition ndp.h:312
uint8_t flags
flags
Definition ndp.h:316
uint8_t type
option type
Definition ndp.h:313
uint8_t prefix_len
prefix length
Definition ndp.h:315
network_uint32_t pref_ltime
preferred lifetime
Definition ndp.h:318
network_uint32_t resv
reserved field
Definition ndp.h:319
network_uint32_t valid_ltime
valid lifetime
Definition ndp.h:317
uint8_t len
length in units of 8 octets
Definition ndp.h:314
ipv6_addr_t prefix
prefix
Definition ndp.h:320
Recursive DNS server option format with payload.
Definition ndp.h:386
uint8_t type
option type
Definition ndp.h:387
network_uint16_t resv
reserved field
Definition ndp.h:389
uint8_t len
length in units of 8 octets
Definition ndp.h:388
network_uint32_t ltime
lifetime in seconds
Definition ndp.h:390
Recursive DNS server option format without payload.
Definition ndp.h:370
uint8_t type
option type
Definition ndp.h:371
network_uint16_t resv
reserved field
Definition ndp.h:373
uint8_t len
length in units of 8 octets
Definition ndp.h:372
network_uint32_t ltime
lifetime in seconds
Definition ndp.h:374
Redirected header option format.
Definition ndp.h:344
uint8_t len
length in units of 8 octets
Definition ndp.h:346
uint8_t type
option type
Definition ndp.h:345
Route information option format.
Definition ndp.h:329
uint8_t prefix_len
prefix length
Definition ndp.h:332
network_uint32_t route_ltime
route lifetime
Definition ndp.h:334
uint8_t len
length in units of 8 octets
Definition ndp.h:331
uint8_t type
option type
Definition ndp.h:330
ipv6_addr_t prefix
prefix
Definition ndp.h:335
uint8_t flags
flags
Definition ndp.h:333
General NDP option format.
Definition ndp.h:298
uint8_t len
length in units of 8 octets
Definition ndp.h:300
uint8_t type
option type
Definition ndp.h:299
Redirect message format.
Definition ndp.h:285
ipv6_addr_t tgt
target address
Definition ndp.h:290
uint8_t code
message code
Definition ndp.h:287
uint8_t type
message type
Definition ndp.h:286
ipv6_addr_t dst
destination address
Definition ndp.h:291
network_uint32_t resv
reserved field
Definition ndp.h:289
network_uint16_t csum
checksum
Definition ndp.h:288
Router advertisement message format.
Definition ndp.h:239
uint8_t code
message code
Definition ndp.h:241
uint8_t flags
flags
Definition ndp.h:244
network_uint32_t reach_time
reachable time
Definition ndp.h:246
network_uint16_t csum
checksum
Definition ndp.h:242
uint8_t type
message type
Definition ndp.h:240
uint8_t cur_hl
current hop limit
Definition ndp.h:243
network_uint32_t retrans_timer
retransmission timer
Definition ndp.h:247
network_uint16_t ltime
router lifetime
Definition ndp.h:245
Router solicitation message format.
Definition ndp.h:226
network_uint16_t csum
checksum
Definition ndp.h:229
network_uint32_t resv
reserved field
Definition ndp.h:230
uint8_t type
message type
Definition ndp.h:227
uint8_t code
message code
Definition ndp.h:228
A 16 bit integer in big endian aka network byte order.
Definition byteorder.h:74
A 32 bit integer in big endian aka network byte order.
Definition byteorder.h:84
Data type to represent an IPv6 address.
Definition addr.h:72