diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-08-30 14:14:19 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-09-04 18:36:54 +0200 |
commit | 026fb71d1dde60135d95741552906fd5320384bc (patch) | |
tree | 3c4c319a00abaffd5e231e4508e9b1eb2f0629f4 /tcp.c | |
parent | 232e12529efe125a068fa5d17e70be71aab92525 (diff) | |
download | passt-026fb71d1dde60135d95741552906fd5320384bc.tar passt-026fb71d1dde60135d95741552906fd5320384bc.tar.gz passt-026fb71d1dde60135d95741552906fd5320384bc.tar.bz2 passt-026fb71d1dde60135d95741552906fd5320384bc.tar.lz passt-026fb71d1dde60135d95741552906fd5320384bc.tar.xz passt-026fb71d1dde60135d95741552906fd5320384bc.tar.zst passt-026fb71d1dde60135d95741552906fd5320384bc.zip |
tcp: Attempt to mitigate EPOLLRDHUP storms with half-closed connections
Link: https://github.com/containers/podman/issues/23686
Diffstat (limited to 'tcp.c')
-rw-r--r-- | tcp.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -424,23 +424,27 @@ int tcp_set_peek_offset(int s, int offset) */ static uint32_t tcp_conn_epoll_events(uint8_t events, uint8_t conn_flags) { + uint32_t rdhup; + if (!events) return 0; + rdhup = (events & SOCK_FIN_RCVD) ? 0 : EPOLLRDHUP; + if (events & ESTABLISHED) { if (events & TAP_FIN_SENT) return EPOLLET; if (conn_flags & STALLED) - return EPOLLIN | EPOLLOUT | EPOLLRDHUP | EPOLLET; + return EPOLLIN | EPOLLOUT | rdhup | EPOLLET; - return EPOLLIN | EPOLLRDHUP; + return EPOLLIN | rdhup; } if (events == TAP_SYN_RCVD) - return EPOLLOUT | EPOLLET | EPOLLRDHUP; + return EPOLLOUT | EPOLLET | rdhup; - return EPOLLRDHUP; + return rdhup; } /** |