Store the thread number in the flow_common structure for ICMP ping
flows using flow_epollfd_set() and retrieve the corresponding epoll
file descriptor with flow_epollfd_get() 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
---
icmp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/icmp.c b/icmp.c
index 56dfac6c958e..5e03e0841ed4 100644
--- a/icmp.c
+++ b/icmp.c
@@ -149,7 +149,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_get(&pingf->f), pingf->sock);
close(pingf->sock);
flow_hash_remove(c, FLOW_SIDX(pingf, INISIDE));
}
@@ -206,11 +206,13 @@ static struct icmp_ping_flow *icmp_ping_new(const struct ctx *c,
if (pingf->sock > FD_REF_MAX)
goto cancel;
+ flow_epollfd_set(&pingf->f, 0, c->epollfd);
+
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_get(&pingf->f), EPOLLIN, &ref) < 0) {
close(pingf->sock);
goto cancel;
}
--
2.50.1