summaryrefslogtreecommitdiff
path: root/process-packet.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2014-07-09 00:15:20 +0800
committerMatt Johnston <matt@ucc.asn.au>2014-07-09 00:15:20 +0800
commitd671d6d3c4d58cf2e0d3d13208430ef70354e097 (patch)
tree2de383596fda3b35e2f65fd628fa697219f5c0c8 /process-packet.c
parentf678a6442a9fed445bc76577ec66fc45536a2d34 (diff)
downloaddropbear-d671d6d3c4d58cf2e0d3d13208430ef70354e097.tar.gz
Make -K keepalive behave like OpenSSH's ServerAliveInterval
Diffstat (limited to 'process-packet.c')
-rw-r--r--process-packet.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/process-packet.c b/process-packet.c
index 6cbcfc7..ddeb9ce 100644
--- a/process-packet.c
+++ b/process-packet.c
@@ -44,6 +44,7 @@ void process_packet() {
unsigned char type;
unsigned int i;
+ time_t now;
TRACE2(("enter process_packet"))
@@ -52,7 +53,8 @@ void process_packet() {
ses.lastpacket = type;
- ses.last_packet_time = monotonic_now();
+ now = monotonic_now();
+ ses.last_packet_time_keepalive_recv = now;
/* These packets we can receive at any time */
switch(type) {
@@ -65,13 +67,21 @@ void process_packet() {
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) {