Mercurial > dropbear
diff process-packet.c @ 943:185b241a0b4a coverity
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 25 Jul 2014 22:23:50 +0800 |
parents | a0819ecfee0b |
children | 73ea0dce9a57 9169e4e7cbee |
line wrap: on
line diff
--- a/process-packet.c Sat Mar 08 21:02:02 2014 +0800 +++ b/process-packet.c Fri Jul 25 22:23:50 2014 +0800 @@ -44,6 +44,7 @@ unsigned char type; unsigned int i; + time_t now; TRACE2(("enter process_packet")) @@ -52,7 +53,8 @@ ses.lastpacket = type; - ses.last_packet_time = time(NULL); + now = monotonic_now(); + ses.last_packet_time_keepalive_recv = now; /* These packets we can receive at any time */ switch(type) { @@ -65,13 +67,21 @@ case SSH_MSG_UNIMPLEMENTED: /* debugging XXX */ TRACE(("SSH_MSG_UNIMPLEMENTED")) - dropbear_exit("Received SSH_MSG_UNIMPLEMENTED"); + goto out; case SSH_MSG_DISCONNECT: /* TODO cleanup? */ dropbear_close("Disconnect received"); } + /* Ignore these packet types so that keepalives don't interfere with + idle detection. This is slightly incorrect since a tcp forwarded + global request with failure won't trigger the idle timeout, + but that's probably acceptable */ + if (!(type == SSH_MSG_GLOBAL_REQUEST || type == SSH_MSG_REQUEST_FAILURE)) { + ses.last_packet_time_idle = now; + } + /* This applies for KEX, where the spec says the next packet MUST be * NEWKEYS */ if (ses.requirenext != 0) {