xref: /freebsd/sys/netinet/icmp6.h (revision 380ee9b3c0c54680ac26dbd80ea812671052fae2)
133841545SHajimu UMEMOTO /*	$KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $	*/
2686cdd19SJun-ichiro itojun Hagino 
3c398230bSWarner Losh /*-
451369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
551369649SPedro F. Giffuni  *
682cd038dSYoshinobu Inoue  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
782cd038dSYoshinobu Inoue  * All rights reserved.
882cd038dSYoshinobu Inoue  *
982cd038dSYoshinobu Inoue  * Redistribution and use in source and binary forms, with or without
1082cd038dSYoshinobu Inoue  * modification, are permitted provided that the following conditions
1182cd038dSYoshinobu Inoue  * are met:
1282cd038dSYoshinobu Inoue  * 1. Redistributions of source code must retain the above copyright
1382cd038dSYoshinobu Inoue  *    notice, this list of conditions and the following disclaimer.
1482cd038dSYoshinobu Inoue  * 2. Redistributions in binary form must reproduce the above copyright
1582cd038dSYoshinobu Inoue  *    notice, this list of conditions and the following disclaimer in the
1682cd038dSYoshinobu Inoue  *    documentation and/or other materials provided with the distribution.
1782cd038dSYoshinobu Inoue  * 3. Neither the name of the project nor the names of its contributors
1882cd038dSYoshinobu Inoue  *    may be used to endorse or promote products derived from this software
1982cd038dSYoshinobu Inoue  *    without specific prior written permission.
2082cd038dSYoshinobu Inoue  *
2182cd038dSYoshinobu Inoue  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2282cd038dSYoshinobu Inoue  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2382cd038dSYoshinobu Inoue  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2482cd038dSYoshinobu Inoue  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2582cd038dSYoshinobu Inoue  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2682cd038dSYoshinobu Inoue  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2782cd038dSYoshinobu Inoue  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2882cd038dSYoshinobu Inoue  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2982cd038dSYoshinobu Inoue  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3082cd038dSYoshinobu Inoue  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3182cd038dSYoshinobu Inoue  * SUCH DAMAGE.
32686cdd19SJun-ichiro itojun Hagino  */
33686cdd19SJun-ichiro itojun Hagino 
34c398230bSWarner Losh /*-
35686cdd19SJun-ichiro itojun Hagino  * Copyright (c) 1982, 1986, 1993
36686cdd19SJun-ichiro itojun Hagino  *	The Regents of the University of California.  All rights reserved.
3782cd038dSYoshinobu Inoue  *
38686cdd19SJun-ichiro itojun Hagino  * Redistribution and use in source and binary forms, with or without
39686cdd19SJun-ichiro itojun Hagino  * modification, are permitted provided that the following conditions
40686cdd19SJun-ichiro itojun Hagino  * are met:
41686cdd19SJun-ichiro itojun Hagino  * 1. Redistributions of source code must retain the above copyright
42686cdd19SJun-ichiro itojun Hagino  *    notice, this list of conditions and the following disclaimer.
43686cdd19SJun-ichiro itojun Hagino  * 2. Redistributions in binary form must reproduce the above copyright
44686cdd19SJun-ichiro itojun Hagino  *    notice, this list of conditions and the following disclaimer in the
45686cdd19SJun-ichiro itojun Hagino  *    documentation and/or other materials provided with the distribution.
46fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
47686cdd19SJun-ichiro itojun Hagino  *    may be used to endorse or promote products derived from this software
48686cdd19SJun-ichiro itojun Hagino  *    without specific prior written permission.
49686cdd19SJun-ichiro itojun Hagino  *
50686cdd19SJun-ichiro itojun Hagino  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51686cdd19SJun-ichiro itojun Hagino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52686cdd19SJun-ichiro itojun Hagino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53686cdd19SJun-ichiro itojun Hagino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54686cdd19SJun-ichiro itojun Hagino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55686cdd19SJun-ichiro itojun Hagino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56686cdd19SJun-ichiro itojun Hagino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57686cdd19SJun-ichiro itojun Hagino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58686cdd19SJun-ichiro itojun Hagino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59686cdd19SJun-ichiro itojun Hagino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60686cdd19SJun-ichiro itojun Hagino  * SUCH DAMAGE.
6182cd038dSYoshinobu Inoue  */
6282cd038dSYoshinobu Inoue 
6382cd038dSYoshinobu Inoue #ifndef _NETINET_ICMP6_H_
6482cd038dSYoshinobu Inoue #define _NETINET_ICMP6_H_
6582cd038dSYoshinobu Inoue 
66*380ee9b3SCy Schubert #include <sys/stdint.h>
674b75afe8SLexi Winter 
68686cdd19SJun-ichiro itojun Hagino #define ICMPV6_PLD_MAXLEN	1232	/* IPV6_MMTU - sizeof(struct ip6_hdr)
69686cdd19SJun-ichiro itojun Hagino 					   - sizeof(struct icmp6_hdr) */
7082cd038dSYoshinobu Inoue 
71686cdd19SJun-ichiro itojun Hagino struct icmp6_hdr {
72686cdd19SJun-ichiro itojun Hagino 	u_int8_t	icmp6_type;	/* type field */
73686cdd19SJun-ichiro itojun Hagino 	u_int8_t	icmp6_code;	/* code field */
74686cdd19SJun-ichiro itojun Hagino 	u_int16_t	icmp6_cksum;	/* checksum field */
75686cdd19SJun-ichiro itojun Hagino 	union {
76686cdd19SJun-ichiro itojun Hagino 		u_int32_t	icmp6_un_data32[1]; /* type-specific field */
77686cdd19SJun-ichiro itojun Hagino 		u_int16_t	icmp6_un_data16[2]; /* type-specific field */
78686cdd19SJun-ichiro itojun Hagino 		u_int8_t	icmp6_un_data8[4];  /* type-specific field */
79686cdd19SJun-ichiro itojun Hagino 	} icmp6_dataun;
80618d51bbSHajimu UMEMOTO } __packed;
81686cdd19SJun-ichiro itojun Hagino 
82686cdd19SJun-ichiro itojun Hagino #define icmp6_data32	icmp6_dataun.icmp6_un_data32
83686cdd19SJun-ichiro itojun Hagino #define icmp6_data16	icmp6_dataun.icmp6_un_data16
84686cdd19SJun-ichiro itojun Hagino #define icmp6_data8	icmp6_dataun.icmp6_un_data8
85686cdd19SJun-ichiro itojun Hagino #define icmp6_pptr	icmp6_data32[0]		/* parameter prob */
86686cdd19SJun-ichiro itojun Hagino #define icmp6_mtu	icmp6_data32[0]		/* packet too big */
87686cdd19SJun-ichiro itojun Hagino #define icmp6_id	icmp6_data16[0]		/* echo request/reply */
88686cdd19SJun-ichiro itojun Hagino #define icmp6_seq	icmp6_data16[1]		/* echo request/reply */
89686cdd19SJun-ichiro itojun Hagino #define icmp6_maxdelay	icmp6_data16[0]		/* mcast group membership */
90686cdd19SJun-ichiro itojun Hagino 
91686cdd19SJun-ichiro itojun Hagino #define ICMP6_DST_UNREACH		1	/* dest unreachable, codes: */
92686cdd19SJun-ichiro itojun Hagino #define ICMP6_PACKET_TOO_BIG		2	/* packet too big */
93686cdd19SJun-ichiro itojun Hagino #define ICMP6_TIME_EXCEEDED		3	/* time exceeded, code: */
94686cdd19SJun-ichiro itojun Hagino #define ICMP6_PARAM_PROB		4	/* ip6 header bad */
95686cdd19SJun-ichiro itojun Hagino 
96686cdd19SJun-ichiro itojun Hagino #define ICMP6_ECHO_REQUEST		128	/* echo service */
97686cdd19SJun-ichiro itojun Hagino #define ICMP6_ECHO_REPLY		129	/* echo reply */
9881170631SHajimu UMEMOTO #define MLD_LISTENER_QUERY		130 	/* multicast listener query */
9981170631SHajimu UMEMOTO #define MLD_LISTENER_REPORT		131	/* multicast listener report */
10081170631SHajimu UMEMOTO #define MLD_LISTENER_DONE		132	/* multicast listener done */
10177b6f9edSHajimu UMEMOTO #define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */
10281170631SHajimu UMEMOTO 
103f95d4633SHajimu UMEMOTO /* RFC2292 decls */
104f95d4633SHajimu UMEMOTO #define ICMP6_MEMBERSHIP_QUERY		130	/* group membership query */
105f95d4633SHajimu UMEMOTO #define ICMP6_MEMBERSHIP_REPORT		131	/* group membership report */
106f95d4633SHajimu UMEMOTO #define ICMP6_MEMBERSHIP_REDUCTION	132	/* group membership termination */
107f95d4633SHajimu UMEMOTO 
10881170631SHajimu UMEMOTO #ifndef _KERNEL
10981170631SHajimu UMEMOTO /* the followings are for backward compatibility to old KAME apps. */
11081170631SHajimu UMEMOTO #define MLD6_LISTENER_QUERY	MLD_LISTENER_QUERY
11181170631SHajimu UMEMOTO #define MLD6_LISTENER_REPORT	MLD_LISTENER_REPORT
11281170631SHajimu UMEMOTO #define MLD6_LISTENER_DONE	MLD_LISTENER_DONE
11381170631SHajimu UMEMOTO #endif
114686cdd19SJun-ichiro itojun Hagino 
115686cdd19SJun-ichiro itojun Hagino #define ND_ROUTER_SOLICIT		133	/* router solicitation */
11618b35df8SHajimu UMEMOTO #define ND_ROUTER_ADVERT		134	/* router advertisement */
117686cdd19SJun-ichiro itojun Hagino #define ND_NEIGHBOR_SOLICIT		135	/* neighbor solicitation */
11818b35df8SHajimu UMEMOTO #define ND_NEIGHBOR_ADVERT		136	/* neighbor advertisement */
119686cdd19SJun-ichiro itojun Hagino #define ND_REDIRECT			137	/* redirect */
120686cdd19SJun-ichiro itojun Hagino 
121686cdd19SJun-ichiro itojun Hagino #define ICMP6_ROUTER_RENUMBERING	138	/* router renumbering */
122686cdd19SJun-ichiro itojun Hagino 
123686cdd19SJun-ichiro itojun Hagino #define ICMP6_WRUREQUEST		139	/* who are you request */
124686cdd19SJun-ichiro itojun Hagino #define ICMP6_WRUREPLY			140	/* who are you reply */
125686cdd19SJun-ichiro itojun Hagino #define ICMP6_FQDN_QUERY		139	/* FQDN query */
126686cdd19SJun-ichiro itojun Hagino #define ICMP6_FQDN_REPLY		140	/* FQDN reply */
127686cdd19SJun-ichiro itojun Hagino #define ICMP6_NI_QUERY			139	/* node information request */
128686cdd19SJun-ichiro itojun Hagino #define ICMP6_NI_REPLY			140	/* node information reply */
1299efc1a1bSBruce M Simpson #define MLDV2_LISTENER_REPORT		143	/* RFC3810 listener report */
130686cdd19SJun-ichiro itojun Hagino 
131686cdd19SJun-ichiro itojun Hagino /* The definitions below are experimental. TBA */
13281170631SHajimu UMEMOTO #define MLD_MTRACE_RESP			200	/* mtrace resp (to sender) */
13381170631SHajimu UMEMOTO #define MLD_MTRACE			201	/* mtrace messages */
134686cdd19SJun-ichiro itojun Hagino 
13581170631SHajimu UMEMOTO #ifndef _KERNEL
13681170631SHajimu UMEMOTO #define MLD6_MTRACE_RESP	MLD_MTRACE_RESP
13781170631SHajimu UMEMOTO #define MLD6_MTRACE		MLD_MTRACE
13881170631SHajimu UMEMOTO #endif
13981170631SHajimu UMEMOTO 
140f95d4633SHajimu UMEMOTO #define ICMP6_MAXTYPE			201
141686cdd19SJun-ichiro itojun Hagino 
142686cdd19SJun-ichiro itojun Hagino #define ICMP6_DST_UNREACH_NOROUTE	0	/* no route to destination */
143686cdd19SJun-ichiro itojun Hagino #define ICMP6_DST_UNREACH_ADMIN	 	1	/* administratively prohibited */
144686cdd19SJun-ichiro itojun Hagino #define ICMP6_DST_UNREACH_NOTNEIGHBOR	2	/* not a neighbor(obsolete) */
145686cdd19SJun-ichiro itojun Hagino #define ICMP6_DST_UNREACH_BEYONDSCOPE	2	/* beyond scope of source address */
146686cdd19SJun-ichiro itojun Hagino #define ICMP6_DST_UNREACH_ADDR		3	/* address unreachable */
147686cdd19SJun-ichiro itojun Hagino #define ICMP6_DST_UNREACH_NOPORT	4	/* port unreachable */
1488b2b91eeSGeorge V. Neville-Neil #define ICMP6_DST_UNREACH_POLICY	5	/* failed ingress/egress policy */
1498b2b91eeSGeorge V. Neville-Neil #define ICMP6_DST_UNREACH_REJECT	6	/* Reject route to destination */
1508b2b91eeSGeorge V. Neville-Neil #define ICMP6_DST_UNREACH_SRCROUTE	7	/* Error in source routing header */
151686cdd19SJun-ichiro itojun Hagino 
152686cdd19SJun-ichiro itojun Hagino #define ICMP6_TIME_EXCEED_TRANSIT 	0	/* ttl==0 in transit */
153686cdd19SJun-ichiro itojun Hagino #define ICMP6_TIME_EXCEED_REASSEMBLY	1	/* ttl==0 in reass */
154686cdd19SJun-ichiro itojun Hagino 
155686cdd19SJun-ichiro itojun Hagino #define ICMP6_PARAMPROB_HEADER 	 	0	/* erroneous header field */
156686cdd19SJun-ichiro itojun Hagino #define ICMP6_PARAMPROB_NEXTHEADER	1	/* unrecognized next header */
157686cdd19SJun-ichiro itojun Hagino #define ICMP6_PARAMPROB_OPTION		2	/* unrecognized option */
158686cdd19SJun-ichiro itojun Hagino 
159686cdd19SJun-ichiro itojun Hagino #define ICMP6_INFOMSG_MASK		0x80	/* all informational messages */
160686cdd19SJun-ichiro itojun Hagino 
161686cdd19SJun-ichiro itojun Hagino #define ICMP6_NI_SUBJ_IPV6	0	/* Query Subject is an IPv6 address */
162686cdd19SJun-ichiro itojun Hagino #define ICMP6_NI_SUBJ_FQDN	1	/* Query Subject is a Domain name */
163686cdd19SJun-ichiro itojun Hagino #define ICMP6_NI_SUBJ_IPV4	2	/* Query Subject is an IPv4 address */
164686cdd19SJun-ichiro itojun Hagino 
16533841545SHajimu UMEMOTO #define ICMP6_NI_SUCCESS	0	/* node information successful reply */
166686cdd19SJun-ichiro itojun Hagino #define ICMP6_NI_REFUSED	1	/* node information request is refused */
167686cdd19SJun-ichiro itojun Hagino #define ICMP6_NI_UNKNOWN	2	/* unknown Qtype */
168686cdd19SJun-ichiro itojun Hagino 
169686cdd19SJun-ichiro itojun Hagino #define ICMP6_ROUTER_RENUMBERING_COMMAND  0	/* rr command */
170686cdd19SJun-ichiro itojun Hagino #define ICMP6_ROUTER_RENUMBERING_RESULT   1	/* rr result */
171686cdd19SJun-ichiro itojun Hagino #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255	/* rr seq num reset */
172686cdd19SJun-ichiro itojun Hagino 
173686cdd19SJun-ichiro itojun Hagino /* Used in kernel only */
174686cdd19SJun-ichiro itojun Hagino #define ND_REDIRECT_ONLINK	0	/* redirect to an on-link node */
175686cdd19SJun-ichiro itojun Hagino #define ND_REDIRECT_ROUTER	1	/* redirect to a better router */
176686cdd19SJun-ichiro itojun Hagino 
177686cdd19SJun-ichiro itojun Hagino /*
178686cdd19SJun-ichiro itojun Hagino  * Multicast Listener Discovery
179686cdd19SJun-ichiro itojun Hagino  */
18081170631SHajimu UMEMOTO struct mld_hdr {
18181170631SHajimu UMEMOTO 	struct icmp6_hdr	mld_icmp6_hdr;
18281170631SHajimu UMEMOTO 	struct in6_addr		mld_addr; /* multicast address */
183618d51bbSHajimu UMEMOTO } __packed;
184686cdd19SJun-ichiro itojun Hagino 
18581170631SHajimu UMEMOTO /* definitions to provide backward compatibility to old KAME applications */
18681170631SHajimu UMEMOTO #ifndef _KERNEL
18781170631SHajimu UMEMOTO #define mld6_hdr	mld_hdr
18881170631SHajimu UMEMOTO #define mld6_type	mld_type
18981170631SHajimu UMEMOTO #define mld6_code	mld_code
19081170631SHajimu UMEMOTO #define mld6_cksum	mld_cksum
19181170631SHajimu UMEMOTO #define mld6_maxdelay	mld_maxdelay
19281170631SHajimu UMEMOTO #define mld6_reserved	mld_reserved
19381170631SHajimu UMEMOTO #define mld6_addr	mld_addr
19481170631SHajimu UMEMOTO #endif
19581170631SHajimu UMEMOTO 
19681170631SHajimu UMEMOTO /* shortcut macro definitions */
19781170631SHajimu UMEMOTO #define mld_type	mld_icmp6_hdr.icmp6_type
19881170631SHajimu UMEMOTO #define mld_code	mld_icmp6_hdr.icmp6_code
19981170631SHajimu UMEMOTO #define mld_cksum	mld_icmp6_hdr.icmp6_cksum
20081170631SHajimu UMEMOTO #define mld_maxdelay	mld_icmp6_hdr.icmp6_data16[0]
20181170631SHajimu UMEMOTO #define mld_reserved	mld_icmp6_hdr.icmp6_data16[1]
2029efc1a1bSBruce M Simpson #define mld_v2_reserved	mld_icmp6_hdr.icmp6_data16[0]
2039efc1a1bSBruce M Simpson #define mld_v2_numrecs	mld_icmp6_hdr.icmp6_data16[1]
204686cdd19SJun-ichiro itojun Hagino 
205686cdd19SJun-ichiro itojun Hagino /*
206686cdd19SJun-ichiro itojun Hagino  * Neighbor Discovery
207686cdd19SJun-ichiro itojun Hagino  */
208686cdd19SJun-ichiro itojun Hagino 
209686cdd19SJun-ichiro itojun Hagino struct nd_router_solicit {	/* router solicitation */
210686cdd19SJun-ichiro itojun Hagino 	struct icmp6_hdr 	nd_rs_hdr;
211686cdd19SJun-ichiro itojun Hagino 	/* could be followed by options */
212618d51bbSHajimu UMEMOTO } __packed;
213686cdd19SJun-ichiro itojun Hagino 
214686cdd19SJun-ichiro itojun Hagino #define nd_rs_type	nd_rs_hdr.icmp6_type
215686cdd19SJun-ichiro itojun Hagino #define nd_rs_code	nd_rs_hdr.icmp6_code
216686cdd19SJun-ichiro itojun Hagino #define nd_rs_cksum	nd_rs_hdr.icmp6_cksum
217686cdd19SJun-ichiro itojun Hagino #define nd_rs_reserved	nd_rs_hdr.icmp6_data32[0]
218686cdd19SJun-ichiro itojun Hagino 
219686cdd19SJun-ichiro itojun Hagino struct nd_router_advert {	/* router advertisement */
220686cdd19SJun-ichiro itojun Hagino 	struct icmp6_hdr	nd_ra_hdr;
221686cdd19SJun-ichiro itojun Hagino 	u_int32_t		nd_ra_reachable;	/* reachable time */
222686cdd19SJun-ichiro itojun Hagino 	u_int32_t		nd_ra_retransmit;	/* retransmit timer */
223686cdd19SJun-ichiro itojun Hagino 	/* could be followed by options */
224618d51bbSHajimu UMEMOTO } __packed;
225686cdd19SJun-ichiro itojun Hagino 
226686cdd19SJun-ichiro itojun Hagino #define nd_ra_type		nd_ra_hdr.icmp6_type
227686cdd19SJun-ichiro itojun Hagino #define nd_ra_code		nd_ra_hdr.icmp6_code
228686cdd19SJun-ichiro itojun Hagino #define nd_ra_cksum		nd_ra_hdr.icmp6_cksum
229686cdd19SJun-ichiro itojun Hagino #define nd_ra_curhoplimit	nd_ra_hdr.icmp6_data8[0]
230686cdd19SJun-ichiro itojun Hagino #define nd_ra_flags_reserved	nd_ra_hdr.icmp6_data8[1]
231686cdd19SJun-ichiro itojun Hagino #define ND_RA_FLAG_MANAGED	0x80
232686cdd19SJun-ichiro itojun Hagino #define ND_RA_FLAG_OTHER	0x40
23333841545SHajimu UMEMOTO #define ND_RA_FLAG_HA		0x20
23433841545SHajimu UMEMOTO 
23533841545SHajimu UMEMOTO /*
23633841545SHajimu UMEMOTO  * Router preference values based on draft-draves-ipngwg-router-selection-01.
23733841545SHajimu UMEMOTO  * These are non-standard definitions.
23833841545SHajimu UMEMOTO  */
23933841545SHajimu UMEMOTO #define ND_RA_FLAG_RTPREF_MASK	0x18 /* 00011000 */
24033841545SHajimu UMEMOTO 
24133841545SHajimu UMEMOTO #define ND_RA_FLAG_RTPREF_HIGH	0x08 /* 00001000 */
24233841545SHajimu UMEMOTO #define ND_RA_FLAG_RTPREF_MEDIUM	0x00 /* 00000000 */
24333841545SHajimu UMEMOTO #define ND_RA_FLAG_RTPREF_LOW	0x18 /* 00011000 */
24433841545SHajimu UMEMOTO #define ND_RA_FLAG_RTPREF_RSV	0x10 /* 00010000 */
24533841545SHajimu UMEMOTO 
246201100c5SBjoern A. Zeeb #ifdef EXPERIMENTAL
247201100c5SBjoern A. Zeeb #define	ND_RA_FLAG_IPV6_ONLY	0x02 /* draft-ietf-6man-ipv6only-flag */
248201100c5SBjoern A. Zeeb #endif
249201100c5SBjoern A. Zeeb 
250686cdd19SJun-ichiro itojun Hagino #define nd_ra_router_lifetime	nd_ra_hdr.icmp6_data16[1]
251686cdd19SJun-ichiro itojun Hagino 
252686cdd19SJun-ichiro itojun Hagino struct nd_neighbor_solicit {	/* neighbor solicitation */
253686cdd19SJun-ichiro itojun Hagino 	struct icmp6_hdr	nd_ns_hdr;
254686cdd19SJun-ichiro itojun Hagino 	struct in6_addr		nd_ns_target;	/*target address */
255686cdd19SJun-ichiro itojun Hagino 	/* could be followed by options */
256618d51bbSHajimu UMEMOTO } __packed;
257686cdd19SJun-ichiro itojun Hagino 
258686cdd19SJun-ichiro itojun Hagino #define nd_ns_type		nd_ns_hdr.icmp6_type
259686cdd19SJun-ichiro itojun Hagino #define nd_ns_code		nd_ns_hdr.icmp6_code
260686cdd19SJun-ichiro itojun Hagino #define nd_ns_cksum		nd_ns_hdr.icmp6_cksum
261686cdd19SJun-ichiro itojun Hagino #define nd_ns_reserved		nd_ns_hdr.icmp6_data32[0]
262686cdd19SJun-ichiro itojun Hagino 
263686cdd19SJun-ichiro itojun Hagino struct nd_neighbor_advert {	/* neighbor advertisement */
264686cdd19SJun-ichiro itojun Hagino 	struct icmp6_hdr	nd_na_hdr;
265686cdd19SJun-ichiro itojun Hagino 	struct in6_addr		nd_na_target;	/* target address */
266686cdd19SJun-ichiro itojun Hagino 	/* could be followed by options */
267618d51bbSHajimu UMEMOTO } __packed;
268686cdd19SJun-ichiro itojun Hagino 
269686cdd19SJun-ichiro itojun Hagino #define nd_na_type		nd_na_hdr.icmp6_type
270686cdd19SJun-ichiro itojun Hagino #define nd_na_code		nd_na_hdr.icmp6_code
271686cdd19SJun-ichiro itojun Hagino #define nd_na_cksum		nd_na_hdr.icmp6_cksum
272686cdd19SJun-ichiro itojun Hagino #define nd_na_flags_reserved	nd_na_hdr.icmp6_data32[0]
273686cdd19SJun-ichiro itojun Hagino #if BYTE_ORDER == BIG_ENDIAN
274686cdd19SJun-ichiro itojun Hagino #define ND_NA_FLAG_ROUTER		0x80000000
275686cdd19SJun-ichiro itojun Hagino #define ND_NA_FLAG_SOLICITED		0x40000000
276686cdd19SJun-ichiro itojun Hagino #define ND_NA_FLAG_OVERRIDE		0x20000000
277686cdd19SJun-ichiro itojun Hagino #else
278686cdd19SJun-ichiro itojun Hagino #if BYTE_ORDER == LITTLE_ENDIAN
279686cdd19SJun-ichiro itojun Hagino #define ND_NA_FLAG_ROUTER		0x80
280686cdd19SJun-ichiro itojun Hagino #define ND_NA_FLAG_SOLICITED		0x40
281686cdd19SJun-ichiro itojun Hagino #define ND_NA_FLAG_OVERRIDE		0x20
282686cdd19SJun-ichiro itojun Hagino #endif
283686cdd19SJun-ichiro itojun Hagino #endif
284686cdd19SJun-ichiro itojun Hagino 
285686cdd19SJun-ichiro itojun Hagino struct nd_redirect {		/* redirect */
286686cdd19SJun-ichiro itojun Hagino 	struct icmp6_hdr	nd_rd_hdr;
287686cdd19SJun-ichiro itojun Hagino 	struct in6_addr		nd_rd_target;	/* target address */
288686cdd19SJun-ichiro itojun Hagino 	struct in6_addr		nd_rd_dst;	/* destination address */
289686cdd19SJun-ichiro itojun Hagino 	/* could be followed by options */
290618d51bbSHajimu UMEMOTO } __packed;
291686cdd19SJun-ichiro itojun Hagino 
292686cdd19SJun-ichiro itojun Hagino #define nd_rd_type		nd_rd_hdr.icmp6_type
293686cdd19SJun-ichiro itojun Hagino #define nd_rd_code		nd_rd_hdr.icmp6_code
294686cdd19SJun-ichiro itojun Hagino #define nd_rd_cksum		nd_rd_hdr.icmp6_cksum
295686cdd19SJun-ichiro itojun Hagino #define nd_rd_reserved		nd_rd_hdr.icmp6_data32[0]
296686cdd19SJun-ichiro itojun Hagino 
297686cdd19SJun-ichiro itojun Hagino struct nd_opt_hdr {		/* Neighbor discovery option header */
298686cdd19SJun-ichiro itojun Hagino 	u_int8_t	nd_opt_type;
299686cdd19SJun-ichiro itojun Hagino 	u_int8_t	nd_opt_len;
300686cdd19SJun-ichiro itojun Hagino 	/* followed by option specific data*/
301618d51bbSHajimu UMEMOTO } __packed;
302686cdd19SJun-ichiro itojun Hagino 
303686cdd19SJun-ichiro itojun Hagino #define ND_OPT_SOURCE_LINKADDR		1
304686cdd19SJun-ichiro itojun Hagino #define ND_OPT_TARGET_LINKADDR		2
305686cdd19SJun-ichiro itojun Hagino #define ND_OPT_PREFIX_INFORMATION	3
306686cdd19SJun-ichiro itojun Hagino #define ND_OPT_REDIRECTED_HEADER	4
307686cdd19SJun-ichiro itojun Hagino #define ND_OPT_MTU			5
30811d8451dSHiroki Sato #define ND_OPT_NONCE			14	/* RFC 3971 */
309db82af41SHiroki Sato #define ND_OPT_ROUTE_INFO		24	/* RFC 4191 */
3104ab8fc10SBjoern A. Zeeb #define ND_OPT_RDNSS			25	/* RFC 6106 */
3114ab8fc10SBjoern A. Zeeb #define ND_OPT_DNSSL			31	/* RFC 6106 */
3121e8eb413SLexi Winter #define ND_OPT_PREF64			38	/* RFC 8781 */
3131e8eb413SLexi Winter #define ND_OPT_MAX			38
314686cdd19SJun-ichiro itojun Hagino 
315686cdd19SJun-ichiro itojun Hagino struct nd_opt_prefix_info {	/* prefix information */
316686cdd19SJun-ichiro itojun Hagino 	u_int8_t	nd_opt_pi_type;
317686cdd19SJun-ichiro itojun Hagino 	u_int8_t	nd_opt_pi_len;
318686cdd19SJun-ichiro itojun Hagino 	u_int8_t	nd_opt_pi_prefix_len;
319686cdd19SJun-ichiro itojun Hagino 	u_int8_t	nd_opt_pi_flags_reserved;
320686cdd19SJun-ichiro itojun Hagino 	u_int32_t	nd_opt_pi_valid_time;
321686cdd19SJun-ichiro itojun Hagino 	u_int32_t	nd_opt_pi_preferred_time;
322686cdd19SJun-ichiro itojun Hagino 	u_int32_t	nd_opt_pi_reserved2;
323686cdd19SJun-ichiro itojun Hagino 	struct in6_addr	nd_opt_pi_prefix;
324618d51bbSHajimu UMEMOTO } __packed;
325686cdd19SJun-ichiro itojun Hagino 
326686cdd19SJun-ichiro itojun Hagino #define ND_OPT_PI_FLAG_ONLINK		0x80
327686cdd19SJun-ichiro itojun Hagino #define ND_OPT_PI_FLAG_AUTO		0x40
328686cdd19SJun-ichiro itojun Hagino 
329686cdd19SJun-ichiro itojun Hagino struct nd_opt_rd_hdr {		/* redirected header */
330686cdd19SJun-ichiro itojun Hagino 	u_int8_t	nd_opt_rh_type;
331686cdd19SJun-ichiro itojun Hagino 	u_int8_t	nd_opt_rh_len;
332686cdd19SJun-ichiro itojun Hagino 	u_int16_t	nd_opt_rh_reserved1;
333686cdd19SJun-ichiro itojun Hagino 	u_int32_t	nd_opt_rh_reserved2;
334686cdd19SJun-ichiro itojun Hagino 	/* followed by IP header and data */
335618d51bbSHajimu UMEMOTO } __packed;
336686cdd19SJun-ichiro itojun Hagino 
337686cdd19SJun-ichiro itojun Hagino struct nd_opt_mtu {		/* MTU option */
338686cdd19SJun-ichiro itojun Hagino 	u_int8_t	nd_opt_mtu_type;
339686cdd19SJun-ichiro itojun Hagino 	u_int8_t	nd_opt_mtu_len;
340686cdd19SJun-ichiro itojun Hagino 	u_int16_t	nd_opt_mtu_reserved;
341686cdd19SJun-ichiro itojun Hagino 	u_int32_t	nd_opt_mtu_mtu;
342618d51bbSHajimu UMEMOTO } __packed;
343686cdd19SJun-ichiro itojun Hagino 
34411d8451dSHiroki Sato #define	ND_OPT_NONCE_LEN	((1 * 8) - 2)
34511d8451dSHiroki Sato #if ((ND_OPT_NONCE_LEN + 2) % 8) != 0
34611d8451dSHiroki Sato #error "(ND_OPT_NONCE_LEN + 2) must be a multiple of 8."
34711d8451dSHiroki Sato #endif
34811d8451dSHiroki Sato struct nd_opt_nonce {		/* nonce option */
34911d8451dSHiroki Sato 	u_int8_t	nd_opt_nonce_type;
35011d8451dSHiroki Sato 	u_int8_t	nd_opt_nonce_len;
35111d8451dSHiroki Sato 	u_int8_t	nd_opt_nonce[ND_OPT_NONCE_LEN];
35211d8451dSHiroki Sato } __packed;
35311d8451dSHiroki Sato 
35433841545SHajimu UMEMOTO struct nd_opt_route_info {	/* route info */
35533841545SHajimu UMEMOTO 	u_int8_t	nd_opt_rti_type;
35633841545SHajimu UMEMOTO 	u_int8_t	nd_opt_rti_len;
35733841545SHajimu UMEMOTO 	u_int8_t	nd_opt_rti_prefixlen;
35833841545SHajimu UMEMOTO 	u_int8_t	nd_opt_rti_flags;
35933841545SHajimu UMEMOTO 	u_int32_t	nd_opt_rti_lifetime;
36088ff5695SSUZUKI Shinsuke 	/* prefix follows */
361618d51bbSHajimu UMEMOTO } __packed;
362a96c0066SMunechika SUMIKAWA 
363db82af41SHiroki Sato struct nd_opt_rdnss {		/* RDNSS option (RFC 6106) */
364db82af41SHiroki Sato 	u_int8_t	nd_opt_rdnss_type;
365db82af41SHiroki Sato 	u_int8_t	nd_opt_rdnss_len;
366db82af41SHiroki Sato 	u_int16_t	nd_opt_rdnss_reserved;
367db82af41SHiroki Sato 	u_int32_t	nd_opt_rdnss_lifetime;
368db82af41SHiroki Sato 	/* followed by list of recursive DNS servers */
369db82af41SHiroki Sato } __packed;
370db82af41SHiroki Sato 
371db82af41SHiroki Sato struct nd_opt_dnssl {		/* DNSSL option (RFC 6106) */
372db82af41SHiroki Sato 	u_int8_t	nd_opt_dnssl_type;
373db82af41SHiroki Sato 	u_int8_t	nd_opt_dnssl_len;
374db82af41SHiroki Sato 	u_int16_t	nd_opt_dnssl_reserved;
375db82af41SHiroki Sato 	u_int32_t	nd_opt_dnssl_lifetime;
376db82af41SHiroki Sato 	/* followed by list of DNS search domains */
377db82af41SHiroki Sato } __packed;
378db82af41SHiroki Sato 
3791e8eb413SLexi Winter struct nd_opt_pref64 {		/* PREF64 option (RFC 8781) */
3804b75afe8SLexi Winter 	uint8_t		nd_opt_pref64_type;
3814b75afe8SLexi Winter 	uint8_t		nd_opt_pref64_len;
3821e8eb413SLexi Winter 	/* bits 0-12 are the SL, bits 13-15 are the PLC */
3834b75afe8SLexi Winter 	uint16_t	nd_opt_pref64_sl_plc;
3841e8eb413SLexi Winter 	char		nd_opt_prefix[12];
3851e8eb413SLexi Winter } __packed;
3861e8eb413SLexi Winter 
387686cdd19SJun-ichiro itojun Hagino /*
388686cdd19SJun-ichiro itojun Hagino  * icmp6 namelookup
389686cdd19SJun-ichiro itojun Hagino  */
390686cdd19SJun-ichiro itojun Hagino 
391686cdd19SJun-ichiro itojun Hagino struct icmp6_namelookup {
392686cdd19SJun-ichiro itojun Hagino 	struct icmp6_hdr 	icmp6_nl_hdr;
393686cdd19SJun-ichiro itojun Hagino 	u_int8_t	icmp6_nl_nonce[8];
394686cdd19SJun-ichiro itojun Hagino 	int32_t		icmp6_nl_ttl;
395686cdd19SJun-ichiro itojun Hagino #if 0
396686cdd19SJun-ichiro itojun Hagino 	u_int8_t	icmp6_nl_len;
397686cdd19SJun-ichiro itojun Hagino 	u_int8_t	icmp6_nl_name[3];
398686cdd19SJun-ichiro itojun Hagino #endif
399686cdd19SJun-ichiro itojun Hagino 	/* could be followed by options */
400618d51bbSHajimu UMEMOTO } __packed;
401686cdd19SJun-ichiro itojun Hagino 
402686cdd19SJun-ichiro itojun Hagino /*
403686cdd19SJun-ichiro itojun Hagino  * icmp6 node information
404686cdd19SJun-ichiro itojun Hagino  */
405686cdd19SJun-ichiro itojun Hagino struct icmp6_nodeinfo {
406686cdd19SJun-ichiro itojun Hagino 	struct icmp6_hdr icmp6_ni_hdr;
407686cdd19SJun-ichiro itojun Hagino 	u_int8_t icmp6_ni_nonce[8];
408686cdd19SJun-ichiro itojun Hagino 	/* could be followed by reply data */
409618d51bbSHajimu UMEMOTO } __packed;
410686cdd19SJun-ichiro itojun Hagino 
411686cdd19SJun-ichiro itojun Hagino #define ni_type		icmp6_ni_hdr.icmp6_type
412686cdd19SJun-ichiro itojun Hagino #define ni_code		icmp6_ni_hdr.icmp6_code
413686cdd19SJun-ichiro itojun Hagino #define ni_cksum	icmp6_ni_hdr.icmp6_cksum
414686cdd19SJun-ichiro itojun Hagino #define ni_qtype	icmp6_ni_hdr.icmp6_data16[0]
415686cdd19SJun-ichiro itojun Hagino #define ni_flags	icmp6_ni_hdr.icmp6_data16[1]
416686cdd19SJun-ichiro itojun Hagino 
417686cdd19SJun-ichiro itojun Hagino #define NI_QTYPE_NOOP		0 /* NOOP  */
418686cdd19SJun-ichiro itojun Hagino #define NI_QTYPE_SUPTYPES	1 /* Supported Qtypes */
41933841545SHajimu UMEMOTO #define NI_QTYPE_FQDN		2 /* FQDN (draft 04) */
42033841545SHajimu UMEMOTO #define NI_QTYPE_DNSNAME	2 /* DNS Name */
42133841545SHajimu UMEMOTO #define NI_QTYPE_NODEADDR	3 /* Node Addresses */
42233841545SHajimu UMEMOTO #define NI_QTYPE_IPV4ADDR	4 /* IPv4 Addresses */
423686cdd19SJun-ichiro itojun Hagino 
424686cdd19SJun-ichiro itojun Hagino #if BYTE_ORDER == BIG_ENDIAN
425686cdd19SJun-ichiro itojun Hagino #define NI_SUPTYPE_FLAG_COMPRESS	0x1
426686cdd19SJun-ichiro itojun Hagino #define NI_FQDN_FLAG_VALIDTTL		0x1
427686cdd19SJun-ichiro itojun Hagino #elif BYTE_ORDER == LITTLE_ENDIAN
428686cdd19SJun-ichiro itojun Hagino #define NI_SUPTYPE_FLAG_COMPRESS	0x0100
429686cdd19SJun-ichiro itojun Hagino #define NI_FQDN_FLAG_VALIDTTL		0x0100
430686cdd19SJun-ichiro itojun Hagino #endif
431686cdd19SJun-ichiro itojun Hagino 
432686cdd19SJun-ichiro itojun Hagino #ifdef NAME_LOOKUPS_04
433686cdd19SJun-ichiro itojun Hagino #if BYTE_ORDER == BIG_ENDIAN
434686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_LINKLOCAL	0x1
435686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_SITELOCAL	0x2
436686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_GLOBAL		0x4
437686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_ALL		0x8
438686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_TRUNCATE	0x10
439686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_ANYCAST	0x20 /* just experimental. not in spec */
440686cdd19SJun-ichiro itojun Hagino #elif BYTE_ORDER == LITTLE_ENDIAN
441686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_LINKLOCAL	0x0100
442686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_SITELOCAL	0x0200
443686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_GLOBAL		0x0400
444686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_ALL		0x0800
445686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_TRUNCATE	0x1000
446686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_ANYCAST	0x2000 /* just experimental. not in spec */
447686cdd19SJun-ichiro itojun Hagino #endif
448686cdd19SJun-ichiro itojun Hagino #else  /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
449686cdd19SJun-ichiro itojun Hagino #if BYTE_ORDER == BIG_ENDIAN
450686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_TRUNCATE	0x1
451686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_ALL		0x2
452686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_COMPAT		0x4
453686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_LINKLOCAL	0x8
454686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_SITELOCAL	0x10
455686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_GLOBAL		0x20
456686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_ANYCAST	0x40 /* just experimental. not in spec */
457686cdd19SJun-ichiro itojun Hagino #elif BYTE_ORDER == LITTLE_ENDIAN
458686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_TRUNCATE	0x0100
459686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_ALL		0x0200
460686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_COMPAT		0x0400
461686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_LINKLOCAL	0x0800
462686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_SITELOCAL	0x1000
463686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_GLOBAL		0x2000
464686cdd19SJun-ichiro itojun Hagino #define NI_NODEADDR_FLAG_ANYCAST	0x4000 /* just experimental. not in spec */
465686cdd19SJun-ichiro itojun Hagino #endif
466686cdd19SJun-ichiro itojun Hagino #endif
467686cdd19SJun-ichiro itojun Hagino 
468686cdd19SJun-ichiro itojun Hagino struct ni_reply_fqdn {
469686cdd19SJun-ichiro itojun Hagino 	u_int32_t ni_fqdn_ttl;	/* TTL */
470686cdd19SJun-ichiro itojun Hagino 	u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
471686cdd19SJun-ichiro itojun Hagino 	u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
472618d51bbSHajimu UMEMOTO } __packed;
473686cdd19SJun-ichiro itojun Hagino 
474686cdd19SJun-ichiro itojun Hagino /*
475686cdd19SJun-ichiro itojun Hagino  * Router Renumbering. as router-renum-08.txt
476686cdd19SJun-ichiro itojun Hagino  */
477686cdd19SJun-ichiro itojun Hagino struct icmp6_router_renum {	/* router renumbering header */
478686cdd19SJun-ichiro itojun Hagino 	struct icmp6_hdr	rr_hdr;
479686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rr_segnum;
480686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rr_flags;
481686cdd19SJun-ichiro itojun Hagino 	u_int16_t	rr_maxdelay;
482686cdd19SJun-ichiro itojun Hagino 	u_int32_t	rr_reserved;
483618d51bbSHajimu UMEMOTO } __packed;
48433841545SHajimu UMEMOTO 
48533841545SHajimu UMEMOTO #define ICMP6_RR_FLAGS_TEST		0x80
48633841545SHajimu UMEMOTO #define ICMP6_RR_FLAGS_REQRESULT	0x40
48733841545SHajimu UMEMOTO #define ICMP6_RR_FLAGS_FORCEAPPLY	0x20
48833841545SHajimu UMEMOTO #define ICMP6_RR_FLAGS_SPECSITE		0x10
48933841545SHajimu UMEMOTO #define ICMP6_RR_FLAGS_PREVDONE		0x08
490686cdd19SJun-ichiro itojun Hagino 
491686cdd19SJun-ichiro itojun Hagino #define rr_type		rr_hdr.icmp6_type
492686cdd19SJun-ichiro itojun Hagino #define rr_code		rr_hdr.icmp6_code
493686cdd19SJun-ichiro itojun Hagino #define rr_cksum	rr_hdr.icmp6_cksum
494686cdd19SJun-ichiro itojun Hagino #define rr_seqnum 	rr_hdr.icmp6_data32[0]
495686cdd19SJun-ichiro itojun Hagino 
496686cdd19SJun-ichiro itojun Hagino struct rr_pco_match {		/* match prefix part */
497686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rpm_code;
498686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rpm_len;
499686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rpm_ordinal;
500686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rpm_matchlen;
501686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rpm_minlen;
502686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rpm_maxlen;
503686cdd19SJun-ichiro itojun Hagino 	u_int16_t	rpm_reserved;
504686cdd19SJun-ichiro itojun Hagino 	struct	in6_addr	rpm_prefix;
505618d51bbSHajimu UMEMOTO } __packed;
506686cdd19SJun-ichiro itojun Hagino 
507686cdd19SJun-ichiro itojun Hagino #define RPM_PCO_ADD		1
508686cdd19SJun-ichiro itojun Hagino #define RPM_PCO_CHANGE		2
509686cdd19SJun-ichiro itojun Hagino #define RPM_PCO_SETGLOBAL	3
510686cdd19SJun-ichiro itojun Hagino #define RPM_PCO_MAX		4
511686cdd19SJun-ichiro itojun Hagino 
512686cdd19SJun-ichiro itojun Hagino struct rr_pco_use {		/* use prefix part */
513686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rpu_uselen;
514686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rpu_keeplen;
515686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rpu_ramask;
516686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rpu_raflags;
517686cdd19SJun-ichiro itojun Hagino 	u_int32_t	rpu_vltime;
518686cdd19SJun-ichiro itojun Hagino 	u_int32_t	rpu_pltime;
519686cdd19SJun-ichiro itojun Hagino 	u_int32_t	rpu_flags;
520686cdd19SJun-ichiro itojun Hagino 	struct	in6_addr rpu_prefix;
521618d51bbSHajimu UMEMOTO } __packed;
522686cdd19SJun-ichiro itojun Hagino #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK	0x80
523686cdd19SJun-ichiro itojun Hagino #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO	0x40
524686cdd19SJun-ichiro itojun Hagino 
525686cdd19SJun-ichiro itojun Hagino #if BYTE_ORDER == BIG_ENDIAN
526686cdd19SJun-ichiro itojun Hagino #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80000000
527686cdd19SJun-ichiro itojun Hagino #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40000000
528686cdd19SJun-ichiro itojun Hagino #elif BYTE_ORDER == LITTLE_ENDIAN
529686cdd19SJun-ichiro itojun Hagino #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80
530686cdd19SJun-ichiro itojun Hagino #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40
531686cdd19SJun-ichiro itojun Hagino #endif
532686cdd19SJun-ichiro itojun Hagino 
533686cdd19SJun-ichiro itojun Hagino struct rr_result {		/* router renumbering result message */
534686cdd19SJun-ichiro itojun Hagino 	u_int16_t	rrr_flags;
535686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rrr_ordinal;
536686cdd19SJun-ichiro itojun Hagino 	u_int8_t	rrr_matchedlen;
537686cdd19SJun-ichiro itojun Hagino 	u_int32_t	rrr_ifid;
538686cdd19SJun-ichiro itojun Hagino 	struct	in6_addr rrr_prefix;
539618d51bbSHajimu UMEMOTO } __packed;
540686cdd19SJun-ichiro itojun Hagino #if BYTE_ORDER == BIG_ENDIAN
541686cdd19SJun-ichiro itojun Hagino #define ICMP6_RR_RESULT_FLAGS_OOB		0x0002
542686cdd19SJun-ichiro itojun Hagino #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0001
543686cdd19SJun-ichiro itojun Hagino #elif BYTE_ORDER == LITTLE_ENDIAN
54433841545SHajimu UMEMOTO #define ICMP6_RR_RESULT_FLAGS_OOB		0x0200
54533841545SHajimu UMEMOTO #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0100
546686cdd19SJun-ichiro itojun Hagino #endif
547686cdd19SJun-ichiro itojun Hagino 
548686cdd19SJun-ichiro itojun Hagino /*
549686cdd19SJun-ichiro itojun Hagino  * icmp6 filter structures.
550686cdd19SJun-ichiro itojun Hagino  */
551686cdd19SJun-ichiro itojun Hagino 
552686cdd19SJun-ichiro itojun Hagino struct icmp6_filter {
553686cdd19SJun-ichiro itojun Hagino 	u_int32_t icmp6_filt[8];
554686cdd19SJun-ichiro itojun Hagino };
555686cdd19SJun-ichiro itojun Hagino 
556686cdd19SJun-ichiro itojun Hagino #ifdef _KERNEL
557686cdd19SJun-ichiro itojun Hagino #define	ICMP6_FILTER_SETPASSALL(filterp) \
558686cdd19SJun-ichiro itojun Hagino do {								\
559686cdd19SJun-ichiro itojun Hagino 	int i; u_char *p;					\
560686cdd19SJun-ichiro itojun Hagino 	p = (u_char *)filterp;					\
561686cdd19SJun-ichiro itojun Hagino 	for (i = 0; i < sizeof(struct icmp6_filter); i++)	\
562686cdd19SJun-ichiro itojun Hagino 		p[i] = 0xff;					\
5635c6ebad8SHajimu UMEMOTO } while (/*CONSTCOND*/ 0)
564686cdd19SJun-ichiro itojun Hagino #define	ICMP6_FILTER_SETBLOCKALL(filterp) \
565686cdd19SJun-ichiro itojun Hagino 	bzero(filterp, sizeof(struct icmp6_filter))
566686cdd19SJun-ichiro itojun Hagino #else /* _KERNEL */
567686cdd19SJun-ichiro itojun Hagino #define	ICMP6_FILTER_SETPASSALL(filterp) \
568686cdd19SJun-ichiro itojun Hagino 	memset(filterp, 0xff, sizeof(struct icmp6_filter))
569686cdd19SJun-ichiro itojun Hagino #define	ICMP6_FILTER_SETBLOCKALL(filterp) \
570686cdd19SJun-ichiro itojun Hagino 	memset(filterp, 0x00, sizeof(struct icmp6_filter))
571686cdd19SJun-ichiro itojun Hagino #endif /* _KERNEL */
572686cdd19SJun-ichiro itojun Hagino 
573686cdd19SJun-ichiro itojun Hagino #define	ICMP6_FILTER_SETPASS(type, filterp) \
574686cdd19SJun-ichiro itojun Hagino 	(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
575686cdd19SJun-ichiro itojun Hagino #define	ICMP6_FILTER_SETBLOCK(type, filterp) \
576686cdd19SJun-ichiro itojun Hagino 	(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
577686cdd19SJun-ichiro itojun Hagino #define	ICMP6_FILTER_WILLPASS(type, filterp) \
578686cdd19SJun-ichiro itojun Hagino 	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
579686cdd19SJun-ichiro itojun Hagino #define	ICMP6_FILTER_WILLBLOCK(type, filterp) \
580686cdd19SJun-ichiro itojun Hagino 	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
581686cdd19SJun-ichiro itojun Hagino 
582686cdd19SJun-ichiro itojun Hagino /*
583686cdd19SJun-ichiro itojun Hagino  * Variables related to this implementation
584686cdd19SJun-ichiro itojun Hagino  * of the internet control message protocol version 6.
585686cdd19SJun-ichiro itojun Hagino  */
586686cdd19SJun-ichiro itojun Hagino struct icmp6stat {
587686cdd19SJun-ichiro itojun Hagino /* statistics related to icmp6 packets generated */
588c80211e3SAndrey V. Elsukov 	uint64_t icp6s_error;		/* # of calls to icmp6_error */
589c80211e3SAndrey V. Elsukov 	uint64_t icp6s_canterror;	/* no error 'cuz old was icmp */
590c80211e3SAndrey V. Elsukov 	uint64_t icp6s_toofreq;		/* no error 'cuz rate limitation */
591c80211e3SAndrey V. Elsukov 	uint64_t icp6s_outhist[256];
592686cdd19SJun-ichiro itojun Hagino /* statistics related to input message processed */
593c80211e3SAndrey V. Elsukov 	uint64_t icp6s_badcode;		/* icmp6_code out of range */
594c80211e3SAndrey V. Elsukov 	uint64_t icp6s_tooshort;	/* packet < sizeof(struct icmp6_hdr) */
595c80211e3SAndrey V. Elsukov 	uint64_t icp6s_checksum;	/* bad checksum */
596c80211e3SAndrey V. Elsukov 	uint64_t icp6s_badlen;		/* calculated bound mismatch */
597d18b4becSArseny Smalyuk 	uint64_t icp6s_dropped;		/* # of packets dropped waiting for a resolution */
59888ff5695SSUZUKI Shinsuke 	/*
59988ff5695SSUZUKI Shinsuke 	 * number of responses: this member is inherited from netinet code, but
60088ff5695SSUZUKI Shinsuke 	 * for netinet6 code, it is already available in icp6s_outhist[].
60188ff5695SSUZUKI Shinsuke 	 */
602c80211e3SAndrey V. Elsukov 	uint64_t icp6s_reflect;
603c80211e3SAndrey V. Elsukov 	uint64_t icp6s_inhist[256];
604c80211e3SAndrey V. Elsukov 	uint64_t icp6s_nd_toomanyopt;	/* too many ND options */
60560d8dbbeSKristof Provost 	uint64_t icp6s_odst_unreach_noroute;
60660d8dbbeSKristof Provost 	uint64_t icp6s_odst_unreach_admin;
60760d8dbbeSKristof Provost 	uint64_t icp6s_odst_unreach_beyondscope;
60860d8dbbeSKristof Provost 	uint64_t icp6s_odst_unreach_addr;
60960d8dbbeSKristof Provost 	uint64_t icp6s_odst_unreach_noport;
61060d8dbbeSKristof Provost 	uint64_t icp6s_opacket_too_big;
61160d8dbbeSKristof Provost 	uint64_t icp6s_otime_exceed_transit;
61260d8dbbeSKristof Provost 	uint64_t icp6s_otime_exceed_reassembly;
61360d8dbbeSKristof Provost 	uint64_t icp6s_oparamprob_header;
61460d8dbbeSKristof Provost 	uint64_t icp6s_oparamprob_nextheader;
61560d8dbbeSKristof Provost 	uint64_t icp6s_oparamprob_option;
61660d8dbbeSKristof Provost 	uint64_t icp6s_oredirect;
61760d8dbbeSKristof Provost 	uint64_t icp6s_ounknown;
618c80211e3SAndrey V. Elsukov 	uint64_t icp6s_pmtuchg;		/* path MTU changes */
619c80211e3SAndrey V. Elsukov 	uint64_t icp6s_nd_badopt;	/* bad ND options */
620c80211e3SAndrey V. Elsukov 	uint64_t icp6s_badns;		/* bad neighbor solicitation */
621c80211e3SAndrey V. Elsukov 	uint64_t icp6s_badna;		/* bad neighbor advertisement */
622f813e520SCy Schubert 	uint64_t icp6s_badrs;		/* bad router solicitation */
623c80211e3SAndrey V. Elsukov 	uint64_t icp6s_badra;		/* bad router advertisement */
624c80211e3SAndrey V. Elsukov 	uint64_t icp6s_badredirect;	/* bad redirect message */
625d2b8fd0dSBjoern A. Zeeb 	uint64_t icp6s_overflowdefrtr;	/* Too many default routers. */
626d2b8fd0dSBjoern A. Zeeb 	uint64_t icp6s_overflowprfx;	/* Too many prefixes. */
627d2b8fd0dSBjoern A. Zeeb 	uint64_t icp6s_overflownndp;	/* Too many neighbour entries. */
628d2b8fd0dSBjoern A. Zeeb 	uint64_t icp6s_overflowredirect;/* Too many redirects. */
6294caea9b1SMark Johnston 	uint64_t icp6s_invlhlim;	/* Invalid hop limit. */
6304caea9b1SMark Johnston 	uint64_t icp6s_spare[32];
631686cdd19SJun-ichiro itojun Hagino };
632686cdd19SJun-ichiro itojun Hagino 
633e27b0c87SRobert Watson #ifdef _KERNEL
634a786f679SAndrey V. Elsukov #include <sys/counter.h>
63560d8dbbeSKristof Provost #include <netinet/in_kdtrace.h>
636a786f679SAndrey V. Elsukov 
6374f96be33SGleb Smirnoff #ifdef SYSCTL_DECL
6384f96be33SGleb Smirnoff SYSCTL_DECL(_net_inet6_icmp6);
6394f96be33SGleb Smirnoff #endif
6404f96be33SGleb Smirnoff 
641a786f679SAndrey V. Elsukov VNET_PCPUSTAT_DECLARE(struct icmp6stat, icmp6stat);
642315e3e38SRobert Watson /*
643315e3e38SRobert Watson  * In-kernel consumers can use these accessor macros directly to update
644315e3e38SRobert Watson  * stats.
645315e3e38SRobert Watson  */
646a786f679SAndrey V. Elsukov #define ICMP6STAT_ADD(name, val)                                             \
64760d8dbbeSKristof Provost 	do {                                                                 \
64860d8dbbeSKristof Provost 		MIB_SDT_PROBE1(icmp6, count, name, (val));                   \
64960d8dbbeSKristof Provost 		VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, (val)); \
65060d8dbbeSKristof Provost 	} while (0)
651e27b0c87SRobert Watson #define ICMP6STAT_INC(name) ICMP6STAT_ADD(name, 1)
65260d8dbbeSKristof Provost #define ICMP6STAT_INC2(name, type)                                       \
65360d8dbbeSKristof Provost 	do {                                                             \
65460d8dbbeSKristof Provost 		MIB_SDT_PROBE2(icmp6, count, name, 1, type);             \
65560d8dbbeSKristof Provost 		VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, 1); \
65660d8dbbeSKristof Provost 	} while (0)
657315e3e38SRobert Watson 
658315e3e38SRobert Watson /*
659315e3e38SRobert Watson  * Kernel module consumers must use this accessor macro.
660315e3e38SRobert Watson  */
661315e3e38SRobert Watson void	kmod_icmp6stat_inc(int statnum);
662315e3e38SRobert Watson #define KMOD_ICMP6STAT_INC(name)                                          \
66360d8dbbeSKristof Provost 	do {                                                              \
66460d8dbbeSKristof Provost 		MIB_SDT_PROBE1(icmp6, count, name, 1);                    \
66560d8dbbeSKristof Provost 		kmod_icmp6stat_inc(                                       \
66660d8dbbeSKristof Provost 		    offsetof(struct icmp6stat, name) / sizeof(uint64_t)); \
66760d8dbbeSKristof Provost 	} while (0)
668e27b0c87SRobert Watson #endif
669e27b0c87SRobert Watson 
670686cdd19SJun-ichiro itojun Hagino /*
671686cdd19SJun-ichiro itojun Hagino  * Names for ICMP sysctl objects
672686cdd19SJun-ichiro itojun Hagino  */
673686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_STATS		1
674686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_REDIRACCEPT	2	/* accept/process redirects */
675686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_REDIRTIMEOUT	3	/* redirect cache time */
67633841545SHajimu UMEMOTO #if 0	/*obsoleted*/
677686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_ERRRATELIMIT	5	/* ICMPv6 error rate limitation */
67833841545SHajimu UMEMOTO #endif
679686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_ND6_PRUNE	6
680686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_ND6_DELAY	8
681686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_ND6_UMAXTRIES	9
682686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_ND6_MMAXTRIES		10
683686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_ND6_USELOOPBACK	11
684686cdd19SJun-ichiro itojun Hagino /*#define ICMPV6CTL_ND6_PROXYALL	12	obsoleted, do not reuse here */
685686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_NODEINFO	13
686686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_ERRPPSLIMIT	14	/* ICMPv6 error pps limitation */
687686cdd19SJun-ichiro itojun Hagino #define ICMPV6CTL_ND6_MAXNUDHINT	15
68833841545SHajimu UMEMOTO #define ICMPV6CTL_MTUDISC_HIWAT	16
68933841545SHajimu UMEMOTO #define ICMPV6CTL_MTUDISC_LOWAT	17
69033841545SHajimu UMEMOTO #define ICMPV6CTL_ND6_DEBUG	18
69133841545SHajimu UMEMOTO #define ICMPV6CTL_ND6_DRLIST	19
69233841545SHajimu UMEMOTO #define ICMPV6CTL_ND6_PRLIST	20
693743eee66SSUZUKI Shinsuke #define ICMPV6CTL_MLD_MAXSRCFILTER	21
694743eee66SSUZUKI Shinsuke #define ICMPV6CTL_MLD_SOMAXSRC	22
695743eee66SSUZUKI Shinsuke #define ICMPV6CTL_MLD_VERSION	23
696743eee66SSUZUKI Shinsuke #define ICMPV6CTL_ND6_MAXQLEN	24
6975df1b6b5SHiroki Sato #define ICMPV6CTL_NODEINFO_OLDMCPREFIX	25
6985df1b6b5SHiroki Sato #define ICMPV6CTL_MAXID		26
699686cdd19SJun-ichiro itojun Hagino 
700686cdd19SJun-ichiro itojun Hagino #ifdef _KERNEL
701686cdd19SJun-ichiro itojun Hagino # ifdef __STDC__
7029ac7c6cfSAlexander V. Chernikov struct	nhop_object;
703686cdd19SJun-ichiro itojun Hagino struct	rttimer;
704686cdd19SJun-ichiro itojun Hagino struct	in6_multi;
705686cdd19SJun-ichiro itojun Hagino # endif
7064d77a549SAlfred Perlstein void	icmp6_paramerror(struct mbuf *, int);
707fcb3f813SGleb Smirnoff int	icmp6_errmap(const struct icmp6_hdr *);
7084d77a549SAlfred Perlstein void	icmp6_error(struct mbuf *, int, int, int);
709a1f7e5f8SHajimu UMEMOTO void	icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
7104d77a549SAlfred Perlstein int	icmp6_input(struct mbuf **, int *, int);
7114d77a549SAlfred Perlstein void	icmp6_prepare(struct mbuf *);
7124d77a549SAlfred Perlstein void	icmp6_redirect_input(struct mbuf *, int);
7139ac7c6cfSAlexander V. Chernikov void	icmp6_redirect_output(struct mbuf *, struct nhop_object *);
714a974702eSKristof Provost int	icmp6_ratelimit(const struct in6_addr *, const int, const int);
715686cdd19SJun-ichiro itojun Hagino 
71633841545SHajimu UMEMOTO struct	ip6ctlparam;
7174d77a549SAlfred Perlstein void	icmp6_mtudisc_update(struct ip6ctlparam *, int);
71833841545SHajimu UMEMOTO 
719686cdd19SJun-ichiro itojun Hagino /* XXX: is this the right place for these macros? */
720686cdd19SJun-ichiro itojun Hagino #define icmp6_ifstat_inc(ifp, tag) \
721686cdd19SJun-ichiro itojun Hagino do {								\
72231b1bfe1SHajimu UMEMOTO 	if (ifp)						\
7232841260cSAndrey V. Elsukov 		counter_u64_add(((struct in6_ifextra *)		\
7242841260cSAndrey V. Elsukov 		    ((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat[\
7252841260cSAndrey V. Elsukov 		    offsetof(struct icmp6_ifstat, tag) / sizeof(uint64_t)], 1);\
7265c6ebad8SHajimu UMEMOTO } while (/*CONSTCOND*/ 0)
727686cdd19SJun-ichiro itojun Hagino 
728686cdd19SJun-ichiro itojun Hagino #define icmp6_ifoutstat_inc(ifp, type, code) \
729686cdd19SJun-ichiro itojun Hagino do { \
730686cdd19SJun-ichiro itojun Hagino 		icmp6_ifstat_inc(ifp, ifs6_out_msg); \
731686cdd19SJun-ichiro itojun Hagino  		if (type < ICMP6_INFOMSG_MASK) \
732686cdd19SJun-ichiro itojun Hagino  			icmp6_ifstat_inc(ifp, ifs6_out_error); \
733686cdd19SJun-ichiro itojun Hagino 		switch (type) { \
734686cdd19SJun-ichiro itojun Hagino 		 case ICMP6_DST_UNREACH: \
735686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
736686cdd19SJun-ichiro itojun Hagino 			 if (code == ICMP6_DST_UNREACH_ADMIN) \
737686cdd19SJun-ichiro itojun Hagino 				 icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
738686cdd19SJun-ichiro itojun Hagino 			 break; \
739686cdd19SJun-ichiro itojun Hagino 		 case ICMP6_PACKET_TOO_BIG: \
740686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
741686cdd19SJun-ichiro itojun Hagino 			 break; \
742686cdd19SJun-ichiro itojun Hagino 		 case ICMP6_TIME_EXCEEDED: \
743686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
744686cdd19SJun-ichiro itojun Hagino 			 break; \
745686cdd19SJun-ichiro itojun Hagino 		 case ICMP6_PARAM_PROB: \
746686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
747686cdd19SJun-ichiro itojun Hagino 			 break; \
748686cdd19SJun-ichiro itojun Hagino 		 case ICMP6_ECHO_REQUEST: \
749686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_echo); \
750686cdd19SJun-ichiro itojun Hagino 			 break; \
751686cdd19SJun-ichiro itojun Hagino 		 case ICMP6_ECHO_REPLY: \
752686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
753686cdd19SJun-ichiro itojun Hagino 			 break; \
75481170631SHajimu UMEMOTO 		 case MLD_LISTENER_QUERY: \
755686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
756686cdd19SJun-ichiro itojun Hagino 			 break; \
75781170631SHajimu UMEMOTO 		 case MLD_LISTENER_REPORT: \
758686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
759686cdd19SJun-ichiro itojun Hagino 			 break; \
76081170631SHajimu UMEMOTO 		 case MLD_LISTENER_DONE: \
761686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
762686cdd19SJun-ichiro itojun Hagino 			 break; \
763686cdd19SJun-ichiro itojun Hagino 		 case ND_ROUTER_SOLICIT: \
764686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
765686cdd19SJun-ichiro itojun Hagino 			 break; \
766686cdd19SJun-ichiro itojun Hagino 		 case ND_ROUTER_ADVERT: \
767686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
768686cdd19SJun-ichiro itojun Hagino 			 break; \
769686cdd19SJun-ichiro itojun Hagino 		 case ND_NEIGHBOR_SOLICIT: \
770686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
771686cdd19SJun-ichiro itojun Hagino 			 break; \
772686cdd19SJun-ichiro itojun Hagino 		 case ND_NEIGHBOR_ADVERT: \
773686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
774686cdd19SJun-ichiro itojun Hagino 			 break; \
775686cdd19SJun-ichiro itojun Hagino 		 case ND_REDIRECT: \
776686cdd19SJun-ichiro itojun Hagino 			 icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
777686cdd19SJun-ichiro itojun Hagino 			 break; \
778686cdd19SJun-ichiro itojun Hagino 		} \
7795c6ebad8SHajimu UMEMOTO } while (/*CONSTCOND*/ 0)
780686cdd19SJun-ichiro itojun Hagino 
78118706985SJINMEI Tatuya #define ICMP6_NODEINFO_FQDNOK		0x1
78218706985SJINMEI Tatuya #define ICMP6_NODEINFO_NODEADDROK	0x2
78318706985SJINMEI Tatuya #define ICMP6_NODEINFO_TMPADDROK	0x4
78418706985SJINMEI Tatuya #define ICMP6_NODEINFO_GLOBALOK		0x8
785686cdd19SJun-ichiro itojun Hagino #endif /* _KERNEL */
786686cdd19SJun-ichiro itojun Hagino 
787686cdd19SJun-ichiro itojun Hagino #endif /* not _NETINET_ICMP6_H_ */
788