1
0
Fork 0
mirror of https://passt.top/passt synced 2025-07-04 03:05:33 +02:00

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>
This commit is contained in:
Stefano Brivio 2021-05-21 11:14:48 +02:00
parent 59182924f0
commit 17337a736f
5 changed files with 120 additions and 2 deletions

View file

@ -53,6 +53,7 @@
#include "icmp.h"
#include "tcp.h"
#include "udp.h"
#include "pcap.h"
#define EPOLL_EVENTS 10
@ -601,6 +602,8 @@ static int tap_handler(struct ctx *c, struct timespec *now)
return 0;
}
pcap(p, len);
msg[msg_count].start = p;
msg[msg_count++].len = len;
@ -792,6 +795,8 @@ int main(int argc, char **argv)
memset(&c.mac_guest, 0xff, sizeof(c.mac_guest));
pcap_init();
if (c.v4) {
info("ARP:");
info(" address: %02x:%02x:%02x:%02x:%02x:%02x from %s",