aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-09-06 10:33:55 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-09-06 12:54:16 +0200
commitafedc2412e8576d95ef49e684601bde2f12d7974 (patch)
tree915adaca987a4574a6219d94d5f4c314ddfaa172 /tcp.c
parentaff5a49b0e75dd08428a88c05d98f39885556c8b (diff)
downloadpasst-afedc2412e8576d95ef49e684601bde2f12d7974.tar
passt-afedc2412e8576d95ef49e684601bde2f12d7974.tar.gz
passt-afedc2412e8576d95ef49e684601bde2f12d7974.tar.bz2
passt-afedc2412e8576d95ef49e684601bde2f12d7974.tar.lz
passt-afedc2412e8576d95ef49e684601bde2f12d7974.tar.xz
passt-afedc2412e8576d95ef49e684601bde2f12d7974.tar.zst
passt-afedc2412e8576d95ef49e684601bde2f12d7974.zip
tcp: Use EPOLLET for any state of not established connections
Currently, for not established connections, we monitor sockets with edge-triggered events (EPOLLET) if we are in the TAP_SYN_RCVD state (outbound connection being established) but not in the TAP_SYN_ACK_SENT case of it (socket is connected, and we sent SYN,ACK to the container/guest). While debugging https://bugs.passt.top/show_bug.cgi?id=94, I spotted another possibility for a short EPOLLRDHUP storm (10 seconds), which doesn't seem to happen in actual use cases, but I could reproduce it: start a connection from a container, while dropping (using netfilter) ACK segments coming out of the container itself. On the server side, outside the container, accept the connection and shutdown the writing side of it immediately. At this point, we're in the TAP_SYN_ACK_SENT case (not just a mere TAP_SYN_RCVD state), we get EPOLLRDHUP from the socket, but we don't have any reasonable way to handle it other than waiting for the tap side to complete the three-way handshake. So we'll just keep getting this EPOLLRDHUP until the SYN_TIMEOUT kicks in. Always enable EPOLLET when EPOLLRDHUP is the only epoll event we subscribe to: in this case, getting multiple EPOLLRDHUP reports is totally useless. In the only remaining non-established state, SOCK_ACCEPTED, for inbound connections, we're anyway discarding EPOLLRDHUP events until we established the conection, because we don't know what to do with them until we get an answer from the tap side, so it's safe to enable EPOLLET also in that case. Link: https://bugs.passt.top/show_bug.cgi?id=94 Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tcp.c b/tcp.c
index 77c62f0..f9fe1b9 100644
--- a/tcp.c
+++ b/tcp.c
@@ -440,7 +440,7 @@ static uint32_t tcp_conn_epoll_events(uint8_t events, uint8_t conn_flags)
if (events == TAP_SYN_RCVD)
return EPOLLOUT | EPOLLET | EPOLLRDHUP;
- return EPOLLRDHUP;
+ return EPOLLET | EPOLLRDHUP;
}
/**