aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2025-10-21 23:01:15 +0200
committerStefano Brivio <sbrivio@redhat.com>2025-10-30 15:33:42 +0100
commitaaa8f347351841fc16bd2a012b84f2b976c9dfb2 (patch)
tree9c8f79e16420848eecdacbd89eee62ee34d229fc
parentca931248dc32bf284a2dee095d983621ab4bec7f (diff)
downloadpasst-aaa8f347351841fc16bd2a012b84f2b976c9dfb2.tar
passt-aaa8f347351841fc16bd2a012b84f2b976c9dfb2.tar.gz
passt-aaa8f347351841fc16bd2a012b84f2b976c9dfb2.tar.bz2
passt-aaa8f347351841fc16bd2a012b84f2b976c9dfb2.tar.lz
passt-aaa8f347351841fc16bd2a012b84f2b976c9dfb2.tar.xz
passt-aaa8f347351841fc16bd2a012b84f2b976c9dfb2.tar.zst
passt-aaa8f347351841fc16bd2a012b84f2b976c9dfb2.zip
udp: Use epoll instance management for UDP flows
Store the epoll id in the flow_common structure for UDP flows using flow_epollid_set() and retrieve the corresponding epoll file descriptor with flow_epollfd() instead of passing c->epollfd directly. This makes UDP consistent with the recent TCP and ICMP changes. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--udp_flow.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/udp_flow.c b/udp_flow.c
index 00e231f..8907f2f 100644
--- a/udp_flow.c
+++ b/udp_flow.c
@@ -52,7 +52,7 @@ void udp_flow_close(const struct ctx *c, struct udp_flow *uflow)
flow_foreach_sidei(sidei) {
flow_hash_remove(c, FLOW_SIDX(uflow, sidei));
if (uflow->s[sidei] >= 0) {
- epoll_del(c->epollfd, uflow->s[sidei]);
+ epoll_del(flow_epollfd(&uflow->f), uflow->s[sidei]);
close(uflow->s[sidei]);
uflow->s[sidei] = -1;
}
@@ -92,7 +92,9 @@ static int udp_flow_sock(const struct ctx *c,
ref.data = fref.data;
ref.fd = s;
- rc = epoll_add(c->epollfd, EPOLLIN, ref);
+ flow_epollid_set(&uflow->f, EPOLLFD_ID_DEFAULT);
+
+ rc = epoll_add(flow_epollfd(&uflow->f), EPOLLIN, ref);
if (rc < 0) {
close(s);
return rc;
@@ -101,7 +103,7 @@ static int udp_flow_sock(const struct ctx *c,
if (flowside_connect(c, s, pif, side) < 0) {
rc = -errno;
- epoll_del(c->epollfd, s);
+ epoll_del(flow_epollfd(&uflow->f), s);
close(s);
flow_dbg_perror(uflow, "Couldn't connect flow socket");