162587Sitojun/*	$FreeBSD: stable/10/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 */
14762587Sitojun
14862587Sitojun#define ICMP6_TIME_EXCEED_TRANSIT 	0	/* ttl==0 in transit */
14962587Sitojun#define ICMP6_TIME_EXCEED_REASSEMBLY	1	/* ttl==0 in reass */
15062587Sitojun
15162587Sitojun#define ICMP6_PARAMPROB_HEADER 	 	0	/* erroneous header field */
15262587Sitojun#define ICMP6_PARAMPROB_NEXTHEADER	1	/* unrecognized next header */
15362587Sitojun#define ICMP6_PARAMPROB_OPTION		2	/* unrecognized option */
15462587Sitojun
15562587Sitojun#define ICMP6_INFOMSG_MASK		0x80	/* all informational messages */
15662587Sitojun
15762587Sitojun#define ICMP6_NI_SUBJ_IPV6	0	/* Query Subject is an IPv6 address */
15862587Sitojun#define ICMP6_NI_SUBJ_FQDN	1	/* Query Subject is a Domain name */
15962587Sitojun#define ICMP6_NI_SUBJ_IPV4	2	/* Query Subject is an IPv4 address */
16062587Sitojun
16178064Sume#define ICMP6_NI_SUCCESS	0	/* node information successful reply */
16262587Sitojun#define ICMP6_NI_REFUSED	1	/* node information request is refused */
16362587Sitojun#define ICMP6_NI_UNKNOWN	2	/* unknown Qtype */
16462587Sitojun
16562587Sitojun#define ICMP6_ROUTER_RENUMBERING_COMMAND  0	/* rr command */
16662587Sitojun#define ICMP6_ROUTER_RENUMBERING_RESULT   1	/* rr result */
16762587Sitojun#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255	/* rr seq num reset */
16862587Sitojun
16962587Sitojun/* Used in kernel only */
17062587Sitojun#define ND_REDIRECT_ONLINK	0	/* redirect to an on-link node */
17162587Sitojun#define ND_REDIRECT_ROUTER	1	/* redirect to a better router */
17262587Sitojun
17362587Sitojun/*
17462587Sitojun * Multicast Listener Discovery
17562587Sitojun */
17696116Sumestruct mld_hdr {
17796116Sume	struct icmp6_hdr	mld_icmp6_hdr;
17896116Sume	struct in6_addr		mld_addr; /* multicast address */
179121499Sume} __packed;
18062587Sitojun
18196116Sume/* definitions to provide backward compatibility to old KAME applications */
18296116Sume#ifndef _KERNEL
18396116Sume#define mld6_hdr	mld_hdr
18496116Sume#define mld6_type	mld_type
18596116Sume#define mld6_code	mld_code
18696116Sume#define mld6_cksum	mld_cksum
18796116Sume#define mld6_maxdelay	mld_maxdelay
18896116Sume#define mld6_reserved	mld_reserved
18996116Sume#define mld6_addr	mld_addr
19096116Sume#endif
19162587Sitojun
19296116Sume/* shortcut macro definitions */
19396116Sume#define mld_type	mld_icmp6_hdr.icmp6_type
19496116Sume#define mld_code	mld_icmp6_hdr.icmp6_code
19596116Sume#define mld_cksum	mld_icmp6_hdr.icmp6_cksum
19696116Sume#define mld_maxdelay	mld_icmp6_hdr.icmp6_data16[0]
19796116Sume#define mld_reserved	mld_icmp6_hdr.icmp6_data16[1]
198191661Sbms#define mld_v2_reserved	mld_icmp6_hdr.icmp6_data16[0]
199191661Sbms#define mld_v2_numrecs	mld_icmp6_hdr.icmp6_data16[1]
20096116Sume
20162587Sitojun/*
20262587Sitojun * Neighbor Discovery
20362587Sitojun */
20462587Sitojun
20562587Sitojunstruct nd_router_solicit {	/* router solicitation */
20662587Sitojun	struct icmp6_hdr 	nd_rs_hdr;
20762587Sitojun	/* could be followed by options */
208121499Sume} __packed;
20962587Sitojun
21062587Sitojun#define nd_rs_type	nd_rs_hdr.icmp6_type
21162587Sitojun#define nd_rs_code	nd_rs_hdr.icmp6_code
21262587Sitojun#define nd_rs_cksum	nd_rs_hdr.icmp6_cksum
21362587Sitojun#define nd_rs_reserved	nd_rs_hdr.icmp6_data32[0]
21462587Sitojun
21562587Sitojunstruct nd_router_advert {	/* router advertisement */
21662587Sitojun	struct icmp6_hdr	nd_ra_hdr;
21762587Sitojun	u_int32_t		nd_ra_reachable;	/* reachable time */
21862587Sitojun	u_int32_t		nd_ra_retransmit;	/* retransmit timer */
21962587Sitojun	/* could be followed by options */
220121499Sume} __packed;
22162587Sitojun
22262587Sitojun#define nd_ra_type		nd_ra_hdr.icmp6_type
22362587Sitojun#define nd_ra_code		nd_ra_hdr.icmp6_code
22462587Sitojun#define nd_ra_cksum		nd_ra_hdr.icmp6_cksum
22562587Sitojun#define nd_ra_curhoplimit	nd_ra_hdr.icmp6_data8[0]
22662587Sitojun#define nd_ra_flags_reserved	nd_ra_hdr.icmp6_data8[1]
22762587Sitojun#define ND_RA_FLAG_MANAGED	0x80
22862587Sitojun#define ND_RA_FLAG_OTHER	0x40
22978064Sume#define ND_RA_FLAG_HA		0x20
23078064Sume
23178064Sume/*
23278064Sume * Router preference values based on draft-draves-ipngwg-router-selection-01.
23378064Sume * These are non-standard definitions.
23478064Sume */
23578064Sume#define ND_RA_FLAG_RTPREF_MASK	0x18 /* 00011000 */
23678064Sume
23778064Sume#define ND_RA_FLAG_RTPREF_HIGH	0x08 /* 00001000 */
23878064Sume#define ND_RA_FLAG_RTPREF_MEDIUM	0x00 /* 00000000 */
23978064Sume#define ND_RA_FLAG_RTPREF_LOW	0x18 /* 00011000 */
24078064Sume#define ND_RA_FLAG_RTPREF_RSV	0x10 /* 00010000 */
24178064Sume
24262587Sitojun#define nd_ra_router_lifetime	nd_ra_hdr.icmp6_data16[1]
24362587Sitojun
24462587Sitojunstruct nd_neighbor_solicit {	/* neighbor solicitation */
24562587Sitojun	struct icmp6_hdr	nd_ns_hdr;
24662587Sitojun	struct in6_addr		nd_ns_target;	/*target address */
24762587Sitojun	/* could be followed by options */
248121499Sume} __packed;
24962587Sitojun
25062587Sitojun#define nd_ns_type		nd_ns_hdr.icmp6_type
25162587Sitojun#define nd_ns_code		nd_ns_hdr.icmp6_code
25262587Sitojun#define nd_ns_cksum		nd_ns_hdr.icmp6_cksum
25362587Sitojun#define nd_ns_reserved		nd_ns_hdr.icmp6_data32[0]
25462587Sitojun
25562587Sitojunstruct nd_neighbor_advert {	/* neighbor advertisement */
25662587Sitojun	struct icmp6_hdr	nd_na_hdr;
25762587Sitojun	struct in6_addr		nd_na_target;	/* target address */
25862587Sitojun	/* could be followed by options */
259121499Sume} __packed;
26062587Sitojun
26162587Sitojun#define nd_na_type		nd_na_hdr.icmp6_type
26262587Sitojun#define nd_na_code		nd_na_hdr.icmp6_code
26362587Sitojun#define nd_na_cksum		nd_na_hdr.icmp6_cksum
26462587Sitojun#define nd_na_flags_reserved	nd_na_hdr.icmp6_data32[0]
26562587Sitojun#if BYTE_ORDER == BIG_ENDIAN
26662587Sitojun#define ND_NA_FLAG_ROUTER		0x80000000
26762587Sitojun#define ND_NA_FLAG_SOLICITED		0x40000000
26862587Sitojun#define ND_NA_FLAG_OVERRIDE		0x20000000
26962587Sitojun#else
27062587Sitojun#if BYTE_ORDER == LITTLE_ENDIAN
27162587Sitojun#define ND_NA_FLAG_ROUTER		0x80
27262587Sitojun#define ND_NA_FLAG_SOLICITED		0x40
27362587Sitojun#define ND_NA_FLAG_OVERRIDE		0x20
27462587Sitojun#endif
27562587Sitojun#endif
27662587Sitojun
27762587Sitojunstruct nd_redirect {		/* redirect */
27862587Sitojun	struct icmp6_hdr	nd_rd_hdr;
27962587Sitojun	struct in6_addr		nd_rd_target;	/* target address */
28062587Sitojun	struct in6_addr		nd_rd_dst;	/* destination address */
28162587Sitojun	/* could be followed by options */
282121499Sume} __packed;
28362587Sitojun
28462587Sitojun#define nd_rd_type		nd_rd_hdr.icmp6_type
28562587Sitojun#define nd_rd_code		nd_rd_hdr.icmp6_code
28662587Sitojun#define nd_rd_cksum		nd_rd_hdr.icmp6_cksum
28762587Sitojun#define nd_rd_reserved		nd_rd_hdr.icmp6_data32[0]
28862587Sitojun
28962587Sitojunstruct nd_opt_hdr {		/* Neighbor discovery option header */
29062587Sitojun	u_int8_t	nd_opt_type;
29162587Sitojun	u_int8_t	nd_opt_len;
29262587Sitojun	/* followed by option specific data*/
293121499Sume} __packed;
29462587Sitojun
29562587Sitojun#define ND_OPT_SOURCE_LINKADDR		1
29662587Sitojun#define ND_OPT_TARGET_LINKADDR		2
29762587Sitojun#define ND_OPT_PREFIX_INFORMATION	3
29862587Sitojun#define ND_OPT_REDIRECTED_HEADER	4
29962587Sitojun#define ND_OPT_MTU			5
300282622Shiren#define ND_OPT_NONCE			14	/* RFC 3971 */
301222732Shrs#define ND_OPT_ROUTE_INFO		24	/* RFC 4191 */
302232513Sbz#define ND_OPT_RDNSS			25	/* RFC 6106 */
303232513Sbz#define ND_OPT_DNSSL			31	/* RFC 6106 */
304282622Shiren#define ND_OPT_MAX			31
30562587Sitojun
30662587Sitojunstruct nd_opt_prefix_info {	/* prefix information */
30762587Sitojun	u_int8_t	nd_opt_pi_type;
30862587Sitojun	u_int8_t	nd_opt_pi_len;
30962587Sitojun	u_int8_t	nd_opt_pi_prefix_len;
31062587Sitojun	u_int8_t	nd_opt_pi_flags_reserved;
31162587Sitojun	u_int32_t	nd_opt_pi_valid_time;
31262587Sitojun	u_int32_t	nd_opt_pi_preferred_time;
31362587Sitojun	u_int32_t	nd_opt_pi_reserved2;
31462587Sitojun	struct in6_addr	nd_opt_pi_prefix;
315121499Sume} __packed;
31662587Sitojun
31762587Sitojun#define ND_OPT_PI_FLAG_ONLINK		0x80
31862587Sitojun#define ND_OPT_PI_FLAG_AUTO		0x40
31962587Sitojun
32062587Sitojunstruct nd_opt_rd_hdr {		/* redirected header */
32162587Sitojun	u_int8_t	nd_opt_rh_type;
32262587Sitojun	u_int8_t	nd_opt_rh_len;
32362587Sitojun	u_int16_t	nd_opt_rh_reserved1;
32462587Sitojun	u_int32_t	nd_opt_rh_reserved2;
32562587Sitojun	/* followed by IP header and data */
326121499Sume} __packed;
32762587Sitojun
32862587Sitojunstruct nd_opt_mtu {		/* MTU option */
32962587Sitojun	u_int8_t	nd_opt_mtu_type;
33062587Sitojun	u_int8_t	nd_opt_mtu_len;
33162587Sitojun	u_int16_t	nd_opt_mtu_reserved;
33262587Sitojun	u_int32_t	nd_opt_mtu_mtu;
333121499Sume} __packed;
33462587Sitojun
335282622Shiren#define	ND_OPT_NONCE_LEN	((1 * 8) - 2)
336282622Shiren#if ((ND_OPT_NONCE_LEN + 2) % 8) != 0
337282622Shiren#error "(ND_OPT_NONCE_LEN + 2) must be a multiple of 8."
338282622Shiren#endif
339282622Shirenstruct nd_opt_nonce {		/* nonce option */
340282622Shiren	u_int8_t	nd_opt_nonce_type;
341282622Shiren	u_int8_t	nd_opt_nonce_len;
342282622Shiren	u_int8_t	nd_opt_nonce[ND_OPT_NONCE_LEN];
343282622Shiren} __packed;
344282622Shiren
34578064Sumestruct nd_opt_route_info {	/* route info */
34678064Sume	u_int8_t	nd_opt_rti_type;
34778064Sume	u_int8_t	nd_opt_rti_len;
34878064Sume	u_int8_t	nd_opt_rti_prefixlen;
34978064Sume	u_int8_t	nd_opt_rti_flags;
35078064Sume	u_int32_t	nd_opt_rti_lifetime;
35195023Ssuz	/* prefix follows */
352121499Sume} __packed;
35378539Ssumikawa
354222732Shrsstruct nd_opt_rdnss {		/* RDNSS option (RFC 6106) */
355222732Shrs	u_int8_t	nd_opt_rdnss_type;
356222732Shrs	u_int8_t	nd_opt_rdnss_len;
357222732Shrs	u_int16_t	nd_opt_rdnss_reserved;
358222732Shrs	u_int32_t	nd_opt_rdnss_lifetime;
359222732Shrs	/* followed by list of recursive DNS servers */
360222732Shrs} __packed;
361222732Shrs
362222732Shrsstruct nd_opt_dnssl {		/* DNSSL option (RFC 6106) */
363222732Shrs	u_int8_t	nd_opt_dnssl_type;
364222732Shrs	u_int8_t	nd_opt_dnssl_len;
365222732Shrs	u_int16_t	nd_opt_dnssl_reserved;
366222732Shrs	u_int32_t	nd_opt_dnssl_lifetime;
367222732Shrs	/* followed by list of DNS search domains */
368222732Shrs} __packed;
369222732Shrs
37062587Sitojun/*
37162587Sitojun * icmp6 namelookup
37262587Sitojun */
37362587Sitojun
37462587Sitojunstruct icmp6_namelookup {
37562587Sitojun	struct icmp6_hdr 	icmp6_nl_hdr;
37662587Sitojun	u_int8_t	icmp6_nl_nonce[8];
37762587Sitojun	int32_t		icmp6_nl_ttl;
37862587Sitojun#if 0
37962587Sitojun	u_int8_t	icmp6_nl_len;
38062587Sitojun	u_int8_t	icmp6_nl_name[3];
38162587Sitojun#endif
38262587Sitojun	/* could be followed by options */
383121499Sume} __packed;
38462587Sitojun
38562587Sitojun/*
38662587Sitojun * icmp6 node information
38762587Sitojun */
38862587Sitojunstruct icmp6_nodeinfo {
38962587Sitojun	struct icmp6_hdr icmp6_ni_hdr;
39062587Sitojun	u_int8_t icmp6_ni_nonce[8];
39162587Sitojun	/* could be followed by reply data */
392121499Sume} __packed;
39362587Sitojun
39462587Sitojun#define ni_type		icmp6_ni_hdr.icmp6_type
39562587Sitojun#define ni_code		icmp6_ni_hdr.icmp6_code
39662587Sitojun#define ni_cksum	icmp6_ni_hdr.icmp6_cksum
39762587Sitojun#define ni_qtype	icmp6_ni_hdr.icmp6_data16[0]
39862587Sitojun#define ni_flags	icmp6_ni_hdr.icmp6_data16[1]
39962587Sitojun
40062587Sitojun#define NI_QTYPE_NOOP		0 /* NOOP  */
40162587Sitojun#define NI_QTYPE_SUPTYPES	1 /* Supported Qtypes */
40278064Sume#define NI_QTYPE_FQDN		2 /* FQDN (draft 04) */
40378064Sume#define NI_QTYPE_DNSNAME	2 /* DNS Name */
40478064Sume#define NI_QTYPE_NODEADDR	3 /* Node Addresses */
40578064Sume#define NI_QTYPE_IPV4ADDR	4 /* IPv4 Addresses */
40662587Sitojun
40762587Sitojun#if BYTE_ORDER == BIG_ENDIAN
40862587Sitojun#define NI_SUPTYPE_FLAG_COMPRESS	0x1
40962587Sitojun#define NI_FQDN_FLAG_VALIDTTL		0x1
41062587Sitojun#elif BYTE_ORDER == LITTLE_ENDIAN
41162587Sitojun#define NI_SUPTYPE_FLAG_COMPRESS	0x0100
41262587Sitojun#define NI_FQDN_FLAG_VALIDTTL		0x0100
41362587Sitojun#endif
41462587Sitojun
41562587Sitojun#ifdef NAME_LOOKUPS_04
41662587Sitojun#if BYTE_ORDER == BIG_ENDIAN
41762587Sitojun#define NI_NODEADDR_FLAG_LINKLOCAL	0x1
41862587Sitojun#define NI_NODEADDR_FLAG_SITELOCAL	0x2
41962587Sitojun#define NI_NODEADDR_FLAG_GLOBAL		0x4
42062587Sitojun#define NI_NODEADDR_FLAG_ALL		0x8
42162587Sitojun#define NI_NODEADDR_FLAG_TRUNCATE	0x10
42262587Sitojun#define NI_NODEADDR_FLAG_ANYCAST	0x20 /* just experimental. not in spec */
42362587Sitojun#elif BYTE_ORDER == LITTLE_ENDIAN
42462587Sitojun#define NI_NODEADDR_FLAG_LINKLOCAL	0x0100
42562587Sitojun#define NI_NODEADDR_FLAG_SITELOCAL	0x0200
42662587Sitojun#define NI_NODEADDR_FLAG_GLOBAL		0x0400
42762587Sitojun#define NI_NODEADDR_FLAG_ALL		0x0800
42862587Sitojun#define NI_NODEADDR_FLAG_TRUNCATE	0x1000
42962587Sitojun#define NI_NODEADDR_FLAG_ANYCAST	0x2000 /* just experimental. not in spec */
43062587Sitojun#endif
43162587Sitojun#else  /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
43262587Sitojun#if BYTE_ORDER == BIG_ENDIAN
43362587Sitojun#define NI_NODEADDR_FLAG_TRUNCATE	0x1
43462587Sitojun#define NI_NODEADDR_FLAG_ALL		0x2
43562587Sitojun#define NI_NODEADDR_FLAG_COMPAT		0x4
43662587Sitojun#define NI_NODEADDR_FLAG_LINKLOCAL	0x8
43762587Sitojun#define NI_NODEADDR_FLAG_SITELOCAL	0x10
43862587Sitojun#define NI_NODEADDR_FLAG_GLOBAL		0x20
43962587Sitojun#define NI_NODEADDR_FLAG_ANYCAST	0x40 /* just experimental. not in spec */
44062587Sitojun#elif BYTE_ORDER == LITTLE_ENDIAN
44162587Sitojun#define NI_NODEADDR_FLAG_TRUNCATE	0x0100
44262587Sitojun#define NI_NODEADDR_FLAG_ALL		0x0200
44362587Sitojun#define NI_NODEADDR_FLAG_COMPAT		0x0400
44462587Sitojun#define NI_NODEADDR_FLAG_LINKLOCAL	0x0800
44562587Sitojun#define NI_NODEADDR_FLAG_SITELOCAL	0x1000
44662587Sitojun#define NI_NODEADDR_FLAG_GLOBAL		0x2000
44762587Sitojun#define NI_NODEADDR_FLAG_ANYCAST	0x4000 /* just experimental. not in spec */
44862587Sitojun#endif
44962587Sitojun#endif
45062587Sitojun
45162587Sitojunstruct ni_reply_fqdn {
45262587Sitojun	u_int32_t ni_fqdn_ttl;	/* TTL */
45362587Sitojun	u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
45462587Sitojun	u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
455121499Sume} __packed;
45662587Sitojun
45762587Sitojun/*
45862587Sitojun * Router Renumbering. as router-renum-08.txt
45962587Sitojun */
46062587Sitojunstruct icmp6_router_renum {	/* router renumbering header */
46162587Sitojun	struct icmp6_hdr	rr_hdr;
46262587Sitojun	u_int8_t	rr_segnum;
46362587Sitojun	u_int8_t	rr_flags;
46462587Sitojun	u_int16_t	rr_maxdelay;
46562587Sitojun	u_int32_t	rr_reserved;
466121499Sume} __packed;
46762587Sitojun
46878064Sume#define ICMP6_RR_FLAGS_TEST		0x80
46978064Sume#define ICMP6_RR_FLAGS_REQRESULT	0x40
47078064Sume#define ICMP6_RR_FLAGS_FORCEAPPLY	0x20
47178064Sume#define ICMP6_RR_FLAGS_SPECSITE		0x10
47278064Sume#define ICMP6_RR_FLAGS_PREVDONE		0x08
47378064Sume
47462587Sitojun#define rr_type		rr_hdr.icmp6_type
47562587Sitojun#define rr_code		rr_hdr.icmp6_code
47662587Sitojun#define rr_cksum	rr_hdr.icmp6_cksum
47762587Sitojun#define rr_seqnum 	rr_hdr.icmp6_data32[0]
47862587Sitojun
47962587Sitojunstruct rr_pco_match {		/* match prefix part */
48062587Sitojun	u_int8_t	rpm_code;
48162587Sitojun	u_int8_t	rpm_len;
48262587Sitojun	u_int8_t	rpm_ordinal;
48362587Sitojun	u_int8_t	rpm_matchlen;
48462587Sitojun	u_int8_t	rpm_minlen;
48562587Sitojun	u_int8_t	rpm_maxlen;
48662587Sitojun	u_int16_t	rpm_reserved;
48762587Sitojun	struct	in6_addr	rpm_prefix;
488121499Sume} __packed;
48962587Sitojun
49062587Sitojun#define RPM_PCO_ADD		1
49162587Sitojun#define RPM_PCO_CHANGE		2
49262587Sitojun#define RPM_PCO_SETGLOBAL	3
49362587Sitojun#define RPM_PCO_MAX		4
49462587Sitojun
49562587Sitojunstruct rr_pco_use {		/* use prefix part */
49662587Sitojun	u_int8_t	rpu_uselen;
49762587Sitojun	u_int8_t	rpu_keeplen;
49862587Sitojun	u_int8_t	rpu_ramask;
49962587Sitojun	u_int8_t	rpu_raflags;
50062587Sitojun	u_int32_t	rpu_vltime;
50162587Sitojun	u_int32_t	rpu_pltime;
50262587Sitojun	u_int32_t	rpu_flags;
50362587Sitojun	struct	in6_addr rpu_prefix;
504121499Sume} __packed;
50562587Sitojun#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK	0x80
50662587Sitojun#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO	0x40
50762587Sitojun
50862587Sitojun#if BYTE_ORDER == BIG_ENDIAN
50962587Sitojun#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80000000
51062587Sitojun#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40000000
51162587Sitojun#elif BYTE_ORDER == LITTLE_ENDIAN
51262587Sitojun#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80
51362587Sitojun#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40
51462587Sitojun#endif
51562587Sitojun
51662587Sitojunstruct rr_result {		/* router renumbering result message */
51762587Sitojun	u_int16_t	rrr_flags;
51862587Sitojun	u_int8_t	rrr_ordinal;
51962587Sitojun	u_int8_t	rrr_matchedlen;
52062587Sitojun	u_int32_t	rrr_ifid;
52162587Sitojun	struct	in6_addr rrr_prefix;
522121499Sume} __packed;
52362587Sitojun#if BYTE_ORDER == BIG_ENDIAN
52462587Sitojun#define ICMP6_RR_RESULT_FLAGS_OOB		0x0002
52562587Sitojun#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0001
52662587Sitojun#elif BYTE_ORDER == LITTLE_ENDIAN
52778064Sume#define ICMP6_RR_RESULT_FLAGS_OOB		0x0200
52878064Sume#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0100
52962587Sitojun#endif
53062587Sitojun
53162587Sitojun/*
53262587Sitojun * icmp6 filter structures.
53362587Sitojun */
53462587Sitojun
53562587Sitojunstruct icmp6_filter {
53662587Sitojun	u_int32_t icmp6_filt[8];
53762587Sitojun};
53862587Sitojun
53962587Sitojun#ifdef _KERNEL
54062587Sitojun#define	ICMP6_FILTER_SETPASSALL(filterp) \
54162587Sitojundo {								\
54262587Sitojun	int i; u_char *p;					\
54362587Sitojun	p = (u_char *)filterp;					\
54462587Sitojun	for (i = 0; i < sizeof(struct icmp6_filter); i++)	\
54562587Sitojun		p[i] = 0xff;					\
546120435Sume} while (/*CONSTCOND*/ 0)
54762587Sitojun#define	ICMP6_FILTER_SETBLOCKALL(filterp) \
54862587Sitojun	bzero(filterp, sizeof(struct icmp6_filter))
54962587Sitojun#else /* _KERNEL */
55062587Sitojun#define	ICMP6_FILTER_SETPASSALL(filterp) \
55162587Sitojun	memset(filterp, 0xff, sizeof(struct icmp6_filter))
55262587Sitojun#define	ICMP6_FILTER_SETBLOCKALL(filterp) \
55362587Sitojun	memset(filterp, 0x00, sizeof(struct icmp6_filter))
55462587Sitojun#endif /* _KERNEL */
55562587Sitojun
55662587Sitojun#define	ICMP6_FILTER_SETPASS(type, filterp) \
55762587Sitojun	(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
55862587Sitojun#define	ICMP6_FILTER_SETBLOCK(type, filterp) \
55962587Sitojun	(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
56062587Sitojun#define	ICMP6_FILTER_WILLPASS(type, filterp) \
56162587Sitojun	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
56262587Sitojun#define	ICMP6_FILTER_WILLBLOCK(type, filterp) \
56362587Sitojun	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
56462587Sitojun
56562587Sitojun/*
56662587Sitojun * Variables related to this implementation
56762587Sitojun * of the internet control message protocol version 6.
56862587Sitojun */
56962587Sitojunstruct icmp6errstat {
570253081Sae	uint64_t icp6errs_dst_unreach_noroute;
571253081Sae	uint64_t icp6errs_dst_unreach_admin;
572253081Sae	uint64_t icp6errs_dst_unreach_beyondscope;
573253081Sae	uint64_t icp6errs_dst_unreach_addr;
574253081Sae	uint64_t icp6errs_dst_unreach_noport;
575253081Sae	uint64_t icp6errs_packet_too_big;
576253081Sae	uint64_t icp6errs_time_exceed_transit;
577253081Sae	uint64_t icp6errs_time_exceed_reassembly;
578253081Sae	uint64_t icp6errs_paramprob_header;
579253081Sae	uint64_t icp6errs_paramprob_nextheader;
580253081Sae	uint64_t icp6errs_paramprob_option;
581253081Sae	uint64_t icp6errs_redirect; /* we regard redirect as an error here */
582253081Sae	uint64_t icp6errs_unknown;
58362587Sitojun};
58462587Sitojun
58562587Sitojunstruct icmp6stat {
58662587Sitojun/* statistics related to icmp6 packets generated */
587253081Sae	uint64_t icp6s_error;		/* # of calls to icmp6_error */
588253081Sae	uint64_t icp6s_canterror;	/* no error 'cuz old was icmp */
589253081Sae	uint64_t icp6s_toofreq;		/* no error 'cuz rate limitation */
590253081Sae	uint64_t icp6s_outhist[256];
59162587Sitojun/* statistics related to input message processed */
592253081Sae	uint64_t icp6s_badcode;		/* icmp6_code out of range */
593253081Sae	uint64_t icp6s_tooshort;	/* packet < sizeof(struct icmp6_hdr) */
594253081Sae	uint64_t icp6s_checksum;	/* bad checksum */
595253081Sae	uint64_t icp6s_badlen;		/* calculated bound mismatch */
59695023Ssuz	/*
59795023Ssuz	 * number of responses: this member is inherited from netinet code, but
59895023Ssuz	 * for netinet6 code, it is already available in icp6s_outhist[].
59995023Ssuz	 */
600253081Sae	uint64_t icp6s_reflect;
601253081Sae	uint64_t icp6s_inhist[256];
602253081Sae	uint64_t icp6s_nd_toomanyopt;	/* too many ND options */
60362587Sitojun	struct icmp6errstat icp6s_outerrhist;
60462587Sitojun#define icp6s_odst_unreach_noroute \
60562587Sitojun	icp6s_outerrhist.icp6errs_dst_unreach_noroute
60662587Sitojun#define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin
60762587Sitojun#define icp6s_odst_unreach_beyondscope \
60862587Sitojun	icp6s_outerrhist.icp6errs_dst_unreach_beyondscope
60962587Sitojun#define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr
61062587Sitojun#define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport
61162587Sitojun#define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big
61262587Sitojun#define icp6s_otime_exceed_transit \
61362587Sitojun	icp6s_outerrhist.icp6errs_time_exceed_transit
61462587Sitojun#define icp6s_otime_exceed_reassembly \
61562587Sitojun	icp6s_outerrhist.icp6errs_time_exceed_reassembly
61662587Sitojun#define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header
61762587Sitojun#define icp6s_oparamprob_nextheader \
61862587Sitojun	icp6s_outerrhist.icp6errs_paramprob_nextheader
61962587Sitojun#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option
62062587Sitojun#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect
62162587Sitojun#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown
622253081Sae	uint64_t icp6s_pmtuchg;		/* path MTU changes */
623253081Sae	uint64_t icp6s_nd_badopt;	/* bad ND options */
624253081Sae	uint64_t icp6s_badns;		/* bad neighbor solicitation */
625253081Sae	uint64_t icp6s_badna;		/* bad neighbor advertisement */
626327716Scy	uint64_t icp6s_badrs;		/* bad router solicitation */
627253081Sae	uint64_t icp6s_badra;		/* bad router advertisement */
628253081Sae	uint64_t icp6s_badredirect;	/* bad redirect message */
62962587Sitojun};
63062587Sitojun
631190964Srwatson#ifdef _KERNEL
632253085Sae#include <sys/counter.h>
633253085Sae
634253085SaeVNET_PCPUSTAT_DECLARE(struct icmp6stat, icmp6stat);
635196039Srwatson/*
636196039Srwatson * In-kernel consumers can use these accessor macros directly to update
637196039Srwatson * stats.
638196039Srwatson */
639253085Sae#define	ICMP6STAT_ADD(name, val)	\
640253085Sae    VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, (val))
641190964Srwatson#define	ICMP6STAT_INC(name)		ICMP6STAT_ADD(name, 1)
642196039Srwatson
643196039Srwatson/*
644196039Srwatson * Kernel module consumers must use this accessor macro.
645196039Srwatson */
646196039Srwatsonvoid	kmod_icmp6stat_inc(int statnum);
647253085Sae#define	KMOD_ICMP6STAT_INC(name)	\
648253085Sae    kmod_icmp6stat_inc(offsetof(struct icmp6stat, name) / sizeof(uint64_t))
649190964Srwatson#endif
650190964Srwatson
65162587Sitojun/*
65262587Sitojun * Names for ICMP sysctl objects
65362587Sitojun */
65462587Sitojun#define ICMPV6CTL_STATS		1
65562587Sitojun#define ICMPV6CTL_REDIRACCEPT	2	/* accept/process redirects */
65662587Sitojun#define ICMPV6CTL_REDIRTIMEOUT	3	/* redirect cache time */
65778064Sume#if 0	/*obsoleted*/
65862587Sitojun#define ICMPV6CTL_ERRRATELIMIT	5	/* ICMPv6 error rate limitation */
65978064Sume#endif
66062587Sitojun#define ICMPV6CTL_ND6_PRUNE	6
66162587Sitojun#define ICMPV6CTL_ND6_DELAY	8
66262587Sitojun#define ICMPV6CTL_ND6_UMAXTRIES	9
66362587Sitojun#define ICMPV6CTL_ND6_MMAXTRIES		10
66462587Sitojun#define ICMPV6CTL_ND6_USELOOPBACK	11
66562587Sitojun/*#define ICMPV6CTL_ND6_PROXYALL	12	obsoleted, do not reuse here */
66662587Sitojun#define ICMPV6CTL_NODEINFO	13
66762587Sitojun#define ICMPV6CTL_ERRPPSLIMIT	14	/* ICMPv6 error pps limitation */
66862587Sitojun#define ICMPV6CTL_ND6_MAXNUDHINT	15
66978064Sume#define ICMPV6CTL_MTUDISC_HIWAT	16
67078064Sume#define ICMPV6CTL_MTUDISC_LOWAT	17
67178064Sume#define ICMPV6CTL_ND6_DEBUG	18
67278064Sume#define ICMPV6CTL_ND6_DRLIST	19
67378064Sume#define ICMPV6CTL_ND6_PRLIST	20
674151539Ssuz#define ICMPV6CTL_MLD_MAXSRCFILTER	21
675151539Ssuz#define ICMPV6CTL_MLD_SOMAXSRC	22
676151539Ssuz#define ICMPV6CTL_MLD_VERSION	23
677151539Ssuz#define ICMPV6CTL_ND6_MAXQLEN	24
678250251Shrs#define ICMPV6CTL_NODEINFO_OLDMCPREFIX	25
679250251Shrs#define ICMPV6CTL_MAXID		26
68062587Sitojun
68162587Sitojun#define RTF_PROBEMTU	RTF_PROTO1
68262587Sitojun
68362587Sitojun#ifdef _KERNEL
68462587Sitojun# ifdef __STDC__
68562587Sitojunstruct	rtentry;
68662587Sitojunstruct	rttimer;
68762587Sitojunstruct	in6_multi;
68862587Sitojun# endif
68992723Salfredvoid	icmp6_paramerror(struct mbuf *, int);
69092723Salfredvoid	icmp6_error(struct mbuf *, int, int, int);
691148385Sumevoid	icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
69292723Salfredint	icmp6_input(struct mbuf **, int *, int);
69392723Salfredvoid	icmp6_fasttimo(void);
694191661Sbmsvoid	icmp6_slowtimo(void);
69592723Salfredvoid	icmp6_reflect(struct mbuf *, size_t);
69692723Salfredvoid	icmp6_prepare(struct mbuf *);
69792723Salfredvoid	icmp6_redirect_input(struct mbuf *, int);
69892723Salfredvoid	icmp6_redirect_output(struct mbuf *, struct rtentry *);
69962587Sitojun
70078064Sumestruct	ip6ctlparam;
70192723Salfredvoid	icmp6_mtudisc_update(struct ip6ctlparam *, int);
70278064Sume
70362587Sitojun/* XXX: is this the right place for these macros? */
70462587Sitojun#define icmp6_ifstat_inc(ifp, tag) \
70562587Sitojundo {								\
706121161Sume	if (ifp)						\
707253086Sae		counter_u64_add(((struct in6_ifextra *)		\
708253086Sae		    ((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat[\
709253086Sae		    offsetof(struct icmp6_ifstat, tag) / sizeof(uint64_t)], 1);\
710120435Sume} while (/*CONSTCOND*/ 0)
71162587Sitojun
71262587Sitojun#define icmp6_ifoutstat_inc(ifp, type, code) \
71362587Sitojundo { \
71462587Sitojun		icmp6_ifstat_inc(ifp, ifs6_out_msg); \
71562587Sitojun 		if (type < ICMP6_INFOMSG_MASK) \
71662587Sitojun 			icmp6_ifstat_inc(ifp, ifs6_out_error); \
717121161Sume		switch (type) { \
71862587Sitojun		 case ICMP6_DST_UNREACH: \
71962587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
72062587Sitojun			 if (code == ICMP6_DST_UNREACH_ADMIN) \
72162587Sitojun				 icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
72262587Sitojun			 break; \
72362587Sitojun		 case ICMP6_PACKET_TOO_BIG: \
72462587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
72562587Sitojun			 break; \
72662587Sitojun		 case ICMP6_TIME_EXCEEDED: \
72762587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
72862587Sitojun			 break; \
72962587Sitojun		 case ICMP6_PARAM_PROB: \
73062587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
73162587Sitojun			 break; \
73262587Sitojun		 case ICMP6_ECHO_REQUEST: \
73362587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_echo); \
73462587Sitojun			 break; \
73562587Sitojun		 case ICMP6_ECHO_REPLY: \
73662587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
73762587Sitojun			 break; \
73896116Sume		 case MLD_LISTENER_QUERY: \
73962587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
74062587Sitojun			 break; \
74196116Sume		 case MLD_LISTENER_REPORT: \
74262587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
74362587Sitojun			 break; \
74496116Sume		 case MLD_LISTENER_DONE: \
74562587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
74662587Sitojun			 break; \
74762587Sitojun		 case ND_ROUTER_SOLICIT: \
74862587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
74962587Sitojun			 break; \
75062587Sitojun		 case ND_ROUTER_ADVERT: \
75162587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
75262587Sitojun			 break; \
75362587Sitojun		 case ND_NEIGHBOR_SOLICIT: \
75462587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
75562587Sitojun			 break; \
75662587Sitojun		 case ND_NEIGHBOR_ADVERT: \
75762587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
75862587Sitojun			 break; \
75962587Sitojun		 case ND_REDIRECT: \
76062587Sitojun			 icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
76162587Sitojun			 break; \
76262587Sitojun		} \
763120435Sume} while (/*CONSTCOND*/ 0)
76462587Sitojun
765195699SrwatsonVNET_DECLARE(int, icmp6_rediraccept);	/* accept/process redirects */
766195699SrwatsonVNET_DECLARE(int, icmp6_redirtimeout);	/* cache time for redirect routes */
767169664Sjinmei
768195727Srwatson#define	V_icmp6_rediraccept	VNET(icmp6_rediraccept)
769195727Srwatson#define	V_icmp6_redirtimeout	VNET(icmp6_redirtimeout)
770195699Srwatson
771169664Sjinmei#define ICMP6_NODEINFO_FQDNOK		0x1
772169664Sjinmei#define ICMP6_NODEINFO_NODEADDROK	0x2
773169664Sjinmei#define ICMP6_NODEINFO_TMPADDROK	0x4
774169664Sjinmei#define ICMP6_NODEINFO_GLOBALOK		0x8
77562587Sitojun#endif /* _KERNEL */
77662587Sitojun
77762587Sitojun#endif /* not _NETINET_ICMP6_H_ */
778