Plug read(2) and write(2) on listening sockets.

This commit is contained in:
Gleb Smirnoff 2017-06-15 20:11:29 +00:00
parent dd8a25a799
commit 2b8e036bfc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319988

View File

@ -1613,8 +1613,14 @@ sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
int error;
CURVNET_SET(so->so_vnet);
error = so->so_proto->pr_usrreqs->pru_sosend(so, addr, uio, top,
control, flags, td);
if (!SOLISTENING(so))
error = so->so_proto->pr_usrreqs->pru_sosend(so, addr, uio,
top, control, flags, td);
else {
m_freem(top);
m_freem(control);
error = ENOTCONN;
}
CURVNET_RESTORE();
return (error);
}
@ -2544,8 +2550,11 @@ soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio,
int error;
CURVNET_SET(so->so_vnet);
error = (so->so_proto->pr_usrreqs->pru_soreceive(so, psa, uio, mp0,
controlp, flagsp));
if (!SOLISTENING(so))
error = (so->so_proto->pr_usrreqs->pru_soreceive(so, psa, uio,
mp0, controlp, flagsp));
else
error = ENOTCONN;
CURVNET_RESTORE();
return (error);
}