Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2016 11:19:43 -0700 (PDT)
From:      Don Lewis <truckman@FreeBSD.org>
To:        freebsd-net@FreeBSD.org
Subject:   Re: IPv6 -> IPv4 fallback broken in serf, kernel bug?
Message-ID:  <201607261819.u6QIJhtU081768@gw.catspoiler.org>
In-Reply-To: <201607261559.u6QFxF8a081339@gw.catspoiler.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607261819.u6QIJhtU081768>