mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #4005 from OlegHahm/shell_ping_multicast_fixes
shell: fix multicast pings
This commit is contained in:
commit
5376dfdca7
@ -21,9 +21,16 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "shell.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define MAIN_QUEUE_SIZE (8)
|
||||
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* we need a message queue for the thread running the shell in order to
|
||||
* receive potentially fast incoming networking packets */
|
||||
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
|
||||
puts("RIOT border router example application");
|
||||
|
||||
/* start shell */
|
||||
|
@ -21,6 +21,10 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "shell.h"
|
||||
#include "msg.h"
|
||||
|
||||
#define MAIN_QUEUE_SIZE (8)
|
||||
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
|
||||
|
||||
extern int udp_cmd(int argc, char **argv);
|
||||
|
||||
@ -31,6 +35,9 @@ static const shell_command_t shell_commands[] = {
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* we need a message queue for the thread running the shell in order to
|
||||
* receive potentially fast incoming networking packets */
|
||||
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
|
||||
puts("RIOT network stack example application");
|
||||
|
||||
/* start shell */
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user