Mercurial > dropbear
comparison process-packet.c @ 989:73ea0dce9a57 pam
Merge up to date
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 23 Jan 2015 21:38:47 +0800 |
parents | bae0b34bc059 a0819ecfee0b |
children |
comparison
equal
deleted
inserted
replaced
925:bae0b34bc059 | 989:73ea0dce9a57 |
---|---|
42 /* process a decrypted packet, call the appropriate handler */ | 42 /* process a decrypted packet, call the appropriate handler */ |
43 void process_packet() { | 43 void process_packet() { |
44 | 44 |
45 unsigned char type; | 45 unsigned char type; |
46 unsigned int i; | 46 unsigned int i; |
47 time_t now; | |
47 | 48 |
48 TRACE2(("enter process_packet")) | 49 TRACE2(("enter process_packet")) |
49 | 50 |
50 type = buf_getbyte(ses.payload); | 51 type = buf_getbyte(ses.payload); |
51 TRACE(("process_packet: packet type = %d, len %d", type, ses.payload->len)) | 52 TRACE(("process_packet: packet type = %d, len %d", type, ses.payload->len)) |
52 | 53 |
53 ses.lastpacket = type; | 54 ses.lastpacket = type; |
54 | 55 |
55 ses.last_packet_time = time(NULL); | 56 now = monotonic_now(); |
57 ses.last_packet_time_keepalive_recv = now; | |
56 | 58 |
57 /* These packets we can receive at any time */ | 59 /* These packets we can receive at any time */ |
58 switch(type) { | 60 switch(type) { |
59 | 61 |
60 case SSH_MSG_IGNORE: | 62 case SSH_MSG_IGNORE: |
63 goto out; | 65 goto out; |
64 | 66 |
65 case SSH_MSG_UNIMPLEMENTED: | 67 case SSH_MSG_UNIMPLEMENTED: |
66 /* debugging XXX */ | 68 /* debugging XXX */ |
67 TRACE(("SSH_MSG_UNIMPLEMENTED")) | 69 TRACE(("SSH_MSG_UNIMPLEMENTED")) |
68 dropbear_exit("Received SSH_MSG_UNIMPLEMENTED"); | 70 goto out; |
69 | 71 |
70 case SSH_MSG_DISCONNECT: | 72 case SSH_MSG_DISCONNECT: |
71 /* TODO cleanup? */ | 73 /* TODO cleanup? */ |
72 dropbear_close("Disconnect received"); | 74 dropbear_close("Disconnect received"); |
75 } | |
76 | |
77 /* Ignore these packet types so that keepalives don't interfere with | |
78 idle detection. This is slightly incorrect since a tcp forwarded | |
79 global request with failure won't trigger the idle timeout, | |
80 but that's probably acceptable */ | |
81 if (!(type == SSH_MSG_GLOBAL_REQUEST || type == SSH_MSG_REQUEST_FAILURE)) { | |
82 ses.last_packet_time_idle = now; | |
73 } | 83 } |
74 | 84 |
75 /* This applies for KEX, where the spec says the next packet MUST be | 85 /* This applies for KEX, where the spec says the next packet MUST be |
76 * NEWKEYS */ | 86 * NEWKEYS */ |
77 if (ses.requirenext != 0) { | 87 if (ses.requirenext != 0) { |