diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-11-16 13:58:13 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-11-16 15:11:22 +0100 |
commit | 25dab96205221b595968f4b88b7a26bf69282b26 (patch) | |
tree | b1d73795d2e4b2a9152d2ad201aaa4064a726a01 | |
parent | b27d6d121c8fad94658bbcf433e99f7fff542550 (diff) | |
download | passt-25dab96205221b595968f4b88b7a26bf69282b26.tar passt-25dab96205221b595968f4b88b7a26bf69282b26.tar.gz passt-25dab96205221b595968f4b88b7a26bf69282b26.tar.bz2 passt-25dab96205221b595968f4b88b7a26bf69282b26.tar.lz passt-25dab96205221b595968f4b88b7a26bf69282b26.tar.xz passt-25dab96205221b595968f4b88b7a26bf69282b26.tar.zst passt-25dab96205221b595968f4b88b7a26bf69282b26.zip |
tap: Revert recently added checks in tap_handler_passt()
This reverts commit 198f87835dc4 ("tap: Return -EIO from
tap_handler_passt() on inconsistent packet stream") and commit
510dace86ccf ("tap: Keep stream consistent if qemu length descriptor
spans two recv() calls").
I can hit occasional failures in perf/passt_tcp tests where we seem
to be getting excess data at the end of a recv(), and for some reason
I couldn't figure out yet, if we just ignore it, subsequent recv()
calls from qemu return correct data. If we close the connection, qemu
can't talk to us anymore, of course.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | tap.c | 20 |
1 files changed, 4 insertions, 16 deletions
@@ -747,31 +747,19 @@ redo: return -ECONNRESET; } - while (n > 0) { - ssize_t len; - - /* Force receiving at least a complete length descriptor to - * avoid an inconsistent stream. - */ - if (n < (ssize_t)sizeof(uint32_t)) { - rem = recv(c->fd_tap, p + n, - (ssize_t)sizeof(uint32_t) - n, 0); - if ((n += rem) != (ssize_t)sizeof(uint32_t)) - return -EIO; - } - - len = ntohl(*(uint32_t *)p); + while (n > (ssize_t)sizeof(uint32_t)) { + ssize_t len = ntohl(*(uint32_t *)p); p += sizeof(uint32_t); n -= sizeof(uint32_t); /* At most one packet might not fit in a single read, and this - * also needs to be blocking. + * needs to be blocking. */ if (len > n) { rem = recv(c->fd_tap, p + n, len - n, 0); if ((n += rem) != len) - return -EIO; + return 0; } /* Complete the partial read above before discarding a malformed |