Error: node-session does not exist or invalid fcnt or mic


#1

Dear LoraServer

I finally connect arduino+lorahat device as end node to loraserver using LMIC Libarary,

now i got the problem, when i try restart/reset the arduino, i cant connect again to loraserver
i got error message like this :
Nov 14 05:28:29 server loraserver[1794]: time=“2017-11-14T05:28:29-05:00” level=error msg=“processing rx packet error: get node-session error: node-session does not exist or invalid fcnt or mic” data_base64=QBER3QCALAAB1OtpIs8eqDXYSh7kiDdp

i read some source, that i have to delete the node from appserver and add it again, after that the device connect again, but when i try to restart the device, the problem came back with the same error,
can anyone help me to solve this?

there is a timestamp when i restart device and add it again later,


Downlink error after publishing with mosquitto
Lora app server experience significant delay in publishing lora node messages
ABP,mote power off,need reconfig
#2

Are you using ABP? Then probably the issue is that by restart/resetting the Arduino, you also reset the frame-counters at the device. Because of this, LoRa Server rejects these frames as it could as well be a replay-attack. To work around this, you could check the Disable frame-counter validation box (on ABP activation).


#3

Thanks @brocaar, I solve this problem… :slight_smile:


Missing downlink message
#4

What need to be step to solve this kind of issue if we are using OTAA node?


#5

Same issue here. Using ABP too. Disabled frame counter, created a new node…

I always get device session error :frowning:


#6

Probably then your keys are setup incorrectly. A common mistake is the byte order of the keys. E.g. in some cases you have to configure them in the reverse order.


#7

Yes I have already tried to reverse the order of my keys, still emits device-session error. Not too sure where else to look at.


#8

Can you help in my case?
I’m using a simulation of a gateway to send packages.
I’m using the VirtualBox Machine which send me to my loraserver(my local machine) with my pc IP address in MQTT, but I also see the same error:

jul 18 10:36:28 diogo loraserver[3971]: time=“2018-07-18T10:36:28+01:00” level=info msg=“backend/gateway: rx packet received”
jul 18 10:36:29 diogo loraserver[3971]: time=“2018-07-18T10:36:29+01:00” level=error msg=“processing rx packet error: get device-session error: device-session does not exist or invalid fcnt or mic” data_base64=“QIMrJgcAAAAByP/0r6/DmDEfUWU=”

IN MY VIRTUAL MACHINE THIS IS THE INFO OF THE PACKAGE:

teste@teste:~/loraserver-device-sim/example$ go run uplink_example.go
Connection established.
Publishing:
{“phyPayload”:“QIMrJgcAAAAByP/0r6/DmDEfUWU=”,“rxInfo”:{“channel”:0,“codeRate”:“4/5”,“crcStatus”:1,“dataRate”:{“bandwidth”:500,“modulation”:“LORA”,“spreadFactor”:8,“bitrate”:0},“frequency”:902300000,“loRaSNR”:7,“mac”:“b827ebfffeb13d1f”,“rfChain”:1,“rssi”:-57,“size”:23,“time”:“2018-07-18T10:36:27+01:00”,“timestamp”:1531906587}}


#9

Hi Brocaar, I have already checked the “Disable frame-counter validation” but still getting this error, I am using the latest test release. I am using LoPy as node. Any other workaround ?

Thank you,

Bnjroos


#10

You can split the error in three parts:

  • device-session does not exist: no such activation exists for the used DevAddr
  • invalid fcnt: the frame-counter did not increment (e.g. replay attack)
  • invalid […] mic: the message integrity code was invalid, meaning that your session-keys are setup incorrect

In the latest case, make sure that some devices use different byte orders when entering the keys. For the LoPy, you can find some examples here: https://github.com/brocaar/pycom-examples.


#12

Hi brocaar, thank you for your answer, I found my issue, it was the selected LoRaWAN version for my device that was incorrect, how dumb of me.


#13

Hello everyone !

