2005-01-07 02:30:35 +00:00
|
|
|
/*-
|
1999-11-05 14:41:39 +00:00
|
|
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
|
|
|
* All rights reserved.
|
1999-11-22 02:45:11 +00:00
|
|
|
*
|
1999-11-05 14:41:39 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the project nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
1999-11-22 02:45:11 +00:00
|
|
|
*
|
1999-11-05 14:41:39 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
2007-12-10 16:03:40 +00:00
|
|
|
*
|
|
|
|
* $KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $
|
1999-11-05 14:41:39 +00:00
|
|
|
*/
|
|
|
|
|
2005-01-07 02:30:35 +00:00
|
|
|
/*-
|
1999-11-05 14:41:39 +00:00
|
|
|
* Copyright (c) 1982, 1986, 1990, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
2007-12-10 16:03:40 +00:00
|
|
|
* $FreeBSD$
|
1999-11-05 14:41:39 +00:00
|
|
|
*/
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#ifndef __KAME_NETINET_IN_H_INCLUDED_
|
2001-06-11 12:39:29 +00:00
|
|
|
#error "do not include netinet6/in6.h directly, include netinet/in.h. see RFC2553"
|
2000-02-10 19:33:58 +00:00
|
|
|
#endif
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#ifndef _NETINET6_IN6_H_
|
|
|
|
#define _NETINET6_IN6_H_
|
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
/*
|
|
|
|
* Identification of the network protocol stack
|
2001-06-11 12:39:29 +00:00
|
|
|
* for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE
|
|
|
|
* has the table of implementation/integration differences.
|
1999-11-05 14:41:39 +00:00
|
|
|
*/
|
2000-07-04 16:35:15 +00:00
|
|
|
#define __KAME__
|
2006-03-19 02:11:42 +00:00
|
|
|
#define __KAME_VERSION "FreeBSD"
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
2006-03-28 12:51:22 +00:00
|
|
|
* IPv6 port allocation rules should mirror the IPv4 rules and are controlled
|
2011-02-21 09:01:34 +00:00
|
|
|
* by the net.inet.ip.portrange sysctl tree. The following defines exist
|
2006-03-28 12:51:22 +00:00
|
|
|
* for compatibility with userland applications that need them.
|
1999-11-05 14:41:39 +00:00
|
|
|
*/
|
2002-05-23 18:48:27 +00:00
|
|
|
#if __BSD_VISIBLE
|
1999-11-05 14:41:39 +00:00
|
|
|
#define IPV6PORT_RESERVED 1024
|
|
|
|
#define IPV6PORT_ANONMIN 49152
|
|
|
|
#define IPV6PORT_ANONMAX 65535
|
|
|
|
#define IPV6PORT_RESERVEDMIN 600
|
|
|
|
#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1)
|
2002-05-23 18:48:27 +00:00
|
|
|
#endif
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* IPv6 address
|
|
|
|
*/
|
|
|
|
struct in6_addr {
|
|
|
|
union {
|
2002-05-23 18:48:27 +00:00
|
|
|
uint8_t __u6_addr8[16];
|
|
|
|
uint16_t __u6_addr16[8];
|
|
|
|
uint32_t __u6_addr32[4];
|
1999-11-05 14:41:39 +00:00
|
|
|
} __u6_addr; /* 128-bit IP6 address */
|
|
|
|
};
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define s6_addr __u6_addr.__u6_addr8
|
2002-04-19 04:46:24 +00:00
|
|
|
#ifdef _KERNEL /* XXX nonstandard */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define s6_addr8 __u6_addr.__u6_addr8
|
|
|
|
#define s6_addr16 __u6_addr.__u6_addr16
|
|
|
|
#define s6_addr32 __u6_addr.__u6_addr32
|
1999-11-05 14:41:39 +00:00
|
|
|
#endif
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define INET6_ADDRSTRLEN 46
|
1999-11-05 14:41:39 +00:00
|
|
|
|
2002-05-23 18:48:27 +00:00
|
|
|
/*
|
|
|
|
* XXX missing POSIX.1-2001 macro IPPROTO_IPV6.
|
|
|
|
*/
|
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
/*
|
|
|
|
* Socket address for IPv6
|
|
|
|
*/
|
2002-05-23 18:48:27 +00:00
|
|
|
#if __BSD_VISIBLE
|
2000-07-04 16:35:15 +00:00
|
|
|
#define SIN6_LEN
|
1999-11-05 14:41:39 +00:00
|
|
|
#endif
|
2002-05-23 18:48:27 +00:00
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
struct sockaddr_in6 {
|
2002-07-22 15:13:55 +00:00
|
|
|
uint8_t sin6_len; /* length of this struct */
|
2002-05-23 18:48:27 +00:00
|
|
|
sa_family_t sin6_family; /* AF_INET6 */
|
|
|
|
in_port_t sin6_port; /* Transport layer port # */
|
|
|
|
uint32_t sin6_flowinfo; /* IP6 flow information */
|
2000-07-04 16:35:15 +00:00
|
|
|
struct in6_addr sin6_addr; /* IP6 address */
|
2002-05-23 18:48:27 +00:00
|
|
|
uint32_t sin6_scope_id; /* scope zone index */
|
1999-11-05 14:41:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local definition for masks
|
|
|
|
*/
|
2002-04-19 04:46:24 +00:00
|
|
|
#ifdef _KERNEL /* XXX nonstandard */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
|
|
|
|
#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
|
1999-11-05 14:41:39 +00:00
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
|
1999-11-05 14:41:39 +00:00
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
|
1999-11-05 14:41:39 +00:00
|
|
|
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
|
1999-11-05 14:41:39 +00:00
|
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _KERNEL
|
2001-06-11 12:39:29 +00:00
|
|
|
extern const struct sockaddr_in6 sa6_any;
|
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
extern const struct in6_addr in6mask0;
|
|
|
|
extern const struct in6_addr in6mask32;
|
|
|
|
extern const struct in6_addr in6mask64;
|
|
|
|
extern const struct in6_addr in6mask96;
|
|
|
|
extern const struct in6_addr in6mask128;
|
|
|
|
#endif /* _KERNEL */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Macros started with IPV6_ADDR is KAME local
|
|
|
|
*/
|
2002-04-19 04:46:24 +00:00
|
|
|
#ifdef _KERNEL /* XXX nonstandard */
|
2002-05-23 18:48:27 +00:00
|
|
|
#if _BYTE_ORDER == _BIG_ENDIAN
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_ADDR_INT32_ONE 1
|
|
|
|
#define IPV6_ADDR_INT32_TWO 2
|
|
|
|
#define IPV6_ADDR_INT32_MNL 0xff010000
|
|
|
|
#define IPV6_ADDR_INT32_MLL 0xff020000
|
|
|
|
#define IPV6_ADDR_INT32_SMP 0x0000ffff
|
|
|
|
#define IPV6_ADDR_INT16_ULL 0xfe80
|
|
|
|
#define IPV6_ADDR_INT16_USL 0xfec0
|
|
|
|
#define IPV6_ADDR_INT16_MLL 0xff02
|
2002-05-23 18:48:27 +00:00
|
|
|
#elif _BYTE_ORDER == _LITTLE_ENDIAN
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_ADDR_INT32_ONE 0x01000000
|
|
|
|
#define IPV6_ADDR_INT32_TWO 0x02000000
|
|
|
|
#define IPV6_ADDR_INT32_MNL 0x000001ff
|
|
|
|
#define IPV6_ADDR_INT32_MLL 0x000002ff
|
|
|
|
#define IPV6_ADDR_INT32_SMP 0xffff0000
|
|
|
|
#define IPV6_ADDR_INT16_ULL 0x80fe
|
|
|
|
#define IPV6_ADDR_INT16_USL 0xc0fe
|
|
|
|
#define IPV6_ADDR_INT16_MLL 0x02ff
|
1999-11-05 14:41:39 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Definition of some useful macros to handle IP6 addresses
|
|
|
|
*/
|
2002-05-23 18:48:27 +00:00
|
|
|
#if __BSD_VISIBLE
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6ADDR_ANY_INIT \
|
1999-11-05 14:41:39 +00:00
|
|
|
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6ADDR_LOOPBACK_INIT \
|
1999-11-05 14:41:39 +00:00
|
|
|
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
|
1999-11-05 14:41:39 +00:00
|
|
|
{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
2003-10-21 20:05:32 +00:00
|
|
|
#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \
|
|
|
|
{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
|
1999-11-05 14:41:39 +00:00
|
|
|
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
|
1999-11-05 14:41:39 +00:00
|
|
|
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
|
2009-04-29 10:22:44 +00:00
|
|
|
#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \
|
|
|
|
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}}
|
2002-05-23 18:48:27 +00:00
|
|
|
#endif
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
extern const struct in6_addr in6addr_any;
|
|
|
|
extern const struct in6_addr in6addr_loopback;
|
2002-05-23 18:48:27 +00:00
|
|
|
#if __BSD_VISIBLE
|
1999-11-05 14:41:39 +00:00
|
|
|
extern const struct in6_addr in6addr_nodelocal_allnodes;
|
|
|
|
extern const struct in6_addr in6addr_linklocal_allnodes;
|
|
|
|
extern const struct in6_addr in6addr_linklocal_allrouters;
|
2009-04-29 10:22:44 +00:00
|
|
|
extern const struct in6_addr in6addr_linklocal_allv2routers;
|
2002-05-23 18:48:27 +00:00
|
|
|
#endif
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Equality
|
1999-11-29 08:19:01 +00:00
|
|
|
* NOTE: Some of kernel programming environment (for example, openbsd/sparc)
|
|
|
|
* does not supply memcmp(). For userland memcmp() is preferred as it is
|
|
|
|
* in ANSI standard.
|
1999-11-05 14:41:39 +00:00
|
|
|
*/
|
1999-11-29 08:19:01 +00:00
|
|
|
#ifdef _KERNEL
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_ARE_ADDR_EQUAL(a, b) \
|
|
|
|
(bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
|
1999-11-29 08:19:01 +00:00
|
|
|
#else
|
2002-05-23 18:48:27 +00:00
|
|
|
#if __BSD_VISIBLE
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_ARE_ADDR_EQUAL(a, b) \
|
|
|
|
(memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
|
1999-11-29 08:19:01 +00:00
|
|
|
#endif
|
2002-05-23 18:48:27 +00:00
|
|
|
#endif
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Unspecified
|
|
|
|
*/
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_UNSPECIFIED(a) \
|
2012-01-26 12:04:19 +00:00
|
|
|
((a)->__u6_addr.__u6_addr32[0] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[1] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[2] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[3] == 0)
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Loopback
|
|
|
|
*/
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_LOOPBACK(a) \
|
2012-01-26 12:04:19 +00:00
|
|
|
((a)->__u6_addr.__u6_addr32[0] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[1] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[2] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[3] == ntohl(1))
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* IPv4 compatible
|
|
|
|
*/
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_V4COMPAT(a) \
|
2012-01-26 12:04:19 +00:00
|
|
|
((a)->__u6_addr.__u6_addr32[0] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[1] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[2] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[3] != 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[3] != ntohl(1))
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Mapped
|
|
|
|
*/
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_V4MAPPED(a) \
|
2012-01-26 12:04:19 +00:00
|
|
|
((a)->__u6_addr.__u6_addr32[0] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[1] == 0 && \
|
|
|
|
(a)->__u6_addr.__u6_addr32[2] == ntohl(0x0000ffff))
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* KAME Scope Values
|
|
|
|
*/
|
|
|
|
|
2002-04-19 04:46:24 +00:00
|
|
|
#ifdef _KERNEL /* XXX nonstandard */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_ADDR_SCOPE_NODELOCAL 0x01
|
2003-10-21 20:05:32 +00:00
|
|
|
#define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02
|
|
|
|
#define IPV6_ADDR_SCOPE_SITELOCAL 0x05
|
|
|
|
#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
|
|
|
|
#define IPV6_ADDR_SCOPE_GLOBAL 0x0e
|
1999-11-05 14:41:39 +00:00
|
|
|
#else
|
2000-07-04 16:35:15 +00:00
|
|
|
#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01
|
2003-10-21 20:05:32 +00:00
|
|
|
#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
|
2000-07-04 16:35:15 +00:00
|
|
|
#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02
|
|
|
|
#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
|
|
|
|
#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
|
|
|
|
#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e
|
1999-11-05 14:41:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Unicast Scope
|
|
|
|
* Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
|
|
|
|
*/
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_LINKLOCAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_SITELOCAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Multicast
|
|
|
|
*/
|
|
|
|
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
|
|
|
|
|
2002-04-19 04:46:24 +00:00
|
|
|
#ifdef _KERNEL /* XXX nonstandard */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
|
1999-11-05 14:41:39 +00:00
|
|
|
#else
|
2000-07-04 16:35:15 +00:00
|
|
|
#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
|
1999-11-05 14:41:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Multicast Scope
|
|
|
|
*/
|
2002-04-19 04:46:24 +00:00
|
|
|
#ifdef _KERNEL /* refers nonstandard items */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
|
|
|
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
|
2003-10-21 20:05:32 +00:00
|
|
|
#define IN6_IS_ADDR_MC_INTFACELOCAL(a) \
|
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
|
|
|
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
|
|
|
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
|
2007-07-05 16:29:40 +00:00
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
1999-11-05 14:41:39 +00:00
|
|
|
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
|
|
|
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_MC_GLOBAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
|
|
|
(IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
|
|
|
|
#else
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
|
|
|
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
|
|
|
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
|
2007-07-05 16:29:40 +00:00
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
1999-11-05 14:41:39 +00:00
|
|
|
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
|
|
|
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_ADDR_MC_GLOBAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
(IN6_IS_ADDR_MULTICAST(a) && \
|
|
|
|
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
|
|
|
|
#endif
|
|
|
|
|
2002-04-19 04:46:24 +00:00
|
|
|
#ifdef _KERNEL /* nonstandard */
|
2001-06-11 12:39:29 +00:00
|
|
|
/*
|
|
|
|
* KAME Scope
|
|
|
|
*/
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IN6_IS_SCOPE_LINKLOCAL(a) \
|
1999-11-05 14:41:39 +00:00
|
|
|
((IN6_IS_ADDR_LINKLOCAL(a)) || \
|
|
|
|
(IN6_IS_ADDR_MC_LINKLOCAL(a)))
|
2007-07-03 12:46:08 +00:00
|
|
|
#define IN6_IS_SCOPE_EMBED(a) \
|
|
|
|
((IN6_IS_ADDR_LINKLOCAL(a)) || \
|
2007-07-05 16:29:40 +00:00
|
|
|
(IN6_IS_ADDR_MC_LINKLOCAL(a)) || \
|
2007-07-03 12:46:08 +00:00
|
|
|
(IN6_IS_ADDR_MC_INTFACELOCAL(a)))
|
2007-07-05 16:29:40 +00:00
|
|
|
|
2001-06-11 12:39:29 +00:00
|
|
|
#define IFA6_IS_DEPRECATED(a) \
|
2005-10-21 16:23:01 +00:00
|
|
|
((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
|
2013-08-05 20:13:02 +00:00
|
|
|
(u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \
|
2005-10-21 16:23:01 +00:00
|
|
|
(a)->ia6_lifetime.ia6t_pltime)
|
2001-06-11 12:39:29 +00:00
|
|
|
#define IFA6_IS_INVALID(a) \
|
2005-10-21 16:23:01 +00:00
|
|
|
((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
|
2013-08-05 20:13:02 +00:00
|
|
|
(u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \
|
2005-10-21 16:23:01 +00:00
|
|
|
(a)->ia6_lifetime.ia6t_vltime)
|
2001-06-11 12:39:29 +00:00
|
|
|
#endif /* _KERNEL */
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* IP6 route structure
|
|
|
|
*/
|
2002-05-23 18:48:27 +00:00
|
|
|
#if __BSD_VISIBLE
|
1999-11-05 14:41:39 +00:00
|
|
|
struct route_in6 {
|
|
|
|
struct rtentry *ro_rt;
|
2009-04-15 20:34:19 +00:00
|
|
|
struct llentry *ro_lle;
|
2011-09-20 20:27:26 +00:00
|
|
|
struct in6_addr *ro_ia6;
|
|
|
|
int ro_flags;
|
1999-11-05 14:41:39 +00:00
|
|
|
struct sockaddr_in6 ro_dst;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Options for use with [gs]etsockopt at the IPV6 level.
|
|
|
|
* First word of comment is data type; bool is stored in int.
|
|
|
|
*/
|
|
|
|
/* no hdrincl */
|
2000-07-04 16:35:15 +00:00
|
|
|
#if 0 /* the followings are relic in IPv4 and hence are disabled */
|
|
|
|
#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */
|
|
|
|
#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */
|
|
|
|
#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */
|
|
|
|
#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */
|
|
|
|
#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */
|
|
|
|
#endif
|
|
|
|
#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
|
2003-10-24 18:26:30 +00:00
|
|
|
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
|
|
|
|
#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
|
|
|
|
#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
|
|
|
|
#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */
|
2011-04-25 09:00:52 +00:00
|
|
|
#define IPV6_JOIN_GROUP 12 /* ipv6_mreq; join a group membership */
|
|
|
|
#define IPV6_LEAVE_GROUP 13 /* ipv6_mreq; leave a group membership */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
|
|
|
|
#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
|
2001-06-11 12:39:29 +00:00
|
|
|
/* RFC2292 options */
|
2003-10-24 18:26:30 +00:00
|
|
|
#ifdef _KERNEL
|
|
|
|
#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */
|
|
|
|
#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */
|
|
|
|
#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */
|
|
|
|
#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */
|
|
|
|
#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */
|
|
|
|
#define IPV6_2292RTHDR 24 /* bool; routing header */
|
|
|
|
#define IPV6_2292PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */
|
|
|
|
#endif
|
2001-06-11 12:39:29 +00:00
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
|
2003-10-24 18:26:30 +00:00
|
|
|
#define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */
|
2001-06-11 12:39:29 +00:00
|
|
|
#ifndef _KERNEL
|
|
|
|
#define IPV6_BINDV6ONLY IPV6_V6ONLY
|
|
|
|
#endif
|
1999-11-05 14:41:39 +00:00
|
|
|
|
2007-07-19 09:16:40 +00:00
|
|
|
#if 1 /* IPSEC */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */
|
2007-07-03 12:13:45 +00:00
|
|
|
#endif /* IPSEC */
|
2007-07-01 11:41:27 +00:00
|
|
|
|
2014-11-09 21:33:01 +00:00
|
|
|
/* 29; unused; was IPV6_FAITH */
|
2002-04-19 04:46:24 +00:00
|
|
|
#if 1 /* IPV6FIREWALL */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_FW_ADD 30 /* add a firewall rule to chain */
|
|
|
|
#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */
|
|
|
|
#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */
|
|
|
|
#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */
|
|
|
|
#define IPV6_FW_GET 34 /* get entire firewall rule chain */
|
2001-06-11 12:39:29 +00:00
|
|
|
#endif
|
|
|
|
|
2005-07-20 08:59:45 +00:00
|
|
|
/* new socket options introduced in RFC3542 */
|
2003-10-24 18:26:30 +00:00
|
|
|
#define IPV6_RTHDRDSTOPTS 35 /* ip6_dest; send dst option before rthdr */
|
|
|
|
|
|
|
|
#define IPV6_RECVPKTINFO 36 /* bool; recv if, dst addr */
|
|
|
|
#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */
|
|
|
|
#define IPV6_RECVRTHDR 38 /* bool; recv routing header */
|
|
|
|
#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */
|
|
|
|
#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */
|
|
|
|
#ifdef _KERNEL
|
|
|
|
#define IPV6_RECVRTHDRDSTOPTS 41 /* bool; recv dst option before rthdr */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */
|
|
|
|
#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */
|
|
|
|
|
|
|
|
#define IPV6_PATHMTU 44 /* mtuinfo; get the current path MTU (sopt),
|
|
|
|
4 bytes int; MTU notification (cmsg) */
|
|
|
|
#if 0 /*obsoleted during 2292bis -> 3542*/
|
|
|
|
#define IPV6_REACHCONF 45 /* no data; ND reachability confirm
|
|
|
|
(cmsg only/not in of RFC3542) */
|
|
|
|
#endif
|
|
|
|
|
2005-07-20 08:59:45 +00:00
|
|
|
/* more new socket options introduced in RFC3542 */
|
2003-10-24 18:26:30 +00:00
|
|
|
#define IPV6_PKTINFO 46 /* in6_pktinfo; send if, src addr */
|
|
|
|
#define IPV6_HOPLIMIT 47 /* int; send hop limit */
|
|
|
|
#define IPV6_NEXTHOP 48 /* sockaddr; next hop addr */
|
|
|
|
#define IPV6_HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */
|
|
|
|
#define IPV6_DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */
|
|
|
|
#define IPV6_RTHDR 51 /* ip6_rthdr; send routing header */
|
|
|
|
#if 0
|
|
|
|
#define IPV6_PKTOPTIONS 52 /* buf/cmsghdr; set/get IPv6 options */
|
2005-07-20 08:59:45 +00:00
|
|
|
/* obsoleted by RFC3542 */
|
2003-10-24 18:26:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define IPV6_RECVTCLASS 57 /* bool; recv traffic class values */
|
|
|
|
|
|
|
|
#define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */
|
|
|
|
|
|
|
|
#define IPV6_TCLASS 61 /* int; send traffic class value */
|
|
|
|
#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */
|
|
|
|
|
|
|
|
#define IPV6_PREFER_TEMPADDR 63 /* int; prefer temporary addresses as
|
|
|
|
* the source address.
|
|
|
|
*/
|
|
|
|
|
2009-06-01 10:30:00 +00:00
|
|
|
#define IPV6_BINDANY 64 /* bool: allow bind to any address */
|
|
|
|
|
2014-07-12 05:44:16 +00:00
|
|
|
#define IPV6_BINDMULTI 65 /* bool; allow multibind to same addr/port */
|
|
|
|
#define IPV6_RSS_LISTEN_BUCKET 66 /* int; set RSS listen bucket */
|
|
|
|
#define IPV6_FLOWID 67 /* int; flowid of given socket */
|
|
|
|
#define IPV6_FLOWTYPE 68 /* int; flowtype of given socket */
|
|
|
|
#define IPV6_RSSBUCKETID 69 /* int; RSS bucket ID of given socket */
|
|
|
|
|
Import rewrite of IPv4 socket multicast layer to support source-specific
and protocol-independent host mode multicast. The code is written to
accomodate IPv6, IGMPv3 and MLDv2 with only a little additional work.
This change only pertains to FreeBSD's use as a multicast end-station and
does not concern multicast routing; for an IGMPv3/MLDv2 router
implementation, consider the XORP project.
The work is based on Wilbert de Graaf's IGMPv3 code drop for FreeBSD 4.6,
which is available at: http://www.kloosterhof.com/wilbert/igmpv3.html
Summary
* IPv4 multicast socket processing is now moved out of ip_output.c
into a new module, in_mcast.c.
* The in_mcast.c module implements the IPv4 legacy any-source API in
terms of the protocol-independent source-specific API.
* Source filters are lazy allocated as the common case does not use them.
They are part of per inpcb state and are covered by the inpcb lock.
* struct ip_mreqn is now supported to allow applications to specify
multicast joins by interface index in the legacy IPv4 any-source API.
* In UDP, an incoming multicast datagram only requires that the source
port matches the 4-tuple if the socket was already bound by source port.
An unbound socket SHOULD be able to receive multicasts sent from an
ephemeral source port.
* The UDP socket multicast filter mode defaults to exclusive, that is,
sources present in the per-socket list will be blocked from delivery.
* The RFC 3678 userland functions have been added to libc: setsourcefilter,
getsourcefilter, setipv4sourcefilter, getipv4sourcefilter.
* Definitions for IGMPv3 are merged but not yet used.
* struct sockaddr_storage is now referenced from <netinet/in.h>. It
is therefore defined there if not already declared in the same way
as for the C99 types.
* The RFC 1724 hack (specify 0.0.0.0/8 addresses to IP_MULTICAST_IF
which are then interpreted as interface indexes) is now deprecated.
* A patch for the Rhyolite.com routed in the FreeBSD base system
is available in the -net archives. This only affects individuals
running RIPv1 or RIPv2 via point-to-point and/or unnumbered interfaces.
* Make IPv6 detach path similar to IPv4's in code flow; functionally same.
* Bump __FreeBSD_version to 700048; see UPDATING.
This work was financially supported by another FreeBSD committer.
Obtained from: p4://bms_netdev
Submitted by: Wilbert de Graaf (original work)
Reviewed by: rwatson (locking), silence from fenner,
net@ (but with encouragement)
2007-06-12 16:24:56 +00:00
|
|
|
/*
|
|
|
|
* The following option is private; do not use it from user applications.
|
|
|
|
* It is deliberately defined to the same value as IP_MSFILTER.
|
|
|
|
*/
|
|
|
|
#define IPV6_MSFILTER 74 /* struct __msfilterreq;
|
|
|
|
* set/get multicast source filter list.
|
|
|
|
*/
|
|
|
|
|
2000-08-27 00:58:13 +00:00
|
|
|
/* to define items, should talk with KAME guys first, for *BSD compatibility */
|
1999-11-05 14:41:39 +00:00
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */
|
|
|
|
#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */
|
|
|
|
#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Defaults and limits for options
|
|
|
|
*/
|
2002-04-19 04:46:24 +00:00
|
|
|
#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */
|
|
|
|
#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
2009-04-29 10:22:44 +00:00
|
|
|
* The im6o_membership vector for each socket is now dynamically allocated at
|
|
|
|
* run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
|
|
|
|
* according to a power-of-two increment.
|
1999-11-05 14:41:39 +00:00
|
|
|
*/
|
2009-04-29 10:22:44 +00:00
|
|
|
#define IPV6_MIN_MEMBERSHIPS 31
|
|
|
|
#define IPV6_MAX_MEMBERSHIPS 4095
|
1999-11-05 14:41:39 +00:00
|
|
|
|
Import rewrite of IPv4 socket multicast layer to support source-specific
and protocol-independent host mode multicast. The code is written to
accomodate IPv6, IGMPv3 and MLDv2 with only a little additional work.
This change only pertains to FreeBSD's use as a multicast end-station and
does not concern multicast routing; for an IGMPv3/MLDv2 router
implementation, consider the XORP project.
The work is based on Wilbert de Graaf's IGMPv3 code drop for FreeBSD 4.6,
which is available at: http://www.kloosterhof.com/wilbert/igmpv3.html
Summary
* IPv4 multicast socket processing is now moved out of ip_output.c
into a new module, in_mcast.c.
* The in_mcast.c module implements the IPv4 legacy any-source API in
terms of the protocol-independent source-specific API.
* Source filters are lazy allocated as the common case does not use them.
They are part of per inpcb state and are covered by the inpcb lock.
* struct ip_mreqn is now supported to allow applications to specify
multicast joins by interface index in the legacy IPv4 any-source API.
* In UDP, an incoming multicast datagram only requires that the source
port matches the 4-tuple if the socket was already bound by source port.
An unbound socket SHOULD be able to receive multicasts sent from an
ephemeral source port.
* The UDP socket multicast filter mode defaults to exclusive, that is,
sources present in the per-socket list will be blocked from delivery.
* The RFC 3678 userland functions have been added to libc: setsourcefilter,
getsourcefilter, setipv4sourcefilter, getipv4sourcefilter.
* Definitions for IGMPv3 are merged but not yet used.
* struct sockaddr_storage is now referenced from <netinet/in.h>. It
is therefore defined there if not already declared in the same way
as for the C99 types.
* The RFC 1724 hack (specify 0.0.0.0/8 addresses to IP_MULTICAST_IF
which are then interpreted as interface indexes) is now deprecated.
* A patch for the Rhyolite.com routed in the FreeBSD base system
is available in the -net archives. This only affects individuals
running RIPv1 or RIPv2 via point-to-point and/or unnumbered interfaces.
* Make IPv6 detach path similar to IPv4's in code flow; functionally same.
* Bump __FreeBSD_version to 700048; see UPDATING.
This work was financially supported by another FreeBSD committer.
Obtained from: p4://bms_netdev
Submitted by: Wilbert de Graaf (original work)
Reviewed by: rwatson (locking), silence from fenner,
net@ (but with encouragement)
2007-06-12 16:24:56 +00:00
|
|
|
/*
|
2009-04-29 10:22:44 +00:00
|
|
|
* Default resource limits for IPv6 multicast source filtering.
|
|
|
|
* These may be modified by sysctl.
|
Import rewrite of IPv4 socket multicast layer to support source-specific
and protocol-independent host mode multicast. The code is written to
accomodate IPv6, IGMPv3 and MLDv2 with only a little additional work.
This change only pertains to FreeBSD's use as a multicast end-station and
does not concern multicast routing; for an IGMPv3/MLDv2 router
implementation, consider the XORP project.
The work is based on Wilbert de Graaf's IGMPv3 code drop for FreeBSD 4.6,
which is available at: http://www.kloosterhof.com/wilbert/igmpv3.html
Summary
* IPv4 multicast socket processing is now moved out of ip_output.c
into a new module, in_mcast.c.
* The in_mcast.c module implements the IPv4 legacy any-source API in
terms of the protocol-independent source-specific API.
* Source filters are lazy allocated as the common case does not use them.
They are part of per inpcb state and are covered by the inpcb lock.
* struct ip_mreqn is now supported to allow applications to specify
multicast joins by interface index in the legacy IPv4 any-source API.
* In UDP, an incoming multicast datagram only requires that the source
port matches the 4-tuple if the socket was already bound by source port.
An unbound socket SHOULD be able to receive multicasts sent from an
ephemeral source port.
* The UDP socket multicast filter mode defaults to exclusive, that is,
sources present in the per-socket list will be blocked from delivery.
* The RFC 3678 userland functions have been added to libc: setsourcefilter,
getsourcefilter, setipv4sourcefilter, getipv4sourcefilter.
* Definitions for IGMPv3 are merged but not yet used.
* struct sockaddr_storage is now referenced from <netinet/in.h>. It
is therefore defined there if not already declared in the same way
as for the C99 types.
* The RFC 1724 hack (specify 0.0.0.0/8 addresses to IP_MULTICAST_IF
which are then interpreted as interface indexes) is now deprecated.
* A patch for the Rhyolite.com routed in the FreeBSD base system
is available in the -net archives. This only affects individuals
running RIPv1 or RIPv2 via point-to-point and/or unnumbered interfaces.
* Make IPv6 detach path similar to IPv4's in code flow; functionally same.
* Bump __FreeBSD_version to 700048; see UPDATING.
This work was financially supported by another FreeBSD committer.
Obtained from: p4://bms_netdev
Submitted by: Wilbert de Graaf (original work)
Reviewed by: rwatson (locking), silence from fenner,
net@ (but with encouragement)
2007-06-12 16:24:56 +00:00
|
|
|
*/
|
2009-04-29 10:22:44 +00:00
|
|
|
#define IPV6_MAX_GROUP_SRC_FILTER 512 /* sources per group */
|
|
|
|
#define IPV6_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
|
|
|
|
*/
|
|
|
|
struct ipv6_mreq {
|
Import rewrite of IPv4 socket multicast layer to support source-specific
and protocol-independent host mode multicast. The code is written to
accomodate IPv6, IGMPv3 and MLDv2 with only a little additional work.
This change only pertains to FreeBSD's use as a multicast end-station and
does not concern multicast routing; for an IGMPv3/MLDv2 router
implementation, consider the XORP project.
The work is based on Wilbert de Graaf's IGMPv3 code drop for FreeBSD 4.6,
which is available at: http://www.kloosterhof.com/wilbert/igmpv3.html
Summary
* IPv4 multicast socket processing is now moved out of ip_output.c
into a new module, in_mcast.c.
* The in_mcast.c module implements the IPv4 legacy any-source API in
terms of the protocol-independent source-specific API.
* Source filters are lazy allocated as the common case does not use them.
They are part of per inpcb state and are covered by the inpcb lock.
* struct ip_mreqn is now supported to allow applications to specify
multicast joins by interface index in the legacy IPv4 any-source API.
* In UDP, an incoming multicast datagram only requires that the source
port matches the 4-tuple if the socket was already bound by source port.
An unbound socket SHOULD be able to receive multicasts sent from an
ephemeral source port.
* The UDP socket multicast filter mode defaults to exclusive, that is,
sources present in the per-socket list will be blocked from delivery.
* The RFC 3678 userland functions have been added to libc: setsourcefilter,
getsourcefilter, setipv4sourcefilter, getipv4sourcefilter.
* Definitions for IGMPv3 are merged but not yet used.
* struct sockaddr_storage is now referenced from <netinet/in.h>. It
is therefore defined there if not already declared in the same way
as for the C99 types.
* The RFC 1724 hack (specify 0.0.0.0/8 addresses to IP_MULTICAST_IF
which are then interpreted as interface indexes) is now deprecated.
* A patch for the Rhyolite.com routed in the FreeBSD base system
is available in the -net archives. This only affects individuals
running RIPv1 or RIPv2 via point-to-point and/or unnumbered interfaces.
* Make IPv6 detach path similar to IPv4's in code flow; functionally same.
* Bump __FreeBSD_version to 700048; see UPDATING.
This work was financially supported by another FreeBSD committer.
Obtained from: p4://bms_netdev
Submitted by: Wilbert de Graaf (original work)
Reviewed by: rwatson (locking), silence from fenner,
net@ (but with encouragement)
2007-06-12 16:24:56 +00:00
|
|
|
struct in6_addr ipv6mr_multiaddr;
|
2009-04-29 10:22:44 +00:00
|
|
|
unsigned int ipv6mr_interface;
|
Import rewrite of IPv4 socket multicast layer to support source-specific
and protocol-independent host mode multicast. The code is written to
accomodate IPv6, IGMPv3 and MLDv2 with only a little additional work.
This change only pertains to FreeBSD's use as a multicast end-station and
does not concern multicast routing; for an IGMPv3/MLDv2 router
implementation, consider the XORP project.
The work is based on Wilbert de Graaf's IGMPv3 code drop for FreeBSD 4.6,
which is available at: http://www.kloosterhof.com/wilbert/igmpv3.html
Summary
* IPv4 multicast socket processing is now moved out of ip_output.c
into a new module, in_mcast.c.
* The in_mcast.c module implements the IPv4 legacy any-source API in
terms of the protocol-independent source-specific API.
* Source filters are lazy allocated as the common case does not use them.
They are part of per inpcb state and are covered by the inpcb lock.
* struct ip_mreqn is now supported to allow applications to specify
multicast joins by interface index in the legacy IPv4 any-source API.
* In UDP, an incoming multicast datagram only requires that the source
port matches the 4-tuple if the socket was already bound by source port.
An unbound socket SHOULD be able to receive multicasts sent from an
ephemeral source port.
* The UDP socket multicast filter mode defaults to exclusive, that is,
sources present in the per-socket list will be blocked from delivery.
* The RFC 3678 userland functions have been added to libc: setsourcefilter,
getsourcefilter, setipv4sourcefilter, getipv4sourcefilter.
* Definitions for IGMPv3 are merged but not yet used.
* struct sockaddr_storage is now referenced from <netinet/in.h>. It
is therefore defined there if not already declared in the same way
as for the C99 types.
* The RFC 1724 hack (specify 0.0.0.0/8 addresses to IP_MULTICAST_IF
which are then interpreted as interface indexes) is now deprecated.
* A patch for the Rhyolite.com routed in the FreeBSD base system
is available in the -net archives. This only affects individuals
running RIPv1 or RIPv2 via point-to-point and/or unnumbered interfaces.
* Make IPv6 detach path similar to IPv4's in code flow; functionally same.
* Bump __FreeBSD_version to 700048; see UPDATING.
This work was financially supported by another FreeBSD committer.
Obtained from: p4://bms_netdev
Submitted by: Wilbert de Graaf (original work)
Reviewed by: rwatson (locking), silence from fenner,
net@ (but with encouragement)
2007-06-12 16:24:56 +00:00
|
|
|
};
|
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
/*
|
|
|
|
* IPV6_PKTINFO: Packet information(RFC2292 sec 5)
|
|
|
|
*/
|
|
|
|
struct in6_pktinfo {
|
2000-07-04 16:35:15 +00:00
|
|
|
struct in6_addr ipi6_addr; /* src/dst IPv6 address */
|
|
|
|
unsigned int ipi6_ifindex; /* send/recv interface index */
|
1999-11-05 14:41:39 +00:00
|
|
|
};
|
|
|
|
|
2003-10-24 18:26:30 +00:00
|
|
|
/*
|
|
|
|
* Control structure for IPV6_RECVPATHMTU socket option.
|
|
|
|
*/
|
|
|
|
struct ip6_mtuinfo {
|
|
|
|
struct sockaddr_in6 ip6m_addr; /* or sockaddr_storage? */
|
2003-10-26 10:49:18 +00:00
|
|
|
uint32_t ip6m_mtu;
|
2003-10-24 18:26:30 +00:00
|
|
|
};
|
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
/*
|
|
|
|
* Argument for IPV6_PORTRANGE:
|
|
|
|
* - which range to search when port is unspecified at bind() or connect()
|
|
|
|
*/
|
|
|
|
#define IPV6_PORTRANGE_DEFAULT 0 /* default range */
|
|
|
|
#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
|
|
|
|
#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
|
|
|
|
|
2003-10-24 18:26:30 +00:00
|
|
|
#if __BSD_VISIBLE
|
1999-11-05 14:41:39 +00:00
|
|
|
/*
|
|
|
|
* Definitions for inet6 sysctl operations.
|
|
|
|
*
|
|
|
|
* Third level is protocol number.
|
|
|
|
* Fourth level is desired variable within that protocol.
|
|
|
|
*/
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */
|
1999-11-05 14:41:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Names for IP sysctl objects
|
|
|
|
*/
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6CTL_FORWARDING 1 /* act as router */
|
|
|
|
#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/
|
|
|
|
#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */
|
1999-11-05 14:41:39 +00:00
|
|
|
#ifdef notyet
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6CTL_DEFMTU 4 /* default MTU */
|
1999-11-05 14:41:39 +00:00
|
|
|
#endif
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */
|
|
|
|
#define IPV6CTL_STATS 6 /* stats */
|
|
|
|
#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */
|
|
|
|
#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */
|
|
|
|
#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */
|
|
|
|
#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */
|
|
|
|
#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */
|
|
|
|
#define IPV6CTL_ACCEPT_RTADV 12
|
2014-11-09 21:33:01 +00:00
|
|
|
/* 13; unused; was: IPV6CTL_KEEPFAITH */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6CTL_LOG_INTERVAL 14
|
|
|
|
#define IPV6CTL_HDRNESTLIMIT 15
|
|
|
|
#define IPV6CTL_DAD_COUNT 16
|
|
|
|
#define IPV6CTL_AUTO_FLOWLABEL 17
|
|
|
|
#define IPV6CTL_DEFMCASTHLIM 18
|
|
|
|
#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */
|
|
|
|
#define IPV6CTL_KAME_VERSION 20
|
|
|
|
#define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */
|
|
|
|
#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */
|
2002-04-19 04:46:24 +00:00
|
|
|
#if 0 /* obsolete */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define IPV6CTL_MAPPED_ADDR 23
|
2000-07-05 01:40:29 +00:00
|
|
|
#endif
|
2001-06-11 12:39:29 +00:00
|
|
|
#define IPV6CTL_V6ONLY 24
|
Kill custom in_matroute() radix mathing function removing one rte mutex lock.
Initially in_matrote() in_clsroute() in their current state was introduced by
r4105 20 years ago. Instead of deleting inactive routes immediately, we kept them
in route table, setting RTPRF_OURS flag and some expire time. After that, either
GC came or RTPRF_OURS got removed on first-packet. It was a good solution
in that days (and probably another decade after that) to keep TCP metrics.
However, after moving metrics to TCP hostcache in r122922, most of in_rmx
functionality became unused. It might had been used for flushing icmp-originated
routes before rte mutexes/refcounting, but I'm not sure about that.
So it looks like this is nearly impossible to make GC do its work nowadays:
in_rtkill() ignores non-RTPRF_OURS routes.
route can only become RTPRF_OURS after dropping last reference via rtfree()
which calls in_clsroute(), which, it turn, ignores UP and non-RTF_DYNAMIC routes.
Dynamic routes can still be installed via received redirect, but they
have default lifetime (no specific rt_expire) and no one has another trie walker
to call RTFREE() on them.
So, the changelist:
* remove custom rnh_match / rnh_close matching function.
* remove all GC functions
* partially revert r256695 (proto3 is no more used inside kernel,
it is not possible to use rt_expire from user point of view, proto3 support
is not complete)
* Finish r241884 (similar to this commit) and remove remaining IPv6 parts
MFC after: 1 month
2014-11-11 02:52:40 +00:00
|
|
|
/* IPV6CTL_RTEXPIRE 25 deprecated */
|
|
|
|
/* IPV6CTL_RTMINEXPIRE 26 deprecated */
|
|
|
|
/* IPV6CTL_RTMAXCACHE 27 deprecated */
|
2001-06-11 12:39:29 +00:00
|
|
|
|
|
|
|
#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses (RFC3041) */
|
|
|
|
#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */
|
|
|
|
#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */
|
|
|
|
#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */
|
|
|
|
#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */
|
2003-11-04 20:22:33 +00:00
|
|
|
#define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */
|
2003-10-30 15:29:17 +00:00
|
|
|
#define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */
|
2005-07-25 12:31:43 +00:00
|
|
|
#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */
|
2003-10-30 15:29:17 +00:00
|
|
|
|
2003-10-22 15:29:42 +00:00
|
|
|
#define IPV6CTL_MAXFRAGS 41 /* max fragments */
|
2005-08-13 19:55:06 +00:00
|
|
|
#if 0
|
|
|
|
#define IPV6CTL_IFQ 42 /* ip6intrq node */
|
|
|
|
#define IPV6CTL_ISATAPRTR 43 /* isatap router */
|
|
|
|
#endif
|
|
|
|
#define IPV6CTL_MCAST_PMTU 44 /* enable pMTU discovery for multicast? */
|
2003-10-22 15:29:42 +00:00
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
/* New entries should be added here from current IPV6CTL_MAXID value. */
|
2000-08-27 00:58:13 +00:00
|
|
|
/* to define items, should talk with KAME guys first, for *BSD compatibility */
|
2005-08-10 09:13:35 +00:00
|
|
|
#define IPV6CTL_STEALTH 45
|
2008-10-02 00:32:59 +00:00
|
|
|
|
|
|
|
#define ICMPV6CTL_ND6_ONLINKNSRFC4861 47
|
- Accept Router Advertisement messages even when net.inet6.ip6.forwarding=1.
- A new per-interface knob IFF_ND6_NO_RADR and sysctl IPV6CTL_NO_RADR.
This controls if accepting a route in an RA message as the default route.
The default value for each interface can be set by net.inet6.ip6.no_radr.
The system wide default value is 0.
- A new sysctl: net.inet6.ip6.norbit_raif. This controls if setting R-bit in
NA on RA accepting interfaces. The default is 0 (R-bit is set based on
net.inet6.ip6.forwarding).
Background:
IPv6 host/router model suggests a router sends an RA and a host accepts it for
router discovery. Because of that, KAME implementation does not allow
accepting RAs when net.inet6.ip6.forwarding=1. Accepting RAs on a router can
make the routing table confused since it can change the default router
unintentionally.
However, in practice there are cases where we cannot distinguish a host from
a router clearly. For example, a customer edge router often works as a host
against the ISP, and as a router against the LAN at the same time. Another
example is a complex network configurations like an L2TP tunnel for IPv6
connection to Internet over an Ethernet link with another native IPv6 subnet.
In this case, the physical interface for the native IPv6 subnet works as a
host, and the pseudo-interface for L2TP works as the default IP forwarding
route.
Problem:
Disabling processing RA messages when net.inet6.ip6.forwarding=1 and
accepting them when net.inet6.ip6.forward=0 cause the following practical
issues:
- A router cannot perform SLAAC. It becomes a problem if a box has
multiple interfaces and you want to use SLAAC on some of them, for
example. A customer edge router for IPv6 Internet access service
using an IPv6-over-IPv6 tunnel sometimes needs SLAAC on the
physical interface for administration purpose; updating firmware
and so on (link-local addresses can be used there, but GUAs by
SLAAC are often used for scalability).
- When a host has multiple IPv6 interfaces and it receives multiple RAs on
them, controlling the default route is difficult. Router preferences
defined in RFC 4191 works only when the routers on the links are
under your control.
Details of Implementation Changes:
Router Advertisement messages will be accepted even when
net.inet6.ip6.forwarding=1. More precisely, the conditions are as
follow:
(ACCEPT_RTADV && !NO_RADR && !ip6.forwarding)
=> Normal RA processing on that interface. (as IPv6 host)
(ACCEPT_RTADV && (NO_RADR || ip6.forwarding))
=> Accept RA but add the router to the defroute list with
rtlifetime=0 unconditionally. This effectively prevents
from setting the received router address as the box's
default route.
(!ACCEPT_RTADV)
=> No RA processing on that interface.
ACCEPT_RTADV and NO_RADR are per-interface knob. In short, all interface
are classified as "RA-accepting" or not. An RA-accepting interface always
processes RA messages regardless of ip6.forwarding. The difference caused by
NO_RADR or ip6.forwarding is whether the RA source address is considered as
the default router or not.
R-bit in NA on the RA accepting interfaces is set based on
net.inet6.ip6.forwarding. While RFC 6204 W-1 rule (for CPE case) suggests
a router should disable the R-bit completely even when the box has
net.inet6.ip6.forwarding=1, I believe there is no technical reason with
doing so. This behavior can be set by a new sysctl net.inet6.ip6.norbit_raif
(the default is 0).
Usage:
# ifconfig fxp0 inet6 accept_rtadv
=> accept RA on fxp0
# ifconfig fxp0 inet6 accept_rtadv no_radr
=> accept RA on fxp0 but ignore default route information in it.
# sysctl net.inet6.ip6.norbit_no_radr=1
=> R-bit in NAs on RA accepting interfaces will always be set to 0.
2011-06-06 02:14:23 +00:00
|
|
|
#define IPV6CTL_NO_RADR 48 /* No defroute from RA */
|
|
|
|
#define IPV6CTL_NORBIT_RAIF 49 /* Disable R-bit in NA on RA
|
|
|
|
* receiving IF. */
|
2011-09-13 00:06:11 +00:00
|
|
|
#define IPV6CTL_RFC6204W3 50 /* Accept defroute even when forwarding
|
|
|
|
enabled */
|
|
|
|
#define IPV6CTL_MAXID 51
|
2003-10-24 18:26:30 +00:00
|
|
|
#endif /* __BSD_VISIBLE */
|
2001-06-11 12:39:29 +00:00
|
|
|
|
1999-11-22 02:45:11 +00:00
|
|
|
/*
|
2014-03-12 14:29:08 +00:00
|
|
|
* Since both netinet/ and netinet6/ call into netipsec/ and netpfil/,
|
|
|
|
* the protocol specific mbuf flags are shared between them.
|
|
|
|
*/
|
|
|
|
#define M_FASTFWD_OURS M_PROTO1 /* changed dst to local */
|
|
|
|
#define M_IP6_NEXTHOP M_PROTO2 /* explicit ip nexthop */
|
|
|
|
#define M_IP_NEXTHOP M_PROTO2 /* explicit ip nexthop */
|
|
|
|
#define M_SKIP_FIREWALL M_PROTO3 /* skip firewall processing */
|
|
|
|
#define M_AUTHIPHDR M_PROTO4
|
|
|
|
#define M_DECRYPTED M_PROTO5
|
|
|
|
#define M_LOOP M_PROTO6
|
|
|
|
#define M_AUTHIPDGM M_PROTO7
|
|
|
|
#define M_RTALERT_MLD M_PROTO8
|
1999-11-22 02:45:11 +00:00
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
#ifdef _KERNEL
|
2001-06-11 12:39:29 +00:00
|
|
|
struct cmsghdr;
|
2012-05-24 18:25:09 +00:00
|
|
|
struct ip6_hdr;
|
1999-11-05 14:41:39 +00:00
|
|
|
|
2012-05-24 18:25:09 +00:00
|
|
|
int in6_cksum_pseudo(struct ip6_hdr *, uint32_t, uint8_t, uint16_t);
|
2012-10-22 21:49:56 +00:00
|
|
|
int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t);
|
2014-10-02 10:32:24 +00:00
|
|
|
int in6_cksum_partial(struct mbuf *, u_int8_t, u_int32_t, u_int32_t,
|
|
|
|
u_int32_t);
|
2012-10-22 21:49:56 +00:00
|
|
|
int in6_localaddr(struct in6_addr *);
|
2011-08-20 16:43:47 +00:00
|
|
|
int in6_localip(struct in6_addr *);
|
2014-09-11 10:27:59 +00:00
|
|
|
int in6_addrscope(const struct in6_addr *);
|
2012-10-22 21:49:56 +00:00
|
|
|
struct in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *);
|
|
|
|
extern void in6_if_up(struct ifnet *);
|
2001-06-11 12:39:29 +00:00
|
|
|
struct sockaddr;
|
2002-03-19 15:01:21 +00:00
|
|
|
extern u_char ip6_protox[];
|
1999-11-05 14:41:39 +00:00
|
|
|
|
2012-10-22 21:49:56 +00:00
|
|
|
void in6_sin6_2_sin(struct sockaddr_in *sin,
|
|
|
|
struct sockaddr_in6 *sin6);
|
|
|
|
void in6_sin_2_v4mapsin6(struct sockaddr_in *sin,
|
|
|
|
struct sockaddr_in6 *sin6);
|
|
|
|
void in6_sin6_2_sin_in_sock(struct sockaddr *nam);
|
|
|
|
void in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam);
|
|
|
|
extern void addrsel_policy_init(void);
|
1999-11-05 14:41:39 +00:00
|
|
|
|
2001-06-11 12:39:29 +00:00
|
|
|
#define satosin6(sa) ((struct sockaddr_in6 *)(sa))
|
|
|
|
#define sin6tosa(sin6) ((struct sockaddr *)(sin6))
|
|
|
|
#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa))
|
2001-09-25 18:40:52 +00:00
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
#endif /* _KERNEL */
|
|
|
|
|
2002-08-21 16:20:02 +00:00
|
|
|
#ifndef _SIZE_T_DECLARED
|
|
|
|
typedef __size_t size_t;
|
|
|
|
#define _SIZE_T_DECLARED
|
2002-05-23 18:48:27 +00:00
|
|
|
#endif
|
|
|
|
|
2003-10-25 09:37:10 +00:00
|
|
|
#ifndef _SOCKLEN_T_DECLARED
|
|
|
|
typedef __socklen_t socklen_t;
|
|
|
|
#define _SOCKLEN_T_DECLARED
|
|
|
|
#endif
|
|
|
|
|
2003-10-24 18:26:30 +00:00
|
|
|
#if __BSD_VISIBLE
|
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
__BEGIN_DECLS
|
|
|
|
struct cmsghdr;
|
|
|
|
|
2012-10-22 21:49:56 +00:00
|
|
|
extern int inet6_option_space(int);
|
|
|
|
extern int inet6_option_init(void *, struct cmsghdr **, int);
|
|
|
|
extern int inet6_option_append(struct cmsghdr *, const uint8_t *,
|
|
|
|
int, int);
|
|
|
|
extern uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);
|
|
|
|
extern int inet6_option_next(const struct cmsghdr *, uint8_t **);
|
|
|
|
extern int inet6_option_find(const struct cmsghdr *, uint8_t **, int);
|
|
|
|
|
|
|
|
extern size_t inet6_rthdr_space(int, int);
|
|
|
|
extern struct cmsghdr *inet6_rthdr_init(void *, int);
|
|
|
|
extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *,
|
|
|
|
unsigned int);
|
|
|
|
extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int);
|
2001-06-11 12:39:29 +00:00
|
|
|
#if 0 /* not implemented yet */
|
2012-10-22 21:49:56 +00:00
|
|
|
extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *);
|
2001-06-11 12:39:29 +00:00
|
|
|
#endif
|
2012-10-22 21:49:56 +00:00
|
|
|
extern int inet6_rthdr_segments(const struct cmsghdr *);
|
|
|
|
extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int);
|
|
|
|
extern int inet6_rthdr_getflags(const struct cmsghdr *, int);
|
|
|
|
|
|
|
|
extern int inet6_opt_init(void *, socklen_t);
|
|
|
|
extern int inet6_opt_append(void *, socklen_t, int, uint8_t, socklen_t,
|
|
|
|
uint8_t, void **);
|
|
|
|
extern int inet6_opt_finish(void *, socklen_t, int);
|
|
|
|
extern int inet6_opt_set_val(void *, int, void *, socklen_t);
|
|
|
|
|
|
|
|
extern int inet6_opt_next(void *, socklen_t, int, uint8_t *, socklen_t *,
|
|
|
|
void **);
|
|
|
|
extern int inet6_opt_find(void *, socklen_t, int, uint8_t, socklen_t *,
|
|
|
|
void **);
|
|
|
|
extern int inet6_opt_get_val(void *, int, void *, socklen_t);
|
|
|
|
extern socklen_t inet6_rth_space(int, int);
|
|
|
|
extern void *inet6_rth_init(void *, socklen_t, int, int);
|
|
|
|
extern int inet6_rth_add(void *, const struct in6_addr *);
|
|
|
|
extern int inet6_rth_reverse(const void *, void *);
|
|
|
|
extern int inet6_rth_segments(const void *);
|
|
|
|
extern struct in6_addr *inet6_rth_getaddr(const void *, int);
|
1999-11-05 14:41:39 +00:00
|
|
|
__END_DECLS
|
|
|
|
|
2002-05-23 18:48:27 +00:00
|
|
|
#endif /* __BSD_VISIBLE */
|
|
|
|
|
1999-11-05 14:41:39 +00:00
|
|
|
#endif /* !_NETINET6_IN6_H_ */
|