]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet6/ip6_var.h
xnu-4903.221.2.tar.gz
[apple/xnu.git] / bsd / netinet6 / ip6_var.h
index ac02672df1cb16d215fab9abbc0ad5964ea7a393..23c5107107b1302d3a629316a957e733d294d536 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2013 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2018 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
@@ -148,10 +148,10 @@ struct    ip6_moptions {
 };
 
 #define        IM6O_LOCK_ASSERT_HELD(_im6o)                                    \
-       lck_mtx_assert(&(_im6o)->im6o_lock, LCK_MTX_ASSERT_OWNED)
+       LCK_MTX_ASSERT(&(_im6o)->im6o_lock, LCK_MTX_ASSERT_OWNED)
 
 #define        IM6O_LOCK_ASSERT_NOTHELD(_im6o)                                 \
-       lck_mtx_assert(&(_im6o)->im6o_lock, LCK_MTX_ASSERT_NOTOWNED)
+       LCK_MTX_ASSERT(&(_im6o)->im6o_lock, LCK_MTX_ASSERT_NOTOWNED)
 
 #define        IM6O_LOCK(_im6o)                                                \
        lck_mtx_lock(&(_im6o)->im6o_lock)
@@ -182,6 +182,7 @@ struct ip6_exthdrs {
        struct mbuf *ip6e_dest1;
        struct mbuf *ip6e_rthdr;
        struct mbuf *ip6e_dest2;
+       boolean_t merged;
 };
 
 /*
@@ -253,6 +254,9 @@ struct      ip6_pktopts {
  */
 #endif /* BSD_KERNEL_PRIVATE */
 
