Steven Chamberlain <ste...@pyro.eu.org> writes:

> lsh-utils sometimes fails to run the testsuite on the kfreebsd buildds:
>
> * 2.1-4 on kfreebsd-i386
> https://buildd.debian.org/status/fetch.php?pkg=lsh-utils&arch=kfreebsd-i386&ver=2.1-4&stamp=1412538954
> | Testing /«PKGBUILDDIR»/src/testsuite/rapid7-ssh-pdu/0000431.pdu
> | tcpconnect: shutdown failed: Connection reset by peer
> | Connect failed
> | FAIL: rapid7-lshd

What this test does, it starts lshd, then uses tcpconnect to connecct
and send some 666 ssh messages broken in different ways, and then the
expected behaviour is that lshd should disconnect each attempt in a
controlled way, and not crash.

Now, my guesss is that there's a race condition, the client (tcpconnect)
calls shutdown on the socket after it has sent its data. If I understand
this correctly, the server responds with a TCP reset in case that socket
has been closed before the client's TCP fin arrives. Does that make
sense?

The linux man page for shutdown(2) doesn't list ECONNRESET as a possible
error, only ENOTCONN. So it seems bsd and linux uses different errno
values for this TCP error case?

Can you try the below patch for tcpconnect (located in
lsh/src/testsuite)?

Regards,
/Niels

diff --git a/src/testsuite/tcpconnect.c b/src/testsuite/tcpconnect.c
index 73398ae..c7dfa02 100644
--- a/src/testsuite/tcpconnect.c
+++ b/src/testsuite/tcpconnect.c
@@ -307,7 +307,8 @@ main (int argc, char **argv)
              wait_stdin_eof = 0;
              if (!wait_remote_eof)
                break;
-             if (shutdown (fd, SHUT_WR) < 0 && errno != ENOTCONN)
+             if (shutdown (fd, SHUT_WR) < 0
+                 && errno != ENOTCONN && errno != ECONNRESET)
                die("shutdown failed: %s\n", strerror(errno));
            }
          else

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to