]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/ip_output.c
xnu-792.6.70.tar.gz
[apple/xnu.git] / bsd / netinet / ip_output.c
index 9fd7a09a1b8ed476e419eb547f71990ab7a67cd0..44f89c3cfb9af8f3c60bdaf3333ac1cf389e75e2 100644 (file)
@@ -850,6 +850,7 @@ skip_ipsec:
                args.m = m;
                args.next_hop = dst;
                args.oif = ifp;
+               lck_mtx_unlock(ip_mutex);
                off = ip_fw_chk_ptr(&args);
                m = args.m;
                dst = args.next_hop;
@@ -873,12 +874,13 @@ skip_ipsec:
                        if (m)
                                m_freem(m);
                        error = EACCES ;
-                       lck_mtx_unlock(ip_mutex);
                        goto done ;
                }
                ip = mtod(m, struct ip *);
-               if (off == 0 && dst == old) /* common case */
+               if (off == 0 && dst == old) {/* common case */
+                       lck_mtx_lock(ip_mutex);
                        goto pass ;
+               }
 #if DUMMYNET
                 if (DUMMYNET_LOADED && (off & IP_FW_PORT_DYNT_FLAG) != 0) {
                     /*
@@ -894,12 +896,12 @@ skip_ipsec:
                    args.dst = dst;
                    args.flags = flags;
 
-                   lck_mtx_unlock(ip_mutex);
                    error = ip_dn_io_ptr(m, off & 0xffff, DN_TO_IP_OUT,
                                &args);
                    goto done;
                }
 #endif /* DUMMYNET */
+               lck_mtx_lock(ip_mutex);
 #if IPDIVERT
                if (off != 0 && (off & IP_FW_PORT_DYNT_FLAG) == 0) {
                        struct mbuf *clone = NULL;
@@ -1381,8 +1383,8 @@ in_delayed_cksum_offset(struct mbuf *m, int ip_offset)
        }
        
        if (ip_offset + sizeof(struct ip) > m->m_len) {
-               printf("delayed m_pullup, m->len: %d  off: %d  p: %d\n",
-                       m->m_len, ip_offset, ip->ip_p);
+               printf("delayed m_pullup, m->len: %d  off: %d\n",
+                       m->m_len, ip_offset);
                /*
                 * XXX
                 * this shouldn't happen