mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-14 01:27:35 -05:00
In SSH packet logging mode, log SSH-2 packet sequence numbers, in
both directions. We had a bug report yesterday about a Cisco router sending SSH2_MSG_UNIMPLEMENTED and it wasn't clear for which packet; logging the sequence numbers should make such problems much easier to diagnose. (In fact this logging fix wouldn't have helped in yesterday's case, because the router also didn't bother to fill in the sequence number field in the SSH2_MSG_UNIMPLEMENTED packet! This is a precautionary measure against the next one of these problems.) [originally from svn r8295]
This commit is contained in:
22
logging.c
22
logging.c
@ -220,8 +220,9 @@ void log_eventlog(void *handle, const char *event)
|
||||
* Set of blanking areas must be in increasing order.
|
||||
*/
|
||||
void log_packet(void *handle, int direction, int type,
|
||||
char *texttype, void *data, int len,
|
||||
int n_blanks, const struct logblank_t *blanks)
|
||||
char *texttype, const void *data, int len,
|
||||
int n_blanks, const struct logblank_t *blanks,
|
||||
const unsigned long *seq)
|
||||
{
|
||||
struct LogContext *ctx = (struct LogContext *)handle;
|
||||
char dumpdata[80], smalldata[5];
|
||||
@ -233,13 +234,20 @@ void log_packet(void *handle, int direction, int type,
|
||||
return;
|
||||
|
||||
/* Packet header. */
|
||||
if (texttype)
|
||||
logprintf(ctx, "%s packet type %d / 0x%02x (%s)\r\n",
|
||||
direction == PKT_INCOMING ? "Incoming" : "Outgoing",
|
||||
type, type, texttype);
|
||||
else
|
||||
if (texttype) {
|
||||
if (seq) {
|
||||
logprintf(ctx, "%s packet #0x%lx, type %d / 0x%02x (%s)\r\n",
|
||||
direction == PKT_INCOMING ? "Incoming" : "Outgoing",
|
||||
*seq, type, type, texttype);
|
||||
} else {
|
||||
logprintf(ctx, "%s packet type %d / 0x%02x (%s)\r\n",
|
||||
direction == PKT_INCOMING ? "Incoming" : "Outgoing",
|
||||
type, type, texttype);
|
||||
}
|
||||
} else {
|
||||
logprintf(ctx, "%s raw data\r\n",
|
||||
direction == PKT_INCOMING ? "Incoming" : "Outgoing");
|
||||
}
|
||||
|
||||
/*
|
||||
* Output a hex/ASCII dump of the packet body, blanking/omitting
|
||||
|
Reference in New Issue
Block a user