diff options
Diffstat (limited to 'sys/netgraph/ng_socket.c')
-rw-r--r-- | sys/netgraph/ng_socket.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c index 09d1c46..312b36b 100644 --- a/sys/netgraph/ng_socket.c +++ b/sys/netgraph/ng_socket.c @@ -734,7 +734,9 @@ ship_msg(struct ngpcb *pcbp, struct ng_mesg *msg, struct sockaddr_ng *addr) m_freem(mdata); return (ENOBUFS); } + SOCK_LOCK(so); sorwakeup(so); + SOCK_UNLOCK(so); return (0); } @@ -770,9 +772,13 @@ ngs_connect(hook_p hook) if ((priv->datasock) && (priv->datasock->ng_socket)) { if (NG_NODE_NUMHOOKS(node) == 1) { + SOCK_LOCK(priv->datasock->ng_socket); priv->datasock->ng_socket->so_state |= SS_ISCONNECTED; + SOCK_UNLOCK(priv->datasock->ng_socket); } else { + SOCK_LOCK(priv->datasock->ng_socket); priv->datasock->ng_socket->so_state &= ~SS_ISCONNECTED; + SOCK_UNLOCK(priv->datasock->ng_socket); } } return (0); @@ -886,7 +892,9 @@ ngs_rcvdata(hook_p hook, item_p item) TRAP_ERROR; return (ENOBUFS); } + SOCK_LOCK(so); sorwakeup(so); + SOCK_UNLOCK(so); return (0); } @@ -905,9 +913,13 @@ ngs_disconnect(hook_p hook) if ((priv->datasock) && (priv->datasock->ng_socket)) { if (NG_NODE_NUMHOOKS(node) == 1) { + SOCK_LOCK(priv->datasock->ng_socket); priv->datasock->ng_socket->so_state |= SS_ISCONNECTED; + SOCK_UNLOCK(priv->datasock->ng_socket); } else { + SOCK_LOCK(priv->datasock->ng_socket); priv->datasock->ng_socket->so_state &= ~SS_ISCONNECTED; + SOCK_UNLOCK(priv->datasock->ng_socket); } } @@ -932,13 +944,17 @@ ngs_shutdown(node_p node) struct ngpcb *const pcbp = priv->ctlsock; if (dpcbp != NULL) { + SOCK_LOCK(dpcbp->ng_socket); soisdisconnected(dpcbp->ng_socket); + SOCK_UNLOCK(dpcbp->ng_socket); dpcbp->sockdata = NULL; priv->datasock = NULL; priv->refs--; } if (pcbp != NULL) { + SOCK_LOCK(pcbp->ng_socket); soisdisconnected(pcbp->ng_socket); + SOCK_UNLOCK(pcbp->ng_socket); pcbp->sockdata = NULL; priv->ctlsock = NULL; priv->refs--; |