From owner-freebsd-current Tue Jan 14 7:19:46 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7CB4137B401; Tue, 14 Jan 2003 07:19:44 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id CDFEF43F3F; Tue, 14 Jan 2003 07:19:42 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id CAA24071; Wed, 15 Jan 2003 02:19:29 +1100 Date: Wed, 15 Jan 2003 02:20:12 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Martin Blapp Cc: Thomas Moestl , , Subject: Re: PANIC in tcp_syncache.c sonewconn() line 562 In-Reply-To: <20030114100620.W76016@levais.imp.ch> Message-ID: <20030115020320.L17332-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 14 Jan 2003, Martin Blapp wrote: > > Hi Thomas, > > > 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); > > > > Can you commit this ? The fix looks appropriate, but the manpage should > also be changed to reflect the change. > > ERRORS > Listen() will fail if: > > [EBADF] The argument s is not a valid descriptor. > [ENOTSOCK] The argument s is not a socket. > [EOPNOTSUPP] The socket is not of a type that > supports the operation listen(). > [EINVAL] Listen() has been already called on the socket. > > Any objections from others ? EINVAL is a bogus errno for this, but is standard. POSIX has better wording: "The socket is already connected". The patch also returns EINVAL if the socket is being connected. Is this right? (Maybe we should wait until we can tell if it is connected.) POSIX also specifies the errors EDESTADDRREQ, EACCES, another EINVAL for shut down sockets, and ENOBUFS. The last 3 "may" cause listen() to fail and the others (including the first EINVAL) "shall" cause it to fail. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message