I came across Inappropriate sequence of syslog messages saying server is listening on desired port when the listen call fails. Feb 24 12:41:38 ssh-165 sshd[2616]: Server listening on 0.0.0.0 port 1111. Feb 24 12:41:38 ssh-165 sshd[2616]: fatal: listen: Socket operation on non-socket
Created attachment 1080 [details] Patch to fix the Inappropriate sequence of log messages This behaviour also happens with bind() call and the attached patch fixes the problem.
Comment on attachment 1080 [details] Patch to fix the Inappropriate sequence of log messages >- debug("Bind to port %s on %s.", strport, ntop); These things are only debugs and are intended to describe what it's about to try (and thus the source of any immediately subsequent errors). >- logit("Server listening on %s port %s.", ntop, strport); > if (listen(listen_sock, SSH_LISTEN_BACKLOG) < 0) > fatal("listen: %.100s", strerror(errno)); >+ else >+ logit("Server listening on %s port %s.", ntop, strport); The problem with doing that is that if it fails you now don't know which of the ports that the listen failed on (remember, there can be more than one).
Created attachment 1096 [details] Reorder log statement This is probably better, and simpler
Comment on attachment 1096 [details] Reorder log statement ok by me
patch applied, will be in 4.4
With the release of 4.4, we believe that this bug is now closed. For information about the release please see http://www.openssh.com/txt/release-4.4 .