TSCH: be more picky in incoming frame filtering

This commit is contained in:
Simon Duquennoy 2017-06-26 16:37:33 +02:00
parent bde0123f49
commit 89cbf87eee
2 changed files with 13 additions and 3 deletions

View File

@ -211,9 +211,9 @@ frame802154_check_dest_panid(frame802154_t *frame)
return 0;
}
frame802154_has_panid(&frame->fcf, NULL, &has_dest_panid);
if(has_dest_panid
&& frame->dest_pid != frame802154_get_pan_id()
&& frame->dest_pid != FRAME802154_BROADCASTPANDID) {
if(!has_dest_panid ||
(frame->dest_pid != frame802154_get_pan_id()
&& frame->dest_pid != FRAME802154_BROADCASTPANDID)) {
/* Packet to another PAN */
return 0;
}

View File

@ -803,6 +803,16 @@ PT_THREAD(tsch_rx_slot(struct pt *pt, struct rtimer *t))
packet_duration = TSCH_PACKET_DURATION(current_input->len);
if(frame_valid) {
if(frame.fcf.frame_type != FRAME802154_DATAFRAME
&& frame.fcf.frame_type != FRAME802154_BEACONFRAME) {
TSCH_LOG_ADD(tsch_log_message,
snprintf(log->message, sizeof(log->message),
"!discarding frame with type %u, len %u", frame.fcf.frame_type, current_input->len));
frame_valid = 0;
}
}
#if LLSEC802154_ENABLED
/* Decrypt and verify incoming frame */
if(frame_valid) {