aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Denys Vlasenko <vda.linux@googlemail.com>2020-12-20 11:16:32 +0100
committerGravatar Denys Vlasenko <vda.linux@googlemail.com>2020-12-20 11:16:32 +0100
commitbc2c1b4f869d3e3b90c187ebb07b3c23c14ca880 (patch)
treec926195d36118b05d1b57658ab3ba2e2c54bc369
parent2124c0ec97249b66889b6486ab5b5223993d31c0 (diff)
downloadbusybox-bc2c1b4f869d3e3b90c187ebb07b3c23c14ca880.tar.gz
busybox-bc2c1b4f869d3e3b90c187ebb07b3c23c14ca880.tar.bz2
ping: fix -wN to not think that one packet is always lost
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/ping.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/networking/ping.c b/networking/ping.c
index bbf9f0db1..ea4fa364b 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -471,17 +471,16 @@ static void sendping_tail(void (*sp)(int), int size_pkt)
{
int sz;
- CLR((uint16_t)G.ntransmitted % MAX_DUP_CHK);
- G.ntransmitted++;
-
- size_pkt += datalen;
-
if (G.deadline_us) {
unsigned n = G.cur_us - G.deadline_us;
if ((int)n >= 0)
print_stats_and_exit(0);
}
+ CLR((uint16_t)G.ntransmitted % MAX_DUP_CHK);
+ G.ntransmitted++;
+ size_pkt += datalen;
+
/* sizeof(pingaddr) can be larger than real sa size, but I think
* it doesn't matter */
sz = xsendto(pingsock, G.snd_packet, size_pkt, &pingaddr.sa, sizeof(pingaddr));