Align IPv6 socket locking with IPv4 locking: lock socket buffer explicitly

and use _locked variants to avoid extra lock and unlock operations.

Reviewed by:	gnn
MFC after:	1 week
This commit is contained in:
Robert Watson 2006-07-23 12:24:22 +00:00
parent 4f1f0ef523
commit c9db0fad09

View File

@ -1954,7 +1954,9 @@ icmp6_rip6_input(mp, off)
ip6_savecontrol(last, n, &opts);
/* strip intermediate headers */
m_adj(n, off);
if (sbappendaddr(&last->in6p_socket->so_rcv,
SOCKBUF_LOCK(&last->in6p_socket->so_rcv);
if (sbappendaddr_locked(
&last->in6p_socket->so_rcv,
(struct sockaddr *)&fromsa, n, opts)
== 0) {
/* should notify about lost packet */
@ -1962,8 +1964,10 @@ icmp6_rip6_input(mp, off)
if (opts) {
m_freem(opts);
}
SOCKBUF_UNLOCK(
&last->in6p_socket->so_rcv);
} else
sorwakeup(last->in6p_socket);
sorwakeup_locked(last->in6p_socket);
opts = NULL;
}
INP_UNLOCK(last);
@ -1995,13 +1999,15 @@ icmp6_rip6_input(mp, off)
}
}
}
if (sbappendaddr(&last->in6p_socket->so_rcv,
SOCKBUF_LOCK(&last->in6p_socket->so_rcv);
if (sbappendaddr_locked(&last->in6p_socket->so_rcv,
(struct sockaddr *)&fromsa, m, opts) == 0) {
m_freem(m);
if (opts)
m_freem(opts);
SOCKBUF_UNLOCK(&last->in6p_socket->so_rcv);
} else
sorwakeup(last->in6p_socket);
sorwakeup_locked(last->in6p_socket);
INP_UNLOCK(last);
} else {
m_freem(m);