From owner-freebsd-net@freebsd.org Wed Jul 27 01:24:46 2016 Return-Path: Delivered-To: freebsd-net@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 E0882BA60DE for ; Wed, 27 Jul 2016 01:24:46 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (unknown [IPv6:2602:304:b010:ef20::f2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gw.catspoiler.org", Issuer "gw.catspoiler.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C27E61329 for ; Wed, 27 Jul 2016 01:24:46 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.15.2/8.15.2) with ESMTP id u6R1OcTi082647; Tue, 26 Jul 2016 18:24:42 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201607270124.u6R1OcTi082647@gw.catspoiler.org> Date: Tue, 26 Jul 2016 18:24:38 -0700 (PDT) From: Don Lewis Subject: Re: IPv6 -> IPv4 fallback broken in serf, kernel bug? To: brde@optusnet.com.au cc: freebsd-net@freebsd.org In-Reply-To: <201607262340.u6QNes2t082436@gw.catspoiler.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 01:24:47 -0000 After giving this some more thought, I believe that the read and write wakeups are correct when the connection attempt fails. I also think that read() should return ENOTCONN if the socket never got to the connected state. I'm not sure how write() should behave. The Open Group Base Specifications Issue 7 says: [ECONNRESET] A write was attempted on a socket that is not connected. [EPIPE] A write was attempted on a socket that is shut down for writing, or is no longer connected. In the latter case, if the socket is of type SOCK_STREAM, a SIGPIPE signal shall also be sent to the thread. whereas our man page only mentions EPIPE. I think poll() should set POLLERR and not POLLIN or POLLOUT if the connection attempt fails. I think kqueue is fine, but the poll() emulation in apr should map the connection failure into POLLERR.