-
Notifications
You must be signed in to change notification settings - Fork 210
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
[WIP] Class B fixes #481
base: master
Are you sure you want to change the base?
[WIP] Class B fixes #481
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -711,7 +711,7 @@ static CONST_TABLE(u1_t, macCmdSize)[] = { | |
static u1_t getMacCmdSize(u1_t macCmd) { | ||
if (macCmd < 2) | ||
return 0; | ||
if (macCmd >= LENOF_TABLE(macCmdSize) - 2) | ||
if ((macCmd - 2) >= LENOF_TABLE(macCmdSize)) | ||
return 0; | ||
return TABLE_GET_U1(macCmdSize, macCmd - 2); | ||
} | ||
|
@@ -1889,6 +1889,9 @@ static bit_t buildDataFrame (void) { | |
LMIC.frame[OFF_DAT_HDR] = HDR_FTYPE_DAUP | HDR_MAJOR_V1; | ||
LMIC.frame[OFF_DAT_FCT] = (LMIC.dnConf | LMIC.adrEnabled | ||
| (sendAdrAckReq() ? FCT_ADRACKReq : 0) | ||
#if !defined(DISABLE_PING) | ||
| ((LMIC.opmode & OP_PINGABLE) ? FCT_CLASSB : 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @terrillmoore I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess. The spec is not clear about this at all. Here's the relevant text (starting at line 1147, page 43, spec 1.0.3
From context, it does appear possible that they mean the device has to be locked to the beacon. So I think it makes sense to change to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixing as part of #208 major update. |
||
#endif // ndef DISABLE_PING | ||
| (end-OFF_DAT_OPTS)); | ||
os_wlsbf4(LMIC.frame+OFF_DAT_ADDR, LMIC.devaddr); | ||
|
||
|
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.
Ugh. Sorry about this one.
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.
No problem, but I'm wondering why 0 is returned in the error case, because in
scan_mac_cmds
I see no check except for line 887, which doesn't do what the comment says.https://github.com/sualko/arduino-lmic/blob/cabf6fbcd4390fcc42102a47c0323b7dafc6723a/src/lmic/lmic.c#L887
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.
Yes, that's a bug too -- no test cases for bad mac commands, even in certification.
Should be
if (cmdlen == 0 || cmdlen >> olen - oidx)
.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.
This was fixed in 06b53c7, merged in #555 (and possibly before that, but that's the most recent change).