]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
c3c9b80d | 2 | * Copyright (c) 2000-2020 Apple Inc. All rights reserved. |
5d5c5d0d | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
0a7de745 | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
0a7de745 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
0a7de745 | 17 | * |
2d21ac55 A |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
0a7de745 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b | 27 | */ |
9bccf70c | 28 | /* $KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $ */ |
1c79356b A |
29 | |
30 | /* | |
31 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
32 | * All rights reserved. | |
33 | * | |
34 | * Redistribution and use in source and binary forms, with or without | |
35 | * modification, are permitted provided that the following conditions | |
36 | * are met: | |
37 | * 1. Redistributions of source code must retain the above copyright | |
38 | * notice, this list of conditions and the following disclaimer. | |
39 | * 2. Redistributions in binary form must reproduce the above copyright | |
40 | * notice, this list of conditions and the following disclaimer in the | |
41 | * documentation and/or other materials provided with the distribution. | |
42 | * 3. Neither the name of the project nor the names of its contributors | |
43 | * may be used to endorse or promote products derived from this software | |
44 | * without specific prior written permission. | |
45 | * | |
46 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND | |
47 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
49 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
50 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
51 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
52 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
53 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
54 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
55 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
56 | * SUCH DAMAGE. | |
57 | */ | |
58 | ||
59 | /* | |
60 | * Copyright (c) 1982, 1986, 1993 | |
61 | * The Regents of the University of California. All rights reserved. | |
62 | * | |
63 | * Redistribution and use in source and binary forms, with or without | |
64 | * modification, are permitted provided that the following conditions | |
65 | * are met: | |
66 | * 1. Redistributions of source code must retain the above copyright | |
67 | * notice, this list of conditions and the following disclaimer. | |
68 | * 2. Redistributions in binary form must reproduce the above copyright | |
69 | * notice, this list of conditions and the following disclaimer in the | |
70 | * documentation and/or other materials provided with the distribution. | |
71 | * 3. All advertising materials mentioning features or use of this software | |
72 | * must display the following acknowledgement: | |
73 | * This product includes software developed by the University of | |
74 | * California, Berkeley and its contributors. | |
75 | * 4. Neither the name of the University nor the names of its contributors | |
76 | * may be used to endorse or promote products derived from this software | |
77 | * without specific prior written permission. | |
78 | * | |
79 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
80 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
81 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
82 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
83 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
84 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
85 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
86 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
87 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
88 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
89 | * SUCH DAMAGE. | |
90 | * | |
91 | * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 | |
92 | */ | |
93 | ||
94 | #ifndef _NETINET_ICMP6_H_ | |
95 | #define _NETINET_ICMP6_H_ | |
f427ee49 | 96 | #ifndef DRIVERKIT |
9bccf70c | 97 | #include <sys/appleapiopts.h> |
f427ee49 A |
98 | #include <sys/types.h> |
99 | #else | |
100 | #include <sys/_types.h> | |
101 | #endif /* DRIVERKIT */ | |
1c79356b | 102 | |
0a7de745 A |
103 | #define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) |
104 | * - sizeof(struct icmp6_hdr) */ | |
1c79356b A |
105 | |
106 | struct icmp6_hdr { | |
0a7de745 A |
107 | u_int8_t icmp6_type; /* type field */ |
108 | u_int8_t icmp6_code; /* code field */ | |
109 | u_int16_t icmp6_cksum; /* checksum field */ | |
1c79356b | 110 | union { |
0a7de745 A |
111 | u_int32_t icmp6_un_data32[1]; /* type-specific field */ |
112 | u_int16_t icmp6_un_data16[2]; /* type-specific field */ | |
113 | u_int8_t icmp6_un_data8[4]; /* type-specific field */ | |
1c79356b | 114 | } icmp6_dataun; |
6d2010ae | 115 | } __attribute__((__packed__)); |
1c79356b | 116 | |
0a7de745 A |
117 | #define icmp6_data32 icmp6_dataun.icmp6_un_data32 |
118 | #define icmp6_data16 icmp6_dataun.icmp6_un_data16 | |
119 | #define icmp6_data8 icmp6_dataun.icmp6_un_data8 | |
120 | #define icmp6_pptr icmp6_data32[0] /* parameter prob */ | |
121 | #define icmp6_mtu icmp6_data32[0] /* packet too big */ | |
122 | #define icmp6_id icmp6_data16[0] /* echo request/reply */ | |
123 | #define icmp6_seq icmp6_data16[1] /* echo request/reply */ | |
124 | #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ | |
125 | ||
126 | #define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ | |
127 | #define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ | |
128 | #define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ | |
129 | #define ICMP6_PARAM_PROB 4 /* ip6 header bad */ | |
130 | ||
131 | #define ICMP6_ECHO_REQUEST 128 /* echo service */ | |
132 | #define ICMP6_ECHO_REPLY 129 /* echo reply */ | |
133 | #define MLD_LISTENER_QUERY 130 /* multicast listener query */ | |
134 | #define MLD_LISTENER_REPORT 131 /* multicast listener report */ | |
135 | #define MLD_LISTENER_DONE 132 /* multicast listener done */ | |
6d2010ae A |
136 | #define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */ |
137 | ||
138 | /* RFC2292 decls */ | |
0a7de745 A |
139 | #define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */ |
140 | #define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ | |
141 | #define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ | |
1c79356b | 142 | |
b0d623f7 | 143 | #ifndef KERNEL |
6d2010ae | 144 | /* the followings are for backward compatibility to old KAME apps. */ |
0a7de745 A |
145 | #define MLD6_LISTENER_QUERY MLD_LISTENER_QUERY |
146 | #define MLD6_LISTENER_REPORT MLD_LISTENER_REPORT | |
147 | #define MLD6_LISTENER_DONE MLD_LISTENER_DONE | |
6d2010ae | 148 | #endif |
b0d623f7 | 149 | |
0a7de745 A |
150 | #define ND_ROUTER_SOLICIT 133 /* router solicitation */ |
151 | #define ND_ROUTER_ADVERT 134 /* router advertisement */ | |
152 | #define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */ | |
153 | #define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisement */ | |
154 | #define ND_REDIRECT 137 /* redirect */ | |
1c79356b | 155 | |
0a7de745 | 156 | #define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */ |
1c79356b | 157 | |
0a7de745 A |
158 | #define ICMP6_WRUREQUEST 139 /* who are you request */ |
159 | #define ICMP6_WRUREPLY 140 /* who are you reply */ | |
160 | #define ICMP6_FQDN_QUERY 139 /* FQDN query */ | |
161 | #define ICMP6_FQDN_REPLY 140 /* FQDN reply */ | |
162 | #define ICMP6_NI_QUERY 139 /* node information request */ | |
163 | #define ICMP6_NI_REPLY 140 /* node information reply */ | |
164 | #define MLDV2_LISTENER_REPORT 143 /* RFC3810 listener report */ | |
1c79356b A |
165 | |
166 | /* The definitions below are experimental. TBA */ | |
0a7de745 A |
167 | #define MLD_MTRACE_RESP 200 /* mtrace resp (to sender) */ |
168 | #define MLD_MTRACE 201 /* mtrace messages */ | |
1c79356b | 169 | |
b0d623f7 | 170 | #ifndef KERNEL |
0a7de745 A |
171 | #define MLD6_MTRACE_RESP MLD_MTRACE_RESP |
172 | #define MLD6_MTRACE MLD_MTRACE | |
6d2010ae | 173 | #endif |
b0d623f7 | 174 | |
0a7de745 | 175 | #define ICMP6_MAXTYPE 201 |
1c79356b | 176 | |
0a7de745 A |
177 | #define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ |
178 | #define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */ | |
179 | #define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */ | |
180 | #define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ | |
181 | #define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ | |
182 | #define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */ | |
1c79356b | 183 | |
0a7de745 A |
184 | #define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */ |
185 | #define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */ | |
1c79356b | 186 | |
f427ee49 A |
187 | #define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ |
188 | #define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */ | |
189 | #define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */ | |
190 | #define ICMP6_PARAMPROB_FIRSTFRAG_INCOMP_HDR 3 /* first fragment has incomplete IPv6 Header Chain */ | |
1c79356b | 191 | |
0a7de745 | 192 | #define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ |
1c79356b | 193 | |
0a7de745 A |
194 | #define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */ |
195 | #define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */ | |
196 | #define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */ | |
9bccf70c | 197 | |
0a7de745 A |
198 | #define ICMP6_NI_SUCCESS 0 /* node information successful reply */ |
199 | #define ICMP6_NI_REFUSED 1 /* node information request is refused */ | |
200 | #define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */ | |
1c79356b | 201 | |
0a7de745 A |
202 | #define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */ |
203 | #define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ | |
204 | #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ | |
1c79356b A |
205 | |
206 | /* Used in kernel only */ | |
0a7de745 A |
207 | #define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ |
208 | #define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ | |
1c79356b A |
209 | |
210 | /* | |
211 | * Multicast Listener Discovery | |
212 | */ | |
6d2010ae | 213 | struct mld_hdr { |
0a7de745 A |
214 | struct icmp6_hdr mld_icmp6_hdr; |
215 | struct in6_addr mld_addr; /* multicast address */ | |
6d2010ae A |
216 | } __attribute__((__packed__)); |
217 | ||
218 | /* definitions to provide backward compatibility to old KAME applications */ | |
219 | #ifndef KERNEL | |
0a7de745 A |
220 | #define mld6_hdr mld_hdr |
221 | #define mld6_type mld_type | |
222 | #define mld6_code mld_code | |
223 | #define mld6_cksum mld_cksum | |
224 | #define mld6_maxdelay mld_maxdelay | |
225 | #define mld6_reserved mld_reserved | |
226 | #define mld6_addr mld_addr | |
6d2010ae | 227 | #endif |
1c79356b | 228 | |
6d2010ae | 229 | /* shortcut macro definitions */ |
0a7de745 A |
230 | #define mld_type mld_icmp6_hdr.icmp6_type |
231 | #define mld_code mld_icmp6_hdr.icmp6_code | |
232 | #define mld_cksum mld_icmp6_hdr.icmp6_cksum | |
233 | #define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] | |
234 | #define mld_reserved mld_icmp6_hdr.icmp6_data16[1] | |
235 | #define mld_v2_reserved mld_icmp6_hdr.icmp6_data16[0] | |
236 | #define mld_v2_numrecs mld_icmp6_hdr.icmp6_data16[1] | |
1c79356b | 237 | |
d9a64523 A |
238 | |
239 | #define ICMP6_ERRORTYPE(type) \ | |
240 | ((type) == ICMP6_DST_UNREACH || (type) == ICMP6_PACKET_TOO_BIG || \ | |
241 | (type) == ICMP6_TIME_EXCEEDED || (type) == ICMP6_PARAM_PROB) | |
1c79356b A |
242 | /* |
243 | * Neighbor Discovery | |
244 | */ | |
245 | ||
0a7de745 A |
246 | struct nd_router_solicit { /* router solicitation */ |
247 | struct icmp6_hdr nd_rs_hdr; | |
1c79356b | 248 | /* could be followed by options */ |
6d2010ae | 249 | }__attribute__((__packed__)); |
1c79356b | 250 | |
0a7de745 A |
251 | #define nd_rs_type nd_rs_hdr.icmp6_type |
252 | #define nd_rs_code nd_rs_hdr.icmp6_code | |
253 | #define nd_rs_cksum nd_rs_hdr.icmp6_cksum | |
254 | #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] | |
1c79356b | 255 | |
0a7de745 A |
256 | struct nd_router_advert { /* router advertisement */ |
257 | struct icmp6_hdr nd_ra_hdr; | |
258 | u_int32_t nd_ra_reachable; /* reachable time */ | |
259 | u_int32_t nd_ra_retransmit; /* retransmit timer */ | |
1c79356b | 260 | /* could be followed by options */ |
6d2010ae | 261 | } __attribute__((__packed__)); |
1c79356b | 262 | |
0a7de745 A |
263 | #define nd_ra_type nd_ra_hdr.icmp6_type |
264 | #define nd_ra_code nd_ra_hdr.icmp6_code | |
265 | #define nd_ra_cksum nd_ra_hdr.icmp6_cksum | |
266 | #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] | |
267 | #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] | |
268 | #define ND_RA_FLAG_MANAGED 0x80 | |
269 | #define ND_RA_FLAG_OTHER 0x40 | |
270 | #define ND_RA_FLAG_HA 0x20 | |
9bccf70c | 271 | |
f427ee49 | 272 | /* Router preference values based on RFC 4191 */ |
0a7de745 | 273 | #define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ |
9bccf70c | 274 | |
0a7de745 A |
275 | #define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */ |
276 | #define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */ | |
277 | #define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */ | |
278 | #define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ | |
9bccf70c | 279 | |
0a7de745 | 280 | #define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] |
1c79356b | 281 | |
0a7de745 A |
282 | struct nd_neighbor_solicit { /* neighbor solicitation */ |
283 | struct icmp6_hdr nd_ns_hdr; | |
284 | struct in6_addr nd_ns_target; /*target address */ | |
1c79356b | 285 | /* could be followed by options */ |
6d2010ae | 286 | }__attribute__((__packed__)); |
1c79356b | 287 | |
0a7de745 A |
288 | #define nd_ns_type nd_ns_hdr.icmp6_type |
289 | #define nd_ns_code nd_ns_hdr.icmp6_code | |
290 | #define nd_ns_cksum nd_ns_hdr.icmp6_cksum | |
291 | #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] | |
1c79356b | 292 | |
0a7de745 A |
293 | struct nd_neighbor_advert { /* neighbor advertisement */ |
294 | struct icmp6_hdr nd_na_hdr; | |
295 | struct in6_addr nd_na_target; /* target address */ | |
1c79356b | 296 | /* could be followed by options */ |
6d2010ae | 297 | }__attribute__((__packed__)); |
1c79356b | 298 | |
0a7de745 A |
299 | #define nd_na_type nd_na_hdr.icmp6_type |
300 | #define nd_na_code nd_na_hdr.icmp6_code | |
301 | #define nd_na_cksum nd_na_hdr.icmp6_cksum | |
302 | #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] | |
1c79356b | 303 | #if BYTE_ORDER == BIG_ENDIAN |
0a7de745 A |
304 | #define ND_NA_FLAG_ROUTER 0x80000000 |
305 | #define ND_NA_FLAG_SOLICITED 0x40000000 | |
306 | #define ND_NA_FLAG_OVERRIDE 0x20000000 | |
1c79356b A |
307 | #else |
308 | #if BYTE_ORDER == LITTLE_ENDIAN | |
0a7de745 A |
309 | #define ND_NA_FLAG_ROUTER 0x80 |
310 | #define ND_NA_FLAG_SOLICITED 0x40 | |
311 | #define ND_NA_FLAG_OVERRIDE 0x20 | |
1c79356b A |
312 | #endif |
313 | #endif | |
314 | ||
0a7de745 A |
315 | struct nd_redirect { /* redirect */ |
316 | struct icmp6_hdr nd_rd_hdr; | |
317 | struct in6_addr nd_rd_target; /* target address */ | |
318 | struct in6_addr nd_rd_dst; /* destination address */ | |
1c79356b | 319 | /* could be followed by options */ |
6d2010ae | 320 | }__attribute__((__packed__)); |
1c79356b | 321 | |
0a7de745 A |
322 | #define nd_rd_type nd_rd_hdr.icmp6_type |
323 | #define nd_rd_code nd_rd_hdr.icmp6_code | |
324 | #define nd_rd_cksum nd_rd_hdr.icmp6_cksum | |
325 | #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] | |
1c79356b | 326 | |
0a7de745 A |
327 | struct nd_opt_hdr { /* Neighbor discovery option header */ |
328 | u_int8_t nd_opt_type; | |
329 | u_int8_t nd_opt_len; | |
1c79356b | 330 | /* followed by option specific data*/ |
6d2010ae | 331 | }__attribute__((__packed__)); |
1c79356b | 332 | |
0a7de745 A |
333 | #define ND_OPT_SOURCE_LINKADDR 1 |
334 | #define ND_OPT_TARGET_LINKADDR 2 | |
335 | #define ND_OPT_PREFIX_INFORMATION 3 | |
336 | #define ND_OPT_REDIRECTED_HEADER 4 | |
337 | #define ND_OPT_MTU 5 | |
338 | #define ND_OPT_NONCE 14 /* RFC 3971 */ | |
f427ee49 | 339 | #define ND_OPT_ROUTE_INFO 24 /* RFC 4191 */ |
0a7de745 A |
340 | #define ND_OPT_RDNSS 25 /* RFC 6106 */ |
341 | #define ND_OPT_DNSSL 31 /* RFC 6106 */ | |
f427ee49 | 342 | #define ND_OPT_CAPTIVE_PORTAL 37 /* RFC 7710 */ |
0a7de745 A |
343 | |
344 | struct nd_opt_prefix_info { /* prefix information */ | |
345 | u_int8_t nd_opt_pi_type; | |
346 | u_int8_t nd_opt_pi_len; | |
347 | u_int8_t nd_opt_pi_prefix_len; | |
348 | u_int8_t nd_opt_pi_flags_reserved; | |
349 | u_int32_t nd_opt_pi_valid_time; | |
350 | u_int32_t nd_opt_pi_preferred_time; | |
351 | u_int32_t nd_opt_pi_reserved2; | |
352 | struct in6_addr nd_opt_pi_prefix; | |
6d2010ae | 353 | }__attribute__((__packed__)); |
1c79356b | 354 | |
0a7de745 A |
355 | #define ND_OPT_PI_FLAG_ONLINK 0x80 |
356 | #define ND_OPT_PI_FLAG_AUTO 0x40 | |
1c79356b | 357 | |
0a7de745 | 358 | #define ND_OPT_NONCE_LEN ((1 * 8) - 2) |
39037602 A |
359 | #if ((ND_OPT_NONCE_LEN + 2) % 8) != 0 |
360 | #error "(ND_OPT_NONCE_LEN + 2) must be a multiple of 8." | |
361 | #endif | |
362 | ||
0a7de745 A |
363 | struct nd_opt_nonce { /* nonce option */ |
364 | u_int8_t nd_opt_nonce_type; | |
365 | u_int8_t nd_opt_nonce_len; | |
366 | u_int8_t nd_opt_nonce[ND_OPT_NONCE_LEN]; | |
39037602 A |
367 | } __attribute__((__packed__)); |
368 | ||
0a7de745 A |
369 | struct nd_opt_rd_hdr { /* redirected header */ |
370 | u_int8_t nd_opt_rh_type; | |
371 | u_int8_t nd_opt_rh_len; | |
372 | u_int16_t nd_opt_rh_reserved1; | |
373 | u_int32_t nd_opt_rh_reserved2; | |
1c79356b | 374 | /* followed by IP header and data */ |
6d2010ae | 375 | } __attribute__((__packed__)); |
1c79356b | 376 | |
0a7de745 A |
377 | struct nd_opt_mtu { /* MTU option */ |
378 | u_int8_t nd_opt_mtu_type; | |
379 | u_int8_t nd_opt_mtu_len; | |
380 | u_int16_t nd_opt_mtu_reserved; | |
381 | u_int32_t nd_opt_mtu_mtu; | |
6d2010ae | 382 | }__attribute__((__packed__)); |
1c79356b | 383 | |
0a7de745 A |
384 | struct nd_opt_route_info { /* route info */ |
385 | u_int8_t nd_opt_rti_type; | |
386 | u_int8_t nd_opt_rti_len; | |
387 | u_int8_t nd_opt_rti_prefixlen; | |
388 | u_int8_t nd_opt_rti_flags; | |
389 | u_int32_t nd_opt_rti_lifetime; | |
6d2010ae A |
390 | /* prefix follows */ |
391 | }__attribute__((__packed__)); | |
392 | ||
0a7de745 A |
393 | struct nd_opt_rdnss { /* recursive domain name system servers */ |
394 | u_int8_t nd_opt_rdnss_type; | |
395 | u_int8_t nd_opt_rdnss_len; | |
396 | u_int16_t nd_opt_rdnss_reserved; | |
397 | u_int32_t nd_opt_rdnss_lifetime; | |
398 | struct in6_addr nd_opt_rdnss_addr[1]; | |
6d2010ae | 399 | } __attribute__((__packed__)); |
1c79356b | 400 | |
0a7de745 A |
401 | struct nd_opt_dnssl { /* domain name search list */ |
402 | u_int8_t nd_opt_dnssl_type; | |
403 | u_int8_t nd_opt_dnssl_len; | |
404 | u_int16_t nd_opt_dnssl_reserved; | |
405 | u_int32_t nd_opt_dnssl_lifetime; | |
406 | u_int8_t nd_opt_dnssl_domains[8]; | |
316670eb A |
407 | } __attribute__((__packed__)); |
408 | ||
1c79356b A |
409 | /* |
410 | * icmp6 namelookup | |
411 | */ | |
412 | ||
413 | struct icmp6_namelookup { | |
0a7de745 A |
414 | struct icmp6_hdr icmp6_nl_hdr; |
415 | u_int8_t icmp6_nl_nonce[8]; | |
416 | int32_t icmp6_nl_ttl; | |
1c79356b | 417 | #if 0 |
0a7de745 A |
418 | u_int8_t icmp6_nl_len; |
419 | u_int8_t icmp6_nl_name[3]; | |
1c79356b A |
420 | #endif |
421 | /* could be followed by options */ | |
6d2010ae | 422 | }__attribute__((__packed__)); |
1c79356b A |
423 | |
424 | /* | |
425 | * icmp6 node information | |
426 | */ | |
427 | struct icmp6_nodeinfo { | |
428 | struct icmp6_hdr icmp6_ni_hdr; | |
429 | u_int8_t icmp6_ni_nonce[8]; | |
430 | /* could be followed by reply data */ | |
6d2010ae | 431 | }__attribute__((__packed__)); |
1c79356b | 432 | |
0a7de745 A |
433 | #define ni_type icmp6_ni_hdr.icmp6_type |
434 | #define ni_code icmp6_ni_hdr.icmp6_code | |
435 | #define ni_cksum icmp6_ni_hdr.icmp6_cksum | |
436 | #define ni_qtype icmp6_ni_hdr.icmp6_data16[0] | |
437 | #define ni_flags icmp6_ni_hdr.icmp6_data16[1] | |
1c79356b | 438 | |
0a7de745 A |
439 | #define NI_QTYPE_NOOP 0 /* NOOP */ |
440 | #define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ | |
441 | #define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ | |
442 | #define NI_QTYPE_DNSNAME 2 /* DNS Name */ | |
443 | #define NI_QTYPE_NODEADDR 3 /* Node Addresses */ | |
444 | #define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ | |
1c79356b A |
445 | |
446 | #if BYTE_ORDER == BIG_ENDIAN | |
0a7de745 A |
447 | #define NI_SUPTYPE_FLAG_COMPRESS 0x1 |
448 | #define NI_FQDN_FLAG_VALIDTTL 0x1 | |
1c79356b | 449 | #elif BYTE_ORDER == LITTLE_ENDIAN |
0a7de745 A |
450 | #define NI_SUPTYPE_FLAG_COMPRESS 0x0100 |
451 | #define NI_FQDN_FLAG_VALIDTTL 0x0100 | |
1c79356b A |
452 | #endif |
453 | ||
454 | #ifdef NAME_LOOKUPS_04 | |
455 | #if BYTE_ORDER == BIG_ENDIAN | |
0a7de745 A |
456 | #define NI_NODEADDR_FLAG_LINKLOCAL 0x1 |
457 | #define NI_NODEADDR_FLAG_SITELOCAL 0x2 | |
458 | #define NI_NODEADDR_FLAG_GLOBAL 0x4 | |
459 | #define NI_NODEADDR_FLAG_ALL 0x8 | |
460 | #define NI_NODEADDR_FLAG_TRUNCATE 0x10 | |
461 | #define NI_NODEADDR_FLAG_ANYCAST 0x20 /* just experimental. not in spec */ | |
1c79356b | 462 | #elif BYTE_ORDER == LITTLE_ENDIAN |
0a7de745 A |
463 | #define NI_NODEADDR_FLAG_LINKLOCAL 0x0100 |
464 | #define NI_NODEADDR_FLAG_SITELOCAL 0x0200 | |
465 | #define NI_NODEADDR_FLAG_GLOBAL 0x0400 | |
466 | #define NI_NODEADDR_FLAG_ALL 0x0800 | |
467 | #define NI_NODEADDR_FLAG_TRUNCATE 0x1000 | |
468 | #define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */ | |
1c79356b A |
469 | #endif |
470 | #else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */ | |
471 | #if BYTE_ORDER == BIG_ENDIAN | |
0a7de745 A |
472 | #define NI_NODEADDR_FLAG_TRUNCATE 0x1 |
473 | #define NI_NODEADDR_FLAG_ALL 0x2 | |
474 | #define NI_NODEADDR_FLAG_COMPAT 0x4 | |
475 | #define NI_NODEADDR_FLAG_LINKLOCAL 0x8 | |
476 | #define NI_NODEADDR_FLAG_SITELOCAL 0x10 | |
477 | #define NI_NODEADDR_FLAG_GLOBAL 0x20 | |
478 | #define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */ | |
1c79356b | 479 | #elif BYTE_ORDER == LITTLE_ENDIAN |
0a7de745 A |
480 | #define NI_NODEADDR_FLAG_TRUNCATE 0x0100 |
481 | #define NI_NODEADDR_FLAG_ALL 0x0200 | |
482 | #define NI_NODEADDR_FLAG_COMPAT 0x0400 | |
483 | #define NI_NODEADDR_FLAG_LINKLOCAL 0x0800 | |
484 | #define NI_NODEADDR_FLAG_SITELOCAL 0x1000 | |
485 | #define NI_NODEADDR_FLAG_GLOBAL 0x2000 | |
486 | #define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ | |
1c79356b A |
487 | #endif |
488 | #endif | |
489 | ||
490 | struct ni_reply_fqdn { | |
0a7de745 | 491 | u_int32_t ni_fqdn_ttl; /* TTL */ |
1c79356b A |
492 | u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ |
493 | u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ | |
6d2010ae | 494 | }__attribute__((__packed__)); |
1c79356b A |
495 | |
496 | /* | |
497 | * Router Renumbering. as router-renum-08.txt | |
498 | */ | |
0a7de745 A |
499 | struct icmp6_router_renum { /* router renumbering header */ |
500 | struct icmp6_hdr rr_hdr; | |
501 | u_int8_t rr_segnum; | |
502 | u_int8_t rr_flags; | |
503 | u_int16_t rr_maxdelay; | |
504 | u_int32_t rr_reserved; | |
6d2010ae | 505 | } __attribute__((__packed__)); |
1c79356b | 506 | |
0a7de745 A |
507 | #define ICMP6_RR_FLAGS_TEST 0x80 |
508 | #define ICMP6_RR_FLAGS_REQRESULT 0x40 | |
509 | #define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 | |
510 | #define ICMP6_RR_FLAGS_SPECSITE 0x10 | |
511 | #define ICMP6_RR_FLAGS_PREVDONE 0x08 | |
512 | ||
513 | #define rr_type rr_hdr.icmp6_type | |
514 | #define rr_code rr_hdr.icmp6_code | |
515 | #define rr_cksum rr_hdr.icmp6_cksum | |
516 | #define rr_seqnum rr_hdr.icmp6_data32[0] | |
517 | ||
518 | struct rr_pco_match { /* match prefix part */ | |
519 | u_int8_t rpm_code; | |
520 | u_int8_t rpm_len; | |
521 | u_int8_t rpm_ordinal; | |
522 | u_int8_t rpm_matchlen; | |
523 | u_int8_t rpm_minlen; | |
524 | u_int8_t rpm_maxlen; | |
525 | u_int16_t rpm_reserved; | |
526 | struct in6_addr rpm_prefix; | |
6d2010ae | 527 | } __attribute__((__packed__)); |
1c79356b | 528 | |
0a7de745 A |
529 | #define RPM_PCO_ADD 1 |
530 | #define RPM_PCO_CHANGE 2 | |
531 | #define RPM_PCO_SETGLOBAL 3 | |
532 | #define RPM_PCO_MAX 4 | |
533 | ||
534 | struct rr_pco_use { /* use prefix part */ | |
535 | u_int8_t rpu_uselen; | |
536 | u_int8_t rpu_keeplen; | |
537 | u_int8_t rpu_ramask; | |
538 | u_int8_t rpu_raflags; | |
539 | u_int32_t rpu_vltime; | |
540 | u_int32_t rpu_pltime; | |
541 | u_int32_t rpu_flags; | |
542 | struct in6_addr rpu_prefix; | |
6d2010ae | 543 | } __attribute__((__packed__)); |
0a7de745 A |
544 | #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 |
545 | #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 | |
9bccf70c A |
546 | |
547 | #if BYTE_ORDER == BIG_ENDIAN | |
548 | #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 | |
549 | #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 | |
1c79356b | 550 | #elif BYTE_ORDER == LITTLE_ENDIAN |
9bccf70c A |
551 | #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 |
552 | #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 | |
553 | #endif | |
1c79356b | 554 | |
0a7de745 A |
555 | struct rr_result { /* router renumbering result message */ |
556 | u_int16_t rrr_flags; | |
557 | u_int8_t rrr_ordinal; | |
558 | u_int8_t rrr_matchedlen; | |
559 | u_int32_t rrr_ifid; | |
560 | struct in6_addr rrr_prefix; | |
6d2010ae | 561 | } __attribute__((__packed__)); |
9bccf70c | 562 | #if BYTE_ORDER == BIG_ENDIAN |
0a7de745 A |
563 | #define ICMP6_RR_RESULT_FLAGS_OOB 0x0002 |
564 | #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001 | |
1c79356b | 565 | #elif BYTE_ORDER == LITTLE_ENDIAN |
0a7de745 A |
566 | #define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 |
567 | #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 | |
9bccf70c | 568 | #endif |
1c79356b A |
569 | |
570 | /* | |
571 | * icmp6 filter structures. | |
572 | */ | |
573 | ||
574 | struct icmp6_filter { | |
575 | u_int32_t icmp6_filt[8]; | |
576 | }; | |
577 | ||
578 | #ifdef KERNEL | |
0a7de745 A |
579 | #define ICMP6_FILTER_SETPASSALL(filterp) \ |
580 | do { \ | |
581 | int i; u_char *ptr; \ | |
582 | ptr = (u_char *)filterp; \ | |
583 | for (i = 0; i < sizeof(struct icmp6_filter); i++) \ | |
584 | ptr[i] = 0xff; \ | |
1c79356b | 585 | } while (0) |
0a7de745 | 586 | #define ICMP6_FILTER_SETBLOCKALL(filterp) \ |
1c79356b A |
587 | bzero(filterp, sizeof(struct icmp6_filter)) |
588 | #else /* KERNEL */ | |
0a7de745 | 589 | #define ICMP6_FILTER_SETPASSALL(filterp) \ |
1c79356b | 590 | memset(filterp, 0xff, sizeof(struct icmp6_filter)) |
0a7de745 | 591 | #define ICMP6_FILTER_SETBLOCKALL(filterp) \ |
1c79356b A |
592 | memset(filterp, 0x00, sizeof(struct icmp6_filter)) |
593 | #endif /* KERNEL */ | |
594 | ||
0a7de745 | 595 | #define ICMP6_FILTER_SETPASS(type, filterp) \ |
1c79356b | 596 | (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))) |
0a7de745 | 597 | #define ICMP6_FILTER_SETBLOCK(type, filterp) \ |
1c79356b | 598 | (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))) |
0a7de745 | 599 | #define ICMP6_FILTER_WILLPASS(type, filterp) \ |
1c79356b | 600 | ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) |
0a7de745 | 601 | #define ICMP6_FILTER_WILLBLOCK(type, filterp) \ |
1c79356b A |
602 | ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) |
603 | ||
604 | /* | |
605 | * Variables related to this implementation | |
606 | * of the internet control message protocol version 6. | |
607 | */ | |
9bccf70c A |
608 | struct icmp6errstat { |
609 | u_quad_t icp6errs_dst_unreach_noroute; | |
610 | u_quad_t icp6errs_dst_unreach_admin; | |
611 | u_quad_t icp6errs_dst_unreach_beyondscope; | |
612 | u_quad_t icp6errs_dst_unreach_addr; | |
613 | u_quad_t icp6errs_dst_unreach_noport; | |
614 | u_quad_t icp6errs_packet_too_big; | |
615 | u_quad_t icp6errs_time_exceed_transit; | |
616 | u_quad_t icp6errs_time_exceed_reassembly; | |
617 | u_quad_t icp6errs_paramprob_header; | |
618 | u_quad_t icp6errs_paramprob_nextheader; | |
619 | u_quad_t icp6errs_paramprob_option; | |
620 | u_quad_t icp6errs_redirect; /* we regard redirect as an error here */ | |
621 | u_quad_t icp6errs_unknown; | |
622 | }; | |
623 | ||
1c79356b A |
624 | struct icmp6stat { |
625 | /* statistics related to icmp6 packets generated */ | |
0a7de745 A |
626 | u_quad_t icp6s_error; /* # of calls to icmp6_error */ |
627 | u_quad_t icp6s_canterror; /* no error 'cuz old was icmp */ | |
628 | u_quad_t icp6s_toofreq; /* no error 'cuz rate limitation */ | |
1c79356b A |
629 | u_quad_t icp6s_outhist[256]; |
630 | /* statistics related to input message processed */ | |
0a7de745 A |
631 | u_quad_t icp6s_badcode; /* icmp6_code out of range */ |
632 | u_quad_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */ | |
633 | u_quad_t icp6s_checksum; /* bad checksum */ | |
634 | u_quad_t icp6s_badlen; /* calculated bound mismatch */ | |
635 | u_quad_t icp6s_reflect; /* number of responses */ | |
636 | u_quad_t icp6s_inhist[256]; | |
637 | u_quad_t icp6s_nd_toomanyopt; /* too many ND options */ | |
9bccf70c A |
638 | struct icmp6errstat icp6s_outerrhist; |
639 | #define icp6s_odst_unreach_noroute \ | |
640 | icp6s_outerrhist.icp6errs_dst_unreach_noroute | |
641 | #define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin | |
642 | #define icp6s_odst_unreach_beyondscope \ | |
643 | icp6s_outerrhist.icp6errs_dst_unreach_beyondscope | |
644 | #define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr | |
645 | #define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport | |
646 | #define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big | |
647 | #define icp6s_otime_exceed_transit \ | |
648 | icp6s_outerrhist.icp6errs_time_exceed_transit | |
649 | #define icp6s_otime_exceed_reassembly \ | |
650 | icp6s_outerrhist.icp6errs_time_exceed_reassembly | |
651 | #define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header | |
652 | #define icp6s_oparamprob_nextheader \ | |
653 | icp6s_outerrhist.icp6errs_paramprob_nextheader | |
654 | #define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option | |
655 | #define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect | |
656 | #define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown | |
0a7de745 A |
657 | u_quad_t icp6s_pmtuchg; /* path MTU changes */ |
658 | u_quad_t icp6s_nd_badopt; /* bad ND options */ | |
659 | u_quad_t icp6s_badns; /* bad neighbor solicitation */ | |
660 | u_quad_t icp6s_badna; /* bad neighbor advertisement */ | |
661 | u_quad_t icp6s_badrs; /* bad router advertisement */ | |
662 | u_quad_t icp6s_badra; /* bad router advertisement */ | |
663 | u_quad_t icp6s_badredirect; /* bad redirect message */ | |
39037602 | 664 | u_quad_t icp6s_rfc6980_drop; /* NDP packet dropped based on RFC 6980 */ |
f427ee49 | 665 | u_quad_t icp6s_badpkttoobig; /* bad packet too big */ |
1c79356b A |
666 | }; |
667 | ||
668 | /* | |
669 | * Names for ICMP sysctl objects | |
670 | */ | |
0a7de745 A |
671 | #define ICMPV6CTL_STATS 1 |
672 | #define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */ | |
673 | #define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */ | |
674 | #if 0 /*obsoleted*/ | |
675 | #define ICMPV6CTL_ERRRATELIMIT 5 /* ICMPv6 error rate limitation */ | |
6d2010ae | 676 | #endif |
0a7de745 A |
677 | #define ICMPV6CTL_ND6_PRUNE 6 |
678 | #define ICMPV6CTL_ND6_DELAY 8 | |
679 | #define ICMPV6CTL_ND6_UMAXTRIES 9 | |
680 | #define ICMPV6CTL_ND6_MMAXTRIES 10 | |
681 | #define ICMPV6CTL_ND6_USELOOPBACK 11 | |
1c79356b | 682 | /*#define ICMPV6CTL_ND6_PROXYALL 12 obsoleted, do not reuse here */ |
0a7de745 A |
683 | #define ICMPV6CTL_NODEINFO 13 |
684 | #define ICMPV6CTL_ERRPPSLIMIT 14 /* ICMPv6 error pps limitation */ | |
685 | #define ICMPV6CTL_ND6_MAXNUDHINT 15 | |
686 | #define ICMPV6CTL_MTUDISC_HIWAT 16 | |
687 | #define ICMPV6CTL_MTUDISC_LOWAT 17 | |
688 | #define ICMPV6CTL_ND6_DEBUG 18 | |
689 | #define ICMPV6CTL_ND6_DRLIST 19 | |
690 | #define ICMPV6CTL_ND6_PRLIST 20 | |
691 | #define ICMPV6CTL_MLD_MAXSRCFILTER 21 | |
692 | #define ICMPV6CTL_MLD_SOMAXSRC 22 | |
693 | #define ICMPV6CTL_MLD_VERSION 23 | |
694 | #define ICMPV6CTL_ND6_MAXQLEN 24 | |
695 | #define ICMPV6CTL_ND6_ACCEPT_6TO4 25 | |
696 | #define ICMPV6CTL_ND6_OPTIMISTIC_DAD 26 /* RFC 4429 */ | |
c3c9b80d A |
697 | #define ICMPV6CTL_ERRPPSLIMIT_RANDOM_INCR 27 |
698 | #define ICMPV6CTL_MAXID 28 | |
1c79356b | 699 | |
39236c6e | 700 | #ifdef BSD_KERNEL_PRIVATE |
1c79356b A |
701 | #define ICMPV6CTL_NAMES { \ |
702 | { 0, 0 }, \ | |
703 | { 0, 0 }, \ | |
704 | { "rediraccept", CTLTYPE_INT }, \ | |
705 | { "redirtimeout", CTLTYPE_INT }, \ | |
706 | { 0, 0 }, \ | |
9bccf70c | 707 | { 0, 0 }, \ |
1c79356b A |
708 | { "nd6_prune", CTLTYPE_INT }, \ |
709 | { 0, 0 }, \ | |
710 | { "nd6_delay", CTLTYPE_INT }, \ | |
711 | { "nd6_umaxtries", CTLTYPE_INT }, \ | |
712 | { "nd6_mmaxtries", CTLTYPE_INT }, \ | |
713 | { "nd6_useloopback", CTLTYPE_INT }, \ | |
714 | { 0, 0 }, \ | |
715 | { "nodeinfo", CTLTYPE_INT }, \ | |
9bccf70c A |
716 | { "errppslimit", CTLTYPE_INT }, \ |
717 | { "nd6_maxnudhint", CTLTYPE_INT }, \ | |
718 | { "mtudisc_hiwat", CTLTYPE_INT }, \ | |
719 | { "mtudisc_lowat", CTLTYPE_INT }, \ | |
720 | { "nd6_debug", CTLTYPE_INT }, \ | |
721 | { 0, 0 }, \ | |
722 | { 0, 0 }, \ | |
6d2010ae A |
723 | { 0, 0 }, \ |
724 | { 0, 0 }, \ | |
725 | { 0, 0 }, \ | |
726 | { 0, 0 }, \ | |
727 | { "nd6_accept_6to4", CTLTYPE_INT }, \ | |
316670eb | 728 | { "nd6_optimistic_dad", CTLTYPE_INT }, \ |
1c79356b | 729 | } |
1c79356b | 730 | |
1c79356b | 731 | # ifdef __STDC__ |
0a7de745 A |
732 | struct rtentry; |
733 | struct rttimer; | |
734 | struct in6_multi; | |
1c79356b | 735 | # endif |
39236c6e | 736 | struct ip6protosw; |
0a7de745 A |
737 | void icmp6_init(struct ip6protosw *, struct domain *); |
738 | void icmp6_paramerror(struct mbuf *, int); | |
3e170ce0 | 739 | |
0a7de745 A |
740 | void icmp6_error_flag(struct mbuf *, int, int, int, int); |
741 | #define ICMP6_ERROR_RST_MRCVIF 0x1 | |
3e170ce0 | 742 | |
0a7de745 A |
743 | void icmp6_error(struct mbuf *, int, int, int); |
744 | void icmp6_error2(struct mbuf *, int, int, int, struct ifnet *); | |
745 | int icmp6_input(struct mbuf **, int *, int); | |
746 | void icmp6_reflect(struct mbuf *, size_t); | |
747 | void icmp6_prepare(struct mbuf *); | |
f427ee49 | 748 | void icmp6_redirect_input(struct mbuf *, int, int); |
0a7de745 | 749 | void icmp6_redirect_output(struct mbuf *, struct rtentry *); |
9bccf70c | 750 | |
0a7de745 A |
751 | struct ip6ctlparam; |
752 | void icmp6_mtudisc_update(struct ip6ctlparam *, int); | |
1c79356b | 753 | |
6d2010ae | 754 | extern lck_rw_t icmp6_ifs_rwlock; |
1c79356b | 755 | /* XXX: is this the right place for these macros? */ |
39236c6e | 756 | /* N.B.: if_inet6data is never freed once set, so we don't need to lock */ |
0a7de745 A |
757 | #define icmp6_ifstat_inc(_ifp, _tag) do { \ |
758 | if (_ifp != NULL && IN6_IFEXTRA(_ifp) != NULL) { \ | |
759 | IN6_IFEXTRA(_ifp)->icmp6_ifstat._tag++; \ | |
760 | } \ | |
1c79356b A |
761 | } while (0) |
762 | ||
0a7de745 A |
763 | #define icmp6_ifoutstat_inc(ifp, type, code) do { \ |
764 | icmp6_ifstat_inc(ifp, ifs6_out_msg); \ | |
765 | if (type < ICMP6_INFOMSG_MASK) \ | |
766 | icmp6_ifstat_inc(ifp, ifs6_out_error); \ | |
767 | switch (type) { \ | |
768 | case ICMP6_DST_UNREACH: \ | |
769 | icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \ | |
770 | if (code == ICMP6_DST_UNREACH_ADMIN) \ | |
771 | icmp6_ifstat_inc(ifp, ifs6_out_adminprohib);\ | |
772 | break; \ | |
773 | case ICMP6_PACKET_TOO_BIG: \ | |
774 | icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \ | |
775 | break; \ | |
776 | case ICMP6_TIME_EXCEEDED: \ | |
777 | icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \ | |
778 | break; \ | |
779 | case ICMP6_PARAM_PROB: \ | |
780 | icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \ | |
781 | break; \ | |
782 | case ICMP6_ECHO_REQUEST: \ | |
783 | icmp6_ifstat_inc(ifp, ifs6_out_echo); \ | |
784 | break; \ | |
785 | case ICMP6_ECHO_REPLY: \ | |
786 | icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \ | |
787 | break; \ | |
788 | case MLD_LISTENER_QUERY: \ | |
789 | icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \ | |
790 | break; \ | |
791 | case MLD_LISTENER_REPORT: \ | |
792 | icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \ | |
793 | break; \ | |
794 | case MLD_LISTENER_DONE: \ | |
795 | icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \ | |
796 | break; \ | |
797 | case ND_ROUTER_SOLICIT: \ | |
798 | icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \ | |
799 | break; \ | |
800 | case ND_ROUTER_ADVERT: \ | |
801 | icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \ | |
802 | break; \ | |
803 | case ND_NEIGHBOR_SOLICIT: \ | |
804 | icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit);\ | |
805 | break; \ | |
806 | case ND_NEIGHBOR_ADVERT: \ | |
807 | icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \ | |
808 | break; \ | |
809 | case ND_REDIRECT: \ | |
810 | icmp6_ifstat_inc(ifp, ifs6_out_redirect); \ | |
811 | break; \ | |
812 | } \ | |
1c79356b A |
813 | } while (0) |
814 | ||
f427ee49 | 815 | #define ICMP6_REDIRACCEPT_DEFAULT 1 |
0a7de745 A |
816 | extern int icmp6_rediraccept; /* accept/process redirects */ |
817 | extern int icmp6_redirtimeout; /* cache time for redirect routes */ | |
6d2010ae | 818 | |
0a7de745 A |
819 | #define ICMP6_NODEINFO_FQDNOK 0x1 |
820 | #define ICMP6_NODEINFO_NODEADDROK 0x2 | |
821 | #define ICMP6_NODEINFO_TMPADDROK 0x4 | |
822 | #define ICMP6_NODEINFO_GLOBALOK 0x8 | |
6d2010ae | 823 | |
39236c6e | 824 | #endif /* BSD_KERNEL_PRIVATE */ |
1c79356b A |
825 | |
826 | #endif /* !_NETINET_ICMP6_H_ */ |