+#define        IP6S_SRCRULE_COUNT 16
+#include <netinet6/scope6_var.h>
+
 struct ip6stat {
        u_quad_t ip6s_total;            /* total packets received */
        u_quad_t ip6s_tooshort;         /* packet too short */
@@ -268,6 +272,7 @@ struct      ip6stat {
        u_quad_t ip6s_localout;         /* total ip packets generated here */
        u_quad_t ip6s_odropped;         /* lost packets due to nobufs, etc. */
        u_quad_t ip6s_reassembled;      /* total packets reassembled ok */
+       u_quad_t ip6s_atmfrag_rcvd;     /* atomic fragments received */
        u_quad_t ip6s_fragmented;       /* datagrams successfully fragmented */
        u_quad_t ip6s_ofragments;       /* output fragments created */
        u_quad_t ip6s_cantfrag;         /* don't fragment flag was set, etc. */
@@ -289,32 +294,35 @@ struct    ip6stat {
        /*
         * statistics for improvement of the source address selection
         * algorithm:
-        * XXX: hardcoded 16 = # of ip6 multicast scope types + 1
         */
        /* number of times that address selection fails */
        u_quad_t ip6s_sources_none;
        /* number of times that an address on the outgoing I/F is chosen */
-       u_quad_t ip6s_sources_sameif[16];
+       u_quad_t ip6s_sources_sameif[SCOPE6_ID_MAX];
        /* number of times that an address on a non-outgoing I/F is chosen */
-       u_quad_t ip6s_sources_otherif[16];
+       u_quad_t ip6s_sources_otherif[SCOPE6_ID_MAX];
        /*
         * number of times that an address that has the same scope
         * from the destination is chosen.
         */
-       u_quad_t ip6s_sources_samescope[16];
+       u_quad_t ip6s_sources_samescope[SCOPE6_ID_MAX];
        /*
         * number of times that an address that has a different scope
         * from the destination is chosen.
         */
-       u_quad_t ip6s_sources_otherscope[16];
+       u_quad_t ip6s_sources_otherscope[SCOPE6_ID_MAX];
        /* number of times that a deprecated address is chosen */
-       u_quad_t ip6s_sources_deprecated[16];
+       u_quad_t ip6s_sources_deprecated[SCOPE6_ID_MAX];
 
        u_quad_t ip6s_forward_cachehit;
        u_quad_t ip6s_forward_cachemiss;
 
        /* number of times that each rule of source selection is applied. */
-       u_quad_t ip6s_sources_rule[16];
+       u_quad_t ip6s_sources_rule[IP6S_SRCRULE_COUNT];
+
+       /* number of times we ignored address on expensive secondary interfaces */
+       u_quad_t ip6s_sources_skip_expensive_secondary_if;
+
        /* pkt dropped, no mbufs for control data */
        u_quad_t ip6s_pktdropcntrl;
 
@@ -325,6 +333,44 @@ struct     ip6stat {
 
        /* duplicate address detection collisions */
        u_quad_t ip6s_dad_collide;
+
+       /* DAD NS looped back */
+       u_quad_t ip6s_dad_loopcount;
+
+       /* NECP policy related drop */
+       u_quad_t ip6s_necp_policy_drop;
+
+       /* CLAT46 stats */
+       u_quad_t ip6s_clat464_in_tooshort_drop;
+       u_quad_t ip6s_clat464_in_nov6addr_drop;
+       u_quad_t ip6s_clat464_in_nov4addr_drop;
+       u_quad_t ip6s_clat464_in_v4synthfail_drop;
+       u_quad_t ip6s_clat464_in_64transfail_drop;
+       u_quad_t ip6s_clat464_in_64proto_transfail_drop;
+       u_quad_t ip6s_clat464_in_64frag_transfail_drop;
+       u_quad_t ip6s_clat464_in_invalpbuf_drop;
+       u_quad_t ip6s_clat464_in_success;
+       u_quad_t ip6s_clat464_in_drop;
+       u_quad_t ip6s_clat464_in_v4_drop;
+
+       u_quad_t ip6s_clat464_out_nov6addr_drop;
+       u_quad_t ip6s_clat464_out_v6synthfail_drop;
+       u_quad_t ip6s_clat464_out_46transfail_drop;
+       u_quad_t ip6s_clat464_out_46proto_transfail_drop;
+       u_quad_t ip6s_clat464_out_46frag_transfail_drop;
+       u_quad_t ip6s_clat464_out_invalpbuf_drop;
+       u_quad_t ip6s_clat464_out_success;
+       u_quad_t ip6s_clat464_out_drop;
+
+       u_quad_t ip6s_clat464_v6addr_conffail;
+       u_quad_t ip6s_clat464_plat64_pfx_setfail;
+       u_quad_t ip6s_clat464_plat64_pfx_getfail;
+};
+
+enum ip6s_sources_rule_index {
+       IP6S_SRCRULE_0, IP6S_SRCRULE_1, IP6S_SRCRULE_2, IP6S_SRCRULE_3, IP6S_SRCRULE_4,
+       IP6S_SRCRULE_5, IP6S_SRCRULE_6, IP6S_SRCRULE_7,
+       IP6S_SRCRULE_7x, IP6S_SRCRULE_8
 };
 
 #ifdef BSD_KERNEL_PRIVATE
@@ -397,8 +443,15 @@ struct ip6_out_args {
 #define        IP6OAF_BOUND_IF         0x00000002      /* boundif value is valid */
 #define        IP6OAF_BOUND_SRCADDR    0x00000004      /* bound to src address */
 #define        IP6OAF_NO_CELLULAR      0x00000010      /* skip IFT_CELLULAR */
+#define        IP6OAF_NO_EXPENSIVE     0x00000020      /* skip IFEF_EXPENSIVE */
+#define        IP6OAF_AWDL_UNRESTRICTED 0x00000040     /* privileged AWDL */
+#define        IP6OAF_QOSMARKING_ALLOWED 0x00000080    /* policy allows Fastlane DSCP marking */
+#define IP6OAF_INTCOPROC_ALLOWED 0x00000100    /* access to internal coproc interfaces */
+#define        IP6OAF_NO_LOW_POWER     0x00000200      /* skip low power */
        u_int32_t       ip6oa_retflags; /* IP6OARF return flags (see below) */
 #define        IP6OARF_IFDENIED        0x00000001      /* denied access to interface */
+       int             ip6oa_sotc;             /* traffic class for Fastlane DSCP mapping */
+       int             ip6oa_netsvctype;
 };
 
 extern struct ip6stat ip6stat; /* statistics */
@@ -417,9 +470,6 @@ extern int ip6_neighborgcthresh; /* Threshold # of NDP entries for GC */
 extern int ip6_maxifprefixes;  /* Max acceptable prefixes via RA per IF */
 extern int ip6_maxifdefrouters;        /* Max acceptable def routers via RA */
 extern int ip6_maxdynroutes;   /* Max # of routes created via redirect */
-#if MROUTING
-extern struct socket *ip6_mrouter; /* multicast routing daemon */
-#endif /* MROUTING */
 extern int ip6_sendredirects;  /* send IP redirects when forwarding? */
 extern int ip6_accept_rtadv;   /* deprecated */
 extern int ip6_log_interval;
@@ -449,10 +499,9 @@ extern int ip6_use_defzone;
 extern struct pr_usrreqs rip6_usrreqs;
 extern struct pr_usrreqs icmp6_dgram_usrreqs;
 
-extern int ip6_doscopedroute;
-
 struct sockopt;
 struct inpcb;
+struct ip6_hdr;
 struct in6_ifaddr;
 struct ip6protosw;
 struct domain;
@@ -484,9 +533,6 @@ extern struct ip6aux *ip6_addaux(struct mbuf *);
 extern struct ip6aux *ip6_findaux(struct mbuf *);
 extern void ip6_delaux(struct mbuf *);
 
-#if MROUTING
-extern int ip6_mforward(struct ip6_hdr *, struct ifnet *, struct mbuf *);
-#endif /* MROUTING */
 extern int ip6_process_hopopts(struct mbuf *, u_int8_t *, int, u_int32_t *,
     u_int32_t *);
 extern struct mbuf **ip6_savecontrol_v4(struct inpcb *, struct mbuf *,
@@ -509,6 +555,8 @@ extern void ip6_clearpktopts(struct ip6_pktopts *, int);
 extern struct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int);
 extern int ip6_optlen(struct inpcb *);
 extern void ip6_drain(void);
+extern int ip6_do_fragmentation(struct mbuf **, uint32_t, struct ifnet *, uint32_t,
+                                                               struct ip6_hdr *, struct ip6_exthdrs *, uint32_t, int);
 
 extern int route6_input(struct mbuf **, int *, int);
 
@@ -517,12 +565,21 @@ extern int frag6_input(struct mbuf **, int *, int);
 extern void frag6_drain(void);
 
 extern int rip6_input(struct mbuf **, int *, int);
-extern void rip6_ctlinput(int, struct sockaddr *, void *);
+extern void rip6_ctlinput(int, struct sockaddr *, void *, struct ifnet *);
 extern int rip6_ctloutput(struct socket *so, struct sockopt *sopt);
 extern int rip6_output(struct mbuf *, struct socket *, struct sockaddr_in6 *,
     struct mbuf *, int);
 
 extern int dest6_input(struct mbuf **, int *, int);
+/*
+ * IPv6 source address selection hints
+ */
+#define IPV6_SRCSEL_HINT_PREFER_TMPADDR         0x00000001
+
+extern struct ifaddr * in6_selectsrc_core_ifa(struct sockaddr_in6 *, struct ifnet *, int);
+extern struct in6_addr * in6_selectsrc_core(struct sockaddr_in6 *,
+    uint32_t, struct ifnet *, int,
+    struct in6_addr *, struct ifnet **, int *, struct ifaddr **);
 extern struct in6_addr *in6_selectsrc(struct sockaddr_in6 *,
     struct ip6_pktopts *, struct inpcb *, struct route_in6 *,
     struct ifnet **, struct in6_addr *, unsigned int, int *);