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. */ 69203e13d97de840e01eded6a267fef9f245cf3a15Elliott Hughes#include <sys/cdefs.h> 703a040d8379a3b1f9731ae93e1a7118c589f1936eElliott Hughes 716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) 726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson - sizeof(struct icmp6_hdr) */ 736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct icmp6_hdr { 756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t icmp6_type; /* type field */ 766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t icmp6_code; /* code field */ 776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int16_t icmp6_cksum; /* checksum field */ 786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson union { 796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t icmp6_un_data32[1]; /* type-specific field */ 806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int16_t icmp6_un_data16[2]; /* type-specific field */ 816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t icmp6_un_data8[4]; /* type-specific field */ 826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson } icmp6_dataun; 836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_data32 icmp6_dataun.icmp6_un_data32 866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_data16 icmp6_dataun.icmp6_un_data16 876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_data8 icmp6_dataun.icmp6_un_data8 886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_pptr icmp6_data32[0] /* parameter prob */ 896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_mtu icmp6_data32[0] /* packet too big */ 906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_id icmp6_data16[0] /* echo request/reply */ 916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_seq icmp6_data16[1] /* echo request/reply */ 926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ 936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ 956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ 966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ 976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_PARAM_PROB 4 /* ip6 header bad */ 986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ECHO_REQUEST 128 /* echo service */ 1006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ECHO_REPLY 129 /* echo reply */ 1016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_LISTENER_QUERY 130 /* multicast listener query */ 1026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_LISTENER_REPORT 131 /* multicast listener report */ 1036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_LISTENER_DONE 132 /* multicast listener done */ 104ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */ 1056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* RFC2292 decls */ 1076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */ 1086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ 1096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ 1106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_ROUTER_SOLICIT 133 /* router solicitation */ 1126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_ROUTER_ADVERT 134 /* router advertisement */ 1136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */ 1146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisement */ 1156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_REDIRECT 137 /* redirect */ 1166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */ 1186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_WRUREQUEST 139 /* who are you request */ 1206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_WRUREPLY 140 /* who are you reply */ 1216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_FQDN_QUERY 139 /* FQDN query */ 1226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_FQDN_REPLY 140 /* FQDN reply */ 1236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_QUERY 139 /* node information request */ 1246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_REPLY 140 /* node information reply */ 125ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define MLDV2_LISTENER_REPORT 143 /* RFC3810 listener report */ 1266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* The definitions below are experimental. TBA */ 1286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_MTRACE_RESP 200 /* mtrace response(to sender) */ 1296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_MTRACE 201 /* mtrace messages */ 1306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_MAXTYPE 201 1326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ 1346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */ 1356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */ 1366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ 1376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ 1386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */ 139ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ICMP6_DST_UNREACH_POLICY 5 /* source address failed ingress/egress policy */ 140ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ICMP6_DST_UNREACH_REJROUTE 6 /* reject route to destination */ 141ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ICMP6_DST_UNREACH_SOURCERT 7 /* error in source routing header */ 1426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */ 1446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */ 1456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ 1476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */ 1486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */ 1496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ 1516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */ 1536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */ 1546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */ 1556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_SUCCESS 0 /* node information successful reply */ 1576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_REFUSED 1 /* node information request is refused */ 1586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */ 1596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */ 1616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ 1626846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ 1636846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* Used in kernel only */ 1656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ 1666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ 1676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1686846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 1696846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Multicast Listener Discovery 1706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 1716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct mld_hdr { 1726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct icmp6_hdr mld_icmp6_hdr; 1736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr mld_addr; /* multicast address */ 1746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 1756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* shortcut macro definitions */ 1776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld_type mld_icmp6_hdr.icmp6_type 1786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld_code mld_icmp6_hdr.icmp6_code 1796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld_cksum mld_icmp6_hdr.icmp6_cksum 1806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] 1816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define mld_reserved mld_icmp6_hdr.icmp6_data16[1] 1826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define MLD_MINLEN 24 1846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 1866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Neighbor Discovery 1876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 1886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_router_solicit { /* router solicitation */ 1906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct icmp6_hdr nd_rs_hdr; 1916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* could be followed by options */ 1926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 1936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rs_type nd_rs_hdr.icmp6_type 1956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rs_code nd_rs_hdr.icmp6_code 1966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rs_cksum nd_rs_hdr.icmp6_cksum 1976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] 1986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 1996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_router_advert { /* router advertisement */ 2006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct icmp6_hdr nd_ra_hdr; 2016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t nd_ra_reachable; /* reachable time */ 2026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t nd_ra_retransmit; /* retransmit timer */ 2036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* could be followed by options */ 2046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 2056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_type nd_ra_hdr.icmp6_type 2076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_code nd_ra_hdr.icmp6_code 2086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_cksum nd_ra_hdr.icmp6_cksum 2096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] 2106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] 2116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_MANAGED 0x80 2126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_OTHER 0x40 2136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_HOME_AGENT 0x20 2146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 216ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti * Router preference values based on RFC4191. 2176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 2186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ 2196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */ 2216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */ 2226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */ 2236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ 2246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] 2266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_neighbor_solicit { /* neighbor solicitation */ 2286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct icmp6_hdr nd_ns_hdr; 2296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr nd_ns_target; /*target address */ 2306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* could be followed by options */ 2316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 2326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ns_type nd_ns_hdr.icmp6_type 2346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ns_code nd_ns_hdr.icmp6_code 2356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ns_cksum nd_ns_hdr.icmp6_cksum 2366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] 2376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_neighbor_advert { /* neighbor advertisement */ 2396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct icmp6_hdr nd_na_hdr; 2406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr nd_na_target; /* target address */ 2416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* could be followed by options */ 2426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 2436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_na_type nd_na_hdr.icmp6_type 2456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_na_code nd_na_hdr.icmp6_code 2466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_na_cksum nd_na_hdr.icmp6_cksum 2476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] 2486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NA_FLAG_ROUTER 0x80 2496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NA_FLAG_SOLICITED 0x40 2506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_NA_FLAG_OVERRIDE 0x20 2516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_redirect { /* redirect */ 2536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct icmp6_hdr nd_rd_hdr; 2546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr nd_rd_target; /* target address */ 2556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr nd_rd_dst; /* destination address */ 2566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* could be followed by options */ 2576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 2586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rd_type nd_rd_hdr.icmp6_type 2606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rd_code nd_rd_hdr.icmp6_code 2616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rd_cksum nd_rd_hdr.icmp6_cksum 2626846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] 2636846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_opt_hdr { /* Neighbor discovery option header */ 2656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_type; 2666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_len; 2676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* followed by option specific data*/ 2686846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 2696846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_SOURCE_LINKADDR 1 2716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_TARGET_LINKADDR 2 2726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_PREFIX_INFORMATION 3 2736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_REDIRECTED_HEADER 4 2746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_MTU 5 2756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_ADVINTERVAL 7 2766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_HOMEAGENT_INFO 8 2776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_SOURCE_ADDRLIST 9 2786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_TARGET_ADDRLIST 10 279ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ND_OPT_MAP 23 /* RFC 5380 */ 280ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ND_OPT_ROUTE_INFO 24 /* RFC 4191 */ 281ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ND_OPT_RDNSS 25 /* RFC 6016 */ 282ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti#define ND_OPT_DNSSL 31 /* RFC 6016 */ 2836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_opt_route_info { /* route info */ 2856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_rti_type; 2866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_rti_len; 2876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_rti_prefixlen; 2886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_rti_flags; 2896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t nd_opt_rti_lifetime; 2906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* prefix follows */ 2916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson}; 2926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 2936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_opt_prefix_info { /* prefix information */ 2946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_pi_type; 2956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_pi_len; 2966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_pi_prefix_len; 2976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_pi_flags_reserved; 2986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t nd_opt_pi_valid_time; 2996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t nd_opt_pi_preferred_time; 3006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t nd_opt_pi_reserved2; 3016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr nd_opt_pi_prefix; 3026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 3036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 3046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_PI_FLAG_ONLINK 0x80 3056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ND_OPT_PI_FLAG_AUTO 0x40 3066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 3076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_opt_rd_hdr { /* redirected header */ 3086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_rh_type; 3096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_rh_len; 3106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int16_t nd_opt_rh_reserved1; 3116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t nd_opt_rh_reserved2; 3126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* followed by IP header and data */ 3136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 3146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 3156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct nd_opt_mtu { /* MTU option */ 3166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_mtu_type; 3176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_mtu_len; 3186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int16_t nd_opt_mtu_reserved; 3196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t nd_opt_mtu_mtu; 3206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 3216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 322ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colittistruct nd_opt_rdnss { /* RDNSS option RFC 6106 */ 3236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_rdnss_type; 3246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t nd_opt_rdnss_len; 3256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int16_t nd_opt_rdnss_reserved; 3266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t nd_opt_rdnss_lifetime; 3276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* followed by list of IP prefixes */ 3286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 3296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 330ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colittistruct nd_opt_dnssl { /* DNSSL option RFC 6106 */ 331ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti u_int8_t nd_opt_dnssl_type; 332ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti u_int8_t nd_opt_dnssl_len; 333ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti u_int16_t nd_opt_dnssl_reserved; 334ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti u_int32_t nd_opt_dnssl_lifetime; 335ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti /* followed by list of IP prefixes */ 336ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti} __packed; 337ce7c404dc7d1d6a3cab9105fdb2a7e2610b43bfcLorenzo Colitti 3386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 3396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * icmp6 namelookup 3406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 3416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 3426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct icmp6_namelookup { 3436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct icmp6_hdr icmp6_nl_hdr; 3446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t icmp6_nl_nonce[8]; 3456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson int32_t icmp6_nl_ttl; 3466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#if 0 3476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t icmp6_nl_len; 3486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t icmp6_nl_name[3]; 3496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif 3506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* could be followed by options */ 3516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 3526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 3536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 3546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * icmp6 node information 3556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 3566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct icmp6_nodeinfo { 3576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct icmp6_hdr icmp6_ni_hdr; 3586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t icmp6_ni_nonce[8]; 3596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson /* could be followed by reply data */ 3606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 3616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 362c2cd33efc4b53495db90ecd2cb9fee698b827aa8Elliott Hughes/* 363c2cd33efc4b53495db90ecd2cb9fee698b827aa8Elliott Hughes * BEGIN android-removed: glibc doesn't have these, and external/ping declares them itself. 3646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ni_type icmp6_ni_hdr.icmp6_type 3656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ni_code icmp6_ni_hdr.icmp6_code 3666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ni_cksum icmp6_ni_hdr.icmp6_cksum 3676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ni_qtype icmp6_ni_hdr.icmp6_data16[0] 3686846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ni_flags icmp6_ni_hdr.icmp6_data16[1] 369c2cd33efc4b53495db90ecd2cb9fee698b827aa8Elliott Hughes * END android-removed 370c2cd33efc4b53495db90ecd2cb9fee698b827aa8Elliott Hughes */ 3716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 3726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_NOOP 0 /* NOOP */ 3736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ 3746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ 3756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_DNSNAME 2 /* DNS Name */ 3766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_NODEADDR 3 /* Node Addresses */ 3776846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ 3786846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 3796846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_SUPTYPE_FLAG_COMPRESS 0x0100 3806846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_FQDN_FLAG_VALIDTTL 0x0100 3816846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 3826846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#ifdef NAME_LOOKUPS_04 3836846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_LINKLOCAL 0x0100 3846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_SITELOCAL 0x0200 3856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_GLOBAL 0x0400 3866846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ALL 0x0800 3876846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_TRUNCATE 0x1000 3886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */ 3896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */ 3906846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_TRUNCATE 0x0100 3916846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ALL 0x0200 3926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_COMPAT 0x0400 3936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_LINKLOCAL 0x0800 3946846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_SITELOCAL 0x1000 3956846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_GLOBAL 0x2000 3966846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ 3976846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif 3986846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 3996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct ni_reply_fqdn { 4006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t ni_fqdn_ttl; /* TTL */ 4016846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ 4026846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ 4036846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 4046846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 4056846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 4066846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * Router Renumbering. as router-renum-08.txt 4076846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 4086846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct icmp6_router_renum { /* router renumbering header */ 4096846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct icmp6_hdr rr_hdr; 4106846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rr_segnum; 4116846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rr_flags; 4126846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int16_t rr_maxdelay; 4136846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t rr_reserved; 4146846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 4156846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 4166846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_FLAGS_TEST 0x80 4176846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_FLAGS_REQRESULT 0x40 4186846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 4196846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_FLAGS_SPECSITE 0x10 4206846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_FLAGS_PREVDONE 0x08 4216846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 4226846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define rr_type rr_hdr.icmp6_type 4236846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define rr_code rr_hdr.icmp6_code 4246846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define rr_cksum rr_hdr.icmp6_cksum 4256846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define rr_seqnum rr_hdr.icmp6_data32[0] 4266846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 4276846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct rr_pco_match { /* match prefix part */ 4286846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rpm_code; 4296846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rpm_len; 4306846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rpm_ordinal; 4316846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rpm_matchlen; 4326846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rpm_minlen; 4336846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rpm_maxlen; 4346846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int16_t rpm_reserved; 4356846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr rpm_prefix; 4366846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 4376846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 4386846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define RPM_PCO_ADD 1 4396846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define RPM_PCO_CHANGE 2 4406846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define RPM_PCO_SETGLOBAL 3 4416846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define RPM_PCO_MAX 4 4426846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 4436846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct rr_pco_use { /* use prefix part */ 4446846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rpu_uselen; 4456846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rpu_keeplen; 4466846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rpu_ramask; 4476846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rpu_raflags; 4486846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t rpu_vltime; 4496846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t rpu_pltime; 4506846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t rpu_flags; 4516846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr rpu_prefix; 4526846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 4536846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 4546846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 4556846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 4566846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 4576846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 4586846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 4596846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct rr_result { /* router renumbering result message */ 4606846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int16_t rrr_flags; 4616846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rrr_ordinal; 4626846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int8_t rrr_matchedlen; 4636846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t rrr_ifid; 4646846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson struct in6_addr rrr_prefix; 4656846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson} __packed; 4666846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 4676846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 4686846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 4696846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson/* 4706846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson * icmp6 filter structures. 4716846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson */ 4726846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 4736846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gundersonstruct icmp6_filter { 4746846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson u_int32_t icmp6_filt[8]; 4756846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson}; 4766846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 477bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti/* 478bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti * BEGIN android-changed 479bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti * Linux and *BSD kernels use opposite values to indicate pass/block in ICMPv6 480bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti * filters, and assign a different value to the ICMP6_FILTER sockopt. 481bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti */ 482bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti#define ICMP6_FILTER 1 483bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti 4846846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_FILTER_SETPASSALL(filterp) \ 4856846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson (void)memset(filterp, 0x00, sizeof(struct icmp6_filter)) 486bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti#define ICMP6_FILTER_SETBLOCKALL(filterp) \ 487bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti (void)memset(filterp, 0xff, sizeof(struct icmp6_filter)) 4886846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_FILTER_SETPASS(type, filterp) \ 4896846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))) 490bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti#define ICMP6_FILTER_SETBLOCK(type, filterp) \ 491bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))) 4926846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#define ICMP6_FILTER_WILLPASS(type, filterp) \ 4936846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) 494bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti#define ICMP6_FILTER_WILLBLOCK(type, filterp) \ 495bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) 496bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti/* 497bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti * END android-changed 498bfc6a59556fc83875f7f3bd6dc5bb139a94df432Lorenzo Colitti */ 4996846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson 5006846a45882f4e099f422d1455eab3a94d4c69795Steinar H. Gunderson#endif /* !_NETINET_ICMP6_H_ */ 501