From f2e3b9defdaa8821975ea68236687cfb6958db80 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 24 Aug 2021 18:24:11 +0200 Subject: [PATCH] tcp: Drop EPOLLET for non-spliced connections Socket-facing functions don't guarantee that all data is handled before they return: stick to level-triggered mode for TCP sockets. Signed-off-by: Stefano Brivio --- tcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tcp.c b/tcp.c index 977e745..a4c9114 100644 --- a/tcp.c +++ b/tcp.c @@ -1034,7 +1034,7 @@ static void tcp_table_tap_compact(struct ctx *c, struct tcp_tap_conn *hole) else if (to->state == TAP_SYN_SENT) ev.events = EPOLLOUT | EPOLLRDHUP; else - ev.events = EPOLLIN | EPOLLET | EPOLLRDHUP; + ev.events = EPOLLIN | EPOLLRDHUP; ref.tcp.v6 = !IN6_IS_ADDR_V4MAPPED(&to->a.a6); ref.s = from->sock; @@ -1335,7 +1335,7 @@ static void tcp_conn_from_tap(struct ctx *c, int af, void *addr, .sin6_port = th->dest, .sin6_addr = *(struct in6_addr *)addr, }; - struct epoll_event ev = { .events = EPOLLIN | EPOLLET | EPOLLRDHUP }; + struct epoll_event ev = { .events = EPOLLIN | EPOLLRDHUP }; union epoll_ref ref = { .proto = IPPROTO_TCP }; const struct sockaddr *sa; struct tcp_tap_conn *conn; @@ -2056,7 +2056,7 @@ int tcp_tap_handler(struct ctx *c, int af, void *addr, tcp_data_from_sock(c, conn, now); tcp_send_to_tap(c, conn, 0, NULL, 0); - ev.events = EPOLLIN | EPOLLET | EPOLLRDHUP; + ev.events = EPOLLIN | EPOLLRDHUP; ref.s = conn->sock; ref.tcp.index = conn - tt; ev.data.u64 = ref.u64; @@ -2123,7 +2123,7 @@ static void tcp_connect_finish(struct ctx *c, struct tcp_tap_conn *conn, return; /* Drop EPOLLOUT, only used to wait for connect() to complete */ - ev.events = EPOLLIN | EPOLLET | EPOLLRDHUP; + ev.events = EPOLLIN | EPOLLRDHUP; ev.data.u64 = ref.u64; epoll_ctl(c->epollfd, EPOLL_CTL_MOD, conn->sock, &ev);