diff --git a/sys/shell/commands/sc_icmpv6_echo.c b/sys/shell/commands/sc_icmpv6_echo.c index 61af94b193..c02a846b26 100644 --- a/sys/shell/commands/sc_icmpv6_echo.c +++ b/sys/shell/commands/sc_icmpv6_echo.c @@ -136,6 +136,7 @@ int _icmpv6_ping(int argc, char **argv) timex_t delay = { 1, 0 }; char *addr_str; ipv6_addr_t addr; + msg_t msg; gnrc_netreg_entry_t *ipv6_entry, my_entry = { NULL, ICMPV6_ECHO_REP, thread_getpid() }; @@ -211,7 +212,6 @@ int _icmpv6_ping(int argc, char **argv) vtimer_now(&start); while ((remaining--) > 0) { - msg_t msg; gnrc_pktsnip_t *pkt; timex_t start, stop, timeout = { 5, 0 }; @@ -284,6 +284,13 @@ int _icmpv6_ping(int argc, char **argv) stop = timex_sub(stop, start); gnrc_netreg_unregister(GNRC_NETTYPE_ICMPV6, &my_entry); + while(msg_try_receive(&msg) > 0) { + if (msg.type == GNRC_NETAPI_MSG_TYPE_RCV) { + printf("dropping additional response packet (probably caused by duplicates)\n"); + gnrc_pktsnip_t *pkt = (gnrc_pktsnip_t *)msg.content.ptr; + gnrc_pktbuf_release(pkt); + } + } printf("--- %s ping statistics ---\n", addr_str);