Unfortunately, I got the same error: e[31mERROe[0m[3402] processing rx packet error: get device-session error: device-session does not exist or invalid fcnt or mic e[31mdata_base64e[0m=gIMaASaAAQAEbtljyaCtnLD5.

I think it is related to the session keys.

Can you help me to understand if I filled them correctly? Thanks a lot !




#14

Hi ,

Does any one get the same error after leave the node(device) for long time(about two month) without power then restart it ? I meet this situation for many times, every time I need to delete this device(Using ABP. Disabled frame counter) and recreate it again.Does any one know how to fix this issue?Thanks a lot!


#15

If you are in ABP, FCnt are not synchronized between node and server. It is normal (security reason : replay attack). So yeah, you have to delete and recreate the node each time. Or use OTAA.


#16

Hello, @Clement @shuangcai_huang @lcer93 @Bnjroos
Anyone can help me for simulation message of device join

Join Request Payload
gateway/48b4866ad7b06b20/rx: {"phyPayload":"AAAAAAAAAAAA4J3O73Hi6w0CEie8sdw=","rxInfo":{"board":0,"antenna":0,"channel":2,"codeRate":"4/5","crcStatus":1,"dataRate":{"bandwidth":125,"modulation":"LORA","spreadFactor":12},"frequency":869525000,"loRaSNR":7,"mac":"48b4866ad7b06b20","rfChain":1,"rssi": -57,"size":23,"time":"2018-10-16T16:24:00.222434Z","timestamp":3036224484}}

gateway/48b4866ad7b06b20/tx : {"token":45812,"txInfo":{"mac":"48b4866ad7b06b20","immediately":false,"timestamp":3041224484,"frequency":869525000,"power":14,"dataRate":{"modulation":"LORA","spreadFactor":12,"bandwidth":125},"codeRate":"4/5","iPol":true,"board":0,"antenna":0},"phyPayload":"ICkFg+QuoPiouhpFcihHK6s="}

LoraServer Logs

time="2018-10-17T11:19:11+05:30" level=info msg="gateway/mqtt: uplink frame received"
time="2018-10-17T11:19:11+05:30" level=info msg="packet(s) collected" dev_eui=0debe271efce9de0 gw_count=1 gw_ids=48b4866ad7b06b20 mtype=JoinRequest
time="2018-10-17T11:19:11+05:30" level=info msg="device-queue flushed" dev_eui=0debe271efce9de0
time="2018-10-17T11:19:11+05:30" level=info msg="device-session saved" dev_addr=0157e777 dev_eui=0debe271efce9de0
time="2018-10-17T11:19:11+05:30" level=info msg="device-activation created" dev_eui=0debe271efce9de0 id=32
time="2018-10-17T11:19:11+05:30" level=info msg="gateway/mqtt: publishing downlink frame" qos=0 topic=gateway/48b4866ad7b06b20/tx
time="2018-10-17T11:19:11+05:30" level=info msg="downlink-frames saved" dev_eui=0debe271efce9de0 token=45812

Lora App Server Log

time="2018-10-17T11:19:11+05:30" level=info msg="js: request received" message_type=JoinReq receiver_id=0000000000000000 sender_id=000000 transaction_id=4044979917
time="2018-10-17T11:19:11+05:30" level=info msg="device-keys updated" dev_eui=0debe271efce9de0
time="2018-10-17T11:19:11+05:30" level=info msg="js: sending response" message_type=JoinAns receiver_id=000000 result_code=Success sender_id=0000000000000000 transaction_id=4044979917

First payload
gateway/48b4866ad7b06b20/rx : {"phyPayload":"QNLjGAEgAwEBdGVzdO7u7u4=","rxInfo":{"board":0,"antenna":0,"channel":1,"codeRate":"4/5", "crcStatus": 1,"dataRate":{"bandwidth":125,"modulation":"LORA","spreadFactor":12,"bitrate":0},"frequency":868300000,"loRaSnr":7,"mac":"48b4866ad7b06b20","rfChain":1,"rssi":-57,"size":23,"time":"2018-10-17T10:42:13+05:30","timestamp":1539772933}}

LoraServer logs shows invalid fcnt or mic

time="2018-10-17T11:22:51+05:30" level=info msg="gateway/mqtt: uplink frame received"
time="2018-10-17T11:22:52+05:30" level=error msg="processing uplink frame error" data_base64="QNLjGAEgAwEBdGVzdO7u7u4=" error="get device-session error: device-session does not exist or invalid fcnt or mic"

I am trying to Join Device.

Anyone can help me please for simulation message…

Thanks