From: Xue Wenqian <wsn.iot.xwq@xxxxxxxxxxxxxx> The filtering for wpan-ping client and server is made by checking frame header. Signed-off-by: Xue Wenqian <wsn.iot.xwq@xxxxxxxxxxxxxx> --- wpan-ping/wpan-ping.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/wpan-ping/wpan-ping.c b/wpan-ping/wpan-ping.c index e6df2b4..f825b22 100644 --- a/wpan-ping/wpan-ping.c +++ b/wpan-ping/wpan-ping.c @@ -303,6 +303,10 @@ static int measure_roundtrip(struct config *conf, int sd) { } gettimeofday(&start_time, NULL); ret = recv(sd, buf, conf->packet_len, 0); + if (buf[0] != NOT_A_6LOWPAN_FRAME) { + printf("Non-wpanping packet was received\n"); + continue; + } if (seq_num != ((buf[2] << 8)| buf[3])) { printf("Sequenze number did not match\n"); continue; @@ -386,11 +390,13 @@ static void init_server(int sd) { #if DEBUG dump_packet(buf, len); #endif - /* Send same packet back */ - len = sendto(sd, buf, len, 0, (struct sockaddr *)&src, addrlen); - if (len < 0) { - perror("sendto"); - continue; + if (buf[0] == NOT_A_6LOWPAN_FRAME) { + /* Send same packet back */ + len = sendto(sd, buf, len, 0, (struct sockaddr *)&src, addrlen); + if (len < 0) { + perror("sendto"); + continue; + } } } free(buf); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wpan" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html