Prevent listen() on a socket that is already connected - we already prevent
connect() on a listening socket.
This commit is contained in:
parent
c65c7603a1
commit
c2f3592995
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uipc_socket.c,v 1.157 2008/03/27 19:06:52 ad Exp $ */
|
||||
/* $NetBSD: uipc_socket.c,v 1.158 2008/03/28 12:12:20 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -68,7 +68,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.157 2008/03/27 19:06:52 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.158 2008/03/28 12:12:20 ad Exp $");
|
||||
|
||||
#include "opt_sock_counters.h"
|
||||
#include "opt_sosend_loan.h"
|
||||
@ -565,6 +565,9 @@ solisten(struct socket *so, int backlog, struct lwp *l)
|
||||
int s, error;
|
||||
|
||||
s = splsoftnet();
|
||||
if ((so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING |
|
||||
SS_ISDISCONNECTING)) != 0)
|
||||
return (EOPNOTSUPP);
|
||||
error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, NULL,
|
||||
NULL, NULL, l);
|
||||
if (error != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user