From 4cc64ea942c2b770721811fe35763d58fcb9c1ff Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Sun, 24 Feb 2019 16:30:57 +0100 Subject: [PATCH] TSCH: filter out frames from ourselves --- os/net/mac/tsch/tsch-slot-operation.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/os/net/mac/tsch/tsch-slot-operation.c b/os/net/mac/tsch/tsch-slot-operation.c index 4397a4805..3f5d329a8 100644 --- a/os/net/mac/tsch/tsch-slot-operation.c +++ b/os/net/mac/tsch/tsch-slot-operation.c @@ -849,8 +849,12 @@ PT_THREAD(tsch_rx_slot(struct pt *pt, struct rtimer *t)) #endif /* LLSEC802154_ENABLED */ if(frame_valid) { - if(linkaddr_cmp(&destination_address, &linkaddr_node_addr) - || linkaddr_cmp(&destination_address, &linkaddr_null)) { + /* Check that frome is for us or broadcast, AND that it is not from + * ourselves. This is for consistency with CSMA and to avoid adding + * ourselves to neighbor tables in case frames are being replayed. */ + if((linkaddr_cmp(&destination_address, &linkaddr_node_addr) + || linkaddr_cmp(&destination_address, &linkaddr_null)) + && !linkaddr_cmp(&source_address, &linkaddr_node_addr)) { int do_nack = 0; rx_count++; estimated_drift = RTIMER_CLOCK_DIFF(expected_rx_time, rx_start_time);