diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-11-08 08:31:59 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-11-10 11:17:50 +0100 |
commit | 510dace86ccf0bd63be3b1dbd35ae9c0b0538e5b (patch) | |
tree | d4f8a673d811a82cc71dc11f0c2c2521cf566065 /util.c | |
parent | e308018bbe2a42a9ad9af5302fe855eee508acc2 (diff) | |
download | passt-510dace86ccf0bd63be3b1dbd35ae9c0b0538e5b.tar passt-510dace86ccf0bd63be3b1dbd35ae9c0b0538e5b.tar.gz passt-510dace86ccf0bd63be3b1dbd35ae9c0b0538e5b.tar.bz2 passt-510dace86ccf0bd63be3b1dbd35ae9c0b0538e5b.tar.lz passt-510dace86ccf0bd63be3b1dbd35ae9c0b0538e5b.tar.xz passt-510dace86ccf0bd63be3b1dbd35ae9c0b0538e5b.tar.zst passt-510dace86ccf0bd63be3b1dbd35ae9c0b0538e5b.zip |
tap: Keep stream consistent if qemu length descriptor spans two recv() calls
I got all paranoid after triggering a divide-by-zero general
protection fault in passt with a qemu version without the virtio_net
TX hang fix, while flooding UDP. I start thinking this was actually
coming from some random changes I was playing with, but before
reaching this conclusion I reviewed once more the relatively short
path in tap_handler_passt() before we start using packet_*()
functions, and found this.
Never observed in practice, but artificially reproduced with changes
in qemu's socket interface: if we don't receive from qemu a complete
length descriptor in one recv() call, or if we receive a partial one
at the end of one call, we currently disregard the rest, which would
make the stream inconsistent.
Nothing really bad happens, except that from that point on we would
disregard all the packets we get until, if ever, we get the stream
back in sync by chance.
Force reading a complete packet length descriptor with a blocking
recv(), if needed -- not just a complete packet later.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.c')
0 files changed, 0 insertions, 0 deletions