Skip to content
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

LMIC doesn't handle LoRaWAN MAX_FCNT_GAP #266

Closed
terrillmoore opened this issue Mar 19, 2019 · 1 comment
Closed

LMIC doesn't handle LoRaWAN MAX_FCNT_GAP #266

terrillmoore opened this issue Mar 19, 2019 · 1 comment
Assignees
Labels

Comments

@terrillmoore
Copy link
Member

Somewhere early on, but after the LMIC started, the core spec added MAX_FCNT_GAP, a regional/network parameter (default 16384) that specifies how far a message count can be from the previous one and still be accepted.

The LMIC code at

seqno = LMIC.seqnoDn + (u2_t)(seqno - LMIC.seqnoDn);
if( !aes_verifyMic(LMIC.nwkKey, LMIC.devaddr, seqno, /*dn*/1, d, pend) ) {
EV(spe3Cond, ERR, (e_.reason = EV::spe3Cond_t::CORRUPTED_MIC,
e_.eui1 = MAIN::CDEV->getEui(),
e_.info1 = Base::lsbf4(&d[pend]),
e_.info2 = seqno,
e_.info3 = LMIC.devaddr));
goto norx;
}
if( seqno < LMIC.seqnoDn ) {
if( (s4_t)seqno > (s4_t)LMIC.seqnoDn ) {
EV(specCond, INFO, (e_.reason = EV::specCond_t::DNSEQNO_ROLL_OVER,
e_.eui = MAIN::CDEV->getEui(),
e_.info = LMIC.seqnoDn,
e_.info2 = seqno));
goto norx;
}
if( seqno != LMIC.seqnoDn-1 || !LMIC.dnConf || ftype != HDR_FTYPE_DCDN ) {
EV(specCond, INFO, (e_.reason = EV::specCond_t::DNSEQNO_OBSOLETE,
e_.eui = MAIN::CDEV->getEui(),
e_.info = LMIC.seqnoDn,
e_.info2 = seqno));
goto norx;
}
// Replay of previous sequence number allowed only if
// previous frame and repeated both requested confirmation
replayConf = 1;
}
must be changed to match the spec.

@terrillmoore
Copy link
Member Author

Fixed by #378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant