Deleted Added
full compact
icmp6.h (57851) icmp6.h (62587)
1/*
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the project nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/netinet6/icmp6.h 57851 2000-03-09 14:47:21Z shin $
30 */
1/* $FreeBSD: head/sys/netinet6/icmp6.h 62587 2000-07-04 16:35:15Z itojun $ */
2/* $KAME: icmp6.h,v 1.17 2000/06/11 17:23:40 jinmei Exp $ */
31
3
32/*
33 * Copyright (c) 1982, 1986, 1993
34 * The Regents of the University of California. All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 * This product includes software developed by the University of
47 * California, Berkeley and its contributors.
48 * 4. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
65 */
66
67#ifndef _NETINET6_ICMPV6_H_
68#define _NETINET6_ICMPV6_H_
69
70#if !defined(_KERNEL) && !defined(__KAME_NETINET_ICMP6_H_INCLUDED_)
71#error "do not include netinet6/icmp6.h directly, include netinet/icmp6.h"
72#endif
73
74#define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr)
75 - sizeof(struct icmp6_hdr) */
76
77struct icmp6_hdr {
78 u_int8_t icmp6_type; /* type field */
79 u_int8_t icmp6_code; /* code field */
80 u_int16_t icmp6_cksum; /* checksum field */
81 union {
82 u_int32_t icmp6_un_data32[1]; /* type-specific field */
83 u_int16_t icmp6_un_data16[2]; /* type-specific field */
84 u_int8_t icmp6_un_data8[4]; /* type-specific field */
85 } icmp6_dataun;
86};
87
88#define icmp6_data32 icmp6_dataun.icmp6_un_data32
89#define icmp6_data16 icmp6_dataun.icmp6_un_data16
90#define icmp6_data8 icmp6_dataun.icmp6_un_data8
91#define icmp6_pptr icmp6_data32[0] /* parameter prob */
92#define icmp6_mtu icmp6_data32[0] /* packet too big */
93#define icmp6_id icmp6_data16[0] /* echo request/reply */
94#define icmp6_seq icmp6_data16[1] /* echo request/reply */
95#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
96
97#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */
98#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */
99#define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */
100#define ICMP6_PARAM_PROB 4 /* ip6 header bad */
101
102#define ICMP6_ECHO_REQUEST 128 /* echo service */
103#define ICMP6_ECHO_REPLY 129 /* echo reply */
104#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */
105#define MLD6_LISTENER_QUERY 130 /* multicast listener query */
106#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */
107#define MLD6_LISTENER_REPORT 131 /* multicast listener report */
108#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */
109#define MLD6_LISTENER_DONE 132 /* multicast listener done */
110
111#define ND_ROUTER_SOLICIT 133 /* router solicitation */
112#define ND_ROUTER_ADVERT 134 /* router advertisment */
113#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */
114#define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisment */
115#define ND_REDIRECT 137 /* redirect */
116
117#define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */
118
119#define ICMP6_WRUREQUEST 139 /* who are you request */
120#define ICMP6_WRUREPLY 140 /* who are you reply */
121#define ICMP6_FQDN_QUERY 139 /* FQDN query */
122#define ICMP6_FQDN_REPLY 140 /* FQDN reply */
123#define ICMP6_NI_QUERY 139 /* node information request */
124#define ICMP6_NI_REPLY 140 /* node information reply */
125
126/* The definitions below are experimental. TBA */
127#define MLD6_MTRACE_RESP 141 /* mtrace response(to sender) */
128#define MLD6_MTRACE 142 /* mtrace messages */
129
130#define ICMP6_MAXTYPE 142
131
132#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
133#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */
134#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */
135#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */
136#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */
137#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */
138
139#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */
140#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */
141
142#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
143#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */
144#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */
145
146#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */
147
148#define ICMP6_NI_SUCESS 0 /* node information successful reply */
149#define ICMP6_NI_REFUSED 1 /* node information request is refused */
150#define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */
151
152#define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */
153#define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */
154#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */
155
156/* Used in kernel only */
157#define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */
158#define ND_REDIRECT_ROUTER 1 /* redirect to a better router */
159
160/*
161 * Multicast Listener Discovery
162 */
163struct mld6_hdr {
164 struct icmp6_hdr mld6_hdr;
165 struct in6_addr mld6_addr; /* multicast address */
166};
167
168#define mld6_type mld6_hdr.icmp6_type
169#define mld6_code mld6_hdr.icmp6_code
170#define mld6_cksum mld6_hdr.icmp6_cksum
171#define mld6_maxdelay mld6_hdr.icmp6_data16[0]
172#define mld6_reserved mld6_hdr.icmp6_data16[1]
173
174/*
175 * Neighbor Discovery
176 */
177
178struct nd_router_solicit { /* router solicitation */
179 struct icmp6_hdr nd_rs_hdr;
180 /* could be followed by options */
181};
182
183#define nd_rs_type nd_rs_hdr.icmp6_type
184#define nd_rs_code nd_rs_hdr.icmp6_code
185#define nd_rs_cksum nd_rs_hdr.icmp6_cksum
186#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0]
187
188struct nd_router_advert { /* router advertisement */
189 struct icmp6_hdr nd_ra_hdr;
190 u_int32_t nd_ra_reachable; /* reachable time */
191 u_int32_t nd_ra_retransmit; /* retransmit timer */
192 /* could be followed by options */
193};
194
195#define nd_ra_type nd_ra_hdr.icmp6_type
196#define nd_ra_code nd_ra_hdr.icmp6_code
197#define nd_ra_cksum nd_ra_hdr.icmp6_cksum
198#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0]
199#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]
200#define ND_RA_FLAG_MANAGED 0x80
201#define ND_RA_FLAG_OTHER 0x40
202#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]
203
204struct nd_neighbor_solicit { /* neighbor solicitation */
205 struct icmp6_hdr nd_ns_hdr;
206 struct in6_addr nd_ns_target; /*target address */
207 /* could be followed by options */
208};
209
210#define nd_ns_type nd_ns_hdr.icmp6_type
211#define nd_ns_code nd_ns_hdr.icmp6_code
212#define nd_ns_cksum nd_ns_hdr.icmp6_cksum
213#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
214
215struct nd_neighbor_advert { /* neighbor advertisement */
216 struct icmp6_hdr nd_na_hdr;
217 struct in6_addr nd_na_target; /* target address */
218 /* could be followed by options */
219};
220
221#define nd_na_type nd_na_hdr.icmp6_type
222#define nd_na_code nd_na_hdr.icmp6_code
223#define nd_na_cksum nd_na_hdr.icmp6_cksum
224#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
225#if BYTE_ORDER == BIG_ENDIAN
226#define ND_NA_FLAG_ROUTER 0x80000000
227#define ND_NA_FLAG_SOLICITED 0x40000000
228#define ND_NA_FLAG_OVERRIDE 0x20000000
229#elif BYTE_ORDER == LITTLE_ENDIAN
230#define ND_NA_FLAG_ROUTER 0x80
231#define ND_NA_FLAG_SOLICITED 0x40
232#define ND_NA_FLAG_OVERRIDE 0x20
233#endif
234
235struct nd_redirect { /* redirect */
236 struct icmp6_hdr nd_rd_hdr;
237 struct in6_addr nd_rd_target; /* target address */
238 struct in6_addr nd_rd_dst; /* destination address */
239 /* could be followed by options */
240};
241
242#define nd_rd_type nd_rd_hdr.icmp6_type
243#define nd_rd_code nd_rd_hdr.icmp6_code
244#define nd_rd_cksum nd_rd_hdr.icmp6_cksum
245#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
246
247struct nd_opt_hdr { /* Neighbor discovery option header */
248 u_int8_t nd_opt_type;
249 u_int8_t nd_opt_len;
250 /* followed by option specific data*/
251};
252
253#define ND_OPT_SOURCE_LINKADDR 1
254#define ND_OPT_TARGET_LINKADDR 2
255#define ND_OPT_PREFIX_INFORMATION 3
256#define ND_OPT_REDIRECTED_HEADER 4
257#define ND_OPT_MTU 5
258
259struct nd_opt_prefix_info { /* prefix information */
260 u_int8_t nd_opt_pi_type;
261 u_int8_t nd_opt_pi_len;
262 u_int8_t nd_opt_pi_prefix_len;
263 u_int8_t nd_opt_pi_flags_reserved;
264 u_int32_t nd_opt_pi_valid_time;
265 u_int32_t nd_opt_pi_preferred_time;
266 u_int32_t nd_opt_pi_reserved2;
267 struct in6_addr nd_opt_pi_prefix;
268};
269
270#define ND_OPT_PI_FLAG_ONLINK 0x80
271#define ND_OPT_PI_FLAG_AUTO 0x40
272
273struct nd_opt_rd_hdr { /* redirected header */
274 u_int8_t nd_opt_rh_type;
275 u_int8_t nd_opt_rh_len;
276 u_int16_t nd_opt_rh_reserved1;
277 u_int32_t nd_opt_rh_reserved2;
278 /* followed by IP header and data */
279};
280
281struct nd_opt_mtu { /* MTU option */
282 u_int8_t nd_opt_mtu_type;
283 u_int8_t nd_opt_mtu_len;
284 u_int16_t nd_opt_mtu_reserved;
285 u_int32_t nd_opt_mtu_mtu;
286};
287
288/*
289 * icmp6 namelookup
290 */
291
292struct icmp6_namelookup {
293 struct icmp6_hdr icmp6_nl_hdr;
294 u_int64_t icmp6_nl_nonce;
295 u_int32_t icmp6_nl_ttl;
296 /* could be followed by options */
297};
298
299/*
300 * icmp6 node information
301 */
302struct icmp6_nodeinfo {
303 struct icmp6_hdr icmp6_ni_hdr;
304 u_int64_t icmp6_ni_nonce;
305 /* could be followed by reply data */
306};
307
308#define ni_type icmp6_ni_hdr.icmp6_type
309#define ni_code icmp6_ni_hdr.icmp6_code
310#define ni_cksum icmp6_ni_hdr.icmp6_cksum
311#define ni_qtype icmp6_ni_hdr.icmp6_data16[0]
312#define ni_flags icmp6_ni_hdr.icmp6_data16[1]
313
314
315#define NI_QTYPE_NOOP 0 /* NOOP */
316#define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */
317#define NI_QTYPE_FQDN 2 /* FQDN */
318#define NI_QTYPE_NODEADDR 3 /* Node Addresses. XXX: spec says 2, but it may be a typo... */
319
320#if BYTE_ORDER == BIG_ENDIAN
321#define NI_SUPTYPE_FLAG_COMPRESS 0x1
322#define NI_FQDN_FLAG_VALIDTTL 0x1
323#elif BYTE_ORDER == LITTLE_ENDIAN
324#define NI_SUPTYPE_FLAG_COMPRESS 0x0100
325#define NI_FQDN_FLAG_VALIDTTL 0x0100
326#endif
327
328#if BYTE_ORDER == BIG_ENDIAN
329#define NI_NODEADDR_FLAG_TRUNCATE 0x1
330#define NI_NODEADDR_FLAG_ALL 0x2
331#define NI_NODEADDR_FLAG_COMPAT 0x4
332#define NI_NODEADDR_FLAG_LINKLOCAL 0x8
333#define NI_NODEADDR_FLAG_SITELOCAL 0x10
334#define NI_NODEADDR_FLAG_GLOBAL 0x20
335#define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */
336#elif BYTE_ORDER == LITTLE_ENDIAN
337#define NI_NODEADDR_FLAG_TRUNCATE 0x0100
338#define NI_NODEADDR_FLAG_ALL 0x0200
339#define NI_NODEADDR_FLAG_COMPAT 0x0400
340#define NI_NODEADDR_FLAG_LINKLOCAL 0x0800
341#define NI_NODEADDR_FLAG_SITELOCAL 0x1000
342#define NI_NODEADDR_FLAG_GLOBAL 0x2000
343#define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */
344#endif
345
346struct ni_reply_fqdn {
347 u_int32_t ni_fqdn_ttl; /* TTL */
348 u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
349 u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
350};
351
352/*
353 * Router Renumbering. as router-renum-08.txt
354 */
355struct icmp6_router_renum { /* router renumbering header */
356 struct icmp6_hdr rr_hdr;
357 u_int8_t rr_segnum;
358 u_int8_t rr_flags;
359 u_int16_t rr_maxdelay;
360 u_int32_t rr_reserved;
361};
362#define ICMP6_RR_FLAGS_SEGNUM 0x80
363#define ICMP6_RR_FLAGS_TEST 0x40
364#define ICMP6_RR_FLAGS_REQRESULT 0x20
365#define ICMP6_RR_FLAGS_FORCEAPPLY 0x10
366#define ICMP6_RR_FLAGS_SPECSITE 0x08
367#define ICMP6_RR_FLAGS_PREVDONE 0x04
368
369#define rr_type rr_hdr.icmp6_type
370#define rr_code rr_hdr.icmp6_code
371#define rr_cksum rr_hdr.icmp6_cksum
372#define rr_seqnum rr_hdr.icmp6_data32[0]
373
374struct rr_pco_match { /* match prefix part */
375 u_int8_t rpm_code;
376 u_int8_t rpm_len;
377 u_int8_t rpm_ordinal;
378 u_int8_t rpm_matchlen;
379 u_int8_t rpm_minlen;
380 u_int8_t rpm_maxlen;
381 u_int16_t rpm_reserved;
382 struct in6_addr rpm_prefix;
383};
384
385#define RPM_PCO_ADD 1
386#define RPM_PCO_CHANGE 2
387#define RPM_PCO_SETGLOBAL 3
388
389struct rr_pco_use { /* use prefix part */
390 u_int8_t rpu_uselen;
391 u_int8_t rpu_keeplen;
392 u_int8_t rpu_ramask;
393 u_int8_t rpu_raflags;
394 u_int32_t rpu_vltime;
395 u_int32_t rpu_pltime;
396 u_int32_t rpu_flags;
397 struct in6_addr rpu_prefix;
398};
399#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80
400#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40
401
402#if BYTE_ORDER == BIG_ENDIAN
403#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
404#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
405#elif BYTE_ORDER == LITTLE_ENDIAN
406#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
407#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
408#endif
409
410struct rr_result { /* router renumbering result message */
411 u_int16_t rrr_flags;
412 u_int8_t rrr_ordinal;
413 u_int8_t rrr_matchedlen;
414 u_int32_t rrr_ifid;
415 struct in6_addr rrr_prefix;
416};
417#if BYTE_ORDER == BIG_ENDIAN
418#define ICMP6_RR_RESULT_FLAGS_OOB 0x0002
419#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
420#elif BYTE_ORDER == LITTLE_ENDIAN
421#define ICMP6_RR_RESULT_FLAGS_OOB 0x02
422#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x01
423#endif
424
425/*
426 * icmp6 filter structures.
427 */
428
429struct icmp6_filter {
430 u_int32_t icmp6_filter[8];
431};
432
433#ifdef _KERNEL
434#define ICMP6_FILTER_SETPASSALL(filterp) \
435 { \
436 int i; u_char *p; \
437 p = (u_char *)filterp; \
438 for (i = 0; i < sizeof(struct icmp6_filter); i++) \
439 p[i] = 0xff; \
440 }
441#define ICMP6_FILTER_SETBLOCKALL(filterp) \
442 bzero(filterp, sizeof(struct icmp6_filter))
443#else /* _KERNEL */
444#define ICMP6_FILTER_SETPASSALL(filterp) \
445 memset(filterp, 0xff, sizeof(struct icmp6_filter))
446#define ICMP6_FILTER_SETBLOCKALL(filterp) \
447 memset(filterp, 0x00, sizeof(struct icmp6_filter))
448#endif /* _KERNEL */
449
450#define ICMP6_FILTER_SETPASS(type, filterp) \
451 (((filterp)->icmp6_filter[(type) >> 5]) |= (1 << ((type) & 31)))
452#define ICMP6_FILTER_SETBLOCK(type, filterp) \
453 (((filterp)->icmp6_filter[(type) >> 5]) &= ~(1 << ((type) & 31)))
454#define ICMP6_FILTER_WILLPASS(type, filterp) \
455 ((((filterp)->icmp6_filter[(type) >> 5]) & (1 << ((type) & 31))) != 0)
456#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
457 ((((filterp)->icmp6_filter[(type) >> 5]) & (1 << ((type) & 31))) == 0)
458
459/*
460 * Variables related to this implementation
461 * of the internet control message protocol version 6.
462 */
463struct icmp6stat {
464/* statistics related to icmp6 packets generated */
465 u_long icp6s_error; /* # of calls to icmp6_error */
466 u_long icp6s_canterror; /* no error 'cuz old was icmp */
467 u_long icp6s_toofreq; /* no error 'cuz rate limitation */
468 u_long icp6s_outhist[256];
469/* statistics related to input messages proccesed */
470 u_long icp6s_badcode; /* icmp6_code out of range */
471 u_long icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */
472 u_long icp6s_checksum; /* bad checksum */
473 u_long icp6s_badlen; /* calculated bound mismatch */
474 u_long icp6s_reflect; /* number of responses */
475 u_long icp6s_inhist[256];
476};
477
478/*
479 * Names for ICMP sysctl objects
480 */
481#define ICMPV6CTL_STATS 1
482#define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */
483#define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */
484#define ICMPV6CTL_ERRRATELIMIT 5 /* ICMPv6 error rate limitation */
485#define ICMPV6CTL_ND6_PRUNE 6
486#define ICMPV6CTL_ND6_DELAY 8
487#define ICMPV6CTL_ND6_UMAXTRIES 9
488#define ICMPV6CTL_ND6_MMAXTRIES 10
489#define ICMPV6CTL_ND6_USELOOPBACK 11
490#define ICMPV6CTL_ND6_PROXYALL 12
491#define ICMPV6CTL_MAXID 13
492
493#define ICMPV6CTL_NAMES { \
494 { 0, 0 }, \
495 { 0, 0 }, \
496 { "rediraccept", CTLTYPE_INT }, \
497 { "redirtimeout", CTLTYPE_INT }, \
498 { 0, 0 }, \
499 { "errratelimit", CTLTYPE_INT }, \
500 { "nd6_prune", CTLTYPE_INT }, \
501 { 0, 0 }, \
502 { "nd6_delay", CTLTYPE_INT }, \
503 { "nd6_umaxtries", CTLTYPE_INT }, \
504 { "nd6_mmaxtries", CTLTYPE_INT }, \
505 { "nd6_useloopback", CTLTYPE_INT }, \
506 { "nd6_proxyall", CTLTYPE_INT }, \
507}
508
509#define ICMPV6CTL_VARS { \
510 0, \
511 0, \
512 &icmp6_rediraccept, \
513 &icmp6_redirtimeout, \
514 0, \
515 0, \
516 &icmp6errratelim, \
517 &nd6_prune, \
518 0, \
519 &nd6_delay, \
520 &nd6_umaxtries, \
521 &nd6_mmaxtries, \
522 &nd6_useloopback, \
523 &nd6_proxyall, \
524}
525
526#define RTF_PROBEMTU RTF_PROTO1
527
528#ifdef _KERNEL
529#ifdef SYSCTL_DECL
530SYSCTL_DECL(_net_inet6_icmp6);
531#endif
532# ifdef __STDC__
533struct rtentry;
534struct rttimer;
535struct in6_multi;
536# endif
537void icmp6_init __P((void));
538void icmp6_paramerror __P((struct mbuf *, int));
539void icmp6_error __P((struct mbuf *, int, int, int));
540int icmp6_input __P((struct mbuf **, int *, int));
541void icmp6_fasttimo __P((void));
542void icmp6_reflect __P((struct mbuf *, size_t));
543void icmp6_prepare __P((struct mbuf *));
544void icmp6_redirect_input __P((struct mbuf *, int));
545void icmp6_redirect_output __P((struct mbuf *, struct rtentry *));
546
547/* XXX: is this the right place for these macros? */
548#define icmp6_ifstat_inc(ifp, tag) \
549do { \
550 if ((ifp) && (ifp)->if_index <= if_index \
551 && (ifp)->if_index < icmp6_ifstatmax \
552 && icmp6_ifstat && icmp6_ifstat[(ifp)->if_index]) { \
553 icmp6_ifstat[(ifp)->if_index]->tag++; \
554 } \
555} while (0)
556
557#define icmp6_ifoutstat_inc(ifp, type, code) \
558do { \
559 icmp6_ifstat_inc(ifp, ifs6_out_msg); \
560 if (type < ICMP6_INFOMSG_MASK) \
561 icmp6_ifstat_inc(ifp, ifs6_out_error); \
562 switch(type) { \
563 case ICMP6_DST_UNREACH: \
564 icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
565 if (code == ICMP6_DST_UNREACH_ADMIN) \
566 icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
567 break; \
568 case ICMP6_PACKET_TOO_BIG: \
569 icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
570 break; \
571 case ICMP6_TIME_EXCEEDED: \
572 icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
573 break; \
574 case ICMP6_PARAM_PROB: \
575 icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
576 break; \
577 case ICMP6_ECHO_REQUEST: \
578 icmp6_ifstat_inc(ifp, ifs6_out_echo); \
579 break; \
580 case ICMP6_ECHO_REPLY: \
581 icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
582 break; \
583 case MLD6_LISTENER_QUERY: \
584 icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
585 break; \
586 case MLD6_LISTENER_REPORT: \
587 icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
588 break; \
589 case MLD6_LISTENER_DONE: \
590 icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
591 break; \
592 case ND_ROUTER_SOLICIT: \
593 icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
594 break; \
595 case ND_ROUTER_ADVERT: \
596 icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
597 break; \
598 case ND_NEIGHBOR_SOLICIT: \
599 icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
600 break; \
601 case ND_NEIGHBOR_ADVERT: \
602 icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
603 break; \
604 case ND_REDIRECT: \
605 icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
606 break; \
607 } \
608} while (0)
609
610extern int icmp6_rediraccept; /* accept/process redirects */
611extern int icmp6_redirtimeout; /* cache time for redirect routes */
612#endif /* _KERNEL */
613
614#endif /* not _NETINET6_ICMPV6_H_ */
615
4#error "netinet6/icmp6.h is obsolete. use netinet/icmp6.h"