Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/include/netinet/icmp6.h

1/*
2 * Copyright (c) 2000,2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
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
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*$KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $*/
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.h8.1 (Berkeley) 6/10/93
92 */
93
94#ifndef _NETINET_ICMP6_H_
95#define _NETINET_ICMP6_H_
96#include <sys/appleapiopts.h>
97
98#define ICMPV6_PLD_MAXLEN1232/* IPV6_MMTU - sizeof(struct ip6_hdr)
99 - sizeof(struct icmp6_hdr) */
100
101struct icmp6_hdr {
102u_int8_ticmp6_type;/* type field */
103u_int8_ticmp6_code;/* code field */
104u_int16_ticmp6_cksum;/* checksum field */
105union {
106u_int32_ticmp6_un_data32[1]; /* type-specific field */
107u_int16_ticmp6_un_data16[2]; /* type-specific field */
108u_int8_ticmp6_un_data8[4]; /* type-specific field */
109} icmp6_dataun;
110};
111
112#define icmp6_data32icmp6_dataun.icmp6_un_data32
113#define icmp6_data16icmp6_dataun.icmp6_un_data16
114#define icmp6_data8icmp6_dataun.icmp6_un_data8
115#define icmp6_pptricmp6_data32[0]/* parameter prob */
116#define icmp6_mtuicmp6_data32[0]/* packet too big */
117#define icmp6_idicmp6_data16[0]/* echo request/reply */
118#define icmp6_seqicmp6_data16[1]/* echo request/reply */
119#define icmp6_maxdelayicmp6_data16[0]/* mcast group membership */
120
121#define ICMP6_DST_UNREACH1/* dest unreachable, codes: */
122#define ICMP6_PACKET_TOO_BIG2/* packet too big */
123#define ICMP6_TIME_EXCEEDED3/* time exceeded, code: */
124#define ICMP6_PARAM_PROB4/* ip6 header bad */
125
126#define ICMP6_ECHO_REQUEST128/* echo service */
127#define ICMP6_ECHO_REPLY129/* echo reply */
128#define ICMP6_MEMBERSHIP_QUERY130/* group membership query */
129#define MLD6_LISTENER_QUERY130 /* multicast listener query */
130#define ICMP6_MEMBERSHIP_REPORT131/* group membership report */
131#define MLD6_LISTENER_REPORT131/* multicast listener report */
132#define ICMP6_MEMBERSHIP_REDUCTION132/* group membership termination */
133#define MLD6_LISTENER_DONE132/* multicast listener done */
134
135#defineMLD_LISTENER_QUERYMLD6_LISTENER_QUERY
136#defineMLD_LISTENER_REPORTMLD6_LISTENER_REPORT
137#defineMLD_LISTENER_DONEMLD6_LISTENER_DONE
138
139#define ND_ROUTER_SOLICIT133/* router solicitation */
140#define ND_ROUTER_ADVERT134/* router advertisment */
141#define ND_NEIGHBOR_SOLICIT135/* neighbor solicitation */
142#define ND_NEIGHBOR_ADVERT136/* neighbor advertisment */
143#define ND_REDIRECT137/* redirect */
144
145#define ICMP6_ROUTER_RENUMBERING138/* router renumbering */
146
147#define ICMP6_WRUREQUEST139/* who are you request */
148#define ICMP6_WRUREPLY140/* who are you reply */
149#define ICMP6_FQDN_QUERY139/* FQDN query */
150#define ICMP6_FQDN_REPLY140/* FQDN reply */
151#define ICMP6_NI_QUERY139/* node information request */
152#define ICMP6_NI_REPLY140/* node information reply */
153
154/* The definitions below are experimental. TBA */
155#define MLD6_MTRACE_RESP200/* mtrace response(to sender) */
156#define MLD6_MTRACE201/* mtrace messages */
157
158#defineMLD_MTRACE_RESPMLD6_MTRACE_RESP
159#defineMLD_MTRACEMLD6_MTRACE
160
161#define ICMP6_HADISCOV_REQUEST202/* XXX To be defined */
162#define ICMP6_HADISCOV_REPLY203/* XXX To be defined */
163
164#define ICMP6_MAXTYPE203
165
166#define ICMP6_DST_UNREACH_NOROUTE0/* no route to destination */
167#define ICMP6_DST_UNREACH_ADMIN 1/* administratively prohibited */
168#define ICMP6_DST_UNREACH_NOTNEIGHBOR2/* not a neighbor(obsolete) */
169#define ICMP6_DST_UNREACH_BEYONDSCOPE2/* beyond scope of source address */
170#define ICMP6_DST_UNREACH_ADDR3/* address unreachable */
171#define ICMP6_DST_UNREACH_NOPORT4/* port unreachable */
172
173#define ICMP6_TIME_EXCEED_TRANSIT 0/* ttl==0 in transit */
174#define ICMP6_TIME_EXCEED_REASSEMBLY1/* ttl==0 in reass */
175
176#define ICMP6_PARAMPROB_HEADER 0/* erroneous header field */
177#define ICMP6_PARAMPROB_NEXTHEADER1/* unrecognized next header */
178#define ICMP6_PARAMPROB_OPTION2/* unrecognized option */
179
180#define ICMP6_INFOMSG_MASK0x80/* all informational messages */
181
182#define ICMP6_NI_SUBJ_IPV60/* Query Subject is an IPv6 address */
183#define ICMP6_NI_SUBJ_FQDN1/* Query Subject is a Domain name */
184#define ICMP6_NI_SUBJ_IPV42/* Query Subject is an IPv4 address */
185
186#define ICMP6_NI_SUCCESS0/* node information successful reply */
187#define ICMP6_NI_REFUSED1/* node information request is refused */
188#define ICMP6_NI_UNKNOWN2/* unknown Qtype */
189
190#define ICMP6_ROUTER_RENUMBERING_COMMAND 0/* rr command */
191#define ICMP6_ROUTER_RENUMBERING_RESULT 1/* rr result */
192#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255/* rr seq num reset */
193
194/* Used in kernel only */
195#define ND_REDIRECT_ONLINK0/* redirect to an on-link node */
196#define ND_REDIRECT_ROUTER1/* redirect to a better router */
197
198/*
199 * Multicast Listener Discovery
200 */
201struct mld6_hdr {
202struct icmp6_hdrmld6_hdr;
203struct in6_addrmld6_addr; /* multicast address */
204};
205
206#define mld6_typemld6_hdr.icmp6_type
207#define mld6_codemld6_hdr.icmp6_code
208#define mld6_cksummld6_hdr.icmp6_cksum
209#define mld6_maxdelaymld6_hdr.icmp6_data16[0]
210#define mld6_reservedmld6_hdr.icmp6_data16[1]
211
212/*
213 * Neighbor Discovery
214 */
215
216struct nd_router_solicit {/* router solicitation */
217struct icmp6_hdr nd_rs_hdr;
218/* could be followed by options */
219};
220
221#define nd_rs_typend_rs_hdr.icmp6_type
222#define nd_rs_codend_rs_hdr.icmp6_code
223#define nd_rs_cksumnd_rs_hdr.icmp6_cksum
224#define nd_rs_reservednd_rs_hdr.icmp6_data32[0]
225
226struct nd_router_advert {/* router advertisement */
227struct icmp6_hdrnd_ra_hdr;
228u_int32_tnd_ra_reachable;/* reachable time */
229u_int32_tnd_ra_retransmit;/* retransmit timer */
230/* could be followed by options */
231};
232
233#define nd_ra_typend_ra_hdr.icmp6_type
234#define nd_ra_codend_ra_hdr.icmp6_code
235#define nd_ra_cksumnd_ra_hdr.icmp6_cksum
236#define nd_ra_curhoplimitnd_ra_hdr.icmp6_data8[0]
237#define nd_ra_flags_reservednd_ra_hdr.icmp6_data8[1]
238#define ND_RA_FLAG_MANAGED0x80
239#define ND_RA_FLAG_OTHER0x40
240#define ND_RA_FLAG_HA0x20
241
242/*
243 * Router preference values based on draft-draves-ipngwg-router-selection-01.
244 * These are non-standard definitions.
245 */
246#define ND_RA_FLAG_RTPREF_MASK0x18 /* 00011000 */
247
248#define ND_RA_FLAG_RTPREF_HIGH0x08 /* 00001000 */
249#define ND_RA_FLAG_RTPREF_MEDIUM0x00 /* 00000000 */
250#define ND_RA_FLAG_RTPREF_LOW0x18 /* 00011000 */
251#define ND_RA_FLAG_RTPREF_RSV0x10 /* 00010000 */
252
253#define nd_ra_router_lifetimend_ra_hdr.icmp6_data16[1]
254
255struct nd_neighbor_solicit {/* neighbor solicitation */
256struct icmp6_hdrnd_ns_hdr;
257struct in6_addrnd_ns_target;/*target address */
258/* could be followed by options */
259};
260
261#define nd_ns_typend_ns_hdr.icmp6_type
262#define nd_ns_codend_ns_hdr.icmp6_code
263#define nd_ns_cksumnd_ns_hdr.icmp6_cksum
264#define nd_ns_reservednd_ns_hdr.icmp6_data32[0]
265
266struct nd_neighbor_advert {/* neighbor advertisement */
267struct icmp6_hdrnd_na_hdr;
268struct in6_addrnd_na_target;/* target address */
269/* could be followed by options */
270};
271
272#define nd_na_typend_na_hdr.icmp6_type
273#define nd_na_codend_na_hdr.icmp6_code
274#define nd_na_cksumnd_na_hdr.icmp6_cksum
275#define nd_na_flags_reservednd_na_hdr.icmp6_data32[0]
276#if BYTE_ORDER == BIG_ENDIAN
277#define ND_NA_FLAG_ROUTER0x80000000
278#define ND_NA_FLAG_SOLICITED0x40000000
279#define ND_NA_FLAG_OVERRIDE0x20000000
280#else
281#if BYTE_ORDER == LITTLE_ENDIAN
282#define ND_NA_FLAG_ROUTER0x80
283#define ND_NA_FLAG_SOLICITED0x40
284#define ND_NA_FLAG_OVERRIDE0x20
285#endif
286#endif
287
288struct nd_redirect {/* redirect */
289struct icmp6_hdrnd_rd_hdr;
290struct in6_addrnd_rd_target;/* target address */
291struct in6_addrnd_rd_dst;/* destination address */
292/* could be followed by options */
293};
294
295#define nd_rd_typend_rd_hdr.icmp6_type
296#define nd_rd_codend_rd_hdr.icmp6_code
297#define nd_rd_cksumnd_rd_hdr.icmp6_cksum
298#define nd_rd_reservednd_rd_hdr.icmp6_data32[0]
299
300struct nd_opt_hdr {/* Neighbor discovery option header */
301u_int8_tnd_opt_type;
302u_int8_tnd_opt_len;
303/* followed by option specific data*/
304};
305
306#define ND_OPT_SOURCE_LINKADDR1
307#define ND_OPT_TARGET_LINKADDR2
308#define ND_OPT_PREFIX_INFORMATION3
309#define ND_OPT_REDIRECTED_HEADER4
310#define ND_OPT_MTU5
311
312#define ND_OPT_ROUTE_INFO200/* draft-ietf-ipngwg-router-preference, not officially assigned yet */
313
314struct nd_opt_prefix_info {/* prefix information */
315u_int8_tnd_opt_pi_type;
316u_int8_tnd_opt_pi_len;
317u_int8_tnd_opt_pi_prefix_len;
318u_int8_tnd_opt_pi_flags_reserved;
319u_int32_tnd_opt_pi_valid_time;
320u_int32_tnd_opt_pi_preferred_time;
321u_int32_tnd_opt_pi_reserved2;
322struct in6_addrnd_opt_pi_prefix;
323};
324
325#define ND_OPT_PI_FLAG_ONLINK0x80
326#define ND_OPT_PI_FLAG_AUTO0x40
327
328struct nd_opt_rd_hdr {/* redirected header */
329u_int8_tnd_opt_rh_type;
330u_int8_tnd_opt_rh_len;
331u_int16_tnd_opt_rh_reserved1;
332u_int32_tnd_opt_rh_reserved2;
333/* followed by IP header and data */
334};
335
336struct nd_opt_mtu {/* MTU option */
337u_int8_tnd_opt_mtu_type;
338u_int8_tnd_opt_mtu_len;
339u_int16_tnd_opt_mtu_reserved;
340u_int32_tnd_opt_mtu_mtu;
341};
342
343struct nd_opt_route_info {/* route info */
344u_int8_tnd_opt_rti_type;
345u_int8_tnd_opt_rti_len;
346u_int8_tnd_opt_rti_prefixlen;
347u_int8_tnd_opt_rti_flags;
348u_int32_tnd_opt_rti_lifetime;
349/* followed by prefix */
350};
351
352/*
353 * icmp6 namelookup
354 */
355
356struct icmp6_namelookup {
357struct icmp6_hdr icmp6_nl_hdr;
358u_int8_ticmp6_nl_nonce[8];
359int32_ticmp6_nl_ttl;
360#if 0
361u_int8_ticmp6_nl_len;
362u_int8_ticmp6_nl_name[3];
363#endif
364/* could be followed by options */
365};
366
367/*
368 * icmp6 node information
369 */
370struct icmp6_nodeinfo {
371struct icmp6_hdr icmp6_ni_hdr;
372u_int8_t icmp6_ni_nonce[8];
373/* could be followed by reply data */
374};
375
376#define ni_typeicmp6_ni_hdr.icmp6_type
377#define ni_codeicmp6_ni_hdr.icmp6_code
378#define ni_cksumicmp6_ni_hdr.icmp6_cksum
379#define ni_qtypeicmp6_ni_hdr.icmp6_data16[0]
380#define ni_flagsicmp6_ni_hdr.icmp6_data16[1]
381
382#define NI_QTYPE_NOOP0 /* NOOP */
383#define NI_QTYPE_SUPTYPES1 /* Supported Qtypes */
384#define NI_QTYPE_FQDN2 /* FQDN (draft 04) */
385#define NI_QTYPE_DNSNAME2 /* DNS Name */
386#define NI_QTYPE_NODEADDR3 /* Node Addresses */
387#define NI_QTYPE_IPV4ADDR4 /* IPv4 Addresses */
388
389#if BYTE_ORDER == BIG_ENDIAN
390#define NI_SUPTYPE_FLAG_COMPRESS0x1
391#define NI_FQDN_FLAG_VALIDTTL0x1
392#elif BYTE_ORDER == LITTLE_ENDIAN
393#define NI_SUPTYPE_FLAG_COMPRESS0x0100
394#define NI_FQDN_FLAG_VALIDTTL0x0100
395#endif
396
397#ifdef NAME_LOOKUPS_04
398#if BYTE_ORDER == BIG_ENDIAN
399#define NI_NODEADDR_FLAG_LINKLOCAL0x1
400#define NI_NODEADDR_FLAG_SITELOCAL0x2
401#define NI_NODEADDR_FLAG_GLOBAL0x4
402#define NI_NODEADDR_FLAG_ALL0x8
403#define NI_NODEADDR_FLAG_TRUNCATE0x10
404#define NI_NODEADDR_FLAG_ANYCAST0x20 /* just experimental. not in spec */
405#elif BYTE_ORDER == LITTLE_ENDIAN
406#define NI_NODEADDR_FLAG_LINKLOCAL0x0100
407#define NI_NODEADDR_FLAG_SITELOCAL0x0200
408#define NI_NODEADDR_FLAG_GLOBAL0x0400
409#define NI_NODEADDR_FLAG_ALL0x0800
410#define NI_NODEADDR_FLAG_TRUNCATE0x1000
411#define NI_NODEADDR_FLAG_ANYCAST0x2000 /* just experimental. not in spec */
412#endif
413#else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
414#if BYTE_ORDER == BIG_ENDIAN
415#define NI_NODEADDR_FLAG_TRUNCATE0x1
416#define NI_NODEADDR_FLAG_ALL0x2
417#define NI_NODEADDR_FLAG_COMPAT0x4
418#define NI_NODEADDR_FLAG_LINKLOCAL0x8
419#define NI_NODEADDR_FLAG_SITELOCAL0x10
420#define NI_NODEADDR_FLAG_GLOBAL0x20
421#define NI_NODEADDR_FLAG_ANYCAST0x40 /* just experimental. not in spec */
422#elif BYTE_ORDER == LITTLE_ENDIAN
423#define NI_NODEADDR_FLAG_TRUNCATE0x0100
424#define NI_NODEADDR_FLAG_ALL0x0200
425#define NI_NODEADDR_FLAG_COMPAT0x0400
426#define NI_NODEADDR_FLAG_LINKLOCAL0x0800
427#define NI_NODEADDR_FLAG_SITELOCAL0x1000
428#define NI_NODEADDR_FLAG_GLOBAL0x2000
429#define NI_NODEADDR_FLAG_ANYCAST0x4000 /* just experimental. not in spec */
430#endif
431#endif
432
433struct ni_reply_fqdn {
434u_int32_t ni_fqdn_ttl;/* TTL */
435u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
436u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
437};
438
439/*
440 * Router Renumbering. as router-renum-08.txt
441 */
442struct icmp6_router_renum {/* router renumbering header */
443struct icmp6_hdrrr_hdr;
444u_int8_trr_segnum;
445u_int8_trr_flags;
446u_int16_trr_maxdelay;
447u_int32_trr_reserved;
448};
449
450#define ICMP6_RR_FLAGS_TEST0x80
451#define ICMP6_RR_FLAGS_REQRESULT0x40
452#define ICMP6_RR_FLAGS_FORCEAPPLY0x20
453#define ICMP6_RR_FLAGS_SPECSITE0x10
454#define ICMP6_RR_FLAGS_PREVDONE0x08
455
456#define rr_typerr_hdr.icmp6_type
457#define rr_coderr_hdr.icmp6_code
458#define rr_cksumrr_hdr.icmp6_cksum
459#define rr_seqnum rr_hdr.icmp6_data32[0]
460
461struct rr_pco_match {/* match prefix part */
462u_int8_trpm_code;
463u_int8_trpm_len;
464u_int8_trpm_ordinal;
465u_int8_trpm_matchlen;
466u_int8_trpm_minlen;
467u_int8_trpm_maxlen;
468u_int16_trpm_reserved;
469structin6_addrrpm_prefix;
470};
471
472#define RPM_PCO_ADD1
473#define RPM_PCO_CHANGE2
474#define RPM_PCO_SETGLOBAL3
475#define RPM_PCO_MAX4
476
477struct rr_pco_use {/* use prefix part */
478u_int8_trpu_uselen;
479u_int8_trpu_keeplen;
480u_int8_trpu_ramask;
481u_int8_trpu_raflags;
482u_int32_trpu_vltime;
483u_int32_trpu_pltime;
484u_int32_trpu_flags;
485structin6_addr rpu_prefix;
486};
487#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK0x80
488#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO0x40
489
490#if BYTE_ORDER == BIG_ENDIAN
491#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
492#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
493#elif BYTE_ORDER == LITTLE_ENDIAN
494#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
495#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
496#endif
497
498struct rr_result {/* router renumbering result message */
499u_int16_trrr_flags;
500u_int8_trrr_ordinal;
501u_int8_trrr_matchedlen;
502u_int32_trrr_ifid;
503structin6_addr rrr_prefix;
504};
505#if BYTE_ORDER == BIG_ENDIAN
506#define ICMP6_RR_RESULT_FLAGS_OOB0x0002
507#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN0x0001
508#elif BYTE_ORDER == LITTLE_ENDIAN
509#define ICMP6_RR_RESULT_FLAGS_OOB0x0200
510#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN0x0100
511#endif
512
513/*
514 * icmp6 filter structures.
515 */
516
517struct icmp6_filter {
518u_int32_t icmp6_filt[8];
519};
520
521#defineICMP6_FILTER_SETPASSALL(filterp) \
522memset(filterp, 0xff, sizeof(struct icmp6_filter))
523#defineICMP6_FILTER_SETBLOCKALL(filterp) \
524memset(filterp, 0x00, sizeof(struct icmp6_filter))
525
526#defineICMP6_FILTER_SETPASS(type, filterp) \
527(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
528#defineICMP6_FILTER_SETBLOCK(type, filterp) \
529(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
530#defineICMP6_FILTER_WILLPASS(type, filterp) \
531((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
532#defineICMP6_FILTER_WILLBLOCK(type, filterp) \
533((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
534
535/*
536 * Variables related to this implementation
537 * of the internet control message protocol version 6.
538 */
539struct icmp6errstat {
540u_quad_t icp6errs_dst_unreach_noroute;
541u_quad_t icp6errs_dst_unreach_admin;
542u_quad_t icp6errs_dst_unreach_beyondscope;
543u_quad_t icp6errs_dst_unreach_addr;
544u_quad_t icp6errs_dst_unreach_noport;
545u_quad_t icp6errs_packet_too_big;
546u_quad_t icp6errs_time_exceed_transit;
547u_quad_t icp6errs_time_exceed_reassembly;
548u_quad_t icp6errs_paramprob_header;
549u_quad_t icp6errs_paramprob_nextheader;
550u_quad_t icp6errs_paramprob_option;
551u_quad_t icp6errs_redirect; /* we regard redirect as an error here */
552u_quad_t icp6errs_unknown;
553};
554
555struct icmp6stat {
556/* statistics related to icmp6 packets generated */
557u_quad_t icp6s_error;/* # of calls to icmp6_error */
558u_quad_t icp6s_canterror;/* no error 'cuz old was icmp */
559u_quad_t icp6s_toofreq;/* no error 'cuz rate limitation */
560u_quad_t icp6s_outhist[256];
561/* statistics related to input message processed */
562u_quad_t icp6s_badcode;/* icmp6_code out of range */
563u_quad_t icp6s_tooshort;/* packet < sizeof(struct icmp6_hdr) */
564u_quad_t icp6s_checksum;/* bad checksum */
565u_quad_t icp6s_badlen;/* calculated bound mismatch */
566u_quad_t icp6s_reflect;/* number of responses */
567u_quad_t icp6s_inhist[256];
568u_quad_t icp6s_nd_toomanyopt;/* too many ND options */
569struct icmp6errstat icp6s_outerrhist;
570#define icp6s_odst_unreach_noroute \
571icp6s_outerrhist.icp6errs_dst_unreach_noroute
572#define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin
573#define icp6s_odst_unreach_beyondscope \
574icp6s_outerrhist.icp6errs_dst_unreach_beyondscope
575#define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr
576#define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport
577#define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big
578#define icp6s_otime_exceed_transit \
579icp6s_outerrhist.icp6errs_time_exceed_transit
580#define icp6s_otime_exceed_reassembly \
581icp6s_outerrhist.icp6errs_time_exceed_reassembly
582#define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header
583#define icp6s_oparamprob_nextheader \
584icp6s_outerrhist.icp6errs_paramprob_nextheader
585#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option
586#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect
587#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown
588u_quad_t icp6s_pmtuchg;/* path MTU changes */
589u_quad_t icp6s_nd_badopt;/* bad ND options */
590u_quad_t icp6s_badns;/* bad neighbor solicitation */
591u_quad_t icp6s_badna;/* bad neighbor advertisement */
592u_quad_t icp6s_badrs;/* bad router advertisement */
593u_quad_t icp6s_badra;/* bad router advertisement */
594u_quad_t icp6s_badredirect;/* bad redirect message */
595};
596
597/*
598 * Names for ICMP sysctl objects
599 */
600#define ICMPV6CTL_STATS1
601#define ICMPV6CTL_REDIRACCEPT2/* accept/process redirects */
602#define ICMPV6CTL_REDIRTIMEOUT3/* redirect cache time */
603#define ICMPV6CTL_ND6_PRUNE6
604#define ICMPV6CTL_ND6_DELAY8
605#define ICMPV6CTL_ND6_UMAXTRIES9
606#define ICMPV6CTL_ND6_MMAXTRIES10
607#define ICMPV6CTL_ND6_USELOOPBACK11
608/*#define ICMPV6CTL_ND6_PROXYALL12obsoleted, do not reuse here */
609#define ICMPV6CTL_NODEINFO13
610#define ICMPV6CTL_ERRPPSLIMIT14/* ICMPv6 error pps limitation */
611#define ICMPV6CTL_ND6_MAXNUDHINT15
612#define ICMPV6CTL_MTUDISC_HIWAT16
613#define ICMPV6CTL_MTUDISC_LOWAT17
614#define ICMPV6CTL_ND6_DEBUG18
615#define ICMPV6CTL_ND6_DRLIST19
616#define ICMPV6CTL_ND6_PRLIST20
617#define ICMPV6CTL_MAXID21
618
619
620#endif /* !_NETINET_ICMP6_H_ */
621

Archive Download this file

Revision: 881