X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/39236c6e673c41db228275375ab7fdb0f837b292..d9a64523371fa019c4575bb400cbbc3a50ac9903:/bsd/netinet6/in6_var.h diff --git a/bsd/netinet6/in6_var.h b/bsd/netinet6/in6_var.h index 80723feed..50cd3e9b9 100644 --- a/bsd/netinet6/in6_var.h +++ b/bsd/netinet6/in6_var.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 Apple Inc. All rights reserved. + * Copyright (c) 2000-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -93,13 +93,15 @@ #ifndef _NETINET6_IN6_VAR_H_ #define _NETINET6_IN6_VAR_H_ #include +#include #ifdef BSD_KERNEL_PRIVATE #include #include -#include #endif /* BSD_KERNEL_PRIVATE */ +#include #include +#include /* * pltime/vltime are just for future reference (required to implements 2 @@ -170,9 +172,7 @@ struct in6_ifaddr { u_int64_t ia6_createtime; u_int64_t ia6_updatetime; - struct ifprefix *ia6_ifpr; /* back pointer to ifprefix */ - - /* back pointer to the ND prefix (for autoconfigured addresses only) */ + /* back pointer to the ND prefix */ struct nd_prefix *ia6_ndpr; /* multicast addresses joined from the kernel */ @@ -221,11 +221,17 @@ struct in6_ifstat { u_quad_t ifs6_reass_ok; /* # of reassembled packets */ /* NOTE: this is # after reass */ /* NOTE: increment on final dst if */ + u_quad_t ifs6_atmfrag_rcvd; /* # of atomic fragments received */ u_quad_t ifs6_reass_fail; /* # of reass failures */ /* NOTE: may not be packet count */ /* NOTE: increment on final dst if */ u_quad_t ifs6_in_mcast; /* # of inbound multicast datagrams */ u_quad_t ifs6_out_mcast; /* # of outbound multicast datagrams */ + + u_quad_t ifs6_cantfoward_icmp6; /* # of ICMPv6 packets received for unreachable dest */ + u_quad_t ifs6_addr_expiry_cnt; /* # of address expiry events (excluding privacy addresses) */ + u_quad_t ifs6_pfx_expiry_cnt; /* # of prefix expiry events */ + u_quad_t ifs6_defrtr_expiry_cnt; /* # of default router expiry events */ }; /* @@ -310,18 +316,6 @@ struct icmp6_ifstat { u_quad_t ifs6_out_mlddone; }; -#ifdef BSD_KERNEL_PRIVATE -/* - * Per-interface IPv6 structures. - */ -struct in6_ifextra { - struct scope6_id scope6_id; - struct in6_ifstat in6_ifstat; - struct icmp6_ifstat icmp6_ifstat; -}; -#define IN6_IFEXTRA(_ifp) ((struct in6_ifextra *)(_ifp->if_inet6data)) -#endif /* BSD_KERNEL_PRIVATE */ - struct in6_ifreq { char ifr_name[IFNAMSIZ]; union { @@ -335,7 +329,7 @@ struct in6_ifreq { struct in6_addrlifetime ifru_lifetime; struct in6_ifstat ifru_stat; struct icmp6_ifstat ifru_icmp6stat; - u_int32_t ifru_scope_id[16]; + u_int32_t ifru_scope_id[SCOPE6_ID_MAX]; } ifr_ifru; }; @@ -369,6 +363,11 @@ struct in6_cga_nodecfg { struct in6_cga_prepare cga_prepare; }; +/* + * XXX in6_llstartreq will be removed once + * configd adopts the more generically named + * in6_cgareq structure. + */ struct in6_llstartreq { char llsr_name[IFNAMSIZ]; int llsr_flags; @@ -376,7 +375,19 @@ struct in6_llstartreq { struct in6_addrlifetime llsr_lifetime; }; +struct in6_cgareq { + char cgar_name[IFNAMSIZ]; + int cgar_flags; + struct in6_cga_prepare cgar_cgaprep; + struct in6_addrlifetime cgar_lifetime; +}; + #ifdef BSD_KERNEL_PRIVATE +/* + * XXX Corresponding versions of in6_llstartreq + * will be removed after the new in6_cgareq is + * adopted by configd + */ struct in6_llstartreq_32 { char llsr_name[IFNAMSIZ]; int llsr_flags; @@ -390,6 +401,21 @@ struct in6_llstartreq_64 { struct in6_cga_prepare llsr_cgaprep; struct in6_addrlifetime_64 llsr_lifetime; }; + +struct in6_cgareq_32 { + char cgar_name[IFNAMSIZ]; + int cgar_flags; + struct in6_cga_prepare cgar_cgaprep; + struct in6_addrlifetime_32 cgar_lifetime; +}; + +struct in6_cgareq_64 { + char cgar_name[IFNAMSIZ]; + int cgar_flags; + struct in6_cga_prepare cgar_cgaprep; + struct in6_addrlifetime_64 cgar_lifetime; +}; + #endif /* !BSD_KERNEL_PRIVATE */ #endif /* PRIVATE */ @@ -514,23 +540,12 @@ struct kev_in6_data { u_int32_t ia_plen; /* prefix length */ u_int32_t ia6_flags; /* address flags from in6_ifaddr */ struct kev_in6_addrlifetime ia_lifetime; /* address life info */ + uint8_t ia_mac[ETHER_ADDR_LEN]; }; -/* - * Define inet6 event subclass and specific inet6 events. - */ -#define KEV_INET6_SUBCLASS 6 /* inet6 subclass identifier */ - -#define KEV_INET6_NEW_USER_ADDR 1 /* Userland configured IPv6 address */ -#define KEV_INET6_CHANGED_ADDR 2 /* Address changed event (future) */ -#define KEV_INET6_ADDR_DELETED 3 /* IPv6 address was deleted */ -#define KEV_INET6_NEW_LL_ADDR 4 /* Autoconf LL address appeared */ -#define KEV_INET6_NEW_RTADV_ADDR 5 /* Autoconf address has appeared */ -#define KEV_INET6_DEFROUTER 6 /* Default router detected */ - #ifdef BSD_KERNEL_PRIVATE /* Utility function used inside netinet6 kernel code for generating events */ -void in6_post_msg(struct ifnet *, u_int32_t, struct in6_ifaddr *); +void in6_post_msg(struct ifnet *, u_int32_t, struct in6_ifaddr *, uint8_t *mac); #define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \ @@ -703,11 +718,17 @@ void in6_post_msg(struct ifnet *, u_int32_t, struct in6_ifaddr *); /* * start secure link-local interface addresses */ -#define SIOCLL_CGASTART _IOW('i', 160, struct in6_llstartreq) +#define SIOCLL_CGASTART _IOW('i', 160, struct in6_cgareq) #ifdef BSD_KERNEL_PRIVATE -#define SIOCLL_CGASTART_32 _IOW('i', 160, struct in6_llstartreq_32) -#define SIOCLL_CGASTART_64 _IOW('i', 160, struct in6_llstartreq_64) +#define SIOCLL_CGASTART_32 _IOW('i', 160, struct in6_cgareq_32) +#define SIOCLL_CGASTART_64 _IOW('i', 160, struct in6_cgareq_64) #endif + +#define SIOCGIFCGAPREP_IN6 _IOWR('i', 187, struct in6_cgareq) +#define SIOCSIFCGAPREP_IN6 _IOWR('i', 188, struct in6_cgareq) + +#define SIOCCLAT46_START _IOWR('i', 189, struct in6_ifreq) +#define SIOCCLAT46_STOP _IOWR('i', 190, struct in6_ifreq) #endif /* PRIVATE */ #ifdef BSD_KERNEL_PRIVATE @@ -719,23 +740,25 @@ void in6_post_msg(struct ifnet *, u_int32_t, struct in6_ifaddr *); * translation between those and the publicly-defined ones below. */ #endif /* BSD_KERNEL_PRIVATE */ -#define IN6_IFF_ANYCAST 0x01 /* anycast address */ -#define IN6_IFF_TENTATIVE 0x02 /* tentative address */ -#define IN6_IFF_DUPLICATED 0x04 /* DAD detected duplicate */ -#define IN6_IFF_DETACHED 0x08 /* may be detached from the link */ -#define IN6_IFF_DEPRECATED 0x10 /* deprecated address */ +#define IN6_IFF_ANYCAST 0x0001 /* anycast address */ +#define IN6_IFF_TENTATIVE 0x0002 /* tentative address */ +#define IN6_IFF_DUPLICATED 0x0004 /* DAD detected duplicate */ +#define IN6_IFF_DETACHED 0x0008 /* may be detached from the link */ +#define IN6_IFF_DEPRECATED 0x0010 /* deprecated address */ /* don't perform DAD on this address (used only at first SIOC* call) */ -#define IN6_IFF_NODAD 0x20 - -#define IN6_IFF_AUTOCONF 0x40 /* autoconfigurable address. */ -#define IN6_IFF_TEMPORARY 0x80 /* temporary (anonymous) address. */ -#define IN6_IFF_DYNAMIC 0x100 /* assigned by DHCPv6 service */ -#define IN6_IFF_OPTIMISTIC 0x200 /* optimistic DAD, i.e. RFC 4429 */ -#define IN6_IFF_SECURED 0x400 /* cryptographically generated */ +#define IN6_IFF_NODAD 0x0020 -/* skip kernel prefix management. XXX: this should be temporary. */ -#define IN6_IFF_NOPFX 0x8000 +#define IN6_IFF_AUTOCONF 0x0040 /* autoconfigurable address. */ +#define IN6_IFF_TEMPORARY 0x0080 /* temporary (anonymous) address. */ +#define IN6_IFF_DYNAMIC 0x0100 /* assigned by DHCPv6 service */ +#define IN6_IFF_OPTIMISTIC 0x0200 /* optimistic DAD, i.e. RFC 4429 */ +#define IN6_IFF_SECURED 0x0400 /* cryptographically generated */ +#ifdef PRIVATE +#define IN6_IFF_SWIFTDAD 0x0800 /* DAD with no delay */ +#endif +#define IN6_IFF_CLAT46 0x1000 /* Address reserved for CLAT46 */ +#define IN6_IFF_NOPFX 0x8000 /* Depreciated. Don't use. */ /* Duplicate Address Detection [DAD] in progress. */ #define IN6_IFF_DADPROGRESS (IN6_IFF_TENTATIVE|IN6_IFF_OPTIMISTIC) @@ -743,6 +766,9 @@ void in6_post_msg(struct ifnet *, u_int32_t, struct in6_ifaddr *); /* do not input/output */ #define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED) +/* SLAAC/DHCPv6 address */ +#define IN6_IFF_NOTMANUAL (IN6_IFF_AUTOCONF|IN6_IFF_DYNAMIC) + #ifdef KERNEL #define IN6_ARE_SCOPE_CMP(a, b) ((a) - (b)) #define IN6_ARE_SCOPE_EQUAL(a, b) ((a) == (b)) @@ -846,6 +872,27 @@ struct in6_multi_mship { LIST_ENTRY(in6_multi_mship) i6mm_chain; /* multicast options chain */ }; +#ifdef BSD_KERNEL_PRIVATE +#include +#include + +/* + * Per-interface IPv6 structures. + */ +struct in6_ifextra { + struct scope6_id scope6_id; + struct in6_ifstat in6_ifstat; + struct icmp6_ifstat icmp6_ifstat; + struct nd_ifinfo nd_ifinfo; + uint32_t netsig_len; + u_int8_t netsig[IFNET_SIGNATURELEN]; + struct ipv6_prefix nat64_prefixes[NAT64_MAX_NUM_PREFIXES]; + struct lltable *ii_llt; /* NDP state */ +}; +#define IN6_IFEXTRA(_ifp) ((struct in6_ifextra *)(_ifp->if_inet6data)) +#define LLTABLE6(ifp) ((IN6_IFEXTRA(ifp) == NULL) ? NULL : IN6_IFEXTRA(ifp)->ii_llt) +#endif /* BSD_KERNEL_PRIVATE */ + struct mld_ifinfo; /* @@ -916,10 +963,10 @@ struct in6_multi { }; #define IN6M_LOCK_ASSERT_HELD(_in6m) \ - lck_mtx_assert(&(_in6m)->in6m_lock, LCK_MTX_ASSERT_OWNED) + LCK_MTX_ASSERT(&(_in6m)->in6m_lock, LCK_MTX_ASSERT_OWNED) #define IN6M_LOCK_ASSERT_NOTHELD(_in6m) \ - lck_mtx_assert(&(_in6m)->in6m_lock, LCK_MTX_ASSERT_NOTOWNED) + LCK_MTX_ASSERT(&(_in6m)->in6m_lock, LCK_MTX_ASSERT_NOTOWNED) #define IN6M_LOCK(_in6m) \ lck_mtx_lock(&(_in6m)->in6m_lock) @@ -1037,7 +1084,7 @@ struct ip6_pktopts; /* Multicast private KPIs. */ extern int im6o_mc_filter(const struct ip6_moptions *, const struct ifnet *, - const struct sockaddr *, const struct sockaddr *); + const struct sockaddr_in6 *, const struct sockaddr_in6 *); extern int in6_mc_join(struct ifnet *, const struct in6_addr *, struct in6_mfilter *, struct in6_multi **, int); extern int in6_mc_leave(struct in6_multi *, struct in6_mfilter *); @@ -1071,6 +1118,7 @@ extern void in6_setmaxmtu(void); extern void in6_restoremkludge(struct in6_ifaddr *, struct ifnet *); extern void in6_purgemkludge(struct ifnet *); extern struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); +extern struct in6_ifaddr *in6ifa_ifpwithflag(struct ifnet *, int); extern struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, struct in6_addr *); extern struct in6_ifaddr *in6ifa_prproxyaddr(struct in6_addr *); extern void in6ifa_getlifetime(struct in6_ifaddr *, @@ -1086,7 +1134,6 @@ extern int in6_prefix_add_ifid(int iilen, struct in6_ifaddr *ia); extern void in6_prefix_remove_ifid(int iilen, struct in6_ifaddr *ia); extern void in6_purgeprefix(struct ifnet *); extern void in6_purgeaddrs(struct ifnet *); -extern int in6_is_addr_deprecated(struct sockaddr_in6 *); extern uint8_t im6s_get_mode(const struct in6_multi *, const struct ip6_msource *, uint8_t); extern void im6f_leave(struct in6_mfilter *); @@ -1118,8 +1165,13 @@ extern int in6_cga_start(const struct in6_cga_nodecfg *); extern int in6_cga_stop(void); extern ssize_t in6_cga_parameters_prepare(void *, size_t, const struct in6_addr *, u_int8_t, const struct in6_cga_modifier *); -extern int in6_cga_generate(const struct in6_cga_prepare *, u_int8_t, +extern int in6_cga_generate(struct in6_cga_prepare *, u_int8_t, struct in6_addr *); +extern int in6_getconninfo(struct socket *, sae_connid_t, uint32_t *, + uint32_t *, int32_t *, user_addr_t, socklen_t *, + user_addr_t, socklen_t *, uint32_t *, user_addr_t, uint32_t *); +extern void in6_ip6_to_sockaddr(const struct in6_addr *ip6, u_int16_t port, + struct sockaddr_in6 *sin6, u_int32_t maxlen); #endif /* BSD_KERNEL_PRIVATE */ #endif /* _NETINET6_IN6_VAR_H_ */