At the moment, tap_handler_passt() reads a batch of packets into pkt_buf, and tries to ensure that there's one full packet at the end of it by blocking recv() calls requesting a given amount of bytes. This doesn't actually guarantee what we want, at least in theory, and also the blocking recv() calls are not really nice to have there. We could instead use pkt_buf as ringbuffer: read a given amount of data, scan for packets, and if one packet at the end isn't complete at the end, just keep a pointer to it and deal with it later. See also: https://archives.passt.top/passt-dev/20221109112929.0ee6c107@elisabeth/