]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/ip6.h
xnu-4903.241.1.tar.gz
[apple/xnu.git] / bsd / netinet / ip6.h
index a740ddc49e1a1d2b8d3e2b2e2dd7c90a37d8f086..7d181e66c11d18e83052f79bb488564be4f394ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -127,10 +127,12 @@ struct ip6_hdr {
 #if BYTE_ORDER == BIG_ENDIAN
 #define IPV6_FLOWINFO_MASK     0x0fffffff      /* flow info (28 bits) */
 #define IPV6_FLOWLABEL_MASK    0x000fffff      /* flow label (20 bits) */
+#define IPV6_FLOW_ECN_MASK     0x00300000      /* the 2 ECN bits */
 #else
 #if BYTE_ORDER == LITTLE_ENDIAN
 #define IPV6_FLOWINFO_MASK     0xffffff0f      /* flow info (28 bits) */
 #define IPV6_FLOWLABEL_MASK    0xffff0f00      /* flow label (20 bits) */
+#define IPV6_FLOW_ECN_MASK     0x00003000      /* the 2 ECN bits */
 #endif /* LITTLE_ENDIAN */
 #endif
 #if 1
@@ -139,6 +141,12 @@ struct ip6_hdr {
 #define IP6TOS_ECT             0x02    /* ECN-capable transport */
 #endif
 
+/*
+ * To access the 6 bits of the DSCP value in the 32 bits ip6_flow field
+ */
+#define        IP6FLOW_DSCP_MASK       0x0fc00000
+#define        IP6FLOW_DSCP_SHIFT      22
+
 /*
  * Extension Headers
  */
@@ -284,14 +292,14 @@ struct ip6_frag {
  */
 #define IPV6_MAXHLIM   255     /* maximum hoplimit */
 #define IPV6_DEFHLIM   64      /* default hlim */
-#define IPV6_FRAGTTL   120     /* ttl for fragment packets, in slowtimo tick */
+#define IPV6_FRAGTTL   60      /* ttl for fragment packets (seconds) */
 #define IPV6_HLIMDEC   1       /* subtracted when forwarding */
 
 #define IPV6_MMTU      1280    /* minimal MTU and reassembly. 1024 + 256 */
 #define IPV6_MAXPACKET 65535   /* ip6 max packet size without Jumbo payload*/
 #define IPV6_MAXOPTHDR 2048    /* max option header size, 256 64-bit words */
 
-#ifdef KERNEL_PRIVATE
+#ifdef BSD_KERNEL_PRIVATE
 /*
  * IP6_EXTHDR_CHECK ensures that region between the IP6 header and the
  * target header (including IPv6 itself, extension headers and
@@ -313,12 +321,14 @@ do {                                                                      \
                if ((m)->m_len < (off) + (hlen)) {                      \
                        ip6stat.ip6s_exthdrtoolong++;                   \
                        m_freem(m);                                     \
+                       (m) = NULL;                                     \
                        action;                                         \
                }                                                       \
        } else {                                                        \
                if ((m)->m_len < (off) + (hlen)) {                      \
                        ip6stat.ip6s_exthdrtoolong++;                   \
                        m_freem(m);                                     \
+                       (m) = NULL;                                     \
                        action;                                         \
                }                                                       \
        }                                                               \
@@ -327,6 +337,7 @@ do {                                                                        \
                ip6stat.ip6s_tooshort++;                                \
                in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated);   \
                m_freem(m);                                             \
+               (m) = NULL;                                             \
                action;                                                 \
        }                                                               \
     }                                                                  \
@@ -346,5 +357,5 @@ do {                                                                        \
 #define IP6_EXTHDR_GET0(val, typ, m, off, len)                         \
        M_STRUCT_GET0(val, typ, m, off, len)
 
-#endif /* KERNEL_PRIVATE */
+#endif /* BSD_KERNEL_PRIVATE */
 #endif /* !_NETINET_IP6_H_ */