File indexing completed on 2025-05-11 08:24:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 #if defined(_NETINET6_IN6_H_) && defined(_KERNEL)
0044
0045
0046 #define s6_addr8 __u6_addr.__u6_addr8
0047 #define s6_addr16 __u6_addr.__u6_addr16
0048 #define s6_addr32 __u6_addr.__u6_addr32
0049
0050
0051
0052
0053
0054 #define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
0055 #define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
0056 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
0057 #define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
0058 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
0059 #define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
0060 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
0061 #define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
0062 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
0063
0064 extern const struct sockaddr_in6 sa6_any;
0065
0066 extern const struct in6_addr in6mask0;
0067 extern const struct in6_addr in6mask32;
0068 extern const struct in6_addr in6mask64;
0069 extern const struct in6_addr in6mask96;
0070 extern const struct in6_addr in6mask128;
0071
0072
0073
0074
0075
0076 #if _BYTE_ORDER == _BIG_ENDIAN
0077 #define IPV6_ADDR_INT32_ONE 1
0078 #define IPV6_ADDR_INT32_TWO 2
0079 #define IPV6_ADDR_INT32_MNL 0xff010000
0080 #define IPV6_ADDR_INT32_MLL 0xff020000
0081 #define IPV6_ADDR_INT32_SMP 0x0000ffff
0082 #define IPV6_ADDR_INT16_ULL 0xfe80
0083 #define IPV6_ADDR_INT16_USL 0xfec0
0084 #define IPV6_ADDR_INT16_MLL 0xff02
0085 #elif _BYTE_ORDER == _LITTLE_ENDIAN
0086 #define IPV6_ADDR_INT32_ONE 0x01000000
0087 #define IPV6_ADDR_INT32_TWO 0x02000000
0088 #define IPV6_ADDR_INT32_MNL 0x000001ff
0089 #define IPV6_ADDR_INT32_MLL 0x000002ff
0090 #define IPV6_ADDR_INT32_SMP 0xffff0000
0091 #define IPV6_ADDR_INT16_ULL 0x80fe
0092 #define IPV6_ADDR_INT16_USL 0xc0fe
0093 #define IPV6_ADDR_INT16_MLL 0x02ff
0094 #endif
0095
0096
0097 #define IPV6_ADDR_SCOPE_NODELOCAL 0x01
0098 #define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
0099 #define IPV6_ADDR_SCOPE_LINKLOCAL 0x02
0100 #define IPV6_ADDR_SCOPE_SITELOCAL 0x05
0101 #define IPV6_ADDR_SCOPE_ORGLOCAL 0x08
0102 #define IPV6_ADDR_SCOPE_GLOBAL 0x0e
0103
0104 #define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
0105
0106
0107 #define IN6_IS_ADDR_MC_NODELOCAL(a) \
0108 (IN6_IS_ADDR_MULTICAST(a) && \
0109 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
0110 #define IN6_IS_ADDR_MC_INTFACELOCAL(a) \
0111 (IN6_IS_ADDR_MULTICAST(a) && \
0112 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))
0113 #define IN6_IS_ADDR_MC_LINKLOCAL(a) \
0114 (IN6_IS_ADDR_MULTICAST(a) && \
0115 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
0116 #define IN6_IS_ADDR_MC_SITELOCAL(a) \
0117 (IN6_IS_ADDR_MULTICAST(a) && \
0118 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
0119 #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
0120 (IN6_IS_ADDR_MULTICAST(a) && \
0121 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
0122 #define IN6_IS_ADDR_MC_GLOBAL(a) \
0123 (IN6_IS_ADDR_MULTICAST(a) && \
0124 (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
0125
0126
0127
0128
0129
0130 #define IN6_IS_SCOPE_LINKLOCAL(a) \
0131 ((IN6_IS_ADDR_LINKLOCAL(a)) || \
0132 (IN6_IS_ADDR_MC_LINKLOCAL(a)))
0133 #define IN6_IS_SCOPE_EMBED(a) \
0134 ((IN6_IS_ADDR_LINKLOCAL(a)) || \
0135 (IN6_IS_ADDR_MC_LINKLOCAL(a)) || \
0136 (IN6_IS_ADDR_MC_INTFACELOCAL(a)))
0137
0138 #define IFA6_IS_DEPRECATED(a) \
0139 ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
0140 (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \
0141 (a)->ia6_lifetime.ia6t_pltime)
0142 #define IFA6_IS_INVALID(a) \
0143 ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
0144 (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \
0145 (a)->ia6_lifetime.ia6t_vltime)
0146
0147 #define MTAG_ABI_IPV6 1444287380
0148 #define IPV6_TAG_DIRECT 0
0149
0150
0151 #define IPV6_2292PKTINFO 19
0152 #define IPV6_2292HOPLIMIT 20
0153 #define IPV6_2292NEXTHOP 21
0154 #define IPV6_2292HOPOPTS 22
0155 #define IPV6_2292DSTOPTS 23
0156 #define IPV6_2292RTHDR 24
0157 #define IPV6_2292PKTOPTIONS 25
0158
0159 #define IPV6_RECVRTHDRDSTOPTS 41
0160
0161 struct cmsghdr;
0162 struct ip6_hdr;
0163
0164 int in6_cksum_pseudo(struct ip6_hdr *, uint32_t, uint8_t, uint16_t);
0165 int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t);
0166 int in6_cksum_partial(struct mbuf *, u_int8_t, u_int32_t, u_int32_t,
0167 u_int32_t);
0168 int in6_localaddr(struct in6_addr *);
0169 int in6_localip(struct in6_addr *);
0170 bool in6_localip_fib(struct in6_addr *, uint16_t);
0171 int in6_ifhasaddr(struct ifnet *, struct in6_addr *);
0172 int in6_addrscope(const struct in6_addr *);
0173 char *ip6_sprintf(char *, const struct in6_addr *);
0174 struct in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *);
0175 extern void in6_if_up(struct ifnet *);
0176 struct sockaddr;
0177 extern u_char ip6_protox[];
0178
0179 void in6_sin6_2_sin(struct sockaddr_in *sin,
0180 struct sockaddr_in6 *sin6);
0181 void in6_sin_2_v4mapsin6(struct sockaddr_in *sin,
0182 struct sockaddr_in6 *sin6);
0183 void in6_sin6_2_sin_in_sock(struct sockaddr *nam);
0184 void in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam);
0185 extern void addrsel_policy_init(void);
0186
0187 #define satosin6(sa) ((struct sockaddr_in6 *)(sa))
0188 #define sin6tosa(sin6) ((struct sockaddr *)(sin6))
0189 #define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa))
0190
0191 #else
0192 #error "must be included via <netinet6/in6.h> in kernel space"
0193 #endif