From be8a364bb45c7d5e944f2e3a815ae51a41ae89c6 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 24 Nov 2021 12:07:14 +0100 Subject: [PATCH] shell/gnrc_icmpv6_echo: fix duplicate datalen check --- sys/shell/commands/sc_gnrc_icmpv6_echo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/shell/commands/sc_gnrc_icmpv6_echo.c b/sys/shell/commands/sc_gnrc_icmpv6_echo.c index 8a6b50d0c3..b441a157b8 100644 --- a/sys/shell/commands/sc_gnrc_icmpv6_echo.c +++ b/sys/shell/commands/sc_gnrc_icmpv6_echo.c @@ -398,14 +398,12 @@ static void _print_reply(_ping_data_t *data, gnrc_pktsnip_t *icmpv6, uint32_t no if (rssi != GNRC_NETIF_HDR_NO_RSSI) { printf(" rssi=%"PRId16" dBm", rssi); } - if (data->datalen >= sizeof(uint32_t)) { - printf(" time=%lu.%03lu ms", (long unsigned)triptime / 1000, - (long unsigned)triptime % 1000); - } - /* we can only calculate RTT (triptime) if payload was large enough for a TX timestamp */ if (data->datalen >= sizeof(uint32_t)) { + printf(" time=%lu.%03lu ms", (long unsigned)triptime / 1000, + (long unsigned)triptime % 1000); + data->tsum += triptime; if (triptime < data->tmin) { data->tmin = triptime;