1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

shell: drop duplicate ICMPv6 echo responses

This commit is contained in:
Oleg Hahm 2015-09-30 17:59:30 +02:00
parent 4e05254eb7
commit e3045e8afe

View File

@ -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);