diff options
Diffstat (limited to 'sys/netipx/ipx_usrreq.c')
-rw-r--r-- | sys/netipx/ipx_usrreq.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/sys/netipx/ipx_usrreq.c b/sys/netipx/ipx_usrreq.c index f0c803a..68d9f10 100644 --- a/sys/netipx/ipx_usrreq.c +++ b/sys/netipx/ipx_usrreq.c @@ -146,7 +146,9 @@ ipx_input(m, ipxp) if (sbappendaddr(&ipxp->ipxp_socket->so_rcv, (struct sockaddr *)&ipx_ipx, m, (struct mbuf *)NULL) == 0) goto bad; + SOCK_LOCK(ipxp->ipxp_socket); sorwakeup(ipxp->ipxp_socket); + SOCK_UNLOCK(ipxp->ipxp_socket); return; bad: m_freem(m); @@ -159,7 +161,9 @@ ipx_abort(ipxp) struct socket *so = ipxp->ipxp_socket; ipx_pcbdisconnect(ipxp); + SOCK_LOCK(so); soisdisconnected(so); + SOCK_UNLOCK(so); } /* @@ -186,7 +190,9 @@ ipx_drop(ipxp, errno) }*/ so->so_error = errno; ipx_pcbdisconnect(ipxp); + SOCK_LOCK(so); soisdisconnected(so); + SOCK_UNLOCK(so); } static int @@ -200,6 +206,7 @@ ipx_output(ipxp, m0) register struct route *ro; struct mbuf *m; struct mbuf *mprev = NULL; + int soopts; /* * Calculate data length. @@ -261,9 +268,14 @@ ipx_output(ipxp, m0) * Output datagram. */ so = ipxp->ipxp_socket; - if (so->so_options & SO_DONTROUTE) + SOCK_LOCK(so); + if (so->so_options & SO_DONTROUTE) { + soopts = so->so_options & SO_BROADCAST; + SOCK_UNLOCK(so); return (ipx_outputfl(m, (struct route *)NULL, - (so->so_options & SO_BROADCAST) | IPX_ROUTETOIF)); + soopts | IPX_ROUTETOIF)); + } + SOCK_UNLOCK(so); /* * Use cached route for previous datagram if * possible. If the previous net was the same @@ -306,7 +318,10 @@ ipx_output(ipxp, m0) } ipxp->ipxp_lastdst = ipx->ipx_dna; #endif /* ancient_history */ - return (ipx_outputfl(m, ro, so->so_options & SO_BROADCAST)); + SOCK_LOCK(so); + soopts = so->so_options & SO_BROADCAST; + SOCK_UNLOCK(so); + return (ipx_outputfl(m, ro, soopts)); } int @@ -429,8 +444,11 @@ ipx_usr_abort(so) s = splnet(); ipx_pcbdetach(ipxp); splx(s); + SOCK_LOCK(so); sotryfree(so); + SOCK_LOCK(so); soisdisconnected(so); + SOCK_UNLOCK(so); return (0); } @@ -480,8 +498,11 @@ ipx_connect(so, nam, td) s = splnet(); error = ipx_pcbconnect(ipxp, nam, td); splx(s); - if (error == 0) + if (error == 0) { + SOCK_LOCK(so); soisconnected(so); + SOCK_UNLOCK(so); + } return (error); } @@ -512,7 +533,9 @@ ipx_disconnect(so) s = splnet(); ipx_pcbdisconnect(ipxp); splx(s); + SOCK_LOCK(so); soisdisconnected(so); + SOCK_UNLOCK(so); return (0); } |