File 0002-arping-Fix-unsolicited-ARP-regressions-on-c-1.patch of Package iputils.34028
From 1fc221a6109339264f5001cb861af2b2d9b991f2 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).
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
Fixes: bsc#1224877
Reported-by: David Bond <dbond@suse.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
[ proposed fix of regression in 0001-arping-Fix-1s-delay-on-exit-for-unsolicited-arpings.patch ]
---
arping.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arping.c b/arping.c
index dc818ba..5ec190e 100644
--- a/arping.c
+++ b/arping.c
@@ -777,10 +777,13 @@ 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)
+ break;
+
ret = poll(pfds, POLLFD_COUNT, -1);
if (ret <= 0) {
if (errno == EAGAIN)
@@ -841,6 +844,7 @@ static int event_loop(struct run_state *ctl)
}
}
}
+
close(sfd);
close(tfd);
freeifaddrs(ctl->ifa0);
--
2.43.0