2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* $KAME: icmp6.h,v 1.9 2000/03/09 21:09:16 itojun Exp $ */
25 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
26 * All rights reserved.
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in the
35 * documentation and/or other materials provided with the distribution.
36 * 3. Neither the name of the project nor the names of its contributors
37 * may be used to endorse or promote products derived from this software
38 * without specific prior written permission.
40 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
41 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
44 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 * Copyright (c) 1982, 1986, 1993
55 * The Regents of the University of California. All rights reserved.
57 * Redistribution and use in source and binary forms, with or without
58 * modification, are permitted provided that the following conditions
60 * 1. Redistributions of source code must retain the above copyright
61 * notice, this list of conditions and the following disclaimer.
62 * 2. Redistributions in binary form must reproduce the above copyright
63 * notice, this list of conditions and the following disclaimer in the
64 * documentation and/or other materials provided with the distribution.
65 * 3. All advertising materials mentioning features or use of this software
66 * must display the following acknowledgement:
67 * This product includes software developed by the University of
68 * California, Berkeley and its contributors.
69 * 4. Neither the name of the University nor the names of its contributors
70 * may be used to endorse or promote products derived from this software
71 * without specific prior written permission.
73 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
74 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
75 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
76 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
77 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
78 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
79 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
80 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
81 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
82 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
85 * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
88 #ifndef _NETINET_ICMP6_H_
89 #define _NETINET_ICMP6_H_
91 #define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr)
92 - sizeof(struct icmp6_hdr) */
95 u_int8_t icmp6_type
; /* type field */
96 u_int8_t icmp6_code
; /* code field */
97 u_int16_t icmp6_cksum
; /* checksum field */
99 u_int32_t icmp6_un_data32
[1]; /* type-specific field */
100 u_int16_t icmp6_un_data16
[2]; /* type-specific field */
101 u_int8_t icmp6_un_data8
[4]; /* type-specific field */
105 #define icmp6_data32 icmp6_dataun.icmp6_un_data32
106 #define icmp6_data16 icmp6_dataun.icmp6_un_data16
107 #define icmp6_data8 icmp6_dataun.icmp6_un_data8
108 #define icmp6_pptr icmp6_data32[0] /* parameter prob */
109 #define icmp6_mtu icmp6_data32[0] /* packet too big */
110 #define icmp6_id icmp6_data16[0] /* echo request/reply */
111 #define icmp6_seq icmp6_data16[1] /* echo request/reply */
112 #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
114 #define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */
115 #define ICMP6_PACKET_TOO_BIG 2 /* packet too big */
116 #define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */
117 #define ICMP6_PARAM_PROB 4 /* ip6 header bad */
119 #define ICMP6_ECHO_REQUEST 128 /* echo service */
120 #define ICMP6_ECHO_REPLY 129 /* echo reply */
121 #define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */
122 #define MLD6_LISTENER_QUERY 130 /* multicast listener query */
123 #define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */
124 #define MLD6_LISTENER_REPORT 131 /* multicast listener report */
125 #define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */
126 #define MLD6_LISTENER_DONE 132 /* multicast listener done */
128 #define ND_ROUTER_SOLICIT 133 /* router solicitation */
129 #define ND_ROUTER_ADVERT 134 /* router advertisment */
130 #define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */
131 #define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisment */
132 #define ND_REDIRECT 137 /* redirect */
134 #define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */
136 #define ICMP6_WRUREQUEST 139 /* who are you request */
137 #define ICMP6_WRUREPLY 140 /* who are you reply */
138 #define ICMP6_FQDN_QUERY 139 /* FQDN query */
139 #define ICMP6_FQDN_REPLY 140 /* FQDN reply */
140 #define ICMP6_NI_QUERY 139 /* node information request */
141 #define ICMP6_NI_REPLY 140 /* node information reply */
143 /* The definitions below are experimental. TBA */
144 #define MLD6_MTRACE_RESP 141 /* mtrace response(to sender) */
145 #define MLD6_MTRACE 142 /* mtrace messages */
147 #define ICMP6_MAXTYPE 142
149 #define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
150 #define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */
151 #define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */
152 #define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */
153 #define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */
154 #define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */
156 #define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */
157 #define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */
159 #define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
160 #define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */
161 #define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */
163 #define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */
165 #define ICMP6_NI_SUCESS 0 /* node information successful reply */
166 #define ICMP6_NI_REFUSED 1 /* node information request is refused */
167 #define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */
169 #define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */
170 #define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */
171 #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */
173 /* Used in kernel only */
174 #define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */
175 #define ND_REDIRECT_ROUTER 1 /* redirect to a better router */
178 * Multicast Listener Discovery
181 struct icmp6_hdr mld6_hdr
;
182 struct in6_addr mld6_addr
; /* multicast address */
185 #define mld6_type mld6_hdr.icmp6_type
186 #define mld6_code mld6_hdr.icmp6_code
187 #define mld6_cksum mld6_hdr.icmp6_cksum
188 #define mld6_maxdelay mld6_hdr.icmp6_data16[0]
189 #define mld6_reserved mld6_hdr.icmp6_data16[1]
195 struct nd_router_solicit
{ /* router solicitation */
196 struct icmp6_hdr nd_rs_hdr
;
197 /* could be followed by options */
200 #define nd_rs_type nd_rs_hdr.icmp6_type
201 #define nd_rs_code nd_rs_hdr.icmp6_code
202 #define nd_rs_cksum nd_rs_hdr.icmp6_cksum
203 #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0]
205 struct nd_router_advert
{ /* router advertisement */
206 struct icmp6_hdr nd_ra_hdr
;
207 u_int32_t nd_ra_reachable
; /* reachable time */
208 u_int32_t nd_ra_retransmit
; /* retransmit timer */
209 /* could be followed by options */
212 #define nd_ra_type nd_ra_hdr.icmp6_type
213 #define nd_ra_code nd_ra_hdr.icmp6_code
214 #define nd_ra_cksum nd_ra_hdr.icmp6_cksum
215 #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0]
216 #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]
217 #define ND_RA_FLAG_MANAGED 0x80
218 #define ND_RA_FLAG_OTHER 0x40
219 #define ND_RA_FLAG_HA 0x20
220 #define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]
222 struct nd_neighbor_solicit
{ /* neighbor solicitation */
223 struct icmp6_hdr nd_ns_hdr
;
224 struct in6_addr nd_ns_target
; /*target address */
225 /* could be followed by options */
228 #define nd_ns_type nd_ns_hdr.icmp6_type
229 #define nd_ns_code nd_ns_hdr.icmp6_code
230 #define nd_ns_cksum nd_ns_hdr.icmp6_cksum
231 #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
233 struct nd_neighbor_advert
{ /* neighbor advertisement */
234 struct icmp6_hdr nd_na_hdr
;
235 struct in6_addr nd_na_target
; /* target address */
236 /* could be followed by options */
239 #define nd_na_type nd_na_hdr.icmp6_type
240 #define nd_na_code nd_na_hdr.icmp6_code
241 #define nd_na_cksum nd_na_hdr.icmp6_cksum
242 #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
243 #if BYTE_ORDER == BIG_ENDIAN
244 #define ND_NA_FLAG_ROUTER 0x80000000
245 #define ND_NA_FLAG_SOLICITED 0x40000000
246 #define ND_NA_FLAG_OVERRIDE 0x20000000
248 #if BYTE_ORDER == LITTLE_ENDIAN
249 #define ND_NA_FLAG_ROUTER 0x80
250 #define ND_NA_FLAG_SOLICITED 0x40
251 #define ND_NA_FLAG_OVERRIDE 0x20
255 struct nd_redirect
{ /* redirect */
256 struct icmp6_hdr nd_rd_hdr
;
257 struct in6_addr nd_rd_target
; /* target address */
258 struct in6_addr nd_rd_dst
; /* destination address */
259 /* could be followed by options */
262 #define nd_rd_type nd_rd_hdr.icmp6_type
263 #define nd_rd_code nd_rd_hdr.icmp6_code
264 #define nd_rd_cksum nd_rd_hdr.icmp6_cksum
265 #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
267 struct nd_opt_hdr
{ /* Neighbor discovery option header */
268 u_int8_t nd_opt_type
;
270 /* followed by option specific data*/
273 #define ND_OPT_SOURCE_LINKADDR 1
274 #define ND_OPT_TARGET_LINKADDR 2
275 #define ND_OPT_PREFIX_INFORMATION 3
276 #define ND_OPT_REDIRECTED_HEADER 4
278 #define ND_OPT_ADV_INTERVAL 7 /* MIPv6 */
279 #define ND_OPT_HA_INFORMATION 8 /* MIPv6 */
281 struct nd_opt_prefix_info
{ /* prefix information */
282 u_int8_t nd_opt_pi_type
;
283 u_int8_t nd_opt_pi_len
;
284 u_int8_t nd_opt_pi_prefix_len
;
285 u_int8_t nd_opt_pi_flags_reserved
;
286 u_int32_t nd_opt_pi_valid_time
;
287 u_int32_t nd_opt_pi_preferred_time
;
288 u_int32_t nd_opt_pi_reserved2
;
289 struct in6_addr nd_opt_pi_prefix
;
292 #define ND_OPT_PI_FLAG_ONLINK 0x80
293 #define ND_OPT_PI_FLAG_AUTO 0x40
294 #define ND_OPT_PI_FLAG_RTADDR 0x20
296 struct nd_opt_rd_hdr
{ /* redirected header */
297 u_int8_t nd_opt_rh_type
;
298 u_int8_t nd_opt_rh_len
;
299 u_int16_t nd_opt_rh_reserved1
;
300 u_int32_t nd_opt_rh_reserved2
;
301 /* followed by IP header and data */
304 struct nd_opt_mtu
{ /* MTU option */
305 u_int8_t nd_opt_mtu_type
;
306 u_int8_t nd_opt_mtu_len
;
307 u_int16_t nd_opt_mtu_reserved
;
308 u_int32_t nd_opt_mtu_mtu
;
311 struct nd_opt_advint
{ /* Advertisement Interval option (MIPv6) */
312 u_int8_t nd_opt_int_type
;
313 u_int8_t nd_opt_int_len
;
314 u_int16_t nd_opt_int_reserved
;
315 u_int32_t nd_opt_int_interval
;
318 struct nd_opt_hai
{ /* Home Agent Information option (MIPv6) */
319 u_int8_t nd_opt_hai_type
;
320 u_int8_t nd_opt_hai_len
;
321 u_int16_t nd_opt_hai_reserved
;
322 u_int16_t nd_opt_hai_pref
;
323 u_int16_t nd_opt_hai_lifetime
;
330 struct icmp6_namelookup
{
331 struct icmp6_hdr icmp6_nl_hdr
;
332 u_int8_t icmp6_nl_nonce
[8];
333 u_int32_t icmp6_nl_ttl
;
335 u_int8_t icmp6_nl_len
;
336 u_int8_t icmp6_nl_name
[3];
338 /* could be followed by options */
342 * icmp6 node information
344 struct icmp6_nodeinfo
{
345 struct icmp6_hdr icmp6_ni_hdr
;
346 u_int8_t icmp6_ni_nonce
[8];
347 /* could be followed by reply data */
350 #define ni_type icmp6_ni_hdr.icmp6_type
351 #define ni_code icmp6_ni_hdr.icmp6_code
352 #define ni_cksum icmp6_ni_hdr.icmp6_cksum
353 #define ni_qtype icmp6_ni_hdr.icmp6_data16[0]
354 #define ni_flags icmp6_ni_hdr.icmp6_data16[1]
357 #define NI_QTYPE_NOOP 0 /* NOOP */
358 #define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */
359 #define NI_QTYPE_FQDN 2 /* FQDN */
360 #define NI_QTYPE_NODEADDR 3 /* Node Addresses. XXX: spec says 2, but it may be a typo... */
362 #if BYTE_ORDER == BIG_ENDIAN
363 #define NI_SUPTYPE_FLAG_COMPRESS 0x1
364 #define NI_FQDN_FLAG_VALIDTTL 0x1
365 #elif BYTE_ORDER == LITTLE_ENDIAN
366 #define NI_SUPTYPE_FLAG_COMPRESS 0x0100
367 #define NI_FQDN_FLAG_VALIDTTL 0x0100
370 #ifdef NAME_LOOKUPS_04
371 #if BYTE_ORDER == BIG_ENDIAN
372 #define NI_NODEADDR_FLAG_LINKLOCAL 0x1
373 #define NI_NODEADDR_FLAG_SITELOCAL 0x2
374 #define NI_NODEADDR_FLAG_GLOBAL 0x4
375 #define NI_NODEADDR_FLAG_ALL 0x8
376 #define NI_NODEADDR_FLAG_TRUNCATE 0x10
377 #define NI_NODEADDR_FLAG_ANYCAST 0x20 /* just experimental. not in spec */
378 #elif BYTE_ORDER == LITTLE_ENDIAN
379 #define NI_NODEADDR_FLAG_LINKLOCAL 0x0100
380 #define NI_NODEADDR_FLAG_SITELOCAL 0x0200
381 #define NI_NODEADDR_FLAG_GLOBAL 0x0400
382 #define NI_NODEADDR_FLAG_ALL 0x0800
383 #define NI_NODEADDR_FLAG_TRUNCATE 0x1000
384 #define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */
386 #else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
387 #if BYTE_ORDER == BIG_ENDIAN
388 #define NI_NODEADDR_FLAG_TRUNCATE 0x1
389 #define NI_NODEADDR_FLAG_ALL 0x2
390 #define NI_NODEADDR_FLAG_COMPAT 0x4
391 #define NI_NODEADDR_FLAG_LINKLOCAL 0x8
392 #define NI_NODEADDR_FLAG_SITELOCAL 0x10
393 #define NI_NODEADDR_FLAG_GLOBAL 0x20
394 #define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */
395 #elif BYTE_ORDER == LITTLE_ENDIAN
396 #define NI_NODEADDR_FLAG_TRUNCATE 0x0100
397 #define NI_NODEADDR_FLAG_ALL 0x0200
398 #define NI_NODEADDR_FLAG_COMPAT 0x0400
399 #define NI_NODEADDR_FLAG_LINKLOCAL 0x0800
400 #define NI_NODEADDR_FLAG_SITELOCAL 0x1000
401 #define NI_NODEADDR_FLAG_GLOBAL 0x2000
402 #define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */
406 struct ni_reply_fqdn
{
407 u_int32_t ni_fqdn_ttl
; /* TTL */
408 u_int8_t ni_fqdn_namelen
; /* length in octets of the FQDN */
409 u_int8_t ni_fqdn_name
[3]; /* XXX: alignment */
413 * Router Renumbering. as router-renum-08.txt
415 #if BYTE_ORDER == BIG_ENDIAN /* net byte order */
416 struct icmp6_router_renum
{ /* router renumbering header */
417 struct icmp6_hdr rr_hdr
;
419 u_int8_t rr_test
: 1;
420 u_int8_t rr_reqresult
: 1;
421 u_int8_t rr_forceapply
: 1;
422 u_int8_t rr_specsite
: 1;
423 u_int8_t rr_prevdone
: 1;
424 u_int8_t rr_flags_reserved
: 3;
425 u_int16_t rr_maxdelay
;
426 u_int32_t rr_reserved
;
428 #elif BYTE_ORDER == LITTLE_ENDIAN
429 struct icmp6_router_renum
{ /* router renumbering header */
430 struct icmp6_hdr rr_hdr
;
432 u_int8_t rr_flags_reserved
: 3;
433 u_int8_t rr_prevdone
: 1;
434 u_int8_t rr_specsite
: 1;
435 u_int8_t rr_forceapply
: 1;
436 u_int8_t rr_reqresult
: 1;
437 u_int8_t rr_test
: 1;
438 u_int16_t rr_maxdelay
;
439 u_int32_t rr_reserved
;
441 #endif /* BYTE_ORDER */
443 #define rr_type rr_hdr.icmp6_type
444 #define rr_code rr_hdr.icmp6_code
445 #define rr_cksum rr_hdr.icmp6_cksum
446 #define rr_seqnum rr_hdr.icmp6_data32[0]
448 struct rr_pco_match
{ /* match prefix part */
451 u_int8_t rpm_ordinal
;
452 u_int8_t rpm_matchlen
;
455 u_int16_t rpm_reserved
;
456 struct in6_addr rpm_prefix
;
459 #define RPM_PCO_ADD 1
460 #define RPM_PCO_CHANGE 2
461 #define RPM_PCO_SETGLOBAL 3
462 #define RPM_PCO_MAX 4
464 #if BYTE_ORDER == BIG_ENDIAN /* net byte order */
465 struct rr_pco_use
{ /* use prefix part */
467 u_int8_t rpu_keeplen
;
468 u_int8_t rpu_mask_onlink
: 1;
469 u_int8_t rpu_mask_autonomous
: 1;
470 u_int8_t rpu_mask_reserved
: 6;
471 u_int8_t rpu_onlink
: 1;
472 u_int8_t rpu_autonomous
: 1;
473 u_int8_t rpu_raflags_reserved
: 6;
474 u_int32_t rpu_vltime
;
475 u_int32_t rpu_pltime
;
476 u_int32_t rpu_decr_vltime
: 1;
477 u_int32_t rpu_decr_pltime
: 1;
478 u_int32_t rpu_flags_reserved
: 6;
479 u_int32_t rpu_reserved
: 24;
480 struct in6_addr rpu_prefix
;
482 #elif BYTE_ORDER == LITTLE_ENDIAN
483 struct rr_pco_use
{ /* use prefix part */
485 u_int8_t rpu_keeplen
;
486 u_int8_t rpu_mask_reserved
: 6;
487 u_int8_t rpu_mask_autonomous
: 1;
488 u_int8_t rpu_mask_onlink
: 1;
489 u_int8_t rpu_raflags_reserved
: 6;
490 u_int8_t rpu_autonomous
: 1;
491 u_int8_t rpu_onlink
: 1;
492 u_int32_t rpu_vltime
;
493 u_int32_t rpu_pltime
;
494 u_int32_t rpu_flags_reserved
: 6;
495 u_int32_t rpu_decr_pltime
: 1;
496 u_int32_t rpu_decr_vltime
: 1;
497 u_int32_t rpu_reserved
: 24;
498 struct in6_addr rpu_prefix
;
500 #endif /* BYTE_ORDER */
502 #if BYTE_ORDER == BIG_ENDIAN /* net byte order */
503 struct rr_result
{ /* router renumbering result message */
504 u_int8_t rrr_reserved
;
505 u_int8_t rrr_flags_reserved
: 6;
506 u_int8_t rrr_outofbound
: 1;
507 u_int8_t rrr_forbidden
: 1;
508 u_int8_t rrr_ordinal
;
509 u_int8_t rrr_matchedlen
;
511 struct in6_addr rrr_prefix
;
513 #elif BYTE_ORDER == LITTLE_ENDIAN
514 struct rr_result
{ /* router renumbering result message */
515 u_int8_t rrr_reserved
;
516 u_int8_t rrr_forbidden
: 1;
517 u_int8_t rrr_outofbound
: 1;
518 u_int8_t rrr_flags_reserved
: 6;
519 u_int8_t rrr_ordinal
;
520 u_int8_t rrr_matchedlen
;
522 struct in6_addr rrr_prefix
;
524 #endif /* BYTE_ORDER */
527 * icmp6 filter structures.
530 struct icmp6_filter
{
531 u_int32_t icmp6_filt
[8];
535 #define ICMP6_FILTER_SETPASSALL(filterp) \
538 p = (u_char *)filterp; \
539 for (i = 0; i < sizeof(struct icmp6_filter); i++) \
542 #define ICMP6_FILTER_SETBLOCKALL(filterp) \
543 bzero(filterp, sizeof(struct icmp6_filter))
545 #define ICMP6_FILTER_SETPASSALL(filterp) \
546 memset(filterp, 0xff, sizeof(struct icmp6_filter))
547 #define ICMP6_FILTER_SETBLOCKALL(filterp) \
548 memset(filterp, 0x00, sizeof(struct icmp6_filter))
551 #define ICMP6_FILTER_SETPASS(type, filterp) \
552 (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
553 #define ICMP6_FILTER_SETBLOCK(type, filterp) \
554 (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
555 #define ICMP6_FILTER_WILLPASS(type, filterp) \
556 ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
557 #define ICMP6_FILTER_WILLBLOCK(type, filterp) \
558 ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
561 * Variables related to this implementation
562 * of the internet control message protocol version 6.
565 /* statistics related to icmp6 packets generated */
566 u_quad_t icp6s_error
; /* # of calls to icmp6_error */
567 u_quad_t icp6s_canterror
; /* no error 'cuz old was icmp */
568 u_quad_t icp6s_toofreq
; /* no error 'cuz rate limitation */
569 u_quad_t icp6s_outhist
[256];
570 /* statistics related to input message processed */
571 u_quad_t icp6s_badcode
; /* icmp6_code out of range */
572 u_quad_t icp6s_tooshort
; /* packet < sizeof(struct icmp6_hdr) */
573 u_quad_t icp6s_checksum
; /* bad checksum */
574 u_quad_t icp6s_badlen
; /* calculated bound mismatch */
575 u_quad_t icp6s_reflect
; /* number of responses */
576 u_quad_t icp6s_inhist
[256];
577 u_quad_t icp6s_nd_toomanyopt
; /* too many ND options */
581 * Names for ICMP sysctl objects
583 #define ICMPV6CTL_STATS 1
584 #define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */
585 #define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */
586 #define ICMPV6CTL_ERRRATELIMIT 5 /* ICMPv6 error rate limitation */
587 #define ICMPV6CTL_ND6_PRUNE 6
588 #define ICMPV6CTL_ND6_DELAY 8
589 #define ICMPV6CTL_ND6_UMAXTRIES 9
590 #define ICMPV6CTL_ND6_MMAXTRIES 10
591 #define ICMPV6CTL_ND6_USELOOPBACK 11
592 /*#define ICMPV6CTL_ND6_PROXYALL 12 obsoleted, do not reuse here */
593 #define ICMPV6CTL_NODEINFO 13
594 #define ICMPV6CTL_MAXID 14
596 #define ICMPV6CTL_NAMES { \
599 { "rediraccept", CTLTYPE_INT }, \
600 { "redirtimeout", CTLTYPE_INT }, \
602 { "errratelimit", CTLTYPE_INT }, \
603 { "nd6_prune", CTLTYPE_INT }, \
605 { "nd6_delay", CTLTYPE_INT }, \
606 { "nd6_umaxtries", CTLTYPE_INT }, \
607 { "nd6_mmaxtries", CTLTYPE_INT }, \
608 { "nd6_useloopback", CTLTYPE_INT }, \
610 { "nodeinfo", CTLTYPE_INT }, \
614 #define ICMPV6CTL_VARS { \
617 &icmp6_rediraccept, \
618 &icmp6_redirtimeout, \
633 #define RTF_PROBEMTU RTF_PROTO1
641 void icmp6_init
__P((void));
642 void icmp6_paramerror
__P((struct mbuf
*, int));
643 void icmp6_error
__P((struct mbuf
*, int, int, int));
644 int icmp6_input
__P((struct mbuf
**, int *, int));
645 void icmp6_fasttimo
__P((void));
646 void icmp6_reflect
__P((struct mbuf
*, size_t));
647 void icmp6_prepare
__P((struct mbuf
*));
648 void icmp6_redirect_input
__P((struct mbuf
*, int));
649 void icmp6_redirect_output
__P((struct mbuf
*, struct rtentry
*));
651 int icmp6_sysctl
__P((int *, u_int
, void *, size_t *, void *, size_t));
652 void icmp6_mtuexpire
__P((struct rtentry
*, struct rttimer
*));
654 #if defined(__NetBSD__) || defined(__OpenBSD__)
655 int icmp6_sysctl
__P((int *, u_int
, void *, size_t *, void *, size_t));
658 /* XXX: is this the right place for these macros? */
659 #define icmp6_ifstat_inc(ifp, tag) \
661 if ((ifp) && (ifp)->if_index <= if_index \
662 && (ifp)->if_index < icmp6_ifstatmax \
663 && icmp6_ifstat && icmp6_ifstat[(ifp)->if_index]) { \
664 icmp6_ifstat[(ifp)->if_index]->tag++; \
668 #define icmp6_ifoutstat_inc(ifp, type, code) \
670 icmp6_ifstat_inc(ifp, ifs6_out_msg); \
671 if (type < ICMP6_INFOMSG_MASK) \
672 icmp6_ifstat_inc(ifp, ifs6_out_error); \
674 case ICMP6_DST_UNREACH: \
675 icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
676 if (code == ICMP6_DST_UNREACH_ADMIN) \
677 icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
679 case ICMP6_PACKET_TOO_BIG: \
680 icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
682 case ICMP6_TIME_EXCEEDED: \
683 icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
685 case ICMP6_PARAM_PROB: \
686 icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
688 case ICMP6_ECHO_REQUEST: \
689 icmp6_ifstat_inc(ifp, ifs6_out_echo); \
691 case ICMP6_ECHO_REPLY: \
692 icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
694 case MLD6_LISTENER_QUERY: \
695 icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
697 case MLD6_LISTENER_REPORT: \
698 icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
700 case MLD6_LISTENER_DONE: \
701 icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
703 case ND_ROUTER_SOLICIT: \
704 icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
706 case ND_ROUTER_ADVERT: \
707 icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
709 case ND_NEIGHBOR_SOLICIT: \
710 icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
712 case ND_NEIGHBOR_ADVERT: \
713 icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
716 icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
721 extern int icmp6_rediraccept
; /* accept/process redirects */
722 extern int icmp6_redirtimeout
; /* cache time for redirect routes */
725 #endif /* !_NETINET_ICMP6_H_ */