Skip to content

Commit

Permalink
arping: Optimize loop checking
Browse files Browse the repository at this point in the history
ctl->unsolicited does not change, therefore it should be checked only
once (as it was done in 67e070d before the rewrite).

Fixes: 4db1de6 ("arping: Fix 1s delay on exit for unsolicited arpings")
Reported-by: David Bond <dbond@suse.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
pevik committed May 23, 2024
1 parent 4db1de6 commit e429a1b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arping.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,10 @@ static int event_loop(struct run_state *ctl)
pfds[POLLFD_SOCKET].events = POLLIN | POLLERR | POLLHUP;
send_pack(ctl);

while (!(exit_loop || ctl->unsolicited)) {
if (ctl->unsolicited)
goto exit;

while (!exit_loop) {
int ret;
size_t i;

Expand Down Expand Up @@ -840,6 +843,7 @@ static int event_loop(struct run_state *ctl)
}
}
}
exit:
close(sfd);
close(tfd);
freeifaddrs(ctl->ifa0);
Expand Down

0 comments on commit e429a1b

Please sign in to comment.