aboutsummaryrefslogtreecommitdiff
path: root/src/packet.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2018-11-27 13:17:28 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-01-09 10:14:56 +0100
commit81fdb574e7e85e2b2b449dd6da99220c447229ba (patch)
tree5bf1cf4101dd36940b0e2cfe209f4f09317494c9 /src/packet.c
parentfff2e85ab293249636117c950a35c9ce199c6c0d (diff)
downloadlibssh-81fdb574e7e85e2b2b449dd6da99220c447229ba.tar.gz
libssh-81fdb574e7e85e2b2b449dd6da99220c447229ba.tar.xz
libssh-81fdb574e7e85e2b2b449dd6da99220c447229ba.zip
packet: Write also incoming packets to .pcap files
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Daiki Ueno <dueno@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/packet.c')
-rw-r--r--src/packet.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/packet.c b/src/packet.c
index 8fc589bb..847a363d 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -1107,6 +1107,16 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
}
}
+#ifdef WITH_PCAP
+ if (session->pcap_ctx != NULL) {
+ ssh_pcap_context_write(session->pcap_ctx,
+ SSH_PCAP_DIR_IN,
+ ssh_buffer_get(session->in_buffer),
+ ssh_buffer_get_len(session->in_buffer),
+ ssh_buffer_get_len(session->in_buffer));
+ }
+#endif
+
/* skip the size field which has been processed before */
ssh_buffer_pass_bytes(session->in_buffer, sizeof(uint32_t));