Unable to "talk" to long sleeping devices behind NAT (patch)
See original GitHub issueFor a NB-IoT devices we’re facing NAT inflicted communications problems:
As lwm2m protocol us UDP based and our devices usually sit in mobile operators private networks we can’t always assume working communication path from server to device. To be able to talk to our device we always observer our device on registration and have command queues for every device holding commands to that device to be executed when a periodic “refresh” of the observation is triggered by the device and the NAT channel is granted (usually for just 30 seconds). When the NAT session expires the next UDP packet from the device is with different port and probably different host. With default Network config this breaks the registration matching but luckily this can be overcome with some coapConfig.setString(NetworkConfig.Keys.RESPONSE_MATCHING,"PRINCIPAL");
and timeout tweaking. Yet in the current code the registration identity is immutable and never changes but this does not reflect the reality in our scenario and when the NAT session is recreated you should “talk” to the identity of the coap responce and not to the original registration identity. I’ve managed to device a minimal change to the current code base that allow proper communication in our scenario. The commit that does the trick is here:
https://github.com/sdrsdr/leshan/commit/6d569616e52c9d151eaddef4199fbf8922fa7d23
If there is a interest in this patch I can do a proper PR 😃
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (7 by maintainers)
Top GitHub Comments
You could also have a look to this #854 PR I just created.
@sdrsdr, if you can maybe you could add Allterco as Leshan adopters ? https://github.com/eclipse/leshan/issues/830