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