From ca931248dc32bf284a2dee095d983621ab4bec7f Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Tue, 21 Oct 2025 23:01:14 +0200 Subject: icmp: Use epoll instance management for ICMP flows Store the epoll id in the flow_common structure for ICMP ping flows using flow_epollid_set() and retrieve the corresponding epoll file descriptor with flow_epollfd() instead of passing c->epollfd directly. This makes ICMP consistent with the recent TCP changes and follows the pattern established in previous commit. Signed-off-by: Laurent Vivier Reviewed-by: David Gibson Signed-off-by: Stefano Brivio --- icmp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/icmp.c b/icmp.c index cd59883..35faefb 100644 --- a/icmp.c +++ b/icmp.c @@ -153,7 +153,7 @@ unexpected: static void icmp_ping_close(const struct ctx *c, const struct icmp_ping_flow *pingf) { - epoll_del(c->epollfd, pingf->sock); + epoll_del(flow_epollfd(&pingf->f), pingf->sock); close(pingf->sock); flow_hash_remove(c, FLOW_SIDX(pingf, INISIDE)); } @@ -210,11 +210,13 @@ static struct icmp_ping_flow *icmp_ping_new(const struct ctx *c, if (pingf->sock > FD_REF_MAX) goto cancel; + flow_epollid_set(&pingf->f, EPOLLFD_ID_DEFAULT); + ref.type = EPOLL_TYPE_PING; ref.flowside = FLOW_SIDX(flow, TGTSIDE); ref.fd = pingf->sock; - if (epoll_add(c->epollfd, EPOLLIN, ref) < 0) { + if (epoll_add(flow_epollfd(&pingf->f), EPOLLIN, ref) < 0) { close(pingf->sock); goto cancel; } -- cgit v1.2.3