From owner-freebsd-net@FreeBSD.ORG Mon May 17 19:05:30 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 631921065672; Mon, 17 May 2010 19:05:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id B79F08FC0A; Mon, 17 May 2010 19:05:29 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o4HJ5djE031537 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 17 May 2010 22:05:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o4HJ5PNV094245; Mon, 17 May 2010 22:05:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o4HJ5P3s094244; Mon, 17 May 2010 22:05:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 17 May 2010 22:05:25 +0300 From: Kostik Belousov To: Yoshihiko Sarumaru Message-ID: <20100517190525.GP83316@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WU1McKeqU8MHoLZD" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_40, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-net@freebsd.org, freebsd-stable@freebsd.org Subject: Re: odd behavior on select() after shutdown() X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2010 19:05:30 -0000 --WU1McKeqU8MHoLZD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 18, 2010 at 01:08:50AM +0900, Yoshihiko Sarumaru wrote: > Hi all, >=20 > Select(2) has three arguments to get socket status for read, write and ex= cept. > After upgrading to 8.0-RELEASE, select() after shutdown(SHUT_WR) returns = with > the status exceptfds is set. It means out-of-bound data can be read > from the socket, > but recv() with OOB flag returns ECONNRESET, and no packets with urgent f= lag > was observed by tcpdump. > It seems strange for me, but is it an intentional change on 8.x ? >=20 > This behavior breaks net/stone on 8.0-RELEASE. > http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dports/141103 > The continuous recv() error on PR might lead by incorrectly setted > exceptfds on every recv() > and it should be fixed, but it doesn't matter if above behavior of > select() doesn't occur. The patch below would fix the problem at hand. I am wondering what unintended consequences it might have. diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index eaefd9c..293dbb1 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -996,7 +996,7 @@ done: static int select_flags[3] =3D { POLLRDNORM | POLLHUP | POLLERR, POLLWRNORM | POLLHUP | POLLERR, - POLLRDBAND | POLLHUP | POLLERR + POLLRDBAND | POLLERR }; =20 /* --WU1McKeqU8MHoLZD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkvxk3UACgkQC3+MBN1Mb4jAjACcC4GG1mQAc0P/VILhbTLePh8S XGUAoI7HPzC9LT1HfFRbLExOfjvWm9Rz =wZ1x -----END PGP SIGNATURE----- --WU1McKeqU8MHoLZD--