This is the mail archive of the
mailing list for the Cygwin project.
Re: connect() hangs on a listen()ing AF_UNIX socket
- From: Christian Franke <Christian dot Franke at t-online dot de>
- To: cygwin at cygwin dot com
- Date: Thu, 21 Aug 2014 21:14:20 +0200
- Subject: Re: connect() hangs on a listen()ing AF_UNIX socket
- Authentication-results: sourceware.org; auth=none
- References: <53F61B70 dot 2020600 at t-online dot de> <20140821164402 dot GB21065 at calimero dot vinschen dot de>
Corinna Vinschen wrote:
On Aug 21 18:16, Christian Franke wrote:
Corinna Vinschen wrote (in thread "[ITP] libsuexec 1.0"):
Postfix for Cygwin would be *so* nice. Sigh. ...
Due to the following problem, Postfix hangs during startup (and blocks any
possible "[ITP] postfix ..."):
If a AF_UNIX socket is in listen()ing state, a client connect() should
succeed immediately. On Cygwin, connect() waits until the server site
accept()s the connection.
This is likely because fhandler_socket::af_local_connect() waits for some
secret. Sending it in af_local_accept() is too late in this case.
Unfortunately the event handling of postfix relies on the correct behavior
and there is possibly no easy workaround.
Off the top of my head I don't see one inside the Cygwin DLL :(
Complex but may work: A fhandler_socket::listen() on a
AF_UNIX/SOCK_STREAM socket starts a thread which accept()s connections,
performs the handshake and puts the new socket descs in a queue.
fhandler_socket::accept4() then no longer calls accept() but waits for
the next entry in the queue.
The problem is that the package exchange at the start of an
accept/connect is required to be able to exchange credentials. This in
turn is required for getpeereid and the SO_PEERCRED socket option which
is utilized at least by sshd.
Easier and may work for Postfix: Add a Cygwin specific socket option
like SO_DONT_NEED_PEERCRED which is set immediately after Postfix calls
socket(AF_UNIX, SOCK_STREAM). If set, no handshake occurs on
connect()/accept(). getpeerid()/SO_PEERCRED should fail then.
Would it help to patch postfix for Cygwin to use a local-only AF_INET
socket at this point instead?
Postfix heavily relies on unix domain sockets (see master.cf) so this
would possibly be complex. Such a patch would likely not be accepted
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple