result_code=MICFailed diagnostics question

Hi all,
newbie question …

I believe I have most of the server infrastructure up and running nicely. But when receiving join requests from an mDot node I am seeing MICFailed in the result code.

— start JoinReq —
INFO[4107] js: request received message_type=JoinReq receiver_id=88963756a2ada968 sender_id=000000 transaction_id=893473386
INFO[4107] js: sending response message_type=JoinAns receiver_id=000000 result_code=MICFailed sender_id=88963756a2ada968 transaction_id=893473386
---- end JoinReq –

The join data decodes as follows:

— start JoinReq —
decoding from Base64: AGipraJWN5aIK88AAAAAgADlroT5478=
Decoded packet
Message Type = Join Request
PHYPayload = 0068A9ADA2563796882BCF000000008000E5AE84F9E3BF

      ( PHYPayload = AppEUI[8] | DevEUI[8] | DevNonce[2] | MIC[4] )
            AppEUI = 88963756A2ADA968
            DevEUI = 008000000000CF2B
          DevNonce = AEE5
               MIC = 84F9E3BF

— end JoinReq —

My question is where to start looking for the exact reason the MIC Failed ?
Is there a ‘diagnostic procedure’ I’ve not found, and/or what piece of code actually generates this error flag. I have searched all Loraserver and app-server source code for MICFailed and result_code but I’ve not found it yet.

Any assistance is appreciated.

Kind regards
Vince.

p.s. Current code versions:
lora-gateway-bridge version 2.1.5 - running on MultiTech Conduit gateway
loraserver version 0.22.0
lora-app-server version 0.14.1
lora-channel-manager version 0.1.1

The only way to debug is to generate your own PHYPayload frames and do your own comparison. With the MIC it is either something is wrong or all is well. It does not give you any hints.

Please note that in some cases the you must enter EUIs MSB, in some cases LSB. See also the example at the bottom of this page: https://docs.loraserver.io/lora-app-server/use/devices/.

Thanks Brocaar, will report results. Awesome work by the way … been digging into the code - like it :smile:

1 Like

ok the issue of the MIK_Fail was due to not setting the app_eui/app_key correctly.

I now see the JoinAns with Success result going back to the device.

The next issue is that the sender_id is being set to 000000 so the reply is not getting back to the mDot.

I’ll create another topic and link to here.