From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id B58AC5A062C; Fri, 31 Jan 2025 20:39:53 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH v3 01/20] tcp: Always pass NULL event with EPOLL_CTL_DEL Date: Fri, 31 Jan 2025 20:39:34 +0100 Message-ID: <20250131193953.3034031-2-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250131193953.3034031-1-sbrivio@redhat.com> References: <20250131193953.3034031-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: P5EXZM4T4JSHY7E6UL733VPHZDDPOPRG X-Message-ID-Hash: P5EXZM4T4JSHY7E6UL733VPHZDDPOPRG X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier , David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: David Gibson In tcp_epoll_ctl() we pass an event pointer with EPOLL_CTL_DEL, even though it will be ignored. It's possible this was a workaround for pre-2.6.9 kernels which required a non-NULL pointer here, but we rely on the kernel accepting NULL events for EPOLL_CTL_DEL in lots of other places. Use NULL instead for simplicity and consistency. Signed-off-by: David Gibson --- tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcp.c b/tcp.c index c89f323..4eed82b 100644 --- a/tcp.c +++ b/tcp.c @@ -468,9 +468,9 @@ static int tcp_epoll_ctl(const struct ctx *c, struct tcp_tap_conn *conn) if (conn->events == CLOSED) { if (conn->in_epoll) - epoll_ctl(c->epollfd, EPOLL_CTL_DEL, conn->sock, &ev); + epoll_ctl(c->epollfd, EPOLL_CTL_DEL, conn->sock, NULL); if (conn->timer != -1) - epoll_ctl(c->epollfd, EPOLL_CTL_DEL, conn->timer, &ev); + epoll_ctl(c->epollfd, EPOLL_CTL_DEL, conn->timer, NULL); return 0; } -- 2.43.0