File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
features/lorawan/lorastack/mac Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -319,10 +319,13 @@ bool LoRaMac::message_integrity_check(const uint8_t *const payload,
319
319
sequence_counter_prev = (uint16_t ) * downlink_counter;
320
320
sequence_counter_diff = sequence_counter - sequence_counter_prev;
321
321
*downlink_counter += sequence_counter_diff;
322
- if (sequence_counter < sequence_counter_prev) {
323
- *downlink_counter += 0x10000 ;
322
+
323
+ if (sequence_counter_diff >= _lora_phy->get_maximum_frame_counter_gap ()) {
324
+ _mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOST;
325
+ _mcps_indication.dl_frame_counter = *downlink_counter;
326
+ return false ;
324
327
}
325
-
328
+
326
329
// sizeof nws_skey must be the same as _params.keys.nwk_skey,
327
330
_lora_crypto.compute_mic (payload, size - LORAMAC_MFR_LEN,
328
331
nwk_skey,
@@ -332,13 +335,7 @@ bool LoRaMac::message_integrity_check(const uint8_t *const payload,
332
335
if (mic_rx != mic) {
333
336
_mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_MIC_FAIL;
334
337
return false ;
335
- }
336
-
337
- if (sequence_counter_diff >= _lora_phy->get_maximum_frame_counter_gap ()) {
338
- _mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOST;
339
- _mcps_indication.dl_frame_counter = *downlink_counter;
340
- return false ;
341
- }
338
+ }
342
339
343
340
return true ;
344
341
}
You can’t perform that action at this time.
0 commit comments