DTLS causes re-registration on LwM2M using mobile network

Hello Everyone,

Summary

Chip:

nRF52840

OS:

nRF Connect / Zephyr

Problem:

Mobile network connections cause LwM2M (with DTLS) to perform re-registration if the update interval is longer than ~3 minutes. 

Details

We're using LwM2M (with DTLS) to monitor / control our nRF52840 uC (connected via an openthread network [OT]).

Working Condition

When the OT boarder router is connected via a fixed connection (within a building) we can set an LwM2M update interval of 5 minutes with no problems. Registration occurs once and updates occur after that point.

Error Condition:

When the OT boarder router is connected via a mobile connection (aka sim) we can't set an LwM2M update interval to more than ~2-3 minutes. If we do set a longer interval for LwM2M all update requests timeout.

This causes the device to perform re-registrations, which has the following effects:

  • Increase data usage
  • Dropping in and out of the LwM2M server as the connection interval is longer than the expected life time.

Additionally if i disable DTLS encryption then LwM2M may have longer update intervals. 

Assumption of the issue

I'm assuming the issue is that the mobile operators network is closing / deleting the NAT entry after 2-3 minutes of no use. Which means the LwM2M server cannot identify the client via the IP+port, forcing the device to re-register / negotiate the DTLS encryption.

From what i've read the following solutions are plausible:

  • Replace DTLS encryption in for OSCORE.
    • Zephyr doesn't seem to have support for OSCORE yet, there is a module for it but its not in the LwM2M stack at-least.
  • Using DTLS 1.2 on the device and server. This allows the connection to be identified by the connection id CID.
    • I'm not sure what version of DTLS Zephyr uses.
  • Sending empty requests every 2 minutes to keep the port open.

Any help or advise on this issue would be great.

Thanks for your time!

Parents Reply
  • > Seems to me that CIDs should be included in the DTLS spec!

    For DTLS 1.3 that's the case. For DTLS 1.2 it's a extension.

    DTLS is not only intended for device communication. For video streaming or stuff like that it works without CID.

    > why nRF/Zephyr isn't using a version of mbedTLS which support CIDs

    That was requested 2020, see Zephyr / DTLS connection ID . One point was the last minute change in the RFC. And then it tokes a little longer until the final RFC9146 made it into mbedtls. Today someone announced, that he wants to implement DTLS 1.2 CID in pion/dtls - go . So hope, it gets more and more common.

Children
Related