File 0002-arping-Fix-unsolicited-ARP-regressions-on-c-1.patch of Package iputils.34426
From 5de892d15eea467775420c4fd641df229f024259 Mon Sep 17 00:00:00 2001
From: Petr Vorel <pvorel@suse.cz>
Date: Fri, 24 May 2024 00:05:53 +0200
Subject: [PATCH 2/2] arping: Fix unsolicited ARP regressions on -c > 1
4db1de6 tried to fix a regression 1 sec delay due poll() for unsolicited
ARP, .i.e. -A and -U (introduced in 67e070d, reported as issue #536).
But skipping the while loop entirely introduced another regression for
-A and -U, which behave like -c1 (sending *always* only a single packet).
Fixing it by checking in while loop and comparing also count (as it was
done in 67e070d before the rewrite).
NOTE: use exit_loop with continue instead of simple break to keep things
consistent.
Fixes: 4db1de6 ("arping: Fix 1s delay on exit for unsolicited arpings")
Fixes: 67e070d ("arping: use signalfd() and timerfd() rather than signals")
Fixes: https://github.com/iputils/iputils/issues/536
Closes: https://github.com/iputils/iputils/pull/543
Fixes: bsc#1224877
Reported-by: David Bond <dbond@suse.com>
Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
[ upstream commit 5de892d15eea467775420c4fd641df229f024259, fix of
regression in 0001-arping-Fix-1s-delay-on-exit-for-unsolicited-arpings.patch ]
---
arping.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arping.c b/arping.c
index 7ad927e..340ba0c 100644
--- a/arping.c
+++ b/arping.c
@@ -775,10 +775,15 @@ static int event_loop(struct run_state *ctl)
pfds[POLLFD_SOCKET].events = POLLIN | POLLERR | POLLHUP;
send_pack(ctl);
- while (!(exit_loop || ctl->unsolicited)) {
+ while (!exit_loop) {
int ret;
size_t i;
+ if ((ctl->sent == ctl->count) && ctl->unsolicited) {
+ exit_loop = 1;
+ continue;
+ }
+
ret = poll(pfds, POLLFD_COUNT, -1);
if (ret <= 0) {
if (errno == EAGAIN)
@@ -839,6 +844,7 @@ static int event_loop(struct run_state *ctl)
}
}
}
+
close(sfd);
close(tfd);
freeifaddrs(ctl->ifa0);
--
2.45.1