-
Notifications
You must be signed in to change notification settings - Fork 2k
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
pkg/semtech-loramac: rework how session keys are get/set #11783
pkg/semtech-loramac: rework how session keys are get/set #11783
Conversation
The patch now exposes globally session keys to make them reachable from the package adaption code directly
hi @aabadie do you have the steps to reproduce the original issue in I'm not sure if it's a good idea to just access internal values of the packet. It makes it harder to maintain and I think the functions might not be the real cause of not restoring the keys properly. In fact, the I would check the return status of the |
You can follow the testing procedure described here. On master, after the last reboot step (before send), you get a hardfault on the lobaro-lorabox (and im880b). With this PR, it doesn't happen, everything works as expected.
I think the same but when one calls them to set the AppSKey and NwkSKey just after reading the keys from EEPROM, they don't work as expected: the value read from EEPROM is correct but after, the value copied to the corresponding static variable is lost for some reason.
I did a lot of debugging in the function itself to verify what arrays were copied to the static variables containing the key. Normal code path was used so checking the return value won't help. I won't be able to work again on this before the release unfortunately. |
Looking into the code it seems to me the problem is actually here:
|
#11847 solves the issue in a less intrusive way. Shall we close this one? |
#11847 was merged, so let's close this. |
Contribution description
This PR fixes #11626.
Although the reason is still unclear to me, I noticed that using Loramac MIB get/set functions to get/set network/application session keys were not working as expected after reading the values from EEPROM.
The idea of this PR is to skip the use of Loramac MIB get/set functions and patch the package to get a global access to the underlying arrays.
Even though this is not very nice, it avoids having to memcpy twice a 16bytes array for each keys.
I tested this change in the im880b board (stm32l1 + sx1272) and b-l072z-lrwan1 and on both it's working like a charm.
Note that I'm not sure this is the best fix, but at least it works.
Testing procedure
tests/pkg_semtech-loramac
on b-l072z-lrwan1 and lobaro-lorabox boardsloramac erase
) and rebootloramac join otaa
loramac save
and rebootloramac erase
) and rebootloramac join abp
loramac save
and rebootIssues/PRs references
fixes #11626