#include <netinet6/in6.h>
netinet6/in6.h
macroIPV6PORT_RESERVED
#define IPV6PORT_RESERVED 1024
macroIPV6PORT_ANONMIN
#define IPV6PORT_ANONMIN 49152
macroIPV6PORT_ANONMAX
#define IPV6PORT_ANONMAX 65535
macroIPV6PORT_RESERVEDMIN
#define IPV6PORT_RESERVEDMIN 600
macroIPV6PORT_RESERVEDMAX
#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1)
structin6_addr
IPv6 address
| unnamed union at Kernel/netinet6/in6.h:154:2 | __u6_addr | ||||||||||
| |||||||||||
typedefin6_addr_t
typedef struct in6_addr in6_addr_t;
macros6_addr
#define s6_addr __u6_addr.__u6_addr8
macros6_addr8
#define s6_addr8 __u6_addr.__u6_addr8
macros6_addr16
#define s6_addr16 __u6_addr.__u6_addr16
macros6_addr32
#define s6_addr32 __u6_addr.__u6_addr32
macroINET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
structsockaddr_in6
| __uint8_t | sin6_len | length of this struct(sa_family_t) |
| sa_family_t | sin6_family | AF_INET6 (sa_family_t) |
| in_port_t | sin6_port | Transport layer port # (in_port_t) |
| __uint32_t | sin6_flowinfo | IP6 flow information |
| struct in6_addr | sin6_addr | IP6 address |
| __uint32_t | sin6_scope_id | scope zone index |
macroIN6MASK0
Local definition for masks
#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}macroIN6MASK7
#define IN6MASK7 {{{ 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}macroIN6MASK8
#define IN6MASK8 {{{ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}macroIN6MASK10
#define IN6MASK10 {{{ 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}macroIN6MASK16
#define IN6MASK16 {{{ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}macroIN6MASK32
#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}macroIN6MASK64
#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}macroIN6MASK96
#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}macroIN6MASK128
#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}macroIPV6_ADDR_INT32_ONE
Macros started with IPV6_ADDR is KAME local
#define IPV6_ADDR_INT32_ONE 0x01000000
macroIPV6_ADDR_INT32_TWO
#define IPV6_ADDR_INT32_TWO 0x02000000
macroIPV6_ADDR_INT32_MNL
#define IPV6_ADDR_INT32_MNL 0x000001ff
macroIPV6_ADDR_INT32_MLL
#define IPV6_ADDR_INT32_MLL 0x000002ff
macroIPV6_ADDR_INT32_SMP
#define IPV6_ADDR_INT32_SMP 0xffff0000
macroIPV6_ADDR_INT16_ULL
#define IPV6_ADDR_INT16_ULL 0x80fe
macroIPV6_ADDR_INT16_USL
#define IPV6_ADDR_INT16_USL 0xc0fe
macroIPV6_ADDR_INT16_MLL
#define IPV6_ADDR_INT16_MLL 0x02ff
macroIN6ADDR_ANY_INIT
Definition of some useful macros to handle IP6 addresses
#define IN6ADDR_ANY_INIT {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}macroIN6ADDR_LOOPBACK_INIT
#define IN6ADDR_LOOPBACK_INIT {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}macroIN6ADDR_NODELOCAL_ALLNODES_INIT
#define IN6ADDR_NODELOCAL_ALLNODES_INIT {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}macroIN6ADDR_INTFACELOCAL_ALLNODES_INIT
#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}macroIN6ADDR_LINKLOCAL_ALLNODES_INIT
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}macroIN6ADDR_LINKLOCAL_ALLROUTERS_INIT
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}macroIN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT
#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}}macroIN6ADDR_V4MAPPED_INIT
#define IN6ADDR_V4MAPPED_INIT {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}macroIN6ADDR_MULTICAST_PREFIX
#define IN6ADDR_MULTICAST_PREFIX IN6MASK8
variablein6addr_any
extern const struct in6_addr in6addr_any
variablein6addr_loopback
extern const struct in6_addr in6addr_loopback
variablein6addr_nodelocal_allnodes
extern const struct in6_addr in6addr_nodelocal_allnodes
variablein6addr_linklocal_allnodes
extern const struct in6_addr in6addr_linklocal_allnodes
variablein6addr_linklocal_allrouters
extern const struct in6_addr in6addr_linklocal_allrouters
variablein6addr_linklocal_allv2routers
extern const struct in6_addr in6addr_linklocal_allv2routers
macroIN6_ARE_ADDR_EQUAL
Equality
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.
#define IN6_ARE_ADDR_EQUAL(a, b) (bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof (struct in6_addr)) == 0)
macroSA6_ARE_ADDR_EQUAL
see if two addresses are equal in a scope-conscious manner.
#define SA6_ARE_ADDR_EQUAL(a, b) (((a)->sin6_scope_id == 0 || (b)->sin6_scope_id == 0 || ((a)->sin6_scope_id == (b)->sin6_scope_id)) && (bcmp(&(a)->sin6_addr, &(b)->sin6_addr, sizeof (struct in6_addr)) == 0))
macroIN6_IS_ADDR_UNSPECIFIED
Unspecified
#define IN6_IS_ADDR_UNSPECIFIED(a) ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
macroIN6_IS_ADDR_LOOPBACK
Loopback
#define IN6_IS_ADDR_LOOPBACK(a) ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))
macroIN6_IS_ADDR_V4COMPAT
IPv4 compatible
#define IN6_IS_ADDR_V4COMPAT(a) ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1)))
macroIN6_IS_ADDR_V4MAPPED
Mapped
#define IN6_IS_ADDR_V4MAPPED(a) ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
macroIPV6_ADDR_SCOPE_NODELOCAL
#define IPV6_ADDR_SCOPE_NODELOCAL 0x01
macroIPV6_ADDR_SCOPE_INTFACELOCAL
#define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
macroIPV6_ADDR_SCOPE_LINKLOCAL
#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02
macroIPV6_ADDR_SCOPE_SITELOCAL
#define IPV6_ADDR_SCOPE_SITELOCAL 0x05
macroIPV6_ADDR_SCOPE_GLOBAL
#define IPV6_ADDR_SCOPE_GLOBAL 0x0e
macroIN6_IS_ADDR_LINKLOCAL
Unicast Scope
Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
#define IN6_IS_ADDR_LINKLOCAL(a) (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
macroIN6_IS_ADDR_SITELOCAL
#define IN6_IS_ADDR_SITELOCAL(a) (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
macroIPV6_ADDR_MC_FLAGS
#define IPV6_ADDR_MC_FLAGS(a) ((a)->s6_addr[1] & 0xf0)
macroIPV6_ADDR_MC_FLAGS_TRANSIENT
#define IPV6_ADDR_MC_FLAGS_TRANSIENT 0x10
macroIPV6_ADDR_MC_FLAGS_PREFIX
#define IPV6_ADDR_MC_FLAGS_PREFIX 0x20
macroIPV6_ADDR_MC_FLAGS_UNICAST_BASED
#define IPV6_ADDR_MC_FLAGS_UNICAST_BASED (IPV6_ADDR_MC_FLAGS_TRANSIENT | IPV6_ADDR_MC_FLAGS_PREFIX)
macroIN6_IS_ADDR_UNICAST_BASED_MULTICAST
#define IN6_IS_ADDR_UNICAST_BASED_MULTICAST(a) (IN6_IS_ADDR_MULTICAST(a) && (IPV6_ADDR_MC_FLAGS(a) == IPV6_ADDR_MC_FLAGS_UNICAST_BASED))
macroIN6_IS_ADDR_UNIQUE_LOCAL
Unique Local IPv6 Unicast Addresses (per RFC 4193)
#define IN6_IS_ADDR_UNIQUE_LOCAL(a) (((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd))
macroIPV6_ADDR_MC_SCOPE
#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
macroIN6_IS_ADDR_MC_UNICAST_BASED_LINKLOCAL
Multicast Scope
#define IN6_IS_ADDR_MC_UNICAST_BASED_LINKLOCAL(a) (IN6_IS_ADDR_MULTICAST(a) && (IPV6_ADDR_MC_FLAGS(a) == IPV6_ADDR_MC_FLAGS_UNICAST_BASED) && (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
macroIN6_IS_ADDR_MC_NODELOCAL
#define IN6_IS_ADDR_MC_NODELOCAL(a) (IN6_IS_ADDR_MULTICAST(a) && (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
macroIN6_IS_ADDR_MC_INTFACELOCAL
#define IN6_IS_ADDR_MC_INTFACELOCAL(a) (IN6_IS_ADDR_MULTICAST(a) && (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))
macroIN6_IS_ADDR_MC_LINKLOCAL
#define IN6_IS_ADDR_MC_LINKLOCAL(a) (IN6_IS_ADDR_MULTICAST(a) && (IPV6_ADDR_MC_FLAGS(a) != IPV6_ADDR_MC_FLAGS_UNICAST_BASED) && (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
macroIN6_IS_ADDR_MC_SITELOCAL
#define IN6_IS_ADDR_MC_SITELOCAL(a) (IN6_IS_ADDR_MULTICAST(a) && (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
macroIN6_IS_ADDR_MC_ORGLOCAL
#define IN6_IS_ADDR_MC_ORGLOCAL(a) (IN6_IS_ADDR_MULTICAST(a) && (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
macroIN6_IS_ADDR_MC_GLOBAL
#define IN6_IS_ADDR_MC_GLOBAL(a) (IN6_IS_ADDR_MULTICAST(a) && (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
macroIN6_IS_SCOPE_LINKLOCAL
KAME Scope
#define IN6_IS_SCOPE_LINKLOCAL(a) ((IN6_IS_ADDR_LINKLOCAL(a)) || (IN6_IS_ADDR_MC_LINKLOCAL(a)))
macroIN6_IS_SCOPE_EMBED
#define IN6_IS_SCOPE_EMBED(a) ((IN6_IS_ADDR_LINKLOCAL(a)) || (IN6_IS_ADDR_MC_LINKLOCAL(a)) || (IN6_IS_ADDR_MC_INTFACELOCAL(a)))
macroIFA6_IS_DEPRECATED
#define IFA6_IS_DEPRECATED(a, t) ((a)->ia6_lifetime.ia6ti_preferred != 0 && (a)->ia6_lifetime.ia6ti_preferred < (t))
macroIFA6_IS_INVALID
#define IFA6_IS_INVALID(a, t) ((a)->ia6_lifetime.ia6ti_expire != 0 && (a)->ia6_lifetime.ia6ti_expire < (t))
macroIPV6_2292PKTOPTIONS
buf/cmsghdr; set/get IPv6 options [obsoleted by RFC3542]
#define IPV6_2292PKTOPTIONS 25
macroIPV6_RECVTCLASS
APPLE: NOTE the value of those 2 options is kept unchanged from
previous version of darwin/OS X for binary compatibility reasons
and differ from FreeBSD (values 57 and 61). See below.
#define IPV6_RECVTCLASS 35
bool; recv traffic class values
macroIPV6_DEFAULT_MULTICAST_HOPS
Defaults and limits for options
#define IPV6_DEFAULT_MULTICAST_HOPS 1
normally limit m'casts to 1 hop
macroIPV6_DEFAULT_MULTICAST_LOOP
#define IPV6_DEFAULT_MULTICAST_LOOP 1
normally hear sends if a member
macroIPV6_MIN_MEMBERSHIPS
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.
#define IPV6_MIN_MEMBERSHIPS 31
macroIPV6_MAX_MEMBERSHIPS
#define IPV6_MAX_MEMBERSHIPS 4095
macroIPV6_MAX_GROUP_SRC_FILTER
Default resource limits for IPv6 multicast source filtering.
These may be modified by sysctl.
#define IPV6_MAX_GROUP_SRC_FILTER 512
sources per group
structipv6_mreq
Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
| struct in6_addr | ipv6mr_multiaddr | |
| unsigned int | ipv6mr_interface |
structin6_pktinfo
IPV6_2292PKTINFO: Packet information(RFC2292 sec 5)
| struct in6_addr | ipi6_addr | src/dst IPv6 address |
| unsigned int | ipi6_ifindex | send/recv interface index |
structip6_mtuinfo
Control structure for IPV6_RECVPATHMTU socket option.
| struct sockaddr_in6 | ip6m_addr | or sockaddr_storage? |
| uint32_t | ip6m_mtu |
macroIPV6_PORTRANGE_DEFAULT
Argument for IPV6_PORTRANGE:
- which range to search when port is unspecified at bind() or connect()
#define IPV6_PORTRANGE_DEFAULT 0
default range
macroIPV6PROTO_MAXID
Definitions for inet6 sysctl operations.
Third level is protocol number.
Fourth level is desired variable within that protocol.
#define IPV6PROTO_MAXID (IPPROTO_PIM + 1)
don't list to IPV6PROTO_MAX
macroIPV6CTL_ACCEPT_RTADV
#define IPV6CTL_ACCEPT_RTADV 12
macroIPV6CTL_LOG_INTERVAL
#define IPV6CTL_LOG_INTERVAL 14
macroIPV6CTL_HDRNESTLIMIT
#define IPV6CTL_HDRNESTLIMIT 15
macroIPV6CTL_DAD_COUNT
#define IPV6CTL_DAD_COUNT 16
macroIPV6CTL_AUTO_FLOWLABEL
#define IPV6CTL_AUTO_FLOWLABEL 17
macroIPV6CTL_DEFMCASTHLIM
#define IPV6CTL_DEFMCASTHLIM 18
macroIPV6CTL_KAME_VERSION
#define IPV6CTL_KAME_VERSION 20
macroIPV6CTL_V6ONLY
#define IPV6CTL_V6ONLY 24
macroIPV6CTL_NEIGHBORGCTHRESH
#define IPV6CTL_NEIGHBORGCTHRESH 46
macroIPV6CTL_MAXIFPREFIXES
#define IPV6CTL_MAXIFPREFIXES 47
macroIPV6CTL_MAXIFDEFROUTERS
#define IPV6CTL_MAXIFDEFROUTERS 48
macroIPV6CTL_MAXDYNROUTES
#define IPV6CTL_MAXDYNROUTES 49
macroICMPV6CTL_ND6_ONLINKNSRFC4861
#define ICMPV6CTL_ND6_ONLINKNSRFC4861 50
macroIPV6CTL_ULA_USETEMPADDR
#define IPV6CTL_ULA_USETEMPADDR 51
macroIPV6CTL_MAXID
New entries should be added here from current IPV6CTL_MAXID value.
to define items, should talk with KAME guys first, for *BSD compatibility
#define IPV6CTL_MAXID 51