Store epollfd in the flow_common structure for ICMP ping flows and use
it for epoll operations 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 d6f0abe68269..2246e1c9ef1d 100644
--- a/icmp.c
+++ b/icmp.c
@@ -151,7 +151,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(pingf->f.epollfd, pingf->sock);
close(pingf->sock);
flow_hash_remove(c, FLOW_SIDX(pingf, INISIDE));
}
@@ -213,9 +213,11 @@ static struct icmp_ping_flow *icmp_ping_new(const struct ctx *c,
ref.flowside = FLOW_SIDX(flow, TGTSIDE);
ref.fd = pingf->sock;
+ pingf->f.epollfd = c->epollfd;
+
ev.events = EPOLLIN;
ev.data.u64 = ref.u64;
- if (epoll_ctl(c->epollfd, EPOLL_CTL_ADD, pingf->sock, &ev) == -1) {
+ if (epoll_ctl(pingf->f.epollfd, EPOLL_CTL_ADD, pingf->sock, &ev) == -1) {
warn_perror("L4 epoll_ctl");
close(pingf->sock);
goto cancel;
--
2.50.1