Unverified Commit 82c3d7f4 authored by Andrew Balmos's avatar Andrew Balmos Committed by GitHub
Browse files

Correctly compute ConfFCnt for MIC. (#540)

Currently `ConfFCnt` in the MIC is always one larger then the `FCnt` of the corresponding uplink, as described in #539. This is because `ctx.DeviceSession.FCntUp` was already incremented by the initial processing of the uplink.

Closes #539.
parent 6d97ec65
......@@ -1391,7 +1391,9 @@ func setPHYPayloads(ctx *dataContext) error {
// Set MIC.
if err := phy.SetDownlinkDataMIC(ctx.DeviceSession.GetMACVersion(), ctx.DeviceSession.FCntUp, ctx.DeviceSession.SNwkSIntKey); err != nil {
// If this is an ACK, then FCntUp has already been incremented by one. If
// this is not an ACK, then DownlinkDataMIC will zero out ConfFCnt.
if err := phy.SetDownlinkDataMIC(ctx.DeviceSession.GetMACVersion(), ctx.DeviceSession.FCntUp - 1, ctx.DeviceSession.SNwkSIntKey); err != nil {
return errors.Wrap(err, "set MIC error")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment