aboutgitcodebugslistschat
path: root/tap.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-05-21 11:14:48 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-05-21 11:14:48 +0200
commit17337a736ff0e7ebd7d5272eba7466a627795215 (patch)
treec1ebb233dbec7a926315f354eb9f9feb709da07b /tap.c
parent59182924f01e4d2e8f6d8af27c355c191f332eba (diff)
downloadpasst-17337a736ff0e7ebd7d5272eba7466a627795215.tar
passt-17337a736ff0e7ebd7d5272eba7466a627795215.tar.gz
passt-17337a736ff0e7ebd7d5272eba7466a627795215.tar.bz2
passt-17337a736ff0e7ebd7d5272eba7466a627795215.tar.lz
passt-17337a736ff0e7ebd7d5272eba7466a627795215.tar.xz
passt-17337a736ff0e7ebd7d5272eba7466a627795215.tar.zst
passt-17337a736ff0e7ebd7d5272eba7466a627795215.zip
passt: Introduce packet capture implementation
With -DDEBUG, passt now saves guest-side traffic captures in pcap format at /tmp/passt_<ISO8601 timestamp>.pcap. The timestamp refers to time and date of start-up. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tap.c')
-rw-r--r--tap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tap.c b/tap.c
index 5d2201a..70e4774 100644
--- a/tap.c
+++ b/tap.c
@@ -25,6 +25,7 @@
#include "passt.h"
#include "util.h"
+#include "pcap.h"
/**
* tap_send() - Send frame and qemu socket header with indication of length
@@ -39,6 +40,8 @@ int tap_send(int fd, void *data, size_t len, int flags)
uint32_t vnet_len = htonl(len);
send(fd, &vnet_len, 4, MSG_DONTWAIT | MSG_NOSIGNAL);
+ pcap(data, len);
+
return send(fd, data, len, flags | MSG_DONTWAIT | MSG_NOSIGNAL);
}