162587Sitojun/*	$FreeBSD: stable/11/sys/netinet/icmp6.h 327716 2018-01-09 06:07:51Z cy $	*/
278064Sume/*	$KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $	*/
362587Sitojun
4139823Simp/*-
553541Sshin * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
653541Sshin * All rights reserved.
753541Sshin *
853541Sshin * Redistribution and use in source and binary forms, with or without
953541Sshin * modification, are permitted provided that the following conditions
1053541Sshin * are met:
1153541Sshin * 1. Redistributions of source code must retain the above copyright
1253541Sshin *    notice, this list of conditions and the following disclaimer.
1353541Sshin * 2. Redistributions in binary form must reproduce the above copyright
1453541Sshin *    notice, this list of conditions and the following disclaimer in the
1553541Sshin *    documentation and/or other materials provided with the distribution.
1653541Sshin * 3. Neither the name of the project nor the names of its contributors
1753541Sshin *    may be used to endorse or promote products derived from this software
1853541Sshin *    without specific prior written permission.
1953541Sshin *
2053541Sshin * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2153541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2253541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2353541Sshin * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2453541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2553541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2653541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2753541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2853541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2953541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3053541Sshin * SUCH DAMAGE.
3162587Sitojun */
3262587Sitojun
33139823Simp/*-
3462587Sitojun * Copyright (c) 1982, 1986, 1993
3562587Sitojun *	The Regents of the University of California.  All rights reserved.
3653541Sshin *
3762587Sitojun * Redistribution and use in source and binary forms, with or without
3862587Sitojun * modification, are permitted provided that the following conditions
3962587Sitojun * are met:
4062587Sitojun * 1. Redistributions of source code must retain the above copyright
4162587Sitojun *    notice, this list of conditions and the following disclaimer.
4262587Sitojun * 2. Redistributions in binary form must reproduce the above copyright
4362587Sitojun *    notice, this list of conditions and the following disclaimer in the
4462587Sitojun *    documentation and/or other materials provided with the distribution.
4562587Sitojun * 4. Neither the name of the University nor the names of its contributors
4662587Sitojun *    may be used to endorse or promote products derived from this software
4762587Sitojun *    without specific prior written permission.
4862587Sitojun *
4962587Sitojun * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
5062587Sitojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5162587Sitojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5262587Sitojun * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
5362587Sitojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5462587Sitojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5562587Sitojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5662587Sitojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5762587Sitojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5862587Sitojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5962587Sitojun * SUCH DAMAGE.
6062587Sitojun *
6162587Sitojun *	@(#)ip_icmp.h	8.1 (Berkeley) 6/10/93
6253541Sshin */
6353541Sshin
6453541Sshin#ifndef _NETINET_ICMP6_H_
6562587Sitojun#define _NETINET_ICMP6_H_
6653541Sshin
6762587Sitojun#define ICMPV6_PLD_MAXLEN	1232	/* IPV6_MMTU - sizeof(struct ip6_hdr)
6862587Sitojun					   - sizeof(struct icmp6_hdr) */
6953541Sshin
7062587Sitojunstruct icmp6_hdr {
7162587Sitojun	u_int8_t	icmp6_type;	/* type field */
7262587Sitojun	u_int8_t	icmp6_code;	/* code field */
7362587Sitojun	u_int16_t	icmp6_cksum;	/* checksum field */
7462587Sitojun	union {
7562587Sitojun		u_int32_t	icmp6_un_data32[1]; /* type-specific field */
7662587Sitojun		u_int16_t	icmp6_un_data16[2]; /* type-specific field */
7762587Sitojun		u_int8_t	icmp6_un_data8[4];  /* type-specific field */
7862587Sitojun	} icmp6_dataun;
79121499Sume} __packed;
8062587Sitojun
8162587Sitojun#define icmp6_data32	icmp6_dataun.icmp6_un_data32
8262587Sitojun#define icmp6_data16	icmp6_dataun.icmp6_un_data16
8362587Sitojun#define icmp6_data8	icmp6_dataun.icmp6_un_data8
8462587Sitojun#define icmp6_pptr	icmp6_data32[0]		/* parameter prob */
8562587Sitojun#define icmp6_mtu	icmp6_data32[0]		/* packet too big */
8662587Sitojun#define icmp6_id	icmp6_data16[0]		/* echo request/reply */
8762587Sitojun#define icmp6_seq	icmp6_data16[1]		/* echo request/reply */
8862587Sitojun#define icmp6_maxdelay	icmp6_data16[0]		/* mcast group membership */
8962587Sitojun
9062587Sitojun#define ICMP6_DST_UNREACH		1	/* dest unreachable, codes: */
9162587Sitojun#define ICMP6_PACKET_TOO_BIG		2	/* packet too big */
9262587Sitojun#define ICMP6_TIME_EXCEEDED		3	/* time exceeded, code: */
9362587Sitojun#define ICMP6_PARAM_PROB		4	/* ip6 header bad */
9462587Sitojun
9562587Sitojun#define ICMP6_ECHO_REQUEST		128	/* echo service */
9662587Sitojun#define ICMP6_ECHO_REPLY		129	/* echo reply */
9796116Sume#define MLD_LISTENER_QUERY		130 	/* multicast listener query */
9896116Sume#define MLD_LISTENER_REPORT		131	/* multicast listener report */
9996116Sume#define MLD_LISTENER_DONE		132	/* multicast listener done */
100148171Sume#define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */
10162587Sitojun
102121472Sume/* RFC2292 decls */
103121472Sume#define ICMP6_MEMBERSHIP_QUERY		130	/* group membership query */
104121472Sume#define ICMP6_MEMBERSHIP_REPORT		131	/* group membership report */
105121472Sume#define ICMP6_MEMBERSHIP_REDUCTION	132	/* group membership termination */
106121472Sume
10796116Sume#ifndef _KERNEL
10896116Sume/* the followings are for backward compatibility to old KAME apps. */
10996116Sume#define MLD6_LISTENER_QUERY	MLD_LISTENER_QUERY
11096116Sume#define MLD6_LISTENER_REPORT	MLD_LISTENER_REPORT
11196116Sume#define MLD6_LISTENER_DONE	MLD_LISTENER_DONE
11296116Sume#endif
11396116Sume
11462587Sitojun#define ND_ROUTER_SOLICIT		133	/* router solicitation */
115148169Sume#define ND_ROUTER_ADVERT		134	/* router advertisement */
11662587Sitojun#define ND_NEIGHBOR_SOLICIT		135	/* neighbor solicitation */
117148169Sume#define ND_NEIGHBOR_ADVERT		136	/* neighbor advertisement */
11862587Sitojun#define ND_REDIRECT			137	/* redirect */
11962587Sitojun
12062587Sitojun#define ICMP6_ROUTER_RENUMBERING	138	/* router renumbering */
12162587Sitojun
12262587Sitojun#define ICMP6_WRUREQUEST		139	/* who are you request */
12362587Sitojun#define ICMP6_WRUREPLY			140	/* who are you reply */
12462587Sitojun#define ICMP6_FQDN_QUERY		139	/* FQDN query */
12562587Sitojun#define ICMP6_FQDN_REPLY		140	/* FQDN reply */
12662587Sitojun#define ICMP6_NI_QUERY			139	/* node information request */
12762587Sitojun#define ICMP6_NI_REPLY			140	/* node information reply */
128191661Sbms#define MLDV2_LISTENER_REPORT		143	/* RFC3810 listener report */
12962587Sitojun
13062587Sitojun/* The definitions below are experimental. TBA */
13196116Sume#define MLD_MTRACE_RESP			200	/* mtrace resp (to sender) */
13296116Sume#define MLD_MTRACE			201	/* mtrace messages */
13362587Sitojun
13496116Sume#ifndef _KERNEL
13596116Sume#define MLD6_MTRACE_RESP	MLD_MTRACE_RESP
13696116Sume#define MLD6_MTRACE		MLD_MTRACE
13796116Sume#endif
13896116Sume
139121472Sume#define ICMP6_MAXTYPE			201
14062587Sitojun
14162587Sitojun#define ICMP6_DST_UNREACH_NOROUTE	0	/* no route to destination */
14262587Sitojun#define ICMP6_DST_UNREACH_ADMIN	 	1	/* administratively prohibited */
14362587Sitojun#define ICMP6_DST_UNREACH_NOTNEIGHBOR	2	/* not a neighbor(obsolete) */
14462587Sitojun#define ICMP6_DST_UNREACH_BEYONDSCOPE	2	/* beyond scope of source address */
14562587Sitojun#define ICMP6_DST_UNREACH_ADDR		3	/* address unreachable */
14662587Sitojun#define ICMP6_DST_UNREACH_NOPORT	4	/* port unreachable */
147301478Sgnn#define ICMP6_DST_UNREACH_POLICY	5	/* failed ingress/egress policy */
148301478Sgnn#define ICMP6_DST_UNREACH_REJECT	6	/* Reject route to destination */
149301478Sgnn#define ICMP6_DST_UNREACH_SRCROUTE	7	/* Error in source routing header */
15062587Sitojun
15162587Sitojun#define ICMP6_TIME_EXCEED_TRANSIT 	0	/* ttl==0 in transit */
15262587Sitojun#define ICMP6_TIME_EXCEED_REASSEMBLY	1	/* ttl==0 in reass */
15362587Sitojun
15462587Sitojun#define ICMP6_PARAMPROB_HEADER 	 	0	/* erroneous header field */
15562587Sitojun#define ICMP6_PARAMPROB_NEXTHEADER	1	/* unrecognized next header */
15662587Sitojun#define ICMP6_PARAMPROB_OPTION		2	/* unrecognized option */
15762587Sitojun
15862587Sitojun#define ICMP6_INFOMSG_MASK		0x80	/* all informational messages */
15962587Sitojun
16062587Sitojun#define ICMP6_NI_SUBJ_IPV6	0	/* Query Subject is an IPv6 address */
16162587Sitojun#define ICMP6_NI_SUBJ_FQDN	1	/* Query Subject is a Domain name */
16262587Sitojun#define ICMP6_NI_SUBJ_IPV4	2	/* Query Subject is an IPv4 address */
16362587Sitojun
16478064Sume#define ICMP6_NI_SUCCESS	0	/* node information successful reply */
16562587Sitojun#define ICMP6_NI_REFUSED	1	/* node information request is refused */
16662587Sitojun#define ICMP6_NI_UNKNOWN	2	/* unknown Qtype */
16762587Sitojun
16862587Sitojun#define ICMP6_ROUTER_RENUMBERING_COMMAND  0	/* rr command */
16962587Sitojun#define ICMP6_ROUTER_RENUMBERING_RESULT   1	/* rr result */
17062587Sitojun#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255	/* rr seq num reset */
17162587Sitojun
17262587Sitojun/* Used in kernel only */
17362587Sitojun#define ND_REDIRECT_ONLINK	0	/* redirect to an on-link node */
17462587Sitojun#define ND_REDIRECT_ROUTER	1	/* redirect to a better router */
17562587Sitojun
17662587Sitojun/*
17762587Sitojun * Multicast Listener Discovery
17862587Sitojun */
17996116Sumestruct mld_hdr {
18096116Sume	struct icmp6_hdr	mld_icmp6_hdr;
18196116Sume	struct in6_addr		mld_addr; /* multicast address */
182121499Sume} __packed;
18362587Sitojun
18496116Sume/* definitions to provide backward compatibility to old KAME applications */
18596116Sume#ifndef _KERNEL
18696116Sume#define mld6_hdr	mld_hdr
18796116Sume#define mld6_type	mld_type
18896116Sume#define mld6_code	mld_code
18996116Sume#define mld6_cksum	mld_cksum
19096116Sume#define mld6_maxdelay	mld_maxdelay
19196116Sume#define mld6_reserved	mld_reserved
19296116Sume#define mld6_addr	mld_addr
19396116Sume#endif
19462587Sitojun
19596116Sume/* shortcut macro definitions */
19696116Sume#define mld_type	mld_icmp6_hdr.icmp6_type
19796116Sume#define mld_code	mld_icmp6_hdr.icmp6_code
19896116Sume#define mld_cksum	mld_icmp6_hdr.icmp6_cksum
19996116Sume#define mld_maxdelay	mld_icmp6_hdr.icmp6_data16[0]
20096116Sume#define mld_reserved	mld_icmp6_hdr.icmp6_data16[1]
201191661Sbms#define mld_v2_reserved	mld_icmp6_hdr.icmp6_data16[0]
202191661Sbms#define mld_v2_numrecs	mld_icmp6_hdr.icmp6_data16[1]
20396116Sume
20462587Sitojun/*
20562587Sitojun * Neighbor Discovery
20662587Sitojun */
20762587Sitojun
20862587Sitojunstruct nd_router_solicit {	/* router solicitation */
20962587Sitojun	struct icmp6_hdr 	nd_rs_hdr;
21062587Sitojun	/* could be followed by options */
211121499Sume} __packed;
21262587Sitojun
21362587Sitojun#define nd_rs_type	nd_rs_hdr.icmp6_type
21462587Sitojun#define nd_rs_code	nd_rs_hdr.icmp6_code
21562587Sitojun#define nd_rs_cksum	nd_rs_hdr.icmp6_cksum
21662587Sitojun#define nd_rs_reserved	nd_rs_hdr.icmp6_data32[0]
21762587Sitojun
21862587Sitojunstruct nd_router_advert {	/* router advertisement */
21962587Sitojun	struct icmp6_hdr	nd_ra_hdr;
22062587Sitojun	u_int32_t		nd_ra_reachable;	/* reachable time */
22162587Sitojun	u_int32_t		nd_ra_retransmit;	/* retransmit timer */
22262587Sitojun	/* could be followed by options */
223121499Sume} __packed;
22462587Sitojun
22562587Sitojun#define nd_ra_type		nd_ra_hdr.icmp6_type
22662587Sitojun#define nd_ra_code		nd_ra_hdr.icmp6_code
22762587Sitojun#define nd_ra_cksum		nd_ra_hdr.icmp6_cksum
22862587Sitojun#define nd_ra_curhoplimit	nd_ra_hdr.icmp6_data8[0]
22962587Sitojun#define nd_ra_flags_reserved	nd_ra_hdr.icmp6_data8[1]
23062587Sitojun#define ND_RA_FLAG_MANAGED	0x80
23162587Sitojun#define ND_RA_FLAG_OTHER	0x40
23278064Sume#define ND_RA_FLAG_HA		0x20
23378064Sume
23478064Sume/*
23578064Sume * Router preference values based on draft-draves-ipngwg-router-selection-01.
23678064Sume * These are non-standard definitions.
23778064Sume */
23878064Sume#define ND_RA_FLAG_RTPREF_MASK	0x18 /* 00011000 */
23978064Sume
24078064Sume#define ND_RA_FLAG_RTPREF_HIGH	0x08 /* 00001000 */
24178064Sume#define ND_RA_FLAG_RTPREF_MEDIUM	0x00 /* 00000000 */
24278064Sume#define ND_RA_FLAG_RTPREF_LOW	0x18 /* 00011000 */
24378064Sume#define ND_RA_FLAG_RTPREF_RSV	0x10 /* 00010000 */
24478064Sume
24562587Sitojun#define nd_ra_router_lifetime	nd_ra_hdr.icmp6_data16[1]
24662587Sitojun
24762587Sitojunstruct nd_neighbor_solicit {	/* neighbor solicitation */
24862587Sitojun	struct icmp6_hdr	nd_ns_hdr;
24962587Sitojun	struct in6_addr		nd_ns_target;	/*target address */
25062587Sitojun	/* could be followed by options */
251121499Sume} __packed;
25262587Sitojun
25362587Sitojun#define nd_ns_type		nd_ns_hdr.icmp6_type
25462587Sitojun#define nd_ns_code		nd_ns_hdr.icmp6_code
25562587Sitojun#define nd_ns_cksum		nd_ns_hdr.icmp6_cksum
25662587Sitojun#define nd_ns_reserved		nd_ns_hdr.icmp6_data32[0]
25762587Sitojun
25862587Sitojunstruct nd_neighbor_advert {	/* neighbor advertisement */
25962587Sitojun	struct icmp6_hdr	nd_na_hdr;
26062587Sitojun	struct in6_addr		nd_na_target;	/* target address */
26162587Sitojun	/* could be followed by options */
262121499Sume} __packed;
26362587Sitojun
26462587Sitojun#define nd_na_type		nd_na_hdr.icmp6_type
26562587Sitojun#define nd_na_code		nd_na_hdr.icmp6_code
26662587Sitojun#define nd_na_cksum		nd_na_hdr.icmp6_cksum
26762587Sitojun#define nd_na_flags_reserved	nd_na_hdr.icmp6_data32[0]
26862587Sitojun#if BYTE_ORDER == BIG_ENDIAN
26962587Sitojun#define ND_NA_FLAG_ROUTER		0x80000000
27062587Sitojun#define ND_NA_FLAG_SOLICITED		0x40000000
27162587Sitojun#define ND_NA_FLAG_OVERRIDE		0x20000000
27262587Sitojun#else
27362587Sitojun#if BYTE_ORDER == LITTLE_ENDIAN
27462587Sitojun#define ND_NA_FLAG_ROUTER		0x80
27562587Sitojun#define ND_NA_FLAG_SOLICITED		0x40
27662587Sitojun#define ND_NA_FLAG_OVERRIDE		0x20
27762587Sitojun#endif
27862587Sitojun#endif
27962587Sitojun
28062587Sitojunstruct nd_redirect {		/* redirect */
28162587Sitojun	struct icmp6_hdr	nd_rd_hdr;
28262587Sitojun	struct in6_addr		nd_rd_target;	/* target address */
28362587Sitojun	struct in6_addr		nd_rd_dst;	/* destination address */
28462587Sitojun	/* could be followed by options */
285121499Sume} __packed;
28662587Sitojun
28762587Sitojun#define nd_rd_type		nd_rd_hdr.icmp6_type
28862587Sitojun#define nd_rd_code		nd_rd_hdr.icmp6_code
28962587Sitojun#define nd_rd_cksum		nd_rd_hdr.icmp6_cksum
29062587Sitojun#define nd_rd_reserved		nd_rd_hdr.icmp6_data32[0]
29162587Sitojun
29262587Sitojunstruct nd_opt_hdr {		/* Neighbor discovery option header */
29362587Sitojun	u_int8_t	nd_opt_type;
29462587Sitojun	u_int8_t	nd_opt_len;
29562587Sitojun	/* followed by option specific data*/
296121499Sume} __packed;
29762587Sitojun
29862587Sitojun#define ND_OPT_SOURCE_LINKADDR		1
29962587Sitojun#define ND_OPT_TARGET_LINKADDR		2
30062587Sitojun#define ND_OPT_PREFIX_INFORMATION	3
30162587Sitojun#define ND_OPT_REDIRECTED_HEADER	4
30262587Sitojun#define ND_OPT_MTU			5
303279531Shrs#define ND_OPT_NONCE			14	/* RFC 3971 */
304222732Shrs#define ND_OPT_ROUTE_INFO		24	/* RFC 4191 */
305232513Sbz#define ND_OPT_RDNSS			25	/* RFC 6106 */
306232513Sbz#define ND_OPT_DNSSL			31	/* RFC 6106 */
307279531Shrs#define ND_OPT_MAX			31
30862587Sitojun
30962587Sitojunstruct nd_opt_prefix_info {	/* prefix information */
31062587Sitojun	u_int8_t	nd_opt_pi_type;
31162587Sitojun	u_int8_t	nd_opt_pi_len;
31262587Sitojun	u_int8_t	nd_opt_pi_prefix_len;
31362587Sitojun	u_int8_t	nd_opt_pi_flags_reserved;
31462587Sitojun	u_int32_t	nd_opt_pi_valid_time;
31562587Sitojun	u_int32_t	nd_opt_pi_preferred_time;
31662587Sitojun	u_int32_t	nd_opt_pi_reserved2;
31762587Sitojun	struct in6_addr	nd_opt_pi_prefix;
318121499Sume} __packed;
31962587Sitojun
32062587Sitojun#define ND_OPT_PI_FLAG_ONLINK		0x80
32162587Sitojun#define ND_OPT_PI_FLAG_AUTO		0x40
32262587Sitojun
32362587Sitojunstruct nd_opt_rd_hdr {		/* redirected header */
32462587Sitojun	u_int8_t	nd_opt_rh_type;
32562587Sitojun	u_int8_t	nd_opt_rh_len;
32662587Sitojun	u_int16_t	nd_opt_rh_reserved1;
32762587Sitojun	u_int32_t	nd_opt_rh_reserved2;
32862587Sitojun	/* followed by IP header and data */
329121499Sume} __packed;
33062587Sitojun
33162587Sitojunstruct nd_opt_mtu {		/* MTU option */
33262587Sitojun	u_int8_t	nd_opt_mtu_type;
33362587Sitojun	u_int8_t	nd_opt_mtu_len;
33462587Sitojun	u_int16_t	nd_opt_mtu_reserved;
33562587Sitojun	u_int32_t	nd_opt_mtu_mtu;
336121499Sume} __packed;
33762587Sitojun
338279531Shrs#define	ND_OPT_NONCE_LEN	((1 * 8) - 2)
339279531Shrs#if ((ND_OPT_NONCE_LEN + 2) % 8) != 0
340279531Shrs#error "(ND_OPT_NONCE_LEN + 2) must be a multiple of 8."
341279531Shrs#endif
342279531Shrsstruct nd_opt_nonce {		/* nonce option */
343279531Shrs	u_int8_t	nd_opt_nonce_type;
344279531Shrs	u_int8_t	nd_opt_nonce_len;
345279531Shrs	u_int8_t	nd_opt_nonce[ND_OPT_NONCE_LEN];
346279531Shrs} __packed;
347279531Shrs
34878064Sumestruct nd_opt_route_info {	/* route info */
34978064Sume	u_int8_t	nd_opt_rti_type;
35078064Sume	u_int8_t	nd_opt_rti_len;
35178064Sume	u_int8_t	nd_opt_rti_prefixlen;
35278064Sume	u_int8_t	nd_opt_rti_flags;
35378064Sume	u_int32_t	nd_opt_rti_lifetime;
35495023Ssuz	/* prefix follows */
355121499Sume} __packed;
35678539Ssumikawa
357222732Shrsstruct nd_opt_rdnss {		/* RDNSS option (RFC 6106) */
358222732Shrs	u_int8_t	nd_opt_rdnss_type;
359222732Shrs	u_int8_t	nd_opt_rdnss_len;
360222732Shrs	u_int16_t	nd_opt_rdnss_reserved;
361222732Shrs	u_int32_t	nd_opt_rdnss_lifetime;
362222732Shrs	/* followed by list of recursive DNS servers */
363222732Shrs} __packed;
364222732Shrs
365222732Shrsstruct nd_opt_dnssl {		/* DNSSL option (RFC 6106) */
366222732Shrs	u_int8_t	nd_opt_dnssl_type;
367222732Shrs	u_int8_t	nd_opt_dnssl_len;
368222732Shrs	u_int16_t	nd_opt_dnssl_reserved;
369222732Shrs	u_int32_t	nd_opt_dnssl_lifetime;
370222732Shrs	/* followed by list of DNS search domains */
371222732Shrs} __packed;
372222732Shrs
37362587Sitojun/*
37462587Sitojun * icmp6 namelookup
37562587Sitojun */
37662587Sitojun
37762587Sitojunstruct icmp6_namelookup {
37862587Sitojun	struct icmp6_hdr 	icmp6_nl_hdr;
37962587Sitojun	u_int8_t	icmp6_nl_nonce[8];
38062587Sitojun	int32_t		icmp6_nl_ttl;
38162587Sitojun#if 0
38262587Sitojun	u_int8_t	icmp6_nl_len;
38362587Sitojun	u_int8_t	icmp6_nl_name[3];
38462587Sitojun#endif
38562587Sitojun	/* could be followed by options */
386121499Sume} __packed;
38762587Sitojun
38862587Sitojun/*
38962587Sitojun * icmp6 node information
39062587Sitojun */
39162587Sitojunstruct icmp6_nodeinfo {
39262587Sitojun	struct icmp6_hdr icmp6_ni_hdr;
39362587Sitojun	u_int8_t icmp6_ni_nonce[8];
39462587Sitojun	/* could be followed by reply data */
395121499Sume} __packed;
39662587Sitojun
39762587Sitojun#define ni_type		icmp6_ni_hdr.icmp6_type
39862587Sitojun#define ni_code		icmp6_ni_hdr.icmp6_code
39962587Sitojun#define ni_cksum	icmp6_ni_hdr.icmp6_cksum
40062587Sitojun#define ni_qtype	icmp6_ni_hdr.icmp6_data16[0]
40162587Sitojun#define ni_flags	icmp6_ni_hdr.icmp6_data16[1]
40262587Sitojun
40362587Sitojun#define NI_QTYPE_NOOP		0 /* NOOP  */
40462587Sitojun#define NI_QTYPE_SUPTYPES	1 /* Supported Qtypes */
40578064Sume#define NI_QTYPE_FQDN		2 /* FQDN (draft 04) */
40678064Sume#define NI_QTYPE_DNSNAME	2 /* DNS Name */
40778064Sume#define NI_QTYPE_NODEADDR	3 /* Node Addresses */
40878064Sume#define NI_QTYPE_IPV4ADDR	4 /* IPv4 Addresses */
40962587Sitojun
41062587Sitojun#if BYTE_ORDER == BIG_ENDIAN
41162587Sitojun#define NI_SUPTYPE_FLAG_COMPRESS	0x1
41262587Sitojun#define NI_FQDN_FLAG_VALIDTTL		0x1
41362587Sitojun#elif BYTE_ORDER == LITTLE_ENDIAN
41462587Sitojun#define NI_SUPTYPE_FLAG_COMPRESS	0x0100
41562587Sitojun#define NI_FQDN_FLAG_VALIDTTL		0x0100
41662587Sitojun#endif
41762587Sitojun
41862587Sitojun#ifdef NAME_LOOKUPS_04
41962587Sitojun#if BYTE_ORDER == BIG_ENDIAN
42062587Sitojun#define NI_NODEADDR_FLAG_LINKLOCAL	0x1
42162587Sitojun#define NI_NODEADDR_FLAG_SITELOCAL	0x2
42262587Sitojun#define NI_NODEADDR_FLAG_GLOBAL		0x4
42362587Sitojun#define NI_NODEADDR_FLAG_ALL		0x8
42462587Sitojun#define NI_NODEADDR_FLAG_TRUNCATE	0x10
42562587Sitojun#define NI_NODEADDR_FLAG_ANYCAST	0x20 /* just experimental. not in spec */
42662587Sitojun#elif BYTE_ORDER == LITTLE_ENDIAN
42762587Sitojun#define NI_NODEADDR_FLAG_LINKLOCAL	0x0100
42862587Sitojun#define NI_NODEADDR_FLAG_SITELOCAL	0x0200
42962587Sitojun#define NI_NODEADDR_FLAG_GLOBAL		0x0400
43062587Sitojun#define NI_NODEADDR_FLAG_ALL		0x0800
43162587Sitojun#define NI_NODEADDR_FLAG_TRUNCATE	0x1000
43262587Sitojun#define NI_NODEADDR_FLAG_ANYCAST	0x2000 /* just experimental. not in spec */
43362587Sitojun#endif
43462587Sitojun#else  /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
43562587Sitojun#if BYTE_ORDER == BIG_ENDIAN
43662587Sitojun#define NI_NODEADDR_FLAG_TRUNCATE	0x1
43762587Sitojun#define NI_NODEADDR_FLAG_ALL		0x2
43862587Sitojun#define NI_NODEADDR_FLAG_COMPAT		0x4
43962587Sitojun#define NI_NODEADDR_FLAG_LINKLOCAL	0x8
44062587Sitojun#define NI_NODEADDR_FLAG_SITELOCAL	0x10
44162587Sitojun#define NI_NODEADDR_FLAG_GLOBAL		0x20
44262587Sitojun#define NI_NODEADDR_FLAG_ANYCAST	0x40 /* just experimental. not in spec */
44362587Sitojun#elif BYTE_ORDER == LITTLE_ENDIAN
44462587Sitojun#define NI_NODEADDR_FLAG_TRUNCATE	0x0100
44562587Sitojun#define NI_NODEADDR_FLAG_ALL		0x0200
44662587Sitojun#define NI_NODEADDR_FLAG_COMPAT		0x0400
44762587Sitojun#define NI_NODEADDR_FLAG_LINKLOCAL	0x0800
44862587Sitojun#define NI_NODEADDR_FLAG_SITELOCAL	0x1000
44962587Sitojun#define NI_NODEADDR_FLAG_GLOBAL		0x2000
45062587Sitojun#define NI_NODEADDR_FLAG_ANYCAST	0x4000 /* just experimental. not in spec */
45162587Sitojun#endif
45262587Sitojun#endif
45362587Sitojun
45462587Sitojunstruct ni_reply_fqdn {
45562587Sitojun	u_int32_t ni_fqdn_ttl;	/* TTL */
45662587Sitojun	u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
45762587Sitojun	u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
458121499Sume} __packed;
45962587Sitojun
46062587Sitojun/*
46162587Sitojun * Router Renumbering. as router-renum-08.txt
46262587Sitojun */
46362587Sitojunstruct icmp6_router_renum {	/* router renumbering header */
46462587Sitojun	struct icmp6_hdr	rr_hdr;
46562587Sitojun	u_int8_t	rr_segnum;
46662587Sitojun	u_int8_t	rr_flags;
46762587Sitojun	u_int16_t	rr_maxdelay;
46862587Sitojun	u_int32_t	rr_reserved;
469121499Sume} __packed;
47062587Sitojun
47178064Sume#define ICMP6_RR_FLAGS_TEST		0x80
47278064Sume#define ICMP6_RR_FLAGS_REQRESULT	0x40
47378064Sume#define ICMP6_RR_FLAGS_FORCEAPPLY	0x20
47478064Sume#define ICMP6_RR_FLAGS_SPECSITE		0x10
47578064Sume#define ICMP6_RR_FLAGS_PREVDONE		0x08
47678064Sume
47762587Sitojun#define rr_type		rr_hdr.icmp6_type
47862587Sitojun#define rr_code		rr_hdr.icmp6_code
47962587Sitojun#define rr_cksum	rr_hdr.icmp6_cksum
48062587Sitojun#define rr_seqnum 	rr_hdr.icmp6_data32[0]
48162587Sitojun
48262587Sitojunstruct rr_pco_match {		/* match prefix part */
48362587Sitojun	u_int8_t	rpm_code;
48462587Sitojun	u_int8_t	rpm_len;
48562587Sitojun	u_int8_t	rpm_ordinal;
48662587Sitojun	u_int8_t	rpm_matchlen;
48762587Sitojun	u_int8_t	rpm_minlen;
48862587Sitojun	u_int8_t	rpm_maxlen;
48962587Sitojun	u_int16_t	rpm_reserved;
49062587Sitojun	struct	in6_addr	rpm_prefix;
491121499Sume} __packed;
49262587Sitojun
49362587Sitojun#define RPM_PCO_ADD		1
49462587Sitojun#define RPM_PCO_CHANGE		2
49562587Sitojun#define RPM_PCO_SETGLOBAL	3
49662587Sitojun#define RPM_PCO_MAX		4
49762587Sitojun
49862587Sitojunstruct rr_pco_use {		/* use prefix part */
49962587Sitojun	u_int8_t	rpu_uselen;
50062587Sitojun	u_int8_t	rpu_keeplen;
50162587Sitojun	u_int8_t	rpu_ramask;
50262587Sitojun	u_int8_t	rpu_raflags;
50362587Sitojun	u_int32_t	rpu_vltime;
50462587Sitojun	u_int32_t	rpu_pltime;
50562587Sitojun	u_int32_t	rpu_flags;
50662587Sitojun	struct	in6_addr rpu_prefix;
507121499Sume} __packed;
50862587Sitojun#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK	0x80
50962587Sitojun#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO	0x40
51062587Sitojun
51162587Sitojun#if BYTE_ORDER == BIG_ENDIAN
51262587Sitojun#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80000000
51362587Sitojun#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40000000
51462587Sitojun#elif BYTE_ORDER == LITTLE_ENDIAN
51562587Sitojun#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80
51662587Sitojun#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40
51762587Sitojun#endif
51862587Sitojun
51962587Sitojunstruct rr_result {		/* router renumbering result message */
52062587Sitojun	u_int16_t	rrr_flags;
52162587Sitojun	u_int8_t	rrr_ordinal;
52262587Sitojun	u_int8_t	rrr_matchedlen;
52362587Sitojun	u_int32_t	rrr_ifid;
52462587Sitojun	struct	in6_addr rrr_prefix;
525121499Sume} __packed;
52662587Sitojun#if BYTE_ORDER == BIG_ENDIAN
52762587Sitojun#define ICMP6_RR_RESULT_FLAGS_OOB		0x0002
52862587Sitojun#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0001
52962587Sitojun#elif BYTE_ORDER == LITTLE_ENDIAN
53078064Sume#define ICMP6_RR_RESULT_FLAGS_OOB		0x0200
53178064Sume#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0100
53262587Sitojun#endif
53362587Sitojun
53462587Sitojun/*
53562587Sitojun * icmp6 filter structures.
53662587Sitojun */
53762587Sitojun
53862587Sitojunstruct icmp6_filter {
53962587Sitojun	u_int32_t icmp6_filt[8];
54062587Sitojun};
54162587Sitojun
54262587Sitojun#ifdef _KERNEL
54362587Sitojun#define	ICMP6_FILTER_SETPASSALL(filterp) \
54462587Sitojundo {								\
54562587Sitojun	int i; u_char *p;					\
54662587Sitojun	p = (u_char *)filterp;					\
54762587Sitojun	for (i = 0; i < sizeof(struct icmp6_filter); i++)	\
54862587Sitojun		p[i] = 0xff;					\
549120435Sume} while (/*CONSTCOND*/ 0)
55062587Sitojun#define	ICMP6_FILTER_SETBLOCKALL(filterp) \
55162587Sitojun	bzero(filterp, sizeof(struct icmp6_filter))
55262587Sitojun#else /* _KERNEL */
55362587Sitojun#define	ICMP6_FILTER_SETPASSALL(filterp) \
55462587Sitojun	memset(filterp, 0xff, sizeof(struct icmp6_filter))
55562587Sitojun#define	ICMP6_FILTER_SETBLOCKALL(filterp) \
55662587Sitojun	memset(filterp, 0x00, sizeof(struct icmp6_filter))
55762587Sitojun#endif /* _KERNEL */
55862587Sitojun
55962587Sitojun#define	ICMP6_FILTER_SETPASS(type, filterp) \
56062587Sitojun	(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
56162587Sitojun#define	ICMP6_FILTER_SETBLOCK(type, filterp) \
56262587Sitojun	(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
56362587Sitojun#define	ICMP6_FILTER_WILLPASS(type, filterp) \
56462587Sitojun	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
56562587Sitojun#define	ICMP6_FILTER_WILLBLOCK(type, filterp) \
56662587Sitojun	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
56762587Sitojun
56862587Sitojun/*
56962587Sitojun * Variables related to this implementation
57062587Sitojun * of the internet control message protocol version 6.
57162587Sitojun */
57262587Sitojunstruct icmp6errstat {
573253081Sae	uint64_t icp6errs_dst_unreach_noroute;
574253081Sae	uint64_t icp6errs_dst_unreach_admin;
575253081Sae	uint64_t icp6errs_dst_unreach_beyondscope;
576253081Sae	uint64_t icp6errs_dst_unreach_addr;
577253081Sae	uint64_t icp6errs_dst_unreach_noport;
578253081Sae	uint64_t icp6errs_packet_too_big;
579253081Sae	uint64_t icp6errs_time_exceed_transit;
580253081Sae	uint64_t icp6errs_time_exceed_reassembly;
581253081Sae	uint64_t icp6errs_paramprob_header;
582253081Sae	uint64_t icp6errs_paramprob_nextheader;
583253081Sae	uint64_t icp6errs_paramprob_option;
584253081Sae	uint64_t icp6errs_redirect; /* we regard redirect as an error here */
585253081Sae	uint64_t icp6errs_unknown;
58662587Sitojun};
58762587Sitojun
58862587Sitojunstruct icmp6stat {
58962587Sitojun/* statistics related to icmp6 packets generated */
590253081Sae	uint64_t icp6s_error;		/* # of calls to icmp6_error */
591253081Sae	uint64_t icp6s_canterror;	/* no error 'cuz old was icmp */
592253081Sae	uint64_t icp6s_toofreq;		/* no error 'cuz rate limitation */
593253081Sae	uint64_t icp6s_outhist[256];
59462587Sitojun/* statistics related to input message processed */
595253081Sae	uint64_t icp6s_badcode;		/* icmp6_code out of range */
596253081Sae	uint64_t icp6s_tooshort;	/* packet < sizeof(struct icmp6_hdr) */
597253081Sae	uint64_t icp6s_checksum;	/* bad checksum */
598253081Sae	uint64_t icp6s_badlen;		/* calculated bound mismatch */
59995023Ssuz	/*
60095023Ssuz	 * number of responses: this member is inherited from netinet code, but
60195023Ssuz	 * for netinet6 code, it is already available in icp6s_outhist[].
60295023Ssuz	 */
603253081Sae	uint64_t icp6s_reflect;
604253081Sae	uint64_t icp6s_inhist[256];
605253081Sae	uint64_t icp6s_nd_toomanyopt;	/* too many ND options */
60662587Sitojun	struct icmp6errstat icp6s_outerrhist;
60762587Sitojun#define icp6s_odst_unreach_noroute \
60862587Sitojun	icp6s_outerrhist.icp6errs_dst_unreach_noroute
60962587Sitojun#define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin
61062587Sitojun#define icp6s_odst_unreach_beyondscope \
61162587Sitojun	icp6s_outerrhist.icp6errs_dst_unreach_beyondscope
61262587Sitojun#define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr
61362587Sitojun#define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport
61462587Sitojun#define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big
61562587Sitojun#define icp6s_otime_exceed_transit \
61662587Sitojun	icp6s_outerrhist.icp6errs_time_exceed_transit
61762587Sitojun#define icp6s_otime_exceed_reassembly \
61862587Sitojun	icp6s_outerrhist.icp6errs_time_exceed_reassembly
61962587Sitojun#define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header
62062587Sitojun#define icp6s_oparamprob_nextheader \
62162587Sitojun	icp6s_outerrhist.icp6errs_paramprob_nextheader
62262587Sitojun#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option
62362587Sitojun#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect
62462587Sitojun#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown
625253081Sae	uint64_t icp6s_pmtuchg;		/* path MTU changes */
626253081Sae	uint64_t icp6s_nd_badopt;	/* bad ND options */
627253081Sae	uint64_t icp6s_badns;		/* bad neighbor solicitation */
628253081Sae	uint64_t icp6s_badna;		/* bad neighbor advertisement */
629327716Scy	uint64_t icp6s_badrs;		/* bad router solicitation */
630253081Sae	uint64_t icp6s_badra;		/* bad router advertisement */
631253081Sae	uint64_t icp6s_badredirect;	/* bad redirect message */
63262587Sitojun};
63362587Sitojun
634190964Srwatson#ifdef _KERNEL
635253085Sae#include <sys/counter.h>
636253085Sae
637253085SaeVNET_PCPUSTAT_DECLARE(struct icmp6stat, icmp6stat);
638196039Srwatson/*
639196039Srwatson * In-kernel consumers can use these accessor macros directly to update
640196039Srwatson * stats.
641196039Srwatson */
642253085Sae#define	ICMP6STAT_ADD(name, val)	\
643253085Sae    VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, (val))
644190964Srwatson#define	ICMP6STAT_INC(name)		ICMP6STAT_ADD(name, 1)
645196039Srwatson
646196039Srwatson/*
647196039Srwatson * Kernel module consumers must use this accessor macro.
648196039Srwatson */
649196039Srwatsonvoid	kmod_icmp6stat_inc(int statnum);
650253085Sae#define	KMOD_ICMP6STAT_INC(name)	\
651253085Sae    kmod_icmp6stat_inc(offsetof(struct icmp6stat, name) / sizeof(uint64_t))
652190964Srwatson#endif
653190964Srwatson
65462587Sitojun/*
65562587Sitojun * Names for ICMP sysctl objects
65662587Sitojun */
65762587Sitojun#define ICMPV6CTL_STATS		1
65862587Sitojun#define ICMPV6CTL_REDIRACCEPT	2	/* accept/process redirects */
65962587Sitojun#define ICMPV6CTL_REDIRTIMEOUT	3	/* redirect cache time */
66078064Sume#if 0	/*obsoleted*/
66162587Sitojun#define ICMPV6CTL_ERRRATELIMIT	5	/* ICMPv6 error rate limitation */
66278064Sume#endif
66362587Sitojun#define ICMPV6CTL_ND6_PRUNE	6
66462587Sitojun#define ICMPV6CTL_ND6_DELAY	8
66562587Sitojun#define ICMPV6CTL_ND6_UMAXTRIES	9
66662587Sitojun#define ICMPV6CTL_ND6_MMAXTRIES		10
66762587Sitojun#define ICMPV6CTL_ND6_USELOOPBACK	11
66862587Sitojun/*#define ICMPV6CTL_ND6_PROXYALL	12	obsoleted, do not reuse here */
66962587Sitojun#define ICMPV6CTL_NODEINFO	13
67062587Sitojun#define ICMPV6CTL_ERRPPSLIMIT	14	/* ICMPv6 error pps limitation */
67162587Sitojun#define ICMPV6CTL_ND6_MAXNUDHINT	15
67278064Sume#define ICMPV6CTL_MTUDISC_HIWAT	16
67378064Sume#define ICMPV6CTL_MTUDISC_LOWAT	17
67478064Sume#define ICMPV6CTL_ND6_DEBUG	18
67578064Sume#define ICMPV6CTL_ND6_DRLIST	19
67678064Sume#define ICMPV6CTL_ND6_PRLIST	20
677151539Ssuz#define ICMPV6CTL_MLD_MAXSRCFILTER	21
678151539Ssuz#define ICMPV6CTL_MLD_SOMAXSRC	22
679151539Ssuz#define ICMPV6CTL_MLD_VERSION	23
680151539Ssuz#define ICMPV6CTL_ND6_MAXQLEN	24
681250251Shrs#define ICMPV6CTL_NODEINFO_OLDMCPREFIX	25
682250251Shrs#define ICMPV6CTL_MAXID		26
68362587Sitojun
68462587Sitojun#define RTF_PROBEMTU	RTF_PROTO1
68562587Sitojun
68662587Sitojun#ifdef _KERNEL
68762587Sitojun# ifdef __STDC__
68862587Sitojunstruct	rtentry;
68962587Sitojunstruct	rttimer;
69062587Sitojunstruct	in6_multi;
69162587Sitojun# endif
69292723Salfredvoid	icmp6_paramerror(struct mbuf *, int);
69392723Salfredvoid	icmp6_error(struct mbuf *, int, int, int);
694148385Sumevoid	icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
69592723Salfredint	icmp6_input(struct mbuf **, int *, int);
69692723Salfredvoid	icmp6_fasttimo(void);
697191661Sbmsvoid	icmp6_slowtimo(void);
69892723Salfredvoid	icmp6_reflect(struct mbuf *, size_t);
69992723Salfredvoid	icmp6_prepare(struct mbuf *);
70092723Salfredvoid	icmp6_redirect_input(struct mbuf *, int);
70192723Salfredvoid	icmp6_redirect_output(struct mbuf *, struct rtentry *);
70262587Sitojun
70378064Sumestruct	ip6ctlparam;
70492723Salfredvoid	icmp6_mtudisc_update(struct ip6ctlparam *, int);
70578064Sume
70662587Sitojun/* XXX: is this the right place for these macros? */
70762587Sitojun#define icmp6_ifstat_inc(ifp, tag) \
70862587Sitojundo {								\
709121161Sume	if (ifp)						\
710253086Sae		counter_u64_add(((struct in6_ifextra *)		\
711253086Sae		    ((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat[\
712253086Sae		    offsetof(struct icmp6_ifstat, tag) / sizeof(uint64_t)], 1);\
713120435Sume} while (/*CONSTCOND*/ 0)
71462587Sitojun
71562587Sitojun#define icmp6_ifoutstat_inc(ifp, type, code) \
71662587Sitojundo { \
71762587Sitojun		icmp6_ifstat_inc(ifp, ifs6_out_msg); \
71862587Sitojun 		if (type < ICMP6_INFOMSG_MASK) \
71962587Sitojun 			icmp6_ifstat_inc(ifp, ifs6_out_error); \
720121161Sume		switch (type) { \
72162587Sitojun		 case ICMP6_DST_UNREACH: \
72262587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
72362587Sitojun			 if (code == ICMP6_DST_UNREACH_ADMIN) \
72462587Sitojun				 icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
72562587Sitojun			 break; \
72662587Sitojun		 case ICMP6_PACKET_TOO_BIG: \
72762587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
72862587Sitojun			 break; \
72962587Sitojun		 case ICMP6_TIME_EXCEEDED: \
73062587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
73162587Sitojun			 break; \
73262587Sitojun		 case ICMP6_PARAM_PROB: \
73362587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
73462587Sitojun			 break; \
73562587Sitojun		 case ICMP6_ECHO_REQUEST: \
73662587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_echo); \
73762587Sitojun			 break; \
73862587Sitojun		 case ICMP6_ECHO_REPLY: \
73962587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
74062587Sitojun			 break; \
74196116Sume		 case MLD_LISTENER_QUERY: \
74262587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
74362587Sitojun			 break; \
74496116Sume		 case MLD_LISTENER_REPORT: \
74562587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
74662587Sitojun			 break; \
74796116Sume		 case MLD_LISTENER_DONE: \
74862587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
74962587Sitojun			 break; \
75062587Sitojun		 case ND_ROUTER_SOLICIT: \
75162587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
75262587Sitojun			 break; \
75362587Sitojun		 case ND_ROUTER_ADVERT: \
75462587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
75562587Sitojun			 break; \
75662587Sitojun		 case ND_NEIGHBOR_SOLICIT: \
75762587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
75862587Sitojun			 break; \
75962587Sitojun		 case ND_NEIGHBOR_ADVERT: \
76062587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
76162587Sitojun			 break; \
76262587Sitojun		 case ND_REDIRECT: \
76362587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
76462587Sitojun			 break; \
76562587Sitojun		} \
766120435Sume} while (/*CONSTCOND*/ 0)
76762587Sitojun
768195699SrwatsonVNET_DECLARE(int, icmp6_rediraccept);	/* accept/process redirects */
769195699SrwatsonVNET_DECLARE(int, icmp6_redirtimeout);	/* cache time for redirect routes */
770169664Sjinmei
771195727Srwatson#define	V_icmp6_rediraccept	VNET(icmp6_rediraccept)
772195727Srwatson#define	V_icmp6_redirtimeout	VNET(icmp6_redirtimeout)
773195699Srwatson
774169664Sjinmei#define ICMP6_NODEINFO_FQDNOK		0x1
775169664Sjinmei#define ICMP6_NODEINFO_NODEADDROK	0x2
776169664Sjinmei#define ICMP6_NODEINFO_TMPADDROK	0x4
777169664Sjinmei#define ICMP6_NODEINFO_GLOBALOK		0x8
77862587Sitojun#endif /* _KERNEL */
77962587Sitojun
78062587Sitojun#endif /* not _NETINET_ICMP6_H_ */
781