The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netinet/icmp6.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $FreeBSD$       */
    2 /*      $KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $  */
    3 
    4 /*-
    5  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. Neither the name of the project nor the names of its contributors
   17  *    may be used to endorse or promote products derived from this software
   18  *    without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
   21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
   24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30  * SUCH DAMAGE.
   31  */
   32 
   33 /*-
   34  * Copyright (c) 1982, 1986, 1993
   35  *      The Regents of the University of California.  All rights reserved.
   36  *
   37  * Redistribution and use in source and binary forms, with or without
   38  * modification, are permitted provided that the following conditions
   39  * are met:
   40  * 1. Redistributions of source code must retain the above copyright
   41  *    notice, this list of conditions and the following disclaimer.
   42  * 2. Redistributions in binary form must reproduce the above copyright
   43  *    notice, this list of conditions and the following disclaimer in the
   44  *    documentation and/or other materials provided with the distribution.
   45  * 4. Neither the name of the University nor the names of its contributors
   46  *    may be used to endorse or promote products derived from this software
   47  *    without specific prior written permission.
   48  *
   49  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   50  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   51  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   52  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   53  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   54  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   55  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   56  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   57  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   58  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   59  * SUCH DAMAGE.
   60  *
   61  *      @(#)ip_icmp.h   8.1 (Berkeley) 6/10/93
   62  */
   63 
   64 #ifndef _NETINET_ICMP6_H_
   65 #define _NETINET_ICMP6_H_
   66 
   67 #define ICMPV6_PLD_MAXLEN       1232    /* IPV6_MMTU - sizeof(struct ip6_hdr)
   68                                            - sizeof(struct icmp6_hdr) */
   69 
   70 struct icmp6_hdr {
   71         u_int8_t        icmp6_type;     /* type field */
   72         u_int8_t        icmp6_code;     /* code field */
   73         u_int16_t       icmp6_cksum;    /* checksum field */
   74         union {
   75                 u_int32_t       icmp6_un_data32[1]; /* type-specific field */
   76                 u_int16_t       icmp6_un_data16[2]; /* type-specific field */
   77                 u_int8_t        icmp6_un_data8[4];  /* type-specific field */
   78         } icmp6_dataun;
   79 } __packed;
   80 
   81 #define icmp6_data32    icmp6_dataun.icmp6_un_data32
   82 #define icmp6_data16    icmp6_dataun.icmp6_un_data16
   83 #define icmp6_data8     icmp6_dataun.icmp6_un_data8
   84 #define icmp6_pptr      icmp6_data32[0]         /* parameter prob */
   85 #define icmp6_mtu       icmp6_data32[0]         /* packet too big */
   86 #define icmp6_id        icmp6_data16[0]         /* echo request/reply */
   87 #define icmp6_seq       icmp6_data16[1]         /* echo request/reply */
   88 #define icmp6_maxdelay  icmp6_data16[0]         /* mcast group membership */
   89 
   90 #define ICMP6_DST_UNREACH               1       /* dest unreachable, codes: */
   91 #define ICMP6_PACKET_TOO_BIG            2       /* packet too big */
   92 #define ICMP6_TIME_EXCEEDED             3       /* time exceeded, code: */
   93 #define ICMP6_PARAM_PROB                4       /* ip6 header bad */
   94 
   95 #define ICMP6_ECHO_REQUEST              128     /* echo service */
   96 #define ICMP6_ECHO_REPLY                129     /* echo reply */
   97 #define MLD_LISTENER_QUERY              130     /* multicast listener query */
   98 #define MLD_LISTENER_REPORT             131     /* multicast listener report */
   99 #define MLD_LISTENER_DONE               132     /* multicast listener done */
  100 #define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */
  101 
  102 /* RFC2292 decls */
  103 #define ICMP6_MEMBERSHIP_QUERY          130     /* group membership query */
  104 #define ICMP6_MEMBERSHIP_REPORT         131     /* group membership report */
  105 #define ICMP6_MEMBERSHIP_REDUCTION      132     /* group membership termination */
  106 
  107 #ifndef _KERNEL
  108 /* the followings are for backward compatibility to old KAME apps. */
  109 #define MLD6_LISTENER_QUERY     MLD_LISTENER_QUERY
  110 #define MLD6_LISTENER_REPORT    MLD_LISTENER_REPORT
  111 #define MLD6_LISTENER_DONE      MLD_LISTENER_DONE
  112 #endif
  113 
  114 #define ND_ROUTER_SOLICIT               133     /* router solicitation */
  115 #define ND_ROUTER_ADVERT                134     /* router advertisement */
  116 #define ND_NEIGHBOR_SOLICIT             135     /* neighbor solicitation */
  117 #define ND_NEIGHBOR_ADVERT              136     /* neighbor advertisement */
  118 #define ND_REDIRECT                     137     /* redirect */
  119 
  120 #define ICMP6_ROUTER_RENUMBERING        138     /* router renumbering */
  121 
  122 #define ICMP6_WRUREQUEST                139     /* who are you request */
  123 #define ICMP6_WRUREPLY                  140     /* who are you reply */
  124 #define ICMP6_FQDN_QUERY                139     /* FQDN query */
  125 #define ICMP6_FQDN_REPLY                140     /* FQDN reply */
  126 #define ICMP6_NI_QUERY                  139     /* node information request */
  127 #define ICMP6_NI_REPLY                  140     /* node information reply */
  128 #define MLDV2_LISTENER_REPORT           143     /* RFC3810 listener report */
  129 
  130 /* The definitions below are experimental. TBA */
  131 #define MLD_MTRACE_RESP                 200     /* mtrace resp (to sender) */
  132 #define MLD_MTRACE                      201     /* mtrace messages */
  133 
  134 #ifndef _KERNEL
  135 #define MLD6_MTRACE_RESP        MLD_MTRACE_RESP
  136 #define MLD6_MTRACE             MLD_MTRACE
  137 #endif
  138 
  139 #define ICMP6_MAXTYPE                   201
  140 
  141 #define ICMP6_DST_UNREACH_NOROUTE       0       /* no route to destination */
  142 #define ICMP6_DST_UNREACH_ADMIN         1       /* administratively prohibited */
  143 #define ICMP6_DST_UNREACH_NOTNEIGHBOR   2       /* not a neighbor(obsolete) */
  144 #define ICMP6_DST_UNREACH_BEYONDSCOPE   2       /* beyond scope of source address */
  145 #define ICMP6_DST_UNREACH_ADDR          3       /* address unreachable */
  146 #define ICMP6_DST_UNREACH_NOPORT        4       /* port unreachable */
  147 
  148 #define ICMP6_TIME_EXCEED_TRANSIT       0       /* ttl==0 in transit */
  149 #define ICMP6_TIME_EXCEED_REASSEMBLY    1       /* ttl==0 in reass */
  150 
  151 #define ICMP6_PARAMPROB_HEADER          0       /* erroneous header field */
  152 #define ICMP6_PARAMPROB_NEXTHEADER      1       /* unrecognized next header */
  153 #define ICMP6_PARAMPROB_OPTION          2       /* unrecognized option */
  154 
  155 #define ICMP6_INFOMSG_MASK              0x80    /* all informational messages */
  156 
  157 #define ICMP6_NI_SUBJ_IPV6      0       /* Query Subject is an IPv6 address */
  158 #define ICMP6_NI_SUBJ_FQDN      1       /* Query Subject is a Domain name */
  159 #define ICMP6_NI_SUBJ_IPV4      2       /* Query Subject is an IPv4 address */
  160 
  161 #define ICMP6_NI_SUCCESS        0       /* node information successful reply */
  162 #define ICMP6_NI_REFUSED        1       /* node information request is refused */
  163 #define ICMP6_NI_UNKNOWN        2       /* unknown Qtype */
  164 
  165 #define ICMP6_ROUTER_RENUMBERING_COMMAND  0     /* rr command */
  166 #define ICMP6_ROUTER_RENUMBERING_RESULT   1     /* rr result */
  167 #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255     /* rr seq num reset */
  168 
  169 /* Used in kernel only */
  170 #define ND_REDIRECT_ONLINK      0       /* redirect to an on-link node */
  171 #define ND_REDIRECT_ROUTER      1       /* redirect to a better router */
  172 
  173 /*
  174  * Multicast Listener Discovery
  175  */
  176 struct mld_hdr {
  177         struct icmp6_hdr        mld_icmp6_hdr;
  178         struct in6_addr         mld_addr; /* multicast address */
  179 } __packed;
  180 
  181 /* definitions to provide backward compatibility to old KAME applications */
  182 #ifndef _KERNEL
  183 #define mld6_hdr        mld_hdr
  184 #define mld6_type       mld_type
  185 #define mld6_code       mld_code
  186 #define mld6_cksum      mld_cksum
  187 #define mld6_maxdelay   mld_maxdelay
  188 #define mld6_reserved   mld_reserved
  189 #define mld6_addr       mld_addr
  190 #endif
  191 
  192 /* shortcut macro definitions */
  193 #define mld_type        mld_icmp6_hdr.icmp6_type
  194 #define mld_code        mld_icmp6_hdr.icmp6_code
  195 #define mld_cksum       mld_icmp6_hdr.icmp6_cksum
  196 #define mld_maxdelay    mld_icmp6_hdr.icmp6_data16[0]
  197 #define mld_reserved    mld_icmp6_hdr.icmp6_data16[1]
  198 #define mld_v2_reserved mld_icmp6_hdr.icmp6_data16[0]
  199 #define mld_v2_numrecs  mld_icmp6_hdr.icmp6_data16[1]
  200 
  201 /*
  202  * Neighbor Discovery
  203  */
  204 
  205 struct nd_router_solicit {      /* router solicitation */
  206         struct icmp6_hdr        nd_rs_hdr;
  207         /* could be followed by options */
  208 } __packed;
  209 
  210 #define nd_rs_type      nd_rs_hdr.icmp6_type
  211 #define nd_rs_code      nd_rs_hdr.icmp6_code
  212 #define nd_rs_cksum     nd_rs_hdr.icmp6_cksum
  213 #define nd_rs_reserved  nd_rs_hdr.icmp6_data32[0]
  214 
  215 struct nd_router_advert {       /* router advertisement */
  216         struct icmp6_hdr        nd_ra_hdr;
  217         u_int32_t               nd_ra_reachable;        /* reachable time */
  218         u_int32_t               nd_ra_retransmit;       /* retransmit timer */
  219         /* could be followed by options */
  220 } __packed;
  221 
  222 #define nd_ra_type              nd_ra_hdr.icmp6_type
  223 #define nd_ra_code              nd_ra_hdr.icmp6_code
  224 #define nd_ra_cksum             nd_ra_hdr.icmp6_cksum
  225 #define nd_ra_curhoplimit       nd_ra_hdr.icmp6_data8[0]
  226 #define nd_ra_flags_reserved    nd_ra_hdr.icmp6_data8[1]
  227 #define ND_RA_FLAG_MANAGED      0x80
  228 #define ND_RA_FLAG_OTHER        0x40
  229 #define ND_RA_FLAG_HA           0x20
  230 
  231 /*
  232  * Router preference values based on draft-draves-ipngwg-router-selection-01.
  233  * These are non-standard definitions.
  234  */
  235 #define ND_RA_FLAG_RTPREF_MASK  0x18 /* 00011000 */
  236 
  237 #define ND_RA_FLAG_RTPREF_HIGH  0x08 /* 00001000 */
  238 #define ND_RA_FLAG_RTPREF_MEDIUM        0x00 /* 00000000 */
  239 #define ND_RA_FLAG_RTPREF_LOW   0x18 /* 00011000 */
  240 #define ND_RA_FLAG_RTPREF_RSV   0x10 /* 00010000 */
  241 
  242 #define nd_ra_router_lifetime   nd_ra_hdr.icmp6_data16[1]
  243 
  244 struct nd_neighbor_solicit {    /* neighbor solicitation */
  245         struct icmp6_hdr        nd_ns_hdr;
  246         struct in6_addr         nd_ns_target;   /*target address */
  247         /* could be followed by options */
  248 } __packed;
  249 
  250 #define nd_ns_type              nd_ns_hdr.icmp6_type
  251 #define nd_ns_code              nd_ns_hdr.icmp6_code
  252 #define nd_ns_cksum             nd_ns_hdr.icmp6_cksum
  253 #define nd_ns_reserved          nd_ns_hdr.icmp6_data32[0]
  254 
  255 struct nd_neighbor_advert {     /* neighbor advertisement */
  256         struct icmp6_hdr        nd_na_hdr;
  257         struct in6_addr         nd_na_target;   /* target address */
  258         /* could be followed by options */
  259 } __packed;
  260 
  261 #define nd_na_type              nd_na_hdr.icmp6_type
  262 #define nd_na_code              nd_na_hdr.icmp6_code
  263 #define nd_na_cksum             nd_na_hdr.icmp6_cksum
  264 #define nd_na_flags_reserved    nd_na_hdr.icmp6_data32[0]
  265 #if BYTE_ORDER == BIG_ENDIAN
  266 #define ND_NA_FLAG_ROUTER               0x80000000
  267 #define ND_NA_FLAG_SOLICITED            0x40000000
  268 #define ND_NA_FLAG_OVERRIDE             0x20000000
  269 #else
  270 #if BYTE_ORDER == LITTLE_ENDIAN
  271 #define ND_NA_FLAG_ROUTER               0x80
  272 #define ND_NA_FLAG_SOLICITED            0x40
  273 #define ND_NA_FLAG_OVERRIDE             0x20
  274 #endif
  275 #endif
  276 
  277 struct nd_redirect {            /* redirect */
  278         struct icmp6_hdr        nd_rd_hdr;
  279         struct in6_addr         nd_rd_target;   /* target address */
  280         struct in6_addr         nd_rd_dst;      /* destination address */
  281         /* could be followed by options */
  282 } __packed;
  283 
  284 #define nd_rd_type              nd_rd_hdr.icmp6_type
  285 #define nd_rd_code              nd_rd_hdr.icmp6_code
  286 #define nd_rd_cksum             nd_rd_hdr.icmp6_cksum
  287 #define nd_rd_reserved          nd_rd_hdr.icmp6_data32[0]
  288 
  289 struct nd_opt_hdr {             /* Neighbor discovery option header */
  290         u_int8_t        nd_opt_type;
  291         u_int8_t        nd_opt_len;
  292         /* followed by option specific data*/
  293 } __packed;
  294 
  295 #define ND_OPT_SOURCE_LINKADDR          1
  296 #define ND_OPT_TARGET_LINKADDR          2
  297 #define ND_OPT_PREFIX_INFORMATION       3
  298 #define ND_OPT_REDIRECTED_HEADER        4
  299 #define ND_OPT_MTU                      5
  300 #define ND_OPT_NONCE                    14      /* RFC 3971 */
  301 #define ND_OPT_ROUTE_INFO               24      /* RFC 4191 */
  302 #define ND_OPT_RDNSS                    25      /* RFC 6106 */
  303 #define ND_OPT_DNSSL                    31      /* RFC 6106 */
  304 #define ND_OPT_MAX                      31
  305 
  306 struct nd_opt_prefix_info {     /* prefix information */
  307         u_int8_t        nd_opt_pi_type;
  308         u_int8_t        nd_opt_pi_len;
  309         u_int8_t        nd_opt_pi_prefix_len;
  310         u_int8_t        nd_opt_pi_flags_reserved;
  311         u_int32_t       nd_opt_pi_valid_time;
  312         u_int32_t       nd_opt_pi_preferred_time;
  313         u_int32_t       nd_opt_pi_reserved2;
  314         struct in6_addr nd_opt_pi_prefix;
  315 } __packed;
  316 
  317 #define ND_OPT_PI_FLAG_ONLINK           0x80
  318 #define ND_OPT_PI_FLAG_AUTO             0x40
  319 
  320 struct nd_opt_rd_hdr {          /* redirected header */
  321         u_int8_t        nd_opt_rh_type;
  322         u_int8_t        nd_opt_rh_len;
  323         u_int16_t       nd_opt_rh_reserved1;
  324         u_int32_t       nd_opt_rh_reserved2;
  325         /* followed by IP header and data */
  326 } __packed;
  327 
  328 struct nd_opt_mtu {             /* MTU option */
  329         u_int8_t        nd_opt_mtu_type;
  330         u_int8_t        nd_opt_mtu_len;
  331         u_int16_t       nd_opt_mtu_reserved;
  332         u_int32_t       nd_opt_mtu_mtu;
  333 } __packed;
  334 
  335 #define ND_OPT_NONCE_LEN        ((1 * 8) - 2)
  336 #if ((ND_OPT_NONCE_LEN + 2) % 8) != 0
  337 #error "(ND_OPT_NONCE_LEN + 2) must be a multiple of 8."
  338 #endif 
  339 struct nd_opt_nonce {           /* nonce option */
  340         u_int8_t        nd_opt_nonce_type;
  341         u_int8_t        nd_opt_nonce_len;
  342         u_int8_t        nd_opt_nonce[ND_OPT_NONCE_LEN];
  343 } __packed;
  344 
  345 struct nd_opt_route_info {      /* route info */
  346         u_int8_t        nd_opt_rti_type;
  347         u_int8_t        nd_opt_rti_len;
  348         u_int8_t        nd_opt_rti_prefixlen;
  349         u_int8_t        nd_opt_rti_flags;
  350         u_int32_t       nd_opt_rti_lifetime;
  351         /* prefix follows */
  352 } __packed;
  353 
  354 struct nd_opt_rdnss {           /* RDNSS option (RFC 6106) */
  355         u_int8_t        nd_opt_rdnss_type;
  356         u_int8_t        nd_opt_rdnss_len;
  357         u_int16_t       nd_opt_rdnss_reserved;
  358         u_int32_t       nd_opt_rdnss_lifetime;
  359         /* followed by list of recursive DNS servers */
  360 } __packed;
  361 
  362 struct nd_opt_dnssl {           /* DNSSL option (RFC 6106) */
  363         u_int8_t        nd_opt_dnssl_type;
  364         u_int8_t        nd_opt_dnssl_len;
  365         u_int16_t       nd_opt_dnssl_reserved;
  366         u_int32_t       nd_opt_dnssl_lifetime;
  367         /* followed by list of DNS search domains */
  368 } __packed;
  369 
  370 /*
  371  * icmp6 namelookup
  372  */
  373 
  374 struct icmp6_namelookup {
  375         struct icmp6_hdr        icmp6_nl_hdr;
  376         u_int8_t        icmp6_nl_nonce[8];
  377         int32_t         icmp6_nl_ttl;
  378 #if 0
  379         u_int8_t        icmp6_nl_len;
  380         u_int8_t        icmp6_nl_name[3];
  381 #endif
  382         /* could be followed by options */
  383 } __packed;
  384 
  385 /*
  386  * icmp6 node information
  387  */
  388 struct icmp6_nodeinfo {
  389         struct icmp6_hdr icmp6_ni_hdr;
  390         u_int8_t icmp6_ni_nonce[8];
  391         /* could be followed by reply data */
  392 } __packed;
  393 
  394 #define ni_type         icmp6_ni_hdr.icmp6_type
  395 #define ni_code         icmp6_ni_hdr.icmp6_code
  396 #define ni_cksum        icmp6_ni_hdr.icmp6_cksum
  397 #define ni_qtype        icmp6_ni_hdr.icmp6_data16[0]
  398 #define ni_flags        icmp6_ni_hdr.icmp6_data16[1]
  399 
  400 #define NI_QTYPE_NOOP           0 /* NOOP  */
  401 #define NI_QTYPE_SUPTYPES       1 /* Supported Qtypes */
  402 #define NI_QTYPE_FQDN           2 /* FQDN (draft 04) */
  403 #define NI_QTYPE_DNSNAME        2 /* DNS Name */
  404 #define NI_QTYPE_NODEADDR       3 /* Node Addresses */
  405 #define NI_QTYPE_IPV4ADDR       4 /* IPv4 Addresses */
  406 
  407 #if BYTE_ORDER == BIG_ENDIAN
  408 #define NI_SUPTYPE_FLAG_COMPRESS        0x1
  409 #define NI_FQDN_FLAG_VALIDTTL           0x1
  410 #elif BYTE_ORDER == LITTLE_ENDIAN
  411 #define NI_SUPTYPE_FLAG_COMPRESS        0x0100
  412 #define NI_FQDN_FLAG_VALIDTTL           0x0100
  413 #endif
  414 
  415 #ifdef NAME_LOOKUPS_04
  416 #if BYTE_ORDER == BIG_ENDIAN
  417 #define NI_NODEADDR_FLAG_LINKLOCAL      0x1
  418 #define NI_NODEADDR_FLAG_SITELOCAL      0x2
  419 #define NI_NODEADDR_FLAG_GLOBAL         0x4
  420 #define NI_NODEADDR_FLAG_ALL            0x8
  421 #define NI_NODEADDR_FLAG_TRUNCATE       0x10
  422 #define NI_NODEADDR_FLAG_ANYCAST        0x20 /* just experimental. not in spec */
  423 #elif BYTE_ORDER == LITTLE_ENDIAN
  424 #define NI_NODEADDR_FLAG_LINKLOCAL      0x0100
  425 #define NI_NODEADDR_FLAG_SITELOCAL      0x0200
  426 #define NI_NODEADDR_FLAG_GLOBAL         0x0400
  427 #define NI_NODEADDR_FLAG_ALL            0x0800
  428 #define NI_NODEADDR_FLAG_TRUNCATE       0x1000
  429 #define NI_NODEADDR_FLAG_ANYCAST        0x2000 /* just experimental. not in spec */
  430 #endif
  431 #else  /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
  432 #if BYTE_ORDER == BIG_ENDIAN
  433 #define NI_NODEADDR_FLAG_TRUNCATE       0x1
  434 #define NI_NODEADDR_FLAG_ALL            0x2
  435 #define NI_NODEADDR_FLAG_COMPAT         0x4
  436 #define NI_NODEADDR_FLAG_LINKLOCAL      0x8
  437 #define NI_NODEADDR_FLAG_SITELOCAL      0x10
  438 #define NI_NODEADDR_FLAG_GLOBAL         0x20
  439 #define NI_NODEADDR_FLAG_ANYCAST        0x40 /* just experimental. not in spec */
  440 #elif BYTE_ORDER == LITTLE_ENDIAN
  441 #define NI_NODEADDR_FLAG_TRUNCATE       0x0100
  442 #define NI_NODEADDR_FLAG_ALL            0x0200
  443 #define NI_NODEADDR_FLAG_COMPAT         0x0400
  444 #define NI_NODEADDR_FLAG_LINKLOCAL      0x0800
  445 #define NI_NODEADDR_FLAG_SITELOCAL      0x1000
  446 #define NI_NODEADDR_FLAG_GLOBAL         0x2000
  447 #define NI_NODEADDR_FLAG_ANYCAST        0x4000 /* just experimental. not in spec */
  448 #endif
  449 #endif
  450 
  451 struct ni_reply_fqdn {
  452         u_int32_t ni_fqdn_ttl;  /* TTL */
  453         u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
  454         u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
  455 } __packed;
  456 
  457 /*
  458  * Router Renumbering. as router-renum-08.txt
  459  */
  460 struct icmp6_router_renum {     /* router renumbering header */
  461         struct icmp6_hdr        rr_hdr;
  462         u_int8_t        rr_segnum;
  463         u_int8_t        rr_flags;
  464         u_int16_t       rr_maxdelay;
  465         u_int32_t       rr_reserved;
  466 } __packed;
  467 
  468 #define ICMP6_RR_FLAGS_TEST             0x80
  469 #define ICMP6_RR_FLAGS_REQRESULT        0x40
  470 #define ICMP6_RR_FLAGS_FORCEAPPLY       0x20
  471 #define ICMP6_RR_FLAGS_SPECSITE         0x10
  472 #define ICMP6_RR_FLAGS_PREVDONE         0x08
  473 
  474 #define rr_type         rr_hdr.icmp6_type
  475 #define rr_code         rr_hdr.icmp6_code
  476 #define rr_cksum        rr_hdr.icmp6_cksum
  477 #define rr_seqnum       rr_hdr.icmp6_data32[0]
  478 
  479 struct rr_pco_match {           /* match prefix part */
  480         u_int8_t        rpm_code;
  481         u_int8_t        rpm_len;
  482         u_int8_t        rpm_ordinal;
  483         u_int8_t        rpm_matchlen;
  484         u_int8_t        rpm_minlen;
  485         u_int8_t        rpm_maxlen;
  486         u_int16_t       rpm_reserved;
  487         struct  in6_addr        rpm_prefix;
  488 } __packed;
  489 
  490 #define RPM_PCO_ADD             1
  491 #define RPM_PCO_CHANGE          2
  492 #define RPM_PCO_SETGLOBAL       3
  493 #define RPM_PCO_MAX             4
  494 
  495 struct rr_pco_use {             /* use prefix part */
  496         u_int8_t        rpu_uselen;
  497         u_int8_t        rpu_keeplen;
  498         u_int8_t        rpu_ramask;
  499         u_int8_t        rpu_raflags;
  500         u_int32_t       rpu_vltime;
  501         u_int32_t       rpu_pltime;
  502         u_int32_t       rpu_flags;
  503         struct  in6_addr rpu_prefix;
  504 } __packed;
  505 #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK  0x80
  506 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO    0x40
  507 
  508 #if BYTE_ORDER == BIG_ENDIAN
  509 #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80000000
  510 #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40000000
  511 #elif BYTE_ORDER == LITTLE_ENDIAN
  512 #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80
  513 #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40
  514 #endif
  515 
  516 struct rr_result {              /* router renumbering result message */
  517         u_int16_t       rrr_flags;
  518         u_int8_t        rrr_ordinal;
  519         u_int8_t        rrr_matchedlen;
  520         u_int32_t       rrr_ifid;
  521         struct  in6_addr rrr_prefix;
  522 } __packed;
  523 #if BYTE_ORDER == BIG_ENDIAN
  524 #define ICMP6_RR_RESULT_FLAGS_OOB               0x0002
  525 #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN         0x0001
  526 #elif BYTE_ORDER == LITTLE_ENDIAN
  527 #define ICMP6_RR_RESULT_FLAGS_OOB               0x0200
  528 #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN         0x0100
  529 #endif
  530 
  531 /*
  532  * icmp6 filter structures.
  533  */
  534 
  535 struct icmp6_filter {
  536         u_int32_t icmp6_filt[8];
  537 };
  538 
  539 #ifdef _KERNEL
  540 #define ICMP6_FILTER_SETPASSALL(filterp) \
  541 do {                                                            \
  542         int i; u_char *p;                                       \
  543         p = (u_char *)filterp;                                  \
  544         for (i = 0; i < sizeof(struct icmp6_filter); i++)       \
  545                 p[i] = 0xff;                                    \
  546 } while (/*CONSTCOND*/ 0)
  547 #define ICMP6_FILTER_SETBLOCKALL(filterp) \
  548         bzero(filterp, sizeof(struct icmp6_filter))
  549 #else /* _KERNEL */
  550 #define ICMP6_FILTER_SETPASSALL(filterp) \
  551         memset(filterp, 0xff, sizeof(struct icmp6_filter))
  552 #define ICMP6_FILTER_SETBLOCKALL(filterp) \
  553         memset(filterp, 0x00, sizeof(struct icmp6_filter))
  554 #endif /* _KERNEL */
  555 
  556 #define ICMP6_FILTER_SETPASS(type, filterp) \
  557         (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
  558 #define ICMP6_FILTER_SETBLOCK(type, filterp) \
  559         (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
  560 #define ICMP6_FILTER_WILLPASS(type, filterp) \
  561         ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
  562 #define ICMP6_FILTER_WILLBLOCK(type, filterp) \
  563         ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
  564 
  565 /*
  566  * Variables related to this implementation
  567  * of the internet control message protocol version 6.
  568  */
  569 struct icmp6errstat {
  570         uint64_t icp6errs_dst_unreach_noroute;
  571         uint64_t icp6errs_dst_unreach_admin;
  572         uint64_t icp6errs_dst_unreach_beyondscope;
  573         uint64_t icp6errs_dst_unreach_addr;
  574         uint64_t icp6errs_dst_unreach_noport;
  575         uint64_t icp6errs_packet_too_big;
  576         uint64_t icp6errs_time_exceed_transit;
  577         uint64_t icp6errs_time_exceed_reassembly;
  578         uint64_t icp6errs_paramprob_header;
  579         uint64_t icp6errs_paramprob_nextheader;
  580         uint64_t icp6errs_paramprob_option;
  581         uint64_t icp6errs_redirect; /* we regard redirect as an error here */
  582         uint64_t icp6errs_unknown;
  583 };
  584 
  585 struct icmp6stat {
  586 /* statistics related to icmp6 packets generated */
  587         uint64_t icp6s_error;           /* # of calls to icmp6_error */
  588         uint64_t icp6s_canterror;       /* no error 'cuz old was icmp */
  589         uint64_t icp6s_toofreq;         /* no error 'cuz rate limitation */
  590         uint64_t icp6s_outhist[256];
  591 /* statistics related to input message processed */
  592         uint64_t icp6s_badcode;         /* icmp6_code out of range */
  593         uint64_t icp6s_tooshort;        /* packet < sizeof(struct icmp6_hdr) */
  594         uint64_t icp6s_checksum;        /* bad checksum */
  595         uint64_t icp6s_badlen;          /* calculated bound mismatch */
  596         /*
  597          * number of responses: this member is inherited from netinet code, but
  598          * for netinet6 code, it is already available in icp6s_outhist[].
  599          */
  600         uint64_t icp6s_reflect;
  601         uint64_t icp6s_inhist[256];     
  602         uint64_t icp6s_nd_toomanyopt;   /* too many ND options */
  603         struct icmp6errstat icp6s_outerrhist;
  604 #define icp6s_odst_unreach_noroute \
  605         icp6s_outerrhist.icp6errs_dst_unreach_noroute
  606 #define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin
  607 #define icp6s_odst_unreach_beyondscope \
  608         icp6s_outerrhist.icp6errs_dst_unreach_beyondscope
  609 #define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr
  610 #define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport
  611 #define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big
  612 #define icp6s_otime_exceed_transit \
  613         icp6s_outerrhist.icp6errs_time_exceed_transit
  614 #define icp6s_otime_exceed_reassembly \
  615         icp6s_outerrhist.icp6errs_time_exceed_reassembly
  616 #define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header
  617 #define icp6s_oparamprob_nextheader \
  618         icp6s_outerrhist.icp6errs_paramprob_nextheader
  619 #define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option
  620 #define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect
  621 #define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown
  622         uint64_t icp6s_pmtuchg;         /* path MTU changes */
  623         uint64_t icp6s_nd_badopt;       /* bad ND options */
  624         uint64_t icp6s_badns;           /* bad neighbor solicitation */
  625         uint64_t icp6s_badna;           /* bad neighbor advertisement */
  626         uint64_t icp6s_badrs;           /* bad router solicitation */
  627         uint64_t icp6s_badra;           /* bad router advertisement */
  628         uint64_t icp6s_badredirect;     /* bad redirect message */
  629 };
  630 
  631 #ifdef _KERNEL
  632 #include <sys/counter.h>
  633 
  634 VNET_PCPUSTAT_DECLARE(struct icmp6stat, icmp6stat);
  635 /*
  636  * In-kernel consumers can use these accessor macros directly to update
  637  * stats.
  638  */
  639 #define ICMP6STAT_ADD(name, val)        \
  640     VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, (val))
  641 #define ICMP6STAT_INC(name)             ICMP6STAT_ADD(name, 1)
  642 
  643 /*
  644  * Kernel module consumers must use this accessor macro.
  645  */
  646 void    kmod_icmp6stat_inc(int statnum);
  647 #define KMOD_ICMP6STAT_INC(name)        \
  648     kmod_icmp6stat_inc(offsetof(struct icmp6stat, name) / sizeof(uint64_t))
  649 #endif
  650 
  651 /*
  652  * Names for ICMP sysctl objects
  653  */
  654 #define ICMPV6CTL_STATS         1
  655 #define ICMPV6CTL_REDIRACCEPT   2       /* accept/process redirects */
  656 #define ICMPV6CTL_REDIRTIMEOUT  3       /* redirect cache time */
  657 #if 0   /*obsoleted*/
  658 #define ICMPV6CTL_ERRRATELIMIT  5       /* ICMPv6 error rate limitation */
  659 #endif
  660 #define ICMPV6CTL_ND6_PRUNE     6
  661 #define ICMPV6CTL_ND6_DELAY     8
  662 #define ICMPV6CTL_ND6_UMAXTRIES 9
  663 #define ICMPV6CTL_ND6_MMAXTRIES         10
  664 #define ICMPV6CTL_ND6_USELOOPBACK       11
  665 /*#define ICMPV6CTL_ND6_PROXYALL        12      obsoleted, do not reuse here */
  666 #define ICMPV6CTL_NODEINFO      13
  667 #define ICMPV6CTL_ERRPPSLIMIT   14      /* ICMPv6 error pps limitation */
  668 #define ICMPV6CTL_ND6_MAXNUDHINT        15
  669 #define ICMPV6CTL_MTUDISC_HIWAT 16
  670 #define ICMPV6CTL_MTUDISC_LOWAT 17
  671 #define ICMPV6CTL_ND6_DEBUG     18
  672 #define ICMPV6CTL_ND6_DRLIST    19
  673 #define ICMPV6CTL_ND6_PRLIST    20
  674 #define ICMPV6CTL_MLD_MAXSRCFILTER      21
  675 #define ICMPV6CTL_MLD_SOMAXSRC  22
  676 #define ICMPV6CTL_MLD_VERSION   23
  677 #define ICMPV6CTL_ND6_MAXQLEN   24
  678 #define ICMPV6CTL_NODEINFO_OLDMCPREFIX  25
  679 #define ICMPV6CTL_MAXID         26
  680 
  681 #define RTF_PROBEMTU    RTF_PROTO1
  682 
  683 #ifdef _KERNEL
  684 # ifdef __STDC__
  685 struct  rtentry;
  686 struct  rttimer;
  687 struct  in6_multi;
  688 # endif
  689 void    icmp6_paramerror(struct mbuf *, int);
  690 void    icmp6_error(struct mbuf *, int, int, int);
  691 void    icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
  692 int     icmp6_input(struct mbuf **, int *, int);
  693 void    icmp6_fasttimo(void);
  694 void    icmp6_slowtimo(void);
  695 void    icmp6_reflect(struct mbuf *, size_t);
  696 void    icmp6_prepare(struct mbuf *);
  697 void    icmp6_redirect_input(struct mbuf *, int);
  698 void    icmp6_redirect_output(struct mbuf *, struct rtentry *);
  699 
  700 struct  ip6ctlparam;
  701 void    icmp6_mtudisc_update(struct ip6ctlparam *, int);
  702 
  703 /* XXX: is this the right place for these macros? */
  704 #define icmp6_ifstat_inc(ifp, tag) \
  705 do {                                                            \
  706         if (ifp)                                                \
  707                 counter_u64_add(((struct in6_ifextra *)         \
  708                     ((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat[\
  709                     offsetof(struct icmp6_ifstat, tag) / sizeof(uint64_t)], 1);\
  710 } while (/*CONSTCOND*/ 0)
  711 
  712 #define icmp6_ifoutstat_inc(ifp, type, code) \
  713 do { \
  714                 icmp6_ifstat_inc(ifp, ifs6_out_msg); \
  715                 if (type < ICMP6_INFOMSG_MASK) \
  716                         icmp6_ifstat_inc(ifp, ifs6_out_error); \
  717                 switch (type) { \
  718                  case ICMP6_DST_UNREACH: \
  719                          icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
  720                          if (code == ICMP6_DST_UNREACH_ADMIN) \
  721                                  icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
  722                          break; \
  723                  case ICMP6_PACKET_TOO_BIG: \
  724                          icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
  725                          break; \
  726                  case ICMP6_TIME_EXCEEDED: \
  727                          icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
  728                          break; \
  729                  case ICMP6_PARAM_PROB: \
  730                          icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
  731                          break; \
  732                  case ICMP6_ECHO_REQUEST: \
  733                          icmp6_ifstat_inc(ifp, ifs6_out_echo); \
  734                          break; \
  735                  case ICMP6_ECHO_REPLY: \
  736                          icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
  737                          break; \
  738                  case MLD_LISTENER_QUERY: \
  739                          icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
  740                          break; \
  741                  case MLD_LISTENER_REPORT: \
  742                          icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
  743                          break; \
  744                  case MLD_LISTENER_DONE: \
  745                          icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
  746                          break; \
  747                  case ND_ROUTER_SOLICIT: \
  748                          icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
  749                          break; \
  750                  case ND_ROUTER_ADVERT: \
  751                          icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
  752                          break; \
  753                  case ND_NEIGHBOR_SOLICIT: \
  754                          icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
  755                          break; \
  756                  case ND_NEIGHBOR_ADVERT: \
  757                          icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
  758                          break; \
  759                  case ND_REDIRECT: \
  760                          icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
  761                          break; \
  762                 } \
  763 } while (/*CONSTCOND*/ 0)
  764 
  765 VNET_DECLARE(int, icmp6_rediraccept);   /* accept/process redirects */
  766 VNET_DECLARE(int, icmp6_redirtimeout);  /* cache time for redirect routes */
  767 
  768 #define V_icmp6_rediraccept     VNET(icmp6_rediraccept)
  769 #define V_icmp6_redirtimeout    VNET(icmp6_redirtimeout)
  770 
  771 #define ICMP6_NODEINFO_FQDNOK           0x1
  772 #define ICMP6_NODEINFO_NODEADDROK       0x2
  773 #define ICMP6_NODEINFO_TMPADDROK        0x4
  774 #define ICMP6_NODEINFO_GLOBALOK         0x8
  775 #endif /* _KERNEL */
  776 
  777 #endif /* not _NETINET_ICMP6_H_ */

Cache object: a08c399d244157398aa07b8c536cd0e9


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.