Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arping: Fix exit code if receive more replies than sent
ARP protocol, unlike ICMP protocol, has no way to link REQUEST and REPLY together (detect to which sender belongs the response). E.g. running more arping instances currently causes failure due receiving more replies than sent probes: # ./builddir/arping -c2 -I eth0 192.168.255.1 -w10 & # ./builddir/arping -c2 -I eth0 192.168.255.1 -w10 & ARPING 192.168.255.1 from 192.168.255.133 eth0 ARPING 192.168.255.1 from 192.168.255.133 eth0 Unicast reply from 192.168.255.1 [50:EB:F6:87:9D:D0] 1.722ms Unicast reply from 192.168.255.1 [50:EB:F6:87:9D:D0] 1.726ms Unicast reply from 192.168.255.1 [50:EB:F6:87:9D:D0] 1.910ms Unicast reply from 192.168.255.1 [50:EB:F6:87:9D:D0] 1.915ms Sent 1 probes (1 broadcast(s)) Sent 1 probes (1 broadcast(s)) Received 2 response(s) Received 2 response(s) [ ENTER ] [1]- Exit 1 ./builddir/arping -c2 -I eth0 192.168.255.1 -w10 [2]+ Exit 1 ./builddir/arping -c2 -I eth0 192.168.255.1 -w10 84ca65c (fix for 67e070d) introduced this regression. Later e594ca5 introduced more precise timing - before arping sent 2 probes instead of 1 with -w1. Then 854873b unified behavior with ping, i.e. using -w (deadline) *without* -c (count) exit 0 if at least one reply arrived (backwards incompatibility, also now incompatible with busybox). But that still kept problematic using -w with -c on multiple instances / replies. Fixing the problem by adding a special condition. Also, when at it, move all exit code evaluation into finish() (before it was in finish() but also event_loop()). This improves code introduced in 67e070d. Fixes: 84ca65c ("arping: fix sent vs received packages return value") Fixes: iputils#538 Closes: iputils#546 Reported-by: Mingyang Liu <papillon@yeah.net> Tested-by: Mingyang Liu <papillon@yeah.net> Reviewed-by: Clemens Famulla-Conrad <cfamullaconrad@suse.com> Reviewed-by: <Michał Sieroń michalwsieron@gmail.com> Tested-by: <Michał Sieroń michalwsieron@gmail.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
- Loading branch information