--- /dev/null
+
+# HG changeset patch
+# User Matt Johnston <matt@ucc.asn.au>
+# Date 1407937727 -28800
+# Node ID f7f6c15b0ec30b0def69c9ccbb3dc4eb97374abc
+# Parent 02821319ab1f1208b7ab5de4af82a562c386d40d
+Don't send SSH_MSG_UNIMPLEMENTED for keepalive responses
+
+diff -r 02821319ab1f -r f7f6c15b0ec3 cli-session.c
+--- a/cli-session.c Fri Aug 08 21:53:47 2014 +0800
++++ b/cli-session.c Wed Aug 13 21:48:47 2014 +0800
+@@ -73,6 +73,8 @@
+ #ifdef ENABLE_CLI_REMOTETCPFWD
+ {SSH_MSG_REQUEST_SUCCESS, cli_recv_msg_request_success}, /* client */
+ {SSH_MSG_REQUEST_FAILURE, cli_recv_msg_request_failure}, /* client */
++#else
++ {SSH_MSG_REQUEST_FAILURE, ignore_recv_msg_request_failure}, /* for keepalive */
+ #endif
+ {0, 0} /* End */
+ };
+diff -r 02821319ab1f -r f7f6c15b0ec3 common-session.c
+--- a/common-session.c Fri Aug 08 21:53:47 2014 +0800
++++ b/common-session.c Wed Aug 13 21:48:47 2014 +0800
+@@ -394,6 +394,11 @@
+ return pos+1;
+ }
+
++void ignore_recv_msg_request_failure() {
++ // Do nothing
++ TRACE(("Ignored msg_request_failure"))
++}
++
+ static void send_msg_keepalive() {
+ CHECKCLEARTOWRITE();
+ time_t old_time_idle = ses.last_packet_time_idle;
+diff -r 02821319ab1f -r f7f6c15b0ec3 session.h
+--- a/session.h Fri Aug 08 21:53:47 2014 +0800
++++ b/session.h Wed Aug 13 21:48:47 2014 +0800
+@@ -47,6 +47,7 @@
+ void session_cleanup();
+ void send_session_identification();
+ void send_msg_ignore();
++void ignore_recv_msg_request_failure();
+
+ void update_channel_prio();
+
+diff -r 02821319ab1f -r f7f6c15b0ec3 svr-session.c
+--- a/svr-session.c Fri Aug 08 21:53:47 2014 +0800
++++ b/svr-session.c Wed Aug 13 21:48:47 2014 +0800
+@@ -58,6 +58,7 @@
+ {SSH_MSG_CHANNEL_OPEN, recv_msg_channel_open},
+ {SSH_MSG_CHANNEL_EOF, recv_msg_channel_eof},
+ {SSH_MSG_CHANNEL_CLOSE, recv_msg_channel_close},
++ {SSH_MSG_REQUEST_FAILURE, ignore_recv_msg_request_failure}, /* for keepalive */
+ #ifdef USING_LISTENERS
+ {SSH_MSG_CHANNEL_OPEN_CONFIRMATION, recv_msg_channel_open_confirmation},
+ {SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure},
+