]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/ip_divert.c
xnu-4903.241.1.tar.gz
[apple/xnu.git] / bsd / netinet / ip_divert.c
index 083b1484b190073e5d56ac20871d3b6a170dbd5b..74efc18df2d1bf62de3d69b9f15b46d56261fa06 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2018 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -374,12 +374,16 @@ div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin,
 
        /* Reinject packet into the system as incoming or outgoing */
        if (!sin || sin->sin_addr.s_addr == 0) {
-               struct ip_out_args ipoa =
-                   { IFSCOPE_NONE, { 0 }, IPOAF_SELECT_SRCIF, 0, SO_TC_UNSPEC,
-                   _NET_SERVICE_TYPE_UNSPEC };
+               struct ip_out_args ipoa;
                struct route ro;
                struct ip_moptions *imo;
 
+               bzero(&ipoa, sizeof(ipoa));
+               ipoa.ipoa_boundif = IFSCOPE_NONE;
+               ipoa.ipoa_flags = IPOAF_SELECT_SRCIF;
+               ipoa.ipoa_sotc = SO_TC_UNSPEC;
+               ipoa.ipoa_netsvctype = _NET_SERVICE_TYPE_UNSPEC;
+
                /*
                 * Don't allow both user specified and setsockopt options,
                 * and don't allow packet length sizes that will crash
@@ -757,7 +761,7 @@ div_unlock(struct socket *so, int refcount, void *lr)
                lck_rw_done(divcbinfo.ipi_lock);
                return (0);
        }
-       lck_mtx_assert(mutex_held, LCK_MTX_ASSERT_OWNED);
+       LCK_MTX_ASSERT(mutex_held, LCK_MTX_ASSERT_OWNED);
        so->unlock_lr[so->next_unlock_lr] = lr_saved;
        so->next_unlock_lr = (so->next_unlock_lr+1) % SO_LCKDBG_MAX;
        lck_mtx_unlock(mutex_held);
@@ -765,17 +769,17 @@ div_unlock(struct socket *so, int refcount, void *lr)
 }
 
 __private_extern__ lck_mtx_t *
-div_getlock(struct socket *so, __unused int locktype)
+div_getlock(struct socket *so, __unused int flags)
 {
        struct inpcb *inpcb = (struct inpcb *)so->so_pcb;
-       
+
        if (so->so_pcb)  {
                if (so->so_usecount < 0)
-                       panic("div_getlock: so=%p usecount=%x lrh= %s\n", 
+                       panic("div_getlock: so=%p usecount=%x lrh= %s\n",
                            so, so->so_usecount, solockhistory_nr(so));
                return(&inpcb->inpcb_mtx);
        } else {
-               panic("div_getlock: so=%p NULL NO PCB lrh= %s\n", 
+               panic("div_getlock: so=%p NULL NO PCB lrh= %s\n",
                    so, solockhistory_nr(so));
                return (so->so_proto->pr_domain->dom_mtx);
        }