iPXE
ndp.h
Go to the documentation of this file.
1#ifndef _IPXE_NDP_H
2#define _IPXE_NDP_H
3
4/** @file
5 *
6 * Neighbour discovery protocol
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdint.h>
14#include <ipxe/in.h>
15#include <ipxe/ipv6.h>
16#include <ipxe/icmpv6.h>
17#include <ipxe/neighbour.h>
18
19/** An NDP option header */
21 /** Type */
23 /** Length (in blocks of 8 bytes) */
25} __attribute__ (( packed ));
26
27/** NDP option block size */
28#define NDP_OPTION_BLKSZ 8U
29
30/** NDP source link-layer address option */
31#define NDP_OPT_LL_SOURCE 1
32
33/** NDP target link-layer address option */
34#define NDP_OPT_LL_TARGET 2
35
36/** NDP source or target link-layer address option */
38 /** NDP option header */
40 /** Link-layer address */
42} __attribute__ (( packed ));
43
44/** NDP prefix information option */
45#define NDP_OPT_PREFIX 3
46
47/** NDP prefix information */
49 /** NDP option header */
51 /** Prefix length */
53 /** Flags */
55 /** Valid lifetime */
57 /** Preferred lifetime */
59 /** Reserved */
61 /** Prefix */
63} __attribute__ (( packed ));
64
65/** NDP on-link flag */
66#define NDP_PREFIX_ON_LINK 0x80
67
68/** NDP autonomous address configuration flag */
69#define NDP_PREFIX_AUTONOMOUS 0x40
70
71/** NDP recursive DNS server option */
72#define NDP_OPT_RDNSS 25
73
74/** NDP recursive DNS server */
76 /** NDP option header */
78 /** Reserved */
80 /** Lifetime */
82 /** Addresses */
84} __attribute__ (( packed ));
85
86/** NDP DNS search list option */
87#define NDP_OPT_DNSSL 31
88
89/** NDP DNS search list */
91 /** NDP option header */
93 /** Reserved */
95 /** Lifetime */
97 /** Domain names */
99} __attribute__ (( packed ));
100
101/** An NDP option */
103 /** Option header */
105 /** Source or target link-layer address option */
107 /** Prefix information option */
109 /** Recursive DNS server option */
111 /** DNS search list option */
113} __attribute__ (( packed ));
114
115/** An NDP neighbour solicitation or advertisement header */
117 /** ICMPv6 header */
119 /** Flags */
121 /** Reserved */
123 /** Target address */
125 /** Options */
127} __attribute__ (( packed ));
128
129/** NDP router flag */
130#define NDP_NEIGHBOUR_ROUTER 0x80
131
132/** NDP solicited flag */
133#define NDP_NEIGHBOUR_SOLICITED 0x40
134
135/** NDP override flag */
136#define NDP_NEIGHBOUR_OVERRIDE 0x20
137
138/** An NDP router advertisement header */
140 /** ICMPv6 header */
142 /** Current hop limit */
144 /** Flags */
146 /** Router lifetime */
148 /** Reachable time */
150 /** Retransmission timer */
152 /** Options */
154} __attribute__ (( packed ));
155
156/** NDP managed address configuration */
157#define NDP_ROUTER_MANAGED 0x80
158
159/** NDP other configuration */
160#define NDP_ROUTER_OTHER 0x40
161
162/** An NDP router solicitation header */
164 /** ICMPv6 header */
166 /** Reserved */
168 /** Options */
170} __attribute__ (( packed ));
171
172/** An NDP header */
174 /** ICMPv6 header */
176 /** Neighbour solicitation or advertisement header */
178 /** Router solicitation header */
180 /** Router advertisement header */
182} __attribute__ (( packed ));
183
185
186/**
187 * Transmit packet, determining link-layer address via NDP
188 *
189 * @v iobuf I/O buffer
190 * @v netdev Network device
191 * @v net_dest Destination network-layer address
192 * @v net_source Source network-layer address
193 * @ret rc Return status code
194 */
195static inline int ndp_tx ( struct io_buffer *iobuf, struct net_device *netdev,
196 const void *net_dest, const void *net_source ) {
197
198 return neighbour_tx ( iobuf, netdev, &ipv6_protocol, net_dest,
199 &ndp_discovery, net_source );
200}
201
202/** NDP settings block name */
203#define NDP_SETTINGS_NAME "ndp"
204
205#endif /* _IPXE_NDP_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned char uint8_t
Definition stdint.h:10
static struct net_device * netdev
Definition gdbudp.c:53
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
ICMPv6 protocol.
#define __attribute__(x)
Definition compiler.h:10
IPv6 protocol.
struct neighbour_discovery ndp_discovery
NDP neighbour discovery protocol.
Definition ndp.c:162
static int ndp_tx(struct io_buffer *iobuf, struct net_device *netdev, const void *net_dest, const void *net_source)
Transmit packet, determining link-layer address via NDP.
Definition ndp.h:195
int neighbour_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, struct neighbour_discovery *discovery, const void *net_source)
Transmit packet, determining link-layer address via neighbour discovery.
Definition neighbour.c:377
Neighbour discovery.
An ICMP header.
Definition icmp.h:20
IP6 address structure.
Definition in.h:51
A persistent I/O buffer.
Definition iobuf.h:38
NDP DNS search list.
Definition ndp.h:90
uint16_t reserved
Reserved.
Definition ndp.h:94
uint32_t lifetime
Lifetime.
Definition ndp.h:96
struct ndp_option_header header
NDP option header.
Definition ndp.h:92
uint8_t names[0]
Domain names.
Definition ndp.h:98
NDP source or target link-layer address option.
Definition ndp.h:37
struct ndp_option_header header
NDP option header.
Definition ndp.h:39
uint8_t ll_addr[0]
Link-layer address.
Definition ndp.h:41
An NDP neighbour solicitation or advertisement header.
Definition ndp.h:116
uint8_t reserved[3]
Reserved.
Definition ndp.h:122
struct icmp_header icmp
ICMPv6 header.
Definition ndp.h:118
uint8_t flags
Flags.
Definition ndp.h:120
union ndp_option option[0]
Options.
Definition ndp.h:126
struct in6_addr target
Target address.
Definition ndp.h:124
An NDP option header.
Definition ndp.h:20
uint8_t blocks
Length (in blocks of 8 bytes)
Definition ndp.h:24
uint8_t type
Type.
Definition ndp.h:22
NDP prefix information.
Definition ndp.h:48
uint8_t flags
Flags.
Definition ndp.h:54
uint8_t prefix_len
Prefix length.
Definition ndp.h:52
uint32_t valid
Valid lifetime.
Definition ndp.h:56
uint32_t reserved
Reserved.
Definition ndp.h:60
struct in6_addr prefix
Prefix.
Definition ndp.h:62
uint32_t preferred
Preferred lifetime.
Definition ndp.h:58
struct ndp_option_header header
NDP option header.
Definition ndp.h:50
NDP recursive DNS server.
Definition ndp.h:75
uint32_t lifetime
Lifetime.
Definition ndp.h:81
struct in6_addr addresses[0]
Addresses.
Definition ndp.h:83
struct ndp_option_header header
NDP option header.
Definition ndp.h:77
uint16_t reserved
Reserved.
Definition ndp.h:79
An NDP router advertisement header.
Definition ndp.h:139
union ndp_option option[0]
Options.
Definition ndp.h:153
uint16_t lifetime
Router lifetime.
Definition ndp.h:147
uint32_t retransmit
Retransmission timer.
Definition ndp.h:151
uint8_t hop_limit
Current hop limit.
Definition ndp.h:143
struct icmp_header icmp
ICMPv6 header.
Definition ndp.h:141
uint32_t reachable
Reachable time.
Definition ndp.h:149
An NDP router solicitation header.
Definition ndp.h:163
uint32_t reserved
Reserved.
Definition ndp.h:167
struct icmp_header icmp
ICMPv6 header.
Definition ndp.h:165
union ndp_option option[0]
Options.
Definition ndp.h:169
A neighbour discovery protocol.
Definition neighbour.h:20
A network device.
Definition netdevice.h:353
An NDP header.
Definition ndp.h:173
struct ndp_router_advertisement_header radv
Router advertisement header.
Definition ndp.h:181
struct ndp_router_solicitation_header rsol
Router solicitation header.
Definition ndp.h:179
struct ndp_neighbour_header neigh
Neighbour solicitation or advertisement header.
Definition ndp.h:177
struct icmp_header icmp
ICMPv6 header.
Definition ndp.h:175
An NDP option.
Definition ndp.h:102
struct ndp_dnssl_option dnssl
DNS search list option.
Definition ndp.h:112
struct ndp_prefix_information_option prefix
Prefix information option.
Definition ndp.h:108
struct ndp_rdnss_option rdnss
Recursive DNS server option.
Definition ndp.h:110
struct ndp_option_header header
Option header.
Definition ndp.h:104
struct ndp_ll_addr_option ll_addr
Source or target link-layer address option.
Definition ndp.h:106