]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet6/ip6_input.c
xnu-517.tar.gz
[apple/xnu.git] / bsd / netinet6 / ip6_input.c
index 2d87b6f5cb3815ac4df55bbeca3ff122d4c0b373..2dc986a66202cfc6393f2495df3286f94ec1396e 100644 (file)
@@ -199,6 +199,7 @@ ip6_init()
 #endif
        nd6_init();
        frag6_init();
+       icmp6_init();
        /*
         * in many cases, random() here does NOT return random number
         * as initialization during bootstrap time occur in fixed order.
@@ -207,7 +208,7 @@ ip6_init()
        ip6_flow_seq = random() ^ tv.tv_usec;
        microtime(&tv);
        ip6_desync_factor = (random() ^ tv.tv_usec) % MAX_TEMP_DESYNC_FACTOR;
-       timeout(ip6_init2, (caddr_t)0, 1 * hz);
+       timeout(ip6_init2, (caddr_t)0, 2 * hz);
 }
 
 static void
@@ -222,7 +223,7 @@ ip6_init2(dummy)
         * to route local address of p2p link to loopback,
         * assign loopback address first.
         */
-       in6_ifattach(&loif[0], NULL);
+       in6_ifattach(&loif[0], NULL, NULL);
 
 #ifdef __APPLE__
        /* nd6_timer_init */
@@ -323,7 +324,7 @@ ip6_input(m)
        ip6_delaux(m);
 
        /*
-        * mbuf statistics by kazu
+        * mbuf statistics
         */
        if (m->m_flags & M_EXT) {
                if (m->m_next)
@@ -334,7 +335,7 @@ ip6_input(m)
 #define M2MMAX (sizeof(ip6stat.ip6s_m2m)/sizeof(ip6stat.ip6s_m2m[0]))
                if (m->m_next) {
                        if (m->m_flags & M_LOOP) {
-                               ip6stat.ip6s_m2m[loif[0].if_index]++;   /*XXX*/
+                               ip6stat.ip6s_m2m[loif[0].if_index]++;   /* XXX */
                        } else if (m->m_pkthdr.rcvif->if_index < M2MMAX)
                                ip6stat.ip6s_m2m[m->m_pkthdr.rcvif->if_index]++;
                        else
@@ -366,7 +367,7 @@ ip6_input(m)
                                n = NULL;
                        }
                }
-               if (!n) {
+               if (n == NULL) {
                        m_freem(m);
                        return; /*ENOBUFS*/
                }
@@ -433,6 +434,7 @@ ip6_input(m)
                in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr);
                goto bad;
        }
+
        /*
         * The following check is not documented in specs.  A malicious
         * party may be able to use IPv4 mapped addr to confuse tcp/udp stack
@@ -660,7 +662,7 @@ ip6_input(m)
                 && ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_FAITH) {
                        /* XXX do we need more sanity checks? */
                        ours = 1;
-                       deliverifp = ip6_forward_rt.ro_rt->rt_ifp; /*faith*/
+                       deliverifp = ip6_forward_rt.ro_rt->rt_ifp; /* faith */
                        goto hbhcheck;
                }
        }
@@ -718,7 +720,7 @@ ip6_input(m)
                ip6 = mtod(m, struct ip6_hdr *);
 
                /*
-                * if the payload length field is 0 and the next header field  
+                * if the payload length field is 0 and the next header field
                 * indicates Hop-by-Hop Options header, then a Jumbo Payload
                 * option MUST be included.
                 */
@@ -1652,8 +1654,10 @@ ip6_addaux(m)
                }
        } else {
                n = m_aux_add(m, AF_INET6, -1);
-               n->m_len = sizeof(struct ip6aux);
-               bzero(mtod(n, caddr_t), n->m_len);
+               if (n) {
+                       n->m_len = sizeof(struct ip6aux);
+                       bzero(mtod(n, caddr_t), n->m_len);
+               }
        }
        return n;
 }