From owner-freebsd-net@freebsd.org Tue Jul 26 18:19:50 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 64DC7BA5663 for ; Tue, 26 Jul 2016 18:19:50 +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 460761C9D for ; Tue, 26 Jul 2016 18:19:50 +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 u6QIJhtU081768 for ; Tue, 26 Jul 2016 11:19:47 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201607261819.u6QIJhtU081768@gw.catspoiler.org> Date: Tue, 26 Jul 2016 11:19:43 -0700 (PDT) From: Don Lewis Subject: Re: IPv6 -> IPv4 fallback broken in serf, kernel bug? To: freebsd-net@FreeBSD.org In-Reply-To: <201607261559.u6QFxF8a081339@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: Tue, 26 Jul 2016 18:19:50 -0000 On 26 Jul, Don Lewis wrote: > It looks like it should be possible to patch serf to handle this, but: > * Should POLLIN be set for this event? I don't think it should, but the standard doesn't cover this case. On a successful non-blocking connect(), our man page says that select(2) will indicate that the fd is writeable. The Open Group Base Specifications Issue 7 says that pselect(), select(), and poll() shall indicate that the socket is ready for writing. I haven't seen anything that says what should be done if the connect fails. > * What errno value should read() return in this case, if it is > ECONNREFUSED, then that should be documented. Our read(2) man page does not document that ENOTCONN can be returned, though we explicitly return it and it is listed as valid by The Open Group Base Specifications. It does not list the connect failure errno values other than ETIMEDOUT as valid for read(). Though read() should not be called before the connection is up, if it is I *think* these errors should be mapped to ENOTCONN, but handling ETIMEDOUT is trickier. If that error came from the connection attempt, then we would want to return ENOTCONN, but if the connection came up and was later dropped due to a timeout, then ETIMEDOUT should be returned.