I am trying to record network packets coming through the "virtio" virtual ethernet device. I am tapping in network packets arriving at the QEMU userspace process in the below function -
ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t size)
I start QEMU using the below command line -
sudo ./qemu-system-x86_64 -m 1024 -machine pc-i440fx-2.5 -netdev tap,id=tap1,ifname=tap0,script=no,downscript=no -device virtio-net-pci,netdev=tap1,mac=00:00:00:00:00:00 -drive file=~/os_images_for_qemu/ubuntu-16.04.server.qcow2,format=qcow2,if=none,id=img-direct -device virtio-blk-pci,drive=img-direct
Is "virtio_net_receive" the correct method to record in network packets received by the QEMU process?
I am hoping that in spite of packets being flushed out of the queue, the 'virtio_net_receive' is the right method to record all network packets without fail.