Disallow listen() on sockets which are in the SS_ISCONNECTED or

SS_ISCONNECTING state, returning EINVAL (which is what POSIX mandates
in this case).
listen() on connected or connecting sockets would cause them to enter
a bad state; in the TCP case, this could cause sockets to go
catatonic or panics, depending on how the socket was connected.

Reviewed by:	-net
MFC after:	2 weeks
This commit is contained in:
tmm 2003-01-17 19:20:00 +00:00
parent 48bc1b69c8
commit 44a87ce9b9

View File

@ -266,6 +266,10 @@ solisten(so, backlog, td)
int s, error;
s = splnet();
if (so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING)) {
splx(s);
return (EINVAL);
}
error = (*so->so_proto->pr_usrreqs->pru_listen)(so, td);
if (error) {
splx(s);