brocaar / chirpstack-network-server

ChirpStack Network Server is an open-source LoRaWAN network-server.
https://www.chirpstack.io
MIT License
1.48k stars 545 forks source link

Return `UnknownDevAddr` and `MICFailed` errors in roaming #574

Closed johanstokking closed 2 years ago

johanstokking commented 2 years ago

Currently, all errors leading to uplink messages not being handled by ChirpStack result in Other result codes via Backend Interfaces. That isn't very useful for fNS to figure out why ChirpStack didn't accept the frame. This PR adds two common errors, UnknownDevAddr and MICFailed, to help with that.

We believe that a frame counter reset or a frame counter retransmission are MIC failures (without having a more accurate error code in BI to describe this). ChirpStack's error codes indicate that the FCnt based on the frame's 16 LSB is lower than permitted, but it can also mean that the rolled over FCnt is too high, which would indeed be a MIC mismatch. Generally speaking, protection against replays is about message integrity so this should all be MICFailed.

brocaar commented 2 years ago

Thanks! :+1: