diff options
-rw-r--r-- | packet.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: packet.c,v 1.225 2016/01/29 03:31:03 dtucker Exp $ */ | 1 | /* $OpenBSD: packet.c,v 1.226 2016/01/29 05:46:01 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -1065,6 +1065,20 @@ ssh_packet_enable_delayed_compress(struct ssh *ssh) | |||
1065 | return 0; | 1065 | return 0; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | /* Used to mute debug logging for noisy packet types */ | ||
1069 | static int | ||
1070 | ssh_packet_log_type(u_char type) | ||
1071 | { | ||
1072 | switch (type) { | ||
1073 | case SSH2_MSG_CHANNEL_DATA: | ||
1074 | case SSH2_MSG_CHANNEL_EXTENDED_DATA: | ||
1075 | case SSH2_MSG_CHANNEL_WINDOW_ADJUST: | ||
1076 | return 0; | ||
1077 | default: | ||
1078 | return 1; | ||
1079 | } | ||
1080 | } | ||
1081 | |||
1068 | /* | 1082 | /* |
1069 | * Finalize packet in SSH2 format (compress, mac, encrypt, enqueue) | 1083 | * Finalize packet in SSH2 format (compress, mac, encrypt, enqueue) |
1070 | */ | 1084 | */ |
@@ -1093,7 +1107,8 @@ ssh_packet_send2_wrapped(struct ssh *ssh) | |||
1093 | aadlen = (mac && mac->enabled && mac->etm) || authlen ? 4 : 0; | 1107 | aadlen = (mac && mac->enabled && mac->etm) || authlen ? 4 : 0; |
1094 | 1108 | ||
1095 | type = (sshbuf_ptr(state->outgoing_packet))[5]; | 1109 | type = (sshbuf_ptr(state->outgoing_packet))[5]; |
1096 | 1110 | if (ssh_packet_log_type(type)) | |
1111 | debug3("send packet: type %u", type); | ||
1097 | #ifdef PACKET_DEBUG | 1112 | #ifdef PACKET_DEBUG |
1098 | fprintf(stderr, "plain: "); | 1113 | fprintf(stderr, "plain: "); |
1099 | sshbuf_dump(state->outgoing_packet, stderr); | 1114 | sshbuf_dump(state->outgoing_packet, stderr); |
@@ -1746,6 +1761,8 @@ ssh_packet_read_poll2(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p) | |||
1746 | */ | 1761 | */ |
1747 | if ((r = sshbuf_get_u8(state->incoming_packet, typep)) != 0) | 1762 | if ((r = sshbuf_get_u8(state->incoming_packet, typep)) != 0) |
1748 | goto out; | 1763 | goto out; |
1764 | if (ssh_packet_log_type(*typep)) | ||
1765 | debug3("receive packet: type %u", *typep); | ||
1749 | if (*typep < SSH2_MSG_MIN || *typep >= SSH2_MSG_LOCAL_MIN) { | 1766 | if (*typep < SSH2_MSG_MIN || *typep >= SSH2_MSG_LOCAL_MIN) { |
1750 | if ((r = sshpkt_disconnect(ssh, | 1767 | if ((r = sshpkt_disconnect(ssh, |
1751 | "Invalid ssh2 packet type: %d", *typep)) != 0 || | 1768 | "Invalid ssh2 packet type: %d", *typep)) != 0 || |