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/netinet6/in6.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 /*      $OpenBSD: in6.h,v 1.109 2021/06/02 00:20:50 dlg Exp $   */
    2 /*      $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei 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, 1990, 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  * 3. 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  *      @(#)in.h        8.3 (Berkeley) 1/3/94
   62  */
   63 
   64 #ifndef __KAME_NETINET_IN_H_INCLUDED_
   65 #error "do not include netinet6/in6.h directly, include netinet/in.h.  see RFC2553"
   66 #endif
   67 
   68 #ifndef _NETINET6_IN6_H_
   69 #define _NETINET6_IN6_H_
   70 
   71 /*
   72  * Identification of the network protocol stack
   73  * for *BSD-current/release: http://www.kame.net/dev/cvsweb2.cgi/kame/COVERAGE
   74  * has the table of implementation/integration differences.
   75  */
   76 #define __KAME__
   77 
   78 /*
   79  * IPv6 address
   80  */
   81 struct in6_addr {
   82         union {
   83                 u_int8_t   __u6_addr8[16];
   84                 u_int16_t  __u6_addr16[8];
   85                 u_int32_t  __u6_addr32[4];
   86         } __u6_addr;                    /* 128-bit IP6 address */
   87 };
   88 
   89 #define s6_addr   __u6_addr.__u6_addr8
   90 #ifdef _KERNEL  /* XXX nonstandard */
   91 #define s6_addr8  __u6_addr.__u6_addr8
   92 #define s6_addr16 __u6_addr.__u6_addr16
   93 #define s6_addr32 __u6_addr.__u6_addr32
   94 #endif
   95 
   96 #ifndef INET6_ADDRSTRLEN
   97 #define INET6_ADDRSTRLEN        46
   98 #endif
   99 
  100 /*
  101  * Socket address for IPv6
  102  */
  103 #if __BSD_VISIBLE
  104 #define SIN6_LEN        /* Indicates sockaddr_in6 has a sin6_len field */
  105 #endif /* __BSD_VISIBLE */
  106 struct sockaddr_in6 {
  107         u_int8_t        sin6_len;       /* length of this struct(sa_family_t)*/
  108         sa_family_t     sin6_family;    /* AF_INET6 (sa_family_t) */
  109         in_port_t       sin6_port;      /* Transport layer port # (in_port_t)*/
  110         u_int32_t       sin6_flowinfo;  /* IP6 flow information */
  111         struct in6_addr sin6_addr;      /* IP6 address */
  112         u_int32_t       sin6_scope_id;  /* intface scope id */
  113 };
  114 
  115 
  116 /*
  117  * Local definition for masks
  118  */
  119 #ifdef _KERNEL  /* XXX nonstandard */
  120 #define IN6MASK0        {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
  121 #define IN6MASK32       {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
  122                             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
  123 #define IN6MASK64       {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
  124                             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
  125 #define IN6MASK96       {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
  126                             0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
  127 #define IN6MASK128      {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
  128                             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
  129 
  130 extern const struct sockaddr_in6 sa6_any;
  131 
  132 extern const struct in6_addr in6mask0;
  133 extern const struct in6_addr in6mask32;
  134 extern const struct in6_addr in6mask64;
  135 extern const struct in6_addr in6mask96;
  136 extern const struct in6_addr in6mask128;
  137 #endif /* _KERNEL */
  138 
  139 /* Both kernel and libc define these for use */
  140 extern const struct in6_addr in6addr_any;
  141 extern const struct in6_addr in6addr_loopback;
  142 extern const struct in6_addr in6addr_intfacelocal_allnodes;
  143 extern const struct in6_addr in6addr_linklocal_allnodes;
  144 extern const struct in6_addr in6addr_linklocal_allrouters;
  145 
  146 #if __BSD_VISIBLE
  147 /*
  148  * IPv6 route structure
  149  */
  150 struct route_in6 {
  151         struct  rtentry *ro_rt;
  152         u_long           ro_tableid;    /* padded to long for alignment */
  153         struct  sockaddr_in6 ro_dst;
  154 };
  155 
  156 /*
  157  * Definition of some useful macros to handle IP6 addresses
  158  */
  159 #define IN6ADDR_ANY_INIT \
  160         {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
  161             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
  162 #define IN6ADDR_LOOPBACK_INIT \
  163         {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
  164             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
  165 #define IN6ADDR_NODELOCAL_ALLNODES_INIT \
  166         {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
  167             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
  168 #define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \
  169         {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
  170             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
  171 #define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
  172         {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
  173             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
  174 #define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
  175         {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
  176             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
  177 
  178 #define IN6_ARE_ADDR_EQUAL(a, b)                        \
  179     (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
  180 
  181 #endif /* __BSD_VISIBLE */
  182 
  183 /*
  184  * Macros started with IPV6_ADDR is KAME local
  185  */
  186 #define __IPV6_ADDR_INT32_ONE   htonl(1)
  187 #define __IPV6_ADDR_INT32_TWO   htonl(2)
  188 #define __IPV6_ADDR_INT32_MNL   htonl(0xff010000)
  189 #define __IPV6_ADDR_INT32_MLL   htonl(0xff020000)
  190 #define __IPV6_ADDR_INT32_SMP   htonl(0x0000ffff)
  191 #define __IPV6_ADDR_INT16_ULL   htons(0xfe80)
  192 #define __IPV6_ADDR_INT16_USL   htons(0xfec0)
  193 #define __IPV6_ADDR_INT16_MLL   htons(0xff02)
  194 
  195 /*
  196  * Unspecified
  197  */
  198 #define IN6_IS_ADDR_UNSPECIFIED(a)      \
  199         ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
  200          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
  201          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
  202          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
  203 
  204 /*
  205  * Loopback
  206  */
  207 #define IN6_IS_ADDR_LOOPBACK(a)         \
  208         ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
  209          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
  210          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
  211          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == __IPV6_ADDR_INT32_ONE))
  212 
  213 /*
  214  * IPv4 compatible
  215  */
  216 #define IN6_IS_ADDR_V4COMPAT(a)         \
  217         ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
  218          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
  219          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
  220          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != 0) &&        \
  221          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != __IPV6_ADDR_INT32_ONE))
  222 
  223 /*
  224  * Mapped
  225  */
  226 #define IN6_IS_ADDR_V4MAPPED(a)               \
  227         ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
  228          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
  229          (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == __IPV6_ADDR_INT32_SMP))
  230 
  231 /*
  232  * Unicast Scope
  233  * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
  234  */
  235 #define IN6_IS_ADDR_LINKLOCAL(a)        \
  236         (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
  237 #define IN6_IS_ADDR_SITELOCAL(a)        \
  238         (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
  239 
  240 /*
  241  * Multicast
  242  */
  243 #define __IPV6_ADDR_MC_SCOPE(a)         ((a)->s6_addr[1] & 0x0f)
  244 #define IN6_IS_ADDR_MULTICAST(a)        ((a)->s6_addr[0] == 0xff)
  245 
  246 #define __IPV6_ADDR_SCOPE_NODELOCAL     0x01
  247 #define __IPV6_ADDR_SCOPE_INTFACELOCAL  0x01
  248 #define __IPV6_ADDR_SCOPE_LINKLOCAL     0x02
  249 #define __IPV6_ADDR_SCOPE_SITELOCAL     0x05
  250 #define __IPV6_ADDR_SCOPE_ORGLOCAL      0x08    /* just used in this file */
  251 #define __IPV6_ADDR_SCOPE_GLOBAL        0x0e
  252 
  253 #define IN6_IS_ADDR_MC_NODELOCAL(a)     \
  254         (IN6_IS_ADDR_MULTICAST(a) &&    \
  255          (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
  256 #define IN6_IS_ADDR_MC_INTFACELOCAL(a)  \
  257         (IN6_IS_ADDR_MULTICAST(a) &&    \
  258          (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_INTFACELOCAL))
  259 #define IN6_IS_ADDR_MC_LINKLOCAL(a)     \
  260         (IN6_IS_ADDR_MULTICAST(a) &&    \
  261          (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
  262 #define IN6_IS_ADDR_MC_SITELOCAL(a)     \
  263         (IN6_IS_ADDR_MULTICAST(a) &&    \
  264          (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
  265 #define IN6_IS_ADDR_MC_ORGLOCAL(a)      \
  266         (IN6_IS_ADDR_MULTICAST(a) &&    \
  267          (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
  268 #define IN6_IS_ADDR_MC_GLOBAL(a)        \
  269         (IN6_IS_ADDR_MULTICAST(a) &&    \
  270          (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
  271 
  272 #ifdef _KERNEL
  273 #define IN6_IS_SCOPE_LINKLOCAL(a)       \
  274         ((IN6_IS_ADDR_LINKLOCAL(a)) ||  \
  275          (IN6_IS_ADDR_MC_LINKLOCAL(a)))
  276 #define IN6_IS_SCOPE_EMBED(a)   \
  277         ((IN6_IS_ADDR_LINKLOCAL(a)) ||  \
  278          (IN6_IS_ADDR_MC_LINKLOCAL(a)) || \
  279          (IN6_IS_ADDR_MC_INTFACELOCAL(a)))
  280 
  281 #define IFA6_IS_DEPRECATED(a) \
  282         ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
  283          (u_int32_t)((getuptime() - (a)->ia6_updatetime)) > \
  284          (a)->ia6_lifetime.ia6t_pltime)
  285 #define IFA6_IS_INVALID(a) \
  286         ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
  287          (u_int32_t)((getuptime() - (a)->ia6_updatetime)) > \
  288          (a)->ia6_lifetime.ia6t_vltime)
  289 
  290 #endif /* _KERNEL */
  291 
  292 /*
  293  * Options for use with [gs]etsockopt at the IPV6 level.
  294  * First word of comment is data type; bool is stored in int.
  295  */
  296 #define IPV6_UNICAST_HOPS       4  /* int; IP6 hops */
  297 #define IPV6_MULTICAST_IF       9  /* u_int; set/get IP6 multicast i/f */
  298 #define IPV6_MULTICAST_HOPS     10 /* u_int; set/get IP6 multicast hops */
  299 #define IPV6_MULTICAST_LOOP     11 /* u_int; set/get IP6 multicast loopback */
  300 #define IPV6_JOIN_GROUP         12 /* ip6_mreq; join a group membership */
  301 #define IPV6_LEAVE_GROUP        13 /* ip6_mreq; leave a group membership */
  302 #define IPV6_PORTRANGE          14 /* int; range to choose for unspec port */
  303 #if __BSD_VISIBLE
  304 #define ICMP6_FILTER            18 /* icmp6_filter; icmp6 filter */
  305 #endif
  306 
  307 #define IPV6_CHECKSUM           26 /* int; checksum offset for raw socket */
  308 #define IPV6_V6ONLY             27 /* bool; make AF_INET6 sockets v6 only */
  309 
  310 /* new socket options introduced in RFC3542 */
  311 #define IPV6_RTHDRDSTOPTS       35 /* ip6_dest; send dst option before rthdr */
  312 
  313 #define IPV6_RECVPKTINFO        36 /* bool; recv if, dst addr */
  314 #define IPV6_RECVHOPLIMIT       37 /* bool; recv hop limit */
  315 #define IPV6_RECVRTHDR          38 /* bool; recv routing header */
  316 #define IPV6_RECVHOPOPTS        39 /* bool; recv hop-by-hop option */
  317 #define IPV6_RECVDSTOPTS        40 /* bool; recv dst option after rthdr */
  318 
  319 #define IPV6_USE_MIN_MTU        42 /* bool; send packets at the minimum MTU */
  320 #define IPV6_RECVPATHMTU        43 /* bool; notify an according MTU */
  321 
  322 #define IPV6_PATHMTU            44 /* mtuinfo; get the current path MTU (sopt),
  323                                       4 bytes int; MTU notification (cmsg) */
  324 
  325 /* More new socket options introduced in RFC3542 */
  326 #define IPV6_PKTINFO            46 /* in6_pktinfo; send if, src addr */
  327 #define IPV6_HOPLIMIT           47 /* int; send hop limit */
  328 #define IPV6_NEXTHOP            48 /* sockaddr; next hop addr */
  329 #define IPV6_HOPOPTS            49 /* ip6_hbh; send hop-by-hop option */
  330 #define IPV6_DSTOPTS            50 /* ip6_dest; send dst option before rthdr */
  331 #define IPV6_RTHDR              51 /* ip6_rthdr; send routing header */
  332 
  333 #define IPV6_AUTH_LEVEL         53   /* int; authentication used */
  334 #define IPV6_ESP_TRANS_LEVEL    54   /* int; transport encryption */
  335 #define IPV6_ESP_NETWORK_LEVEL  55   /* int; full-packet encryption */
  336 #if __BSD_VISIBLE
  337 #define IPSEC6_OUTSA            56   /* set the outbound SA for a socket */
  338 #endif
  339 #define IPV6_RECVTCLASS         57   /* bool; recv traffic class values */
  340 
  341 #define IPV6_AUTOFLOWLABEL      59   /* bool; attach flowlabel automagically */
  342 #define IPV6_IPCOMP_LEVEL       60   /* int; compression */
  343 
  344 #define IPV6_TCLASS             61   /* int; send traffic class value */
  345 #define IPV6_DONTFRAG           62   /* bool; disable IPv6 fragmentation */
  346 #define IPV6_PIPEX              63   /* bool; using PIPEX */
  347 
  348 #define IPV6_RECVDSTPORT        64   /* bool; receive IP dst port w/dgram */
  349 #define IPV6_MINHOPCOUNT        65   /* int; minimum recv hop limit */
  350 
  351 #define IPV6_RTABLE             0x1021  /* int; routing table, see SO_RTABLE */
  352 
  353 /* to define items, should talk with KAME guys first, for *BSD compatibility */
  354 #define IPV6_RTHDR_LOOSE        0       /* this hop need not be a neighbor */
  355 #define IPV6_RTHDR_TYPE_0       0       /* IPv6 routing header type 0 */
  356 
  357 /*
  358  * Defaults and limits for options
  359  */
  360 #define IPV6_DEFAULT_MULTICAST_HOPS 1   /* normally limit m'casts to 1 hop */
  361 #define IPV6_DEFAULT_MULTICAST_LOOP 1   /* normally hear sends if a member */
  362 
  363 /*
  364  * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
  365  */
  366 struct ipv6_mreq {
  367         struct in6_addr ipv6mr_multiaddr;
  368         unsigned int    ipv6mr_interface;
  369 };
  370 
  371 /*
  372  * IPV6_PKTINFO: Packet information(RFC3542 sec 6)
  373  */
  374 struct in6_pktinfo {
  375         struct in6_addr ipi6_addr;      /* src/dst IPv6 address */
  376         unsigned int    ipi6_ifindex;   /* send/recv interface index */
  377 };
  378 
  379 /*
  380  * Control structure for IPV6_RECVPATHMTU socket option.
  381  * XXX Not allowed here by POSIX, but required by RFC 3542, so go
  382  * XXX with the code on the pavement.
  383  */
  384 struct ip6_mtuinfo {
  385         struct sockaddr_in6 ip6m_addr;  /* or sockaddr_storage? */
  386         u_int32_t ip6m_mtu;
  387 };
  388 
  389 /*
  390  * Argument for IPV6_PORTRANGE:
  391  * - which range to search when port is unspecified at bind() or connect()
  392  */
  393 #define IPV6_PORTRANGE_DEFAULT  0       /* default range */
  394 #define IPV6_PORTRANGE_HIGH     1       /* "high" - request firewall bypass */
  395 #define IPV6_PORTRANGE_LOW      2       /* "low" - vouchsafe security */
  396 
  397 #ifdef __BSD_VISIBLE
  398 
  399 #ifndef _SOCKLEN_T_DEFINED_
  400 #define _SOCKLEN_T_DEFINED_
  401 typedef __socklen_t     socklen_t;      /* length type for network syscalls */
  402 #endif
  403 
  404 #endif /* __BSD_VISIBLE */
  405 
  406 #ifdef _KERNEL
  407 extern const u_char inet6ctlerrmap[];
  408 extern const struct in6_addr zeroin6_addr;
  409 
  410 struct mbuf;
  411 struct sockaddr;
  412 struct sockaddr_in6;
  413 struct ifaddr;
  414 struct in6_ifaddr;
  415 struct ifnet;
  416 
  417 void    ipv6_input(struct ifnet *, struct mbuf *);
  418 struct mbuf *
  419         ipv6_check(struct ifnet *, struct mbuf *);
  420 
  421 int     in6_cksum(struct mbuf *, uint8_t, uint32_t, uint32_t);
  422 void    in6_proto_cksum_out(struct mbuf *, struct ifnet *);
  423 int     in6_localaddr(struct in6_addr *);
  424 int     in6_addrscope(struct in6_addr *);
  425 struct  in6_ifaddr *in6_ifawithscope(struct ifnet *, struct in6_addr *, u_int);
  426 int     in6_mask2len(struct in6_addr *, u_char *);
  427 int     in6_nam2sin6(const struct mbuf *, struct sockaddr_in6 **);
  428 int     in6_sa2sin6(struct sockaddr *, struct sockaddr_in6 **);
  429 
  430 struct inpcb;
  431 
  432 int     in6_embedscope(struct in6_addr *, const struct sockaddr_in6 *,
  433             struct inpcb *);
  434 void    in6_recoverscope(struct sockaddr_in6 *, const struct in6_addr *);
  435 void    in6_clearscope(struct in6_addr *);
  436 
  437 /*
  438  * Convert between address family specific and general structs.
  439  * Inline functions check the source type and are stricter than
  440  * casts or defines.
  441  */
  442 
  443 static inline struct sockaddr_in6 *
  444 satosin6(struct sockaddr *sa)
  445 {
  446         return ((struct sockaddr_in6 *)(sa));
  447 }
  448 
  449 static inline struct sockaddr *
  450 sin6tosa(struct sockaddr_in6 *sin6)
  451 {
  452         return ((struct sockaddr *)(sin6));
  453 }
  454 
  455 static inline struct in6_ifaddr *
  456 ifatoia6(struct ifaddr *ifa)
  457 {
  458         return ((struct in6_ifaddr *)(ifa));
  459 }
  460 
  461 #endif /* _KERNEL */
  462 
  463 #if __BSD_VISIBLE
  464 /*
  465  * Definitions for inet6 sysctl operations.
  466  *
  467  * Third level is protocol number.
  468  * Fourth level is desired variable within that protocol.
  469  */
  470 #define IPV6PROTO_MAXID (IPPROTO_DIVERT + 1)    /* don't list to IPV6PROTO_MAX */
  471 
  472 #define CTL_IPV6PROTO_NAMES { \
  473         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  474         { 0, 0 }, \
  475         { "tcp6", CTLTYPE_NODE }, \
  476         { 0, 0 }, \
  477         { 0, 0 }, \
  478         { 0, 0 }, \
  479         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  480         { 0, 0 }, \
  481         { 0, 0 }, \
  482         { "udp6", CTLTYPE_NODE }, \
  483         { 0, 0 }, \
  484         { 0, 0 }, \
  485         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  486         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  487         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  488         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  489         { 0, 0 }, \
  490         { "ip6", CTLTYPE_NODE }, \
  491         { 0, 0 }, \
  492         { 0, 0 }, \
  493         { 0, 0 }, \
  494         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  495         { 0, 0 }, \
  496         { "ipsec6", CTLTYPE_NODE }, \
  497         { 0, 0 }, \
  498         { 0, 0 }, \
  499         { 0, 0 }, \
  500         { 0, 0 }, \
  501         { 0, 0 }, \
  502         { 0, 0 }, \
  503         { "icmp6", CTLTYPE_NODE }, \
  504         { 0, 0 }, \
  505         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  506         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  507         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  508         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  509         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  510         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  511         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  512         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  513         { 0, 0 }, \
  514         { 0, 0 }, \
  515         { 0, 0 }, \
  516         { 0, 0 }, \
  517         { 0, 0 }, \
  518         { 0, 0 }, \
  519         { 0, 0 }, \
  520         { 0, 0 }, \
  521         { 0, 0 }, \
  522         { 0, 0 }, \
  523 /*110*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  524         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  525 /*120*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  526         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  527 /*130*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  528         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  529 /*140*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  530         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  531 /*150*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  532         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  533 /*160*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  534         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  535 /*170*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  536         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  537 /*180*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  538         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  539 /*190*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  540         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  541 /*200*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  542         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  543 /*210*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  544         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  545 /*220*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  546         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  547 /*230*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  548         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  549 /*240*/ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  550         { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
  551 /*250*/ { 0, 0 }, \
  552         { 0, 0 }, \
  553         { 0, 0 }, \
  554         { 0, 0 }, \
  555         { 0, 0 }, \
  556         { 0, 0 }, \
  557         { 0, 0 }, \
  558         { 0, 0 }, \
  559         { "divert", CTLTYPE_NODE }, \
  560 }
  561 
  562 /*
  563  * Names for IP sysctl objects
  564  */
  565 #define IPV6CTL_FORWARDING      1       /* act as router */
  566 #define IPV6CTL_SENDREDIRECTS   2       /* may send redirects when forwarding*/
  567 #define IPV6CTL_DEFHLIM         3       /* default Hop-Limit */
  568 #define IPV6CTL_FORWSRCRT       5       /* forward source-routed dgrams */
  569 #define IPV6CTL_STATS           6       /* stats */
  570 #define IPV6CTL_MRTSTATS        7       /* multicast forwarding stats */
  571 #define IPV6CTL_MRTPROTO        8       /* multicast routing protocol */
  572 #define IPV6CTL_MAXFRAGPACKETS  9       /* max packets reassembly queue */
  573 #define IPV6CTL_SOURCECHECK     10      /* verify source route and intf */
  574 #define IPV6CTL_SOURCECHECK_LOGINT 11   /* minimume logging interval */
  575 #define IPV6CTL_ACCEPT_RTADV    12
  576 #define IPV6CTL_LOG_INTERVAL    14
  577 #define IPV6CTL_HDRNESTLIMIT    15
  578 #define IPV6CTL_DAD_COUNT       16
  579 #define IPV6CTL_AUTO_FLOWLABEL  17
  580 #define IPV6CTL_DEFMCASTHLIM    18
  581 #define IPV6CTL_USE_DEPRECATED  21      /* use deprecated addr (RFC2462 5.5.4) */
  582 /* 24 to 40: reserved */
  583 #define IPV6CTL_MAXFRAGS        41      /* max fragments */
  584 #define IPV6CTL_MFORWARDING     42
  585 #define IPV6CTL_MULTIPATH       43
  586 #define IPV6CTL_MCAST_PMTU      44      /* path MTU discovery for multicast */
  587 #define IPV6CTL_NEIGHBORGCTHRESH 45
  588 #define IPV6CTL_MAXDYNROUTES    48
  589 #define IPV6CTL_DAD_PENDING     49
  590 #define IPV6CTL_MTUDISCTIMEOUT  50
  591 #define IPV6CTL_IFQUEUE         51
  592 #define IPV6CTL_MRTMIF          52
  593 #define IPV6CTL_MRTMFC          53
  594 #define IPV6CTL_SOIIKEY         54
  595 #define IPV6CTL_MAXID           55
  596 
  597 /* New entries should be added here from current IPV6CTL_MAXID value. */
  598 /* to define items, should talk with KAME guys first, for *BSD compatibility */
  599 
  600 #define IPV6CTL_NAMES { \
  601         { 0, 0 }, \
  602         { "forwarding", CTLTYPE_INT }, \
  603         { "redirect", CTLTYPE_INT }, \
  604         { "hlim", CTLTYPE_INT }, \
  605         { 0, 0 }, \
  606         { "forwsrcrt", CTLTYPE_INT }, \
  607         { 0, 0 }, \
  608         { 0, 0 }, \
  609         { "mrtproto", CTLTYPE_INT }, \
  610         { "maxfragpackets", CTLTYPE_INT }, \
  611         { "sourcecheck", CTLTYPE_INT }, \
  612         { "sourcecheck_logint", CTLTYPE_INT }, \
  613         { 0, 0 }, \
  614         { 0, 0 }, \
  615         { "log_interval", CTLTYPE_INT }, \
  616         { "hdrnestlimit", CTLTYPE_INT }, \
  617         { "dad_count", CTLTYPE_INT }, \
  618         { "auto_flowlabel", CTLTYPE_INT }, \
  619         { "defmcasthlim", CTLTYPE_INT }, \
  620         { 0, 0 }, \
  621         { 0, 0 }, \
  622         { "use_deprecated", CTLTYPE_INT }, \
  623         { 0, 0 }, \
  624         { 0, 0 }, \
  625         { 0, 0 }, \
  626         { 0, 0 }, \
  627         { 0, 0 }, \
  628         { 0, 0 }, \
  629         { 0, 0 }, \
  630         { 0, 0 }, \
  631         { 0, 0 }, \
  632         { 0, 0 }, \
  633         { 0, 0 }, \
  634         { 0, 0 }, \
  635         { 0, 0 }, \
  636         { 0, 0 }, \
  637         { 0, 0 }, \
  638         { 0, 0 }, \
  639         { 0, 0 }, \
  640         { 0, 0 }, \
  641         { 0, 0 }, \
  642         { "maxfrags", CTLTYPE_INT }, \
  643         { "mforwarding", CTLTYPE_INT }, \
  644         { "multipath", CTLTYPE_INT }, \
  645         { "multicast_mtudisc", CTLTYPE_INT }, \
  646         { "neighborgcthresh", CTLTYPE_INT }, \
  647         { 0, 0 }, \
  648         { 0, 0 }, \
  649         { "maxdynroutes", CTLTYPE_INT }, \
  650         { "dad_pending", CTLTYPE_INT }, \
  651         { "mtudisctimeout", CTLTYPE_INT }, \
  652         { "ifq", CTLTYPE_NODE }, \
  653         { "mrtmif", CTLTYPE_STRUCT }, \
  654         { "mrtmfc", CTLTYPE_STRUCT }, \
  655         { "soiikey", CTLTYPE_STRING }, /* binary string */ \
  656 }
  657 
  658 __BEGIN_DECLS
  659 struct cmsghdr;
  660 
  661 extern int inet6_opt_init(void *, socklen_t);
  662 extern int inet6_opt_append(void *, socklen_t, int, u_int8_t,
  663                 socklen_t, u_int8_t, void **);
  664 extern int inet6_opt_finish(void *, socklen_t, int);
  665 extern int inet6_opt_set_val(void *, int, void *, socklen_t);
  666 
  667 extern int inet6_opt_next(void *, socklen_t, int, u_int8_t *,
  668                 socklen_t *, void **);
  669 extern int inet6_opt_find(void *, socklen_t, int, u_int8_t,
  670                 socklen_t *, void **);
  671 extern int inet6_opt_get_val(void *, int, void *, socklen_t);
  672 
  673 extern socklen_t inet6_rth_space(int, int);
  674 extern void *inet6_rth_init(void *, socklen_t, int, int);
  675 extern int inet6_rth_add(void *, const struct in6_addr *);
  676 extern int inet6_rth_reverse(const void *, void *);
  677 extern int inet6_rth_segments(const void *);
  678 extern struct in6_addr *inet6_rth_getaddr(const void *, int);
  679 __END_DECLS
  680 #endif /* __BSD_VISIBLE */
  681 
  682 #endif /* !_NETINET6_IN6_H_ */

Cache object: 9b13ec1276a3fda5e723c62fa66c14e7


[ 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.