aboutgitcodebugslistschat
path: root/util.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-07-26 17:20:29 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-07-26 14:07:20 +0200
commit4684f603446b1f5da20f242006eedb4fb9eced95 (patch)
tree89208f725b9e36cf5c23702a0cb5bbd2f2f05b32 /util.h
parent9e3f2355c452a841f98a9a9e32b71f6af157db6b (diff)
downloadpasst-4684f603446b1f5da20f242006eedb4fb9eced95.tar
passt-4684f603446b1f5da20f242006eedb4fb9eced95.tar.gz
passt-4684f603446b1f5da20f242006eedb4fb9eced95.tar.bz2
passt-4684f603446b1f5da20f242006eedb4fb9eced95.tar.lz
passt-4684f603446b1f5da20f242006eedb4fb9eced95.tar.xz
passt-4684f603446b1f5da20f242006eedb4fb9eced95.tar.zst
passt-4684f603446b1f5da20f242006eedb4fb9eced95.zip
tap: Don't use EPOLLET on Qemu sockets
Currently we set EPOLLET (edge trigger) on the epoll flags for the connected Qemu Unix socket. It's not clear that there's a reason for doing this: for TCP sockets we need to use EPOLLET, because we leave data in the socket buffers for our flow control handling. That consideration doesn't apply to the way we handle the qemu socket however. Furthermore, using EPOLLET causes additional complications: 1) We don't set EPOLLET when opening /dev/net/tun for pasta mode, however we *do* set it when using pasta mode with --fd. This inconsistency doesn't seem to have broken anything, but it's odd. 2) EPOLLET requires that tap_handler_passt() loop until all data available is read (otherwise we may have data in the buffer but never get an event causing us to read it). We do that with a rather ugly goto. Worse, our condition for that goto appears to be incorrect. We'll only loop if rem is non-zero, which will only happen if we perform a blocking recv() for a partially received frame. We'll only perform that second recv() if the original recv() resulted in a partially read frame. As far as I can tell the original recv() could end on a frame boundary (never triggering the second recv()) even if there is additional data in the socket buffer. In that circumstance we wouldn't goto redo and could leave unprocessed frames in the qemu socket buffer indefinitely. This doesn't seem to have caused any problems in practice, but since there's no obvious reason to use EPOLLET here anyway, we might as well get rid of it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.h')
0 files changed, 0 insertions, 0 deletions