-
Notifications
You must be signed in to change notification settings - Fork 3k
Update for downlink sequence counter rollover #10137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Current implementation did call AT+CGEREP before sim was ready and it was failing in most modems.
Cellular: call AT+CGEREP after sim is ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expand the commit msg (you provided details in the comment) - about the fix. It's bugfix rather "Bug"
Hi,
Sorry, I do not understand the mail below. Is there any action needed from my side?
Thanks for taking care.
Best regards,
Itziar
|
Yes. Your current commit msg is "Bug related to downlink sequence counter rollover". You provided good description in the first comment:
Please edit your commit message to add details about the bug fix. You can actually replace the current commit message by this above quoted text. |
For the test, the downlink sequence counter of the downlink messages has been incremented by 1600 (< MAX_FCNT_GAP) several times. For example, until 64005 and following situation was shown: Downlink sequence counter increased to 64005 (by 1600 steps) The radio module accepts this, as expected. After that, downlink sequence counter increased to 65536 (rollover for 32 bits sequence counter) The radio module rejects this frame With the change everything works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix issue related to downlink sequence counter rollover in LoRaWAN.
For the test, the downlink sequence counter of the downlink messages has been incremented by 1600 (< MAX_FCNT_GAP) several times. For example, until 64005 and following situation was shown:
Downlink sequence counter increased to 64005 (by 1600 steps)
The radio module accepts this, as expected.
After that, downlink sequence counter increased to 65536 (rollover for 32 bits sequence counter)
The radio module rejects this frame
With the change everything works fine.
@itziardelatorre A minor and major nit. Major nit: Merges of ARMmbed/mbed-os master into PR head branches don't work. Please remove your merge commit and instead do a fetch + rebase to update your PR head branch. Minor nit: Please take a look at the git apply -3 <<'PATCH' && git commit -am "Applied suggested astyle fix(es)" && git push
diff --git a/features/lorawan/lorastack/mac/LoRaMac.cpp b/features/lorawan/lorastack/mac/LoRaMac.cpp
index 032094d9df..1b6768cd9e 100644
--- a/features/lorawan/lorastack/mac/LoRaMac.cpp
+++ b/features/lorawan/lorastack/mac/LoRaMac.cpp
@@ -319,13 +319,13 @@ bool LoRaMac::message_integrity_check(const uint8_t *const payload,
sequence_counter_prev = (uint16_t) * downlink_counter;
sequence_counter_diff = sequence_counter - sequence_counter_prev;
*downlink_counter += sequence_counter_diff;
-
+
if (sequence_counter_diff >= _lora_phy->get_maximum_frame_counter_gap()) {
_mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOST;
_mcps_indication.dl_frame_counter = *downlink_counter;
return false;
}
-
+
// sizeof nws_skey must be the same as _params.keys.nwk_skey,
_lora_crypto.compute_mic(payload, size - LORAMAC_MFR_LEN,
nwk_skey,
@@ -335,7 +335,7 @@ bool LoRaMac::message_integrity_check(const uint8_t *const payload,
if (mic_rx != mic) {
_mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_MIC_FAIL;
return false;
- }
+ }
return true;
}
PATCH |
For the test, the downlink sequence counter of the downlink messages has been incremented by 1600 (< MAX_FCNT_GAP) several times. For example, until 64005 and following situation was shown: - Downlink sequence counter increased to 64005 (by 1600 steps) The radio module accepts this, as expected. - After that, downlink sequence counter increased to 65536 (rollover for 32 bits sequence counter) The radio module rejects this frame With the change everything works fine.
Thanks for the instructions. I have tried to follow them. Please let me know if any other change is required.
|
This PR could be closed. New PR #10154 |
Description
Fix issue related to downlink sequence counter rollover in LoRaWAN.
For the test, the downlink sequence counter of the downlink messages has been incremented by 1600 (< MAX_FCNT_GAP) several times. For example, until 64005 and following situation was shown:
The radio module accepts this, as expected.
The radio module rejects this frame
With the change everything works fine.
Pull request type
Reviewers
Release Notes