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