1ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti/*	$NetBSD: icmp6.h,v 1.47 2013/07/01 12:43:15 christos Exp $	*/
26846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*	$KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $	*/
36846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
46846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
56846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
66846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
76846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * All rights reserved.
86846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *
96846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Redistribution and use in source and binary forms, with or without
106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * modification, are permitted provided that the following conditions
116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * are met:
126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 1. Redistributions of source code must retain the above copyright
136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *    notice, this list of conditions and the following disclaimer.
146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 2. Redistributions in binary form must reproduce the above copyright
156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *    notice, this list of conditions and the following disclaimer in the
166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *    documentation and/or other materials provided with the distribution.
176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 3. Neither the name of the project nor the names of its contributors
186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *    may be used to endorse or promote products derived from this software
196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *    without specific prior written permission.
206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *
216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * SUCH DAMAGE.
326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Copyright (c) 1982, 1986, 1993
366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *	The Regents of the University of California.  All rights reserved.
376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *
386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Redistribution and use in source and binary forms, with or without
396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * modification, are permitted provided that the following conditions
406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * are met:
416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 1. Redistributions of source code must retain the above copyright
426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *    notice, this list of conditions and the following disclaimer.
436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 2. Redistributions in binary form must reproduce the above copyright
446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *    notice, this list of conditions and the following disclaimer in the
456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *    documentation and/or other materials provided with the distribution.
466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * 3. Neither the name of the University nor the names of its contributors
476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *    may be used to endorse or promote products derived from this software
486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *    without specific prior written permission.
496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *
506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * SUCH DAMAGE.
616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *
626846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson *	@(#)ip_icmp.h	8.1 (Berkeley) 6/10/93
636846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#ifndef _NETINET_ICMP6_H_
666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define _NETINET_ICMP6_H_
676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
683a040d8379a3b1f9731ae93e1a7118c589f1936eElliott Hughes#include <netinet/in.h> /* android-added: glibc source compatibility. */
693a040d8379a3b1f9731ae93e1a7118c589f1936eElliott Hughes
706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6_PLD_MAXLEN	1232	/* IPV6_MMTU - sizeof(struct ip6_hdr)
716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson					   - sizeof(struct icmp6_hdr) */
726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct icmp6_hdr {
746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	icmp6_type;	/* type field */
756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	icmp6_code;	/* code field */
766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int16_t	icmp6_cksum;	/* checksum field */
776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	union {
786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		u_int32_t	icmp6_un_data32[1]; /* type-specific field */
796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		u_int16_t	icmp6_un_data16[2]; /* type-specific field */
806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		u_int8_t	icmp6_un_data8[4];  /* type-specific field */
816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	} icmp6_dataun;
826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_data32	icmp6_dataun.icmp6_un_data32
856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_data16	icmp6_dataun.icmp6_un_data16
866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_data8	icmp6_dataun.icmp6_un_data8
876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_pptr	icmp6_data32[0]		/* parameter prob */
886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_mtu	icmp6_data32[0]		/* packet too big */
896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_id	icmp6_data16[0]		/* echo request/reply */
906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_seq	icmp6_data16[1]		/* echo request/reply */
916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_maxdelay	icmp6_data16[0]		/* mcast group membership */
926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH		1	/* dest unreachable, codes: */
946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_PACKET_TOO_BIG		2	/* packet too big */
956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_TIME_EXCEEDED		3	/* time exceeded, code: */
966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_PARAM_PROB		4	/* ip6 header bad */
976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ECHO_REQUEST		128	/* echo service */
996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ECHO_REPLY		129	/* echo reply */
1006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_LISTENER_QUERY		130 	/* multicast listener query */
1016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_LISTENER_REPORT		131	/* multicast listener report */
1026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_LISTENER_DONE		132	/* multicast listener done */
103ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */
1046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* RFC2292 decls */
1066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_MEMBERSHIP_QUERY		130	/* group membership query */
1076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_MEMBERSHIP_REPORT		131	/* group membership report */
1086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_MEMBERSHIP_REDUCTION	132	/* group membership termination */
1096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#ifndef _KERNEL
1116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* the followings are for backward compatibility to old KAME apps. */
1126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD6_LISTENER_QUERY	MLD_LISTENER_QUERY
1136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD6_LISTENER_REPORT	MLD_LISTENER_REPORT
1146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD6_LISTENER_DONE	MLD_LISTENER_DONE
1156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
1166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_ROUTER_SOLICIT		133	/* router solicitation */
1186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_ROUTER_ADVERT		134	/* router advertisement */
1196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NEIGHBOR_SOLICIT		135	/* neighbor solicitation */
1206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NEIGHBOR_ADVERT		136	/* neighbor advertisement */
1216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_REDIRECT			137	/* redirect */
1226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ROUTER_RENUMBERING	138	/* router renumbering */
1246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_WRUREQUEST		139	/* who are you request */
1266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_WRUREPLY			140	/* who are you reply */
1276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_FQDN_QUERY		139	/* FQDN query */
1286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_FQDN_REPLY		140	/* FQDN reply */
1296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_QUERY			139	/* node information request */
1306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_REPLY			140	/* node information reply */
131ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define MLDV2_LISTENER_REPORT		143	/* RFC3810 listener report */
1326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* The definitions below are experimental. TBA */
1346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_MTRACE_RESP			200	/* mtrace response(to sender) */
1356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_MTRACE			201	/* mtrace messages */
1366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#ifndef _KERNEL
1386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* the followings are for backward compatibility to old KAME apps. */
1396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD6_MTRACE_RESP	MLD_MTRACE_RESP
1406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD6_MTRACE		MLD_MTRACE
1416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
1426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_MAXTYPE			201
1446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_NOROUTE	0	/* no route to destination */
1466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_ADMIN	 	1	/* administratively prohibited */
1476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_NOTNEIGHBOR	2	/* not a neighbor(obsolete) */
1486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_BEYONDSCOPE	2	/* beyond scope of source address */
1496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_ADDR		3	/* address unreachable */
1506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_NOPORT	4	/* port unreachable */
151ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ICMP6_DST_UNREACH_POLICY	5	/* source address failed ingress/egress policy */
152ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ICMP6_DST_UNREACH_REJROUTE	6	/* reject route to destination */
153ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ICMP6_DST_UNREACH_SOURCERT	7	/* error in source routing header */
1546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_TIME_EXCEED_TRANSIT 	0	/* ttl==0 in transit */
1566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_TIME_EXCEED_REASSEMBLY	1	/* ttl==0 in reass */
1576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_PARAMPROB_HEADER 	 	0	/* erroneous header field */
1596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_PARAMPROB_NEXTHEADER	1	/* unrecognized next header */
1606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_PARAMPROB_OPTION		2	/* unrecognized option */
1616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1626846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_INFOMSG_MASK		0x80	/* all informational messages */
1636846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_SUBJ_IPV6	0	/* Query Subject is an IPv6 address */
1656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_SUBJ_FQDN	1	/* Query Subject is a Domain name */
1666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_SUBJ_IPV4	2	/* Query Subject is an IPv4 address */
1676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1686846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_SUCCESS	0	/* node information successful reply */
1696846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_REFUSED	1	/* node information request is refused */
1706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_UNKNOWN	2	/* unknown Qtype */
1716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ROUTER_RENUMBERING_COMMAND  0	/* rr command */
1736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ROUTER_RENUMBERING_RESULT   1	/* rr result */
1746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255	/* rr seq num reset */
1756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Used in kernel only */
1776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_REDIRECT_ONLINK	0	/* redirect to an on-link node */
1786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_REDIRECT_ROUTER	1	/* redirect to a better router */
1796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
1816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Multicast Listener Discovery
1826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
1836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct mld_hdr {
1846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct icmp6_hdr	mld_icmp6_hdr;
1856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct in6_addr		mld_addr; /* multicast address */
1866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
1876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* definitions to provide backward compatibility to old KAME applications */
1896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#ifndef _KERNEL
1906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld6_hdr	mld_hdr
1916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld6_type	mld_type
1926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld6_code	mld_code
1936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld6_cksum	mld_cksum
1946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld6_maxdelay	mld_maxdelay
1956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld6_reserved	mld_reserved
1966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld6_addr	mld_addr
1976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
1986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
1996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* shortcut macro definitions */
2006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld_type	mld_icmp6_hdr.icmp6_type
2016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld_code	mld_icmp6_hdr.icmp6_code
2026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld_cksum	mld_icmp6_hdr.icmp6_cksum
2036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld_maxdelay	mld_icmp6_hdr.icmp6_data16[0]
2046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld_reserved	mld_icmp6_hdr.icmp6_data16[1]
2056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_MINLEN			24
2076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
2096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Neighbor Discovery
2106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
2116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_router_solicit {	/* router solicitation */
2136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct icmp6_hdr 	nd_rs_hdr;
2146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* could be followed by options */
2156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
2166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rs_type	nd_rs_hdr.icmp6_type
2186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rs_code	nd_rs_hdr.icmp6_code
2196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rs_cksum	nd_rs_hdr.icmp6_cksum
2206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rs_reserved	nd_rs_hdr.icmp6_data32[0]
2216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_router_advert {	/* router advertisement */
2236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct icmp6_hdr	nd_ra_hdr;
2246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t		nd_ra_reachable;	/* reachable time */
2256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t		nd_ra_retransmit;	/* retransmit timer */
2266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* could be followed by options */
2276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
2286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_type		nd_ra_hdr.icmp6_type
2306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_code		nd_ra_hdr.icmp6_code
2316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_cksum		nd_ra_hdr.icmp6_cksum
2326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_curhoplimit	nd_ra_hdr.icmp6_data8[0]
2336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_flags_reserved	nd_ra_hdr.icmp6_data8[1]
2346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_MANAGED	0x80
2356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_OTHER	0x40
2366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_HOME_AGENT	0x20
2376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
239ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti * Router preference values based on RFC4191.
2406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
2416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_RTPREF_MASK	0x18 /* 00011000 */
2426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_RTPREF_HIGH	0x08 /* 00001000 */
2446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_RTPREF_MEDIUM	0x00 /* 00000000 */
2456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_RTPREF_LOW	0x18 /* 00011000 */
2466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_RTPREF_RSV	0x10 /* 00010000 */
2476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_router_lifetime	nd_ra_hdr.icmp6_data16[1]
2496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_neighbor_solicit {	/* neighbor solicitation */
2516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct icmp6_hdr	nd_ns_hdr;
2526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct in6_addr		nd_ns_target;	/*target address */
2536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* could be followed by options */
2546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
2556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ns_type		nd_ns_hdr.icmp6_type
2576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ns_code		nd_ns_hdr.icmp6_code
2586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ns_cksum		nd_ns_hdr.icmp6_cksum
2596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ns_reserved		nd_ns_hdr.icmp6_data32[0]
2606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_neighbor_advert {	/* neighbor advertisement */
2626846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct icmp6_hdr	nd_na_hdr;
2636846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct in6_addr		nd_na_target;	/* target address */
2646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* could be followed by options */
2656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
2666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_na_type		nd_na_hdr.icmp6_type
2686846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_na_code		nd_na_hdr.icmp6_code
2696846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_na_cksum		nd_na_hdr.icmp6_cksum
2706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_na_flags_reserved	nd_na_hdr.icmp6_data32[0]
2716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if BYTE_ORDER == BIG_ENDIAN
2726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NA_FLAG_ROUTER		0x80000000
2736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NA_FLAG_SOLICITED		0x40000000
2746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NA_FLAG_OVERRIDE		0x20000000
2756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#else
2766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if BYTE_ORDER == LITTLE_ENDIAN
2776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NA_FLAG_ROUTER		0x80
2786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NA_FLAG_SOLICITED		0x40
2796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NA_FLAG_OVERRIDE		0x20
2806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
2816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
2826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_redirect {		/* redirect */
2846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct icmp6_hdr	nd_rd_hdr;
2856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct in6_addr		nd_rd_target;	/* target address */
2866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct in6_addr		nd_rd_dst;	/* destination address */
2876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* could be followed by options */
2886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
2896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rd_type		nd_rd_hdr.icmp6_type
2916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rd_code		nd_rd_hdr.icmp6_code
2926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rd_cksum		nd_rd_hdr.icmp6_cksum
2936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rd_reserved		nd_rd_hdr.icmp6_data32[0]
2946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
2956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_opt_hdr {		/* Neighbor discovery option header */
2966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_type;
2976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_len;
2986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* followed by option specific data*/
2996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
3006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
3016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_SOURCE_LINKADDR		1
3026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_TARGET_LINKADDR		2
3036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_PREFIX_INFORMATION	3
3046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_REDIRECTED_HEADER	4
3056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_MTU			5
3066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_ADVINTERVAL		7
3076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_HOMEAGENT_INFO		8
3086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_SOURCE_ADDRLIST		9
3096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_TARGET_ADDRLIST		10
310ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ND_OPT_MAP			23	/* RFC 5380 */
311ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ND_OPT_ROUTE_INFO		24	/* RFC 4191 */
312ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ND_OPT_RDNSS			25	/* RFC 6016 */
313ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ND_OPT_DNSSL			31	/* RFC 6016 */
3146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
3156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_opt_route_info {	/* route info */
3166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_rti_type;
3176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_rti_len;
3186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_rti_prefixlen;
3196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_rti_flags;
3206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	nd_opt_rti_lifetime;
3216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* prefix follows */
3226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson};
3236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
3246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_opt_prefix_info {	/* prefix information */
3256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_pi_type;
3266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_pi_len;
3276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_pi_prefix_len;
3286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_pi_flags_reserved;
3296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	nd_opt_pi_valid_time;
3306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	nd_opt_pi_preferred_time;
3316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	nd_opt_pi_reserved2;
3326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct in6_addr	nd_opt_pi_prefix;
3336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
3346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
3356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_PI_FLAG_ONLINK		0x80
3366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_PI_FLAG_AUTO		0x40
3376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
3386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_opt_rd_hdr {		/* redirected header */
3396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_rh_type;
3406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_rh_len;
3416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int16_t	nd_opt_rh_reserved1;
3426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	nd_opt_rh_reserved2;
3436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* followed by IP header and data */
3446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
3456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
3466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_opt_mtu {		/* MTU option */
3476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_mtu_type;
3486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_mtu_len;
3496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int16_t	nd_opt_mtu_reserved;
3506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	nd_opt_mtu_mtu;
3516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
3526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
353ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colittistruct nd_opt_rdnss {		/* RDNSS option RFC 6106 */
3546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_rdnss_type;
3556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	nd_opt_rdnss_len;
3566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int16_t	nd_opt_rdnss_reserved;
3576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	nd_opt_rdnss_lifetime;
3586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* followed by list of IP prefixes */
3596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
3606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
361ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colittistruct nd_opt_dnssl {		/* DNSSL option RFC 6106 */
362ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	u_int8_t	nd_opt_dnssl_type;
363ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	u_int8_t	nd_opt_dnssl_len;
364ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	u_int16_t	nd_opt_dnssl_reserved;
365ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	u_int32_t	nd_opt_dnssl_lifetime;
366ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	/* followed by list of IP prefixes */
367ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti} __packed;
368ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti
3696846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
3706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * icmp6 namelookup
3716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
3726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
3736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct icmp6_namelookup {
3746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct icmp6_hdr 	icmp6_nl_hdr;
3756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	icmp6_nl_nonce[8];
3766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	int32_t		icmp6_nl_ttl;
3776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if 0
3786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	icmp6_nl_len;
3796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	icmp6_nl_name[3];
3806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
3816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* could be followed by options */
3826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
3836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
3846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
3856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * icmp6 node information
3866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
3876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct icmp6_nodeinfo {
3886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct icmp6_hdr icmp6_ni_hdr;
3896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t icmp6_ni_nonce[8];
3906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/* could be followed by reply data */
3916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
3926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
393c2cd33efc4b53495db90ecd2cb9fee698b827aa8Elliott Hughes/*
394c2cd33efc4b53495db90ecd2cb9fee698b827aa8Elliott Hughes * BEGIN android-removed: glibc doesn't have these, and external/ping declares them itself.
3956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ni_type		icmp6_ni_hdr.icmp6_type
3966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ni_code		icmp6_ni_hdr.icmp6_code
3976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ni_cksum	icmp6_ni_hdr.icmp6_cksum
3986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ni_qtype	icmp6_ni_hdr.icmp6_data16[0]
3996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ni_flags	icmp6_ni_hdr.icmp6_data16[1]
400c2cd33efc4b53495db90ecd2cb9fee698b827aa8Elliott Hughes * END android-removed
401c2cd33efc4b53495db90ecd2cb9fee698b827aa8Elliott Hughes */
4026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
4036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_NOOP		0 /* NOOP  */
4046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_SUPTYPES	1 /* Supported Qtypes */
4056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_FQDN		2 /* FQDN (draft 04) */
4066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_DNSNAME	2 /* DNS Name */
4076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_NODEADDR	3 /* Node Addresses */
4086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_IPV4ADDR	4 /* IPv4 Addresses */
4096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
4106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if BYTE_ORDER == BIG_ENDIAN
4116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_SUPTYPE_FLAG_COMPRESS	0x1
4126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_FQDN_FLAG_VALIDTTL		0x1
4136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#elif BYTE_ORDER == LITTLE_ENDIAN
4146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_SUPTYPE_FLAG_COMPRESS	0x0100
4156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_FQDN_FLAG_VALIDTTL		0x0100
4166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
4176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
4186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#ifdef NAME_LOOKUPS_04
4196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if BYTE_ORDER == BIG_ENDIAN
4206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_LINKLOCAL	0x1
4216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_SITELOCAL	0x2
4226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_GLOBAL		0x4
4236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ALL		0x8
4246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_TRUNCATE	0x10
4256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ANYCAST	0x20 /* just experimental. not in spec */
4266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#elif BYTE_ORDER == LITTLE_ENDIAN
4276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_LINKLOCAL	0x0100
4286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_SITELOCAL	0x0200
4296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_GLOBAL		0x0400
4306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ALL		0x0800
4316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_TRUNCATE	0x1000
4326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ANYCAST	0x2000 /* just experimental. not in spec */
4336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
4346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#else  /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
4356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if BYTE_ORDER == BIG_ENDIAN
4366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_TRUNCATE	0x1
4376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ALL		0x2
4386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_COMPAT		0x4
4396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_LINKLOCAL	0x8
4406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_SITELOCAL	0x10
4416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_GLOBAL		0x20
4426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ANYCAST	0x40 /* just experimental. not in spec */
4436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#elif BYTE_ORDER == LITTLE_ENDIAN
4446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_TRUNCATE	0x0100
4456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ALL		0x0200
4466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_COMPAT		0x0400
4476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_LINKLOCAL	0x0800
4486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_SITELOCAL	0x1000
4496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_GLOBAL		0x2000
4506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ANYCAST	0x4000 /* just experimental. not in spec */
4516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
4526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
4536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
4546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ni_reply_fqdn {
4556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t ni_fqdn_ttl;	/* TTL */
4566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
4576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
4586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
4596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
4606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
4616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Router Renumbering. as router-renum-08.txt
4626846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
4636846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct icmp6_router_renum {	/* router renumbering header */
4646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct icmp6_hdr	rr_hdr;
4656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rr_segnum;
4666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rr_flags;
4676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int16_t	rr_maxdelay;
4686846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	rr_reserved;
4696846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
4706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
4716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_FLAGS_TEST		0x80
4726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_FLAGS_REQRESULT	0x40
4736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_FLAGS_FORCEAPPLY	0x20
4746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_FLAGS_SPECSITE		0x10
4756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_FLAGS_PREVDONE		0x08
4766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
4776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define rr_type		rr_hdr.icmp6_type
4786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define rr_code		rr_hdr.icmp6_code
4796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define rr_cksum	rr_hdr.icmp6_cksum
4806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define rr_seqnum 	rr_hdr.icmp6_data32[0]
4816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
4826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct rr_pco_match {		/* match prefix part */
4836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rpm_code;
4846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rpm_len;
4856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rpm_ordinal;
4866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rpm_matchlen;
4876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rpm_minlen;
4886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rpm_maxlen;
4896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int16_t	rpm_reserved;
4906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct	in6_addr	rpm_prefix;
4916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
4926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
4936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define RPM_PCO_ADD		1
4946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define RPM_PCO_CHANGE		2
4956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define RPM_PCO_SETGLOBAL	3
4966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define RPM_PCO_MAX		4
4976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
4986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct rr_pco_use {		/* use prefix part */
4996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rpu_uselen;
5006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rpu_keeplen;
5016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rpu_ramask;
5026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rpu_raflags;
5036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	rpu_vltime;
5046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	rpu_pltime;
5056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	rpu_flags;
5066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct	in6_addr rpu_prefix;
5076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
5086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK	0x80
5096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO	0x40
5106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
5116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if BYTE_ORDER == BIG_ENDIAN
5126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80000000
5136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40000000
5146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#elif BYTE_ORDER == LITTLE_ENDIAN
5156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80
5166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40
5176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
5186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
5196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct rr_result {		/* router renumbering result message */
5206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int16_t	rrr_flags;
5216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rrr_ordinal;
5226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int8_t	rrr_matchedlen;
5236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t	rrr_ifid;
5246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	struct	in6_addr rrr_prefix;
5256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed;
5266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if BYTE_ORDER == BIG_ENDIAN
5276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_RESULT_FLAGS_OOB		0x0002
5286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0001
5296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#elif BYTE_ORDER == LITTLE_ENDIAN
5306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_RESULT_FLAGS_OOB		0x0200
5316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0100
5326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
5336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
5346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
5356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * icmp6 filter structures.
5366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
5376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
5386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct icmp6_filter {
5396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	u_int32_t icmp6_filt[8];
5406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson};
5416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
542bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti/*
543bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti * BEGIN android-changed
544bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti * Linux and *BSD kernels use opposite values to indicate pass/block in ICMPv6
545bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti * filters, and assign a different value to the ICMP6_FILTER sockopt.
546bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti */
547bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti#define ICMP6_FILTER 1
548bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti
5496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_FILTER_SETPASSALL(filterp) \
5506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	(void)memset(filterp, 0x00, sizeof(struct icmp6_filter))
551bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti#define	ICMP6_FILTER_SETBLOCKALL(filterp) \
552bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti	(void)memset(filterp, 0xff, sizeof(struct icmp6_filter))
5536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_FILTER_SETPASS(type, filterp) \
5546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
555bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti#define	ICMP6_FILTER_SETBLOCK(type, filterp) \
556bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti	(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
5576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_FILTER_WILLPASS(type, filterp) \
5586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
559bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti#define	ICMP6_FILTER_WILLBLOCK(type, filterp) \
560bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
561bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti/*
562bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti * END android-changed
563bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti */
5646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
5656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
5666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Variables related to this implementation
5676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * of the internet control message protocol version 6.
5686846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
5696846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
5706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
5716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * IPv6 ICMP statistics.
5726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Each counter is an unsigned 64-bit value.
5736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
5746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_ERROR	0	/* # of calls to icmp6_error */
5756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_CANTERROR	1	/* no error (old was icmp) */
5766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_TOOFREQ	2	/* no error (rate limitation) */
5776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_OUTHIST	3	/* # of output messages */
5786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		/* space for 256 counters */
5796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_BADCODE	259	/* icmp6_code out of range */
5806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_TOOSHORT	260	/* packet < sizeof(struct icmp6_hdr) */
5816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_CHECKSUM	261	/* bad checksum */
5826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_BADLEN	262	/* calculated bound mismatch */
5836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	/*
5846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	 * number of responses; this member is inherited from the netinet code,
5856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	 * but for netinet6 code, it is already available in outhist[].
5866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	 */
5876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_REFLECT	263
5886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_INHIST	264	/* # of input messages */
5896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		/* space for 256 counters */
5906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_ND_TOOMANYOPT 520	/* too many ND options */
5916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_OUTERRHIST	521
5926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		/* space for 13 counters */
5936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_PMTUCHG	534	/* path MTU changes */
5946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_ND_BADOPT	535	/* bad ND options */
5956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_BADNS	536	/* bad neighbor solicititation */
5966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_BADNA	537	/* bad neighbor advertisement */
5976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_BADRS	538	/* bad router solicitiation */
5986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_BADRA	539	/* bad router advertisement */
5996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_STAT_BADREDIRECT	540	/* bad redirect message */
600ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ICMP6_STAT_DROPPED_RAROUTE 541	/* discarded routes from router advertisement */
6016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
602ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define	ICMP6_NSTATS		542
6036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
6046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_DST_UNREACH_NOROUTE	0
6056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_DST_UNREACH_ADMIN		1
6066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_DST_UNREACH_BEYONDSCOPE	2
6076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_DST_UNREACH_ADDR		3
6086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_DST_UNREACH_NOPORT	4
6096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_PACKET_TOO_BIG		5
6106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_TIME_EXCEED_TRANSIT	6
6116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_TIME_EXCEED_REASSEMBLY	7
6126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_PARAMPROB_HEADER		8
6136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_PARAMPROB_NEXTHEADER	9
6146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_PARAMPROB_OPTION		10
6156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_REDIRECT			11
6166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMP6_ERRSTAT_UNKNOWN			12
6176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
6186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*
6196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Names for ICMP sysctl objects
6206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */
6216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_STATS		1
6226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_REDIRACCEPT	2	/* accept/process redirects */
6236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_REDIRTIMEOUT	3	/* redirect cache time */
6246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if 0	/*obsoleted*/
6256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ERRRATELIMIT	5	/* ICMPv6 error rate limitation */
6266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif
6276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ND6_PRUNE	6
6286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ND6_DELAY	8
6296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ND6_UMAXTRIES	9
6306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ND6_MMAXTRIES		10
6316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ND6_USELOOPBACK	11
6326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/*#define ICMPV6CTL_ND6_PROXYALL	12	obsoleted, do not reuse here */
6336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_NODEINFO	13
6346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ERRPPSLIMIT	14	/* ICMPv6 error pps limitation */
6356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ND6_MAXNUDHINT	15
6366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_MTUDISC_HIWAT	16
6376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_MTUDISC_LOWAT	17
6386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ND6_DEBUG	18
6396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ND6_DRLIST	19
6406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_ND6_PRLIST	20
6416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define	ICMPV6CTL_ND6_MAXQLEN	24
6426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_MAXID		25
6436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
6446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6CTL_NAMES { \
6456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "rediraccept", CTLTYPE_INT }, \
6486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "redirtimeout", CTLTYPE_INT }, \
6496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "nd6_prune", CTLTYPE_INT }, \
6526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "nd6_delay", CTLTYPE_INT }, \
6546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "nd6_umaxtries", CTLTYPE_INT }, \
6556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "nd6_mmaxtries", CTLTYPE_INT }, \
6566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "nd6_useloopback", CTLTYPE_INT }, \
6576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "nodeinfo", CTLTYPE_INT }, \
6596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "errppslimit", CTLTYPE_INT }, \
6606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "nd6_maxnudhint", CTLTYPE_INT }, \
6616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "mtudisc_hiwat", CTLTYPE_INT }, \
6626846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "mtudisc_lowat", CTLTYPE_INT }, \
6636846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "nd6_debug", CTLTYPE_INT }, \
6646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6686846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ 0, 0 }, \
6696846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	{ "nd6_maxqueuelen", CTLTYPE_INT }, \
6706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson}
6716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
6726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#ifdef _KERNEL
6736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct	rtentry;
6746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct	rttimer;
6756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct	in6_multi;
6766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
6776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_init(void);
6786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_paramerror(struct mbuf *, int);
6796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_error(struct mbuf *, int, int, int);
6806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
6816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonint	icmp6_input(struct mbuf **, int *, int);
6826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_fasttimo(void);
6836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_reflect(struct mbuf *, size_t);
6846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_prepare(struct mbuf *);
6856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_redirect_input(struct mbuf *, int);
6866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_redirect_output(struct mbuf *, struct rtentry *);
6876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonint	icmp6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
6886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
6896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_statinc(u_int);
6906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
6916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct	ip6ctlparam;
6926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_mtudisc_update(struct ip6ctlparam *, int);
6936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonvoid	icmp6_mtudisc_callback_register(void (*)(struct in6_addr *));
6946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
6956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* XXX: is this the right place for these macros? */
6966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_ifstat_inc(ifp, tag) \
6976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersondo {								\
6986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson	if (ifp)						\
6996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat->tag++; \
7006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} while (/*CONSTCOND*/ 0)
7016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
7026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_ifoutstat_inc(ifp, type, code) \
7036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersondo { \
7046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		icmp6_ifstat_inc(ifp, ifs6_out_msg); \
7056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		switch(type) { \
7066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ICMP6_DST_UNREACH: \
7076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
7086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 if (code == ICMP6_DST_UNREACH_ADMIN) \
7096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson				 icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
7106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ICMP6_PACKET_TOO_BIG: \
7126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
7136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ICMP6_TIME_EXCEEDED: \
7156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
7166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ICMP6_PARAM_PROB: \
7186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
7196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ICMP6_ECHO_REQUEST: \
7216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_echo); \
7226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ICMP6_ECHO_REPLY: \
7246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
7256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case MLD_LISTENER_QUERY: \
7276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
7286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case MLD_LISTENER_REPORT: \
7306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
7316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case MLD_LISTENER_DONE: \
7336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
7346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ND_ROUTER_SOLICIT: \
7366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
7376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ND_ROUTER_ADVERT: \
7396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
7406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ND_NEIGHBOR_SOLICIT: \
7426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
7436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ND_NEIGHBOR_ADVERT: \
7456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
7466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		 case ND_REDIRECT: \
7486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
7496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson			 break; \
7506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson		} \
7516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} while (/*CONSTCOND*/ 0)
7526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
7536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonextern int	icmp6_rediraccept;	/* accept/process redirects */
7546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonextern int	icmp6_redirtimeout;	/* cache time for redirect routes */
7556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif /* _KERNEL */
7566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson
757ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#ifdef ICMP6_STRINGS
758ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti/* Info: http://www.iana.org/assignments/icmpv6-parameters */
759ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti
760ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colittistatic const char * const icmp6_type_err[] = {
761ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"reserved0", "unreach", "packet_too_big", "timxceed", "paramprob",
762ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	NULL
763ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti};
764ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti
765ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colittistatic const char * const icmp6_type_info[] = {
766ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"echo", "echoreply",
767ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"mcastlistenq", "mcastlistenrep", "mcastlistendone",
768ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"rtsol", "rtadv", "neighsol", "neighadv", "redirect",
769ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"routerrenum", "nodeinfoq", "nodeinfor", "invneighsol", "invneighrep",
770ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"mcastlistenrep2", "haad_req", "haad_rep",
771ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"mobile_psol", "mobile_padv", "cga_sol", "cga_adv",
772ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"experimental150", "mcast_rtadv", "mcast_rtsol", "mcast_rtterm",
773ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"fmipv6_msg", "rpl_control", NULL
774ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti};
775ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti
776ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colittistatic const char * const icmp6_code_none[] = { "none", NULL };
777ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti
778ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colittistatic const char * const icmp6_code_unreach[] = {
779ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"noroute", "admin", "beyondscope", "addr", "port",
780ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"srcaddr_policy", "reject_route", "source_route_err", NULL
781ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti};
782ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti
783ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colittistatic const char * const icmp6_code_timxceed[] = {
784ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"intrans", "reass", NULL
785ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti};
786ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti
787ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colittistatic const char * const icmp6_code_paramprob[] = {
788ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti	"hdr_field", "nxthdr_type", "option", NULL
789ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti};
790ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti
791ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti/* not all informational icmps that have codes have a names array */
792ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#endif
793ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti
7946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif /* !_NETINET_ICMP6_H_ */
795