]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/icmp6.h
xnu-2782.30.5.tar.gz
[apple/xnu.git] / bsd / netinet / icmp6.h
index aab7c4ffd52b7047dc79d49bee2710f3e8042a95..da271fa32afe74be6f72a2db9e49b4b966d2e594 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000,2008-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2013 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
 #define _NETINET_ICMP6_H_
 #include <sys/appleapiopts.h>
 
-#ifdef XNU_KERNEL_PRIVATE
-#include <sys/mcache.h>
-#endif
-
 #define ICMPV6_PLD_MAXLEN      1232    /* IPV6_MMTU - sizeof(struct ip6_hdr)
                                           - sizeof(struct icmp6_hdr) */
 
@@ -333,6 +329,7 @@ struct nd_opt_hdr {         /* Neighbor discovery option header */
 #define ND_OPT_REDIRECTED_HEADER       4
 #define ND_OPT_MTU                     5
 #define ND_OPT_RDNSS                   25      /* RFC 5006 */
+#define ND_OPT_DNSSL                   31      /* RFC 6106 */
 
 #define ND_OPT_ROUTE_INFO              200     /* draft-ietf-ipngwg-router-preference, not officially assigned yet */
 
@@ -382,6 +379,14 @@ struct nd_opt_rdnss {      /* recursive domain name system servers */
     struct in6_addr    nd_opt_rdnss_addr[1];
 } __attribute__((__packed__));
 
+struct nd_opt_dnssl {  /* domain name search list */
+    u_int8_t           nd_opt_dnssl_type;
+    u_int8_t           nd_opt_dnssl_len;
+    u_int16_t          nd_opt_dnssl_reserved;
+    u_int32_t          nd_opt_dnssl_lifetime;
+    u_int8_t           nd_opt_dnssl_domains[8];
+} __attribute__((__packed__));
+
 /*
  * icmp6 namelookup
  */
@@ -648,28 +653,29 @@ struct icmp6stat {
 #if 0  /*obsoleted*/
 #define ICMPV6CTL_ERRRATELIMIT         5       /* ICMPv6 error rate limitation */
 #endif
-#define ICMPV6CTL_ND6_PRUNE                    6
-#define ICMPV6CTL_ND6_DELAY                    8
+#define ICMPV6CTL_ND6_PRUNE            6
+#define ICMPV6CTL_ND6_DELAY            8
 #define ICMPV6CTL_ND6_UMAXTRIES                9
 #define ICMPV6CTL_ND6_MMAXTRIES                10
 #define ICMPV6CTL_ND6_USELOOPBACK      11
 /*#define ICMPV6CTL_ND6_PROXYALL       12      obsoleted, do not reuse here */
-#define ICMPV6CTL_NODEINFO                     13
+#define ICMPV6CTL_NODEINFO             13
 #define ICMPV6CTL_ERRPPSLIMIT          14      /* ICMPv6 error pps limitation */
 #define ICMPV6CTL_ND6_MAXNUDHINT       15
 #define ICMPV6CTL_MTUDISC_HIWAT                16
 #define ICMPV6CTL_MTUDISC_LOWAT                17
-#define ICMPV6CTL_ND6_DEBUG                    18
+#define ICMPV6CTL_ND6_DEBUG            18
 #define ICMPV6CTL_ND6_DRLIST           19
 #define ICMPV6CTL_ND6_PRLIST           20
 #define ICMPV6CTL_MLD_MAXSRCFILTER     21
 #define ICMPV6CTL_MLD_SOMAXSRC         22
 #define ICMPV6CTL_MLD_VERSION          23
 #define ICMPV6CTL_ND6_MAXQLEN          24
-#define        ICMPV6CTL_ND6_ACCEPT_6TO4       25
-#define ICMPV6CTL_MAXID                                26
+#define ICMPV6CTL_ND6_ACCEPT_6TO4      25
+#define ICMPV6CTL_ND6_OPTIMISTIC_DAD   26      /* RFC 4429 */
+#define ICMPV6CTL_MAXID                        27
 
-#ifdef KERNEL_PRIVATE
+#ifdef BSD_KERNEL_PRIVATE
 #define ICMPV6CTL_NAMES { \
        { 0, 0 }, \
        { 0, 0 }, \
@@ -697,16 +703,16 @@ struct icmp6stat {
        { 0, 0 }, \
        { 0, 0 }, \
        { "nd6_accept_6to4", CTLTYPE_INT }, \
+       { "nd6_optimistic_dad", CTLTYPE_INT }, \
 }
 
-#define RTF_PROBEMTU   RTF_PROTO1
-
 # ifdef __STDC__
 struct rtentry;
 struct rttimer;
 struct in6_multi;
 # endif
-void   icmp6_init(void);
+struct ip6protosw;
+void   icmp6_init(struct ip6protosw *, struct domain *);
 void   icmp6_paramerror(struct mbuf *, int);
 void   icmp6_error(struct mbuf *, int, int, int);
 void   icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
@@ -721,68 +727,63 @@ void      icmp6_mtudisc_update(struct ip6ctlparam *, int);
 
 extern lck_rw_t icmp6_ifs_rwlock;
 /* XXX: is this the right place for these macros? */
-#define icmp6_ifstat_inc(ifp, tag) \
-do {                                                                   \
-       lck_rw_lock_shared(&icmp6_ifs_rwlock);                          \
-       if ((ifp) && (ifp)->if_index <= if_index                        \
-        && (ifp)->if_index < icmp6_ifstatmax                           \
-        && icmp6_ifstat && icmp6_ifstat[(ifp)->if_index]) {            \
-               atomic_add_64(&icmp6_ifstat[(ifp)->if_index]->tag, 1);  \
-       }                                                               \
-       lck_rw_done(&icmp6_ifs_rwlock);                                 \
+/* N.B.: if_inet6data is never freed once set, so we don't need to lock */
+#define icmp6_ifstat_inc(_ifp, _tag) do {                      \
+       if (_ifp != NULL && IN6_IFEXTRA(_ifp) != NULL) {        \
+               IN6_IFEXTRA(_ifp)->icmp6_ifstat._tag++;         \
+       }                                                       \
 } while (0)
 
-#define icmp6_ifoutstat_inc(ifp, type, code) \
-do { \
-               icmp6_ifstat_inc(ifp, ifs6_out_msg); \
-               if (type < ICMP6_INFOMSG_MASK) \
-                       icmp6_ifstat_inc(ifp, ifs6_out_error); \
-               switch (type) { \
-                case ICMP6_DST_UNREACH: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
-                        if (code == ICMP6_DST_UNREACH_ADMIN) \
-                                icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
-                        break; \
-                case ICMP6_PACKET_TOO_BIG: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
-                        break; \
-                case ICMP6_TIME_EXCEEDED: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
-                        break; \
-                case ICMP6_PARAM_PROB: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
-                        break; \
-                case ICMP6_ECHO_REQUEST: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_echo); \
-                        break; \
-                case ICMP6_ECHO_REPLY: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
-                        break; \
-                case MLD_LISTENER_QUERY: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
-                        break; \
-                case MLD_LISTENER_REPORT: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
-                        break; \
-                case MLD_LISTENER_DONE: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
-                        break; \
-                case ND_ROUTER_SOLICIT: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
-                        break; \
-                case ND_ROUTER_ADVERT: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
-                        break; \
-                case ND_NEIGHBOR_SOLICIT: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
-                        break; \
-                case ND_NEIGHBOR_ADVERT: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
-                        break; \
-                case ND_REDIRECT: \
-                        icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
-                        break; \
-               } \
+#define icmp6_ifoutstat_inc(ifp, type, code) do {              \
+       icmp6_ifstat_inc(ifp, ifs6_out_msg);                    \
+       if (type < ICMP6_INFOMSG_MASK)                          \
+               icmp6_ifstat_inc(ifp, ifs6_out_error);          \
+       switch (type) {                                         \
+       case ICMP6_DST_UNREACH:                                 \
+               icmp6_ifstat_inc(ifp, ifs6_out_dstunreach);     \
+               if (code == ICMP6_DST_UNREACH_ADMIN)            \
+                       icmp6_ifstat_inc(ifp, ifs6_out_adminprohib);\
+                break;                                         \
+       case ICMP6_PACKET_TOO_BIG:                              \
+               icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig);      \
+               break;                                          \
+       case ICMP6_TIME_EXCEEDED:                               \
+               icmp6_ifstat_inc(ifp, ifs6_out_timeexceed);     \
+               break;                                          \
+       case ICMP6_PARAM_PROB:                                  \
+               icmp6_ifstat_inc(ifp, ifs6_out_paramprob);      \
+               break;                                          \
+       case ICMP6_ECHO_REQUEST:                                \
+               icmp6_ifstat_inc(ifp, ifs6_out_echo);           \
+               break;                                          \
+       case ICMP6_ECHO_REPLY:                                  \
+               icmp6_ifstat_inc(ifp, ifs6_out_echoreply);      \
+               break;                                          \
+       case MLD_LISTENER_QUERY:                                \
+               icmp6_ifstat_inc(ifp, ifs6_out_mldquery);       \
+               break;                                          \
+       case MLD_LISTENER_REPORT:                               \
+               icmp6_ifstat_inc(ifp, ifs6_out_mldreport);      \
+               break;                                          \
+       case MLD_LISTENER_DONE:                                 \
+               icmp6_ifstat_inc(ifp, ifs6_out_mlddone);        \
+               break;                                          \
+       case ND_ROUTER_SOLICIT:                                 \
+               icmp6_ifstat_inc(ifp, ifs6_out_routersolicit);  \
+               break;                                          \
+       case ND_ROUTER_ADVERT:                                  \
+               icmp6_ifstat_inc(ifp, ifs6_out_routeradvert);   \
+               break;                                          \
+       case ND_NEIGHBOR_SOLICIT:                               \
+               icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit);\
+               break;                                          \
+       case ND_NEIGHBOR_ADVERT:                                \
+               icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
+               break;                                          \
+       case ND_REDIRECT:                                       \
+               icmp6_ifstat_inc(ifp, ifs6_out_redirect);       \
+               break;                                          \
+       }                                                       \
 } while (0)
 
 extern int     icmp6_rediraccept;      /* accept/process redirects */
@@ -793,6 +794,6 @@ extern int  icmp6_redirtimeout;     /* cache time for redirect routes */
 #define ICMP6_NODEINFO_TMPADDROK       0x4
 #define ICMP6_NODEINFO_GLOBALOK                0x8
 
-#endif /* KERNEL_PRIVATE */
+#endif /* BSD_KERNEL_PRIVATE */
 
 #endif /* !_NETINET_ICMP6_H_ */