From 9b6769d53b20933d593a12c4a267b10c48b214d6 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 16 Sep 2021 08:42:45 +0200 Subject: tcp: Don't reset connection from ESTABLISHED state on EPOLLHUP That might just mean we shut down the socket -- but we still have to go through the other states to ensure a orderly shutdown guest-side. While at it, drop the EPOLLHUP check for unhandled states: we should never hit that, but if we do, resetting the connection at that point is probably the wrong thing to do. Signed-off-by: Stefano Brivio --- tcp.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'tcp.c') diff --git a/tcp.c b/tcp.c index 526032e..a40b03b 100644 --- a/tcp.c +++ b/tcp.c @@ -2825,9 +2825,7 @@ void tcp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events, case ESTABLISHED_SOCK_FIN_SENT: case ESTABLISHED: tcp_data_from_sock(c, conn, now); - if (events & EPOLLHUP) { - tcp_rst(c, conn); - } else if (events & EPOLLRDHUP) { + if (events & EPOLLRDHUP) { if (conn->state == ESTABLISHED) tcp_tap_state(conn, ESTABLISHED_SOCK_FIN); tcp_data_from_sock(c, conn, now); @@ -2870,9 +2868,6 @@ void tcp_sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events, case CLOSED: break; } - - if (events & EPOLLHUP) - tcp_rst(c, conn); } /** -- cgit v1.2.3