From owner-svn-src-head@freebsd.org Thu Jun 15 20:11:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02671B95928; Thu, 15 Jun 2017 20:11:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6E47825F1; Thu, 15 Jun 2017 20:11:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FKBUS6045835; Thu, 15 Jun 2017 20:11:30 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FKBUUL045834; Thu, 15 Jun 2017 20:11:30 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201706152011.v5FKBUUL045834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 15 Jun 2017 20:11:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319988 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jun 2017 20:11:31 -0000 Author: glebius Date: Thu Jun 15 20:11:29 2017 New Revision: 319988 URL: https://svnweb.freebsd.org/changeset/base/319988 Log: Plug read(2) and write(2) on listening sockets. Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Thu Jun 15 20:06:41 2017 (r319987) +++ head/sys/kern/uipc_socket.c Thu Jun 15 20:11:29 2017 (r319988) @@ -1613,8 +1613,14 @@ sosend(struct socket *so, struct sockaddr *addr, struc 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, st 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); }