Don't erroneously log SSH_MSG_REQUEST_FAILURE packets from keepalive
Notes:
When setting a ServerAliveInterval using libssh2_keepalive_config() with want_reply set to true, some servers will reply to the keep-alive requests with a single SSH_MSG_REQUEST_FAILURE packet. This is an allowed behavior in RFC 4254, section 4.
Credit:
Michael Buckley
@@ -2045,8 +2045,13 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id,
if(readpkt->data_len < 5) {
read_packet = read_next;
+
+ if(readpkt->data_len != 1 ||
+ readpkt->data[0] != SSH_MSG_REQUEST_FAILURE) {
_libssh2_debug(channel->session, LIBSSH2_TRACE_ERROR,
"Unexpected packet length");
+ }
+
continue;
}
