-
Notifications
You must be signed in to change notification settings - Fork 407
LWM2M Devices with Dynamic IP
LWM2M specification supports dynamic IP environment use cases like devices behind a NAT.
A specification compliant way to support a device which could change its IP address/port is :
- Devices should use Queue Mode (device initiated communication).
- When devices wake up/come back,
- At DTLS level, devices must do a new
handshake
(full or abbreviated) or useconnection-Id
. - At LWM2M level, devices should start its communication with an
Update
request.
- At DTLS level, devices must do a new
- When server receives the
Update
, it will update the registration using the new IP address/port, then it can send pending requests for this devices.
For more details, see LWM2M-v1.1.1@transport§6.5. Queue Mode Operation
This should be OK with Leshan, you should look at LWM2M-Observe#requestnotifications-matching
Using Queue mode, this is mandatory and this Update
request MUST be done before any other communications. If device doesn't do it, its registration will not be updated on Notification
or Send
requests which could lead to some behavior issue at Leshan side.
You SHOULD fix your device behavior because it doesn't fully comply the LWM2M specification and so could lead to interoperability issue.
If you think the specification should be modified, you could try to open an issue at : https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues but you should probably read this before : https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues/555.
If you can not fix your device (this doesn't smell good), you can mitigate issue by configuring Leshan to update registration on Notification
or Send
Request. The drawback is that will increase write access to RegistrationStore
as each Notification or Send request reception will lead to an extra write access.
For Notification
:
Since Leshan v1.1
, you can activate a Update Registration On Notification
mode (Not recommended).
This mode can be activated via : leshanServerBuilder.setUpdateRegistrationOnNotification(true);
If you don't use DTLS and use Californium provider for CoAP (coap://
), you probably need to use a the Relaxed response matching mode too.
coapConfig.setString(NetworkConfig.Keys.RESPONSE_MATCHING, "RELAXED");
See LWM2M-Observe#for-udp-without-security
For Send
request:
Since Leshan v2.0.0-M14
, you can active Update Registration On Send Request
mode (Not recommended).
This mode can be activated via : LeshanServerBuilder.setUpdateRegistrationOnSend(true);
Note Update Registration On Send Request
only works when using protocol with authentication, e.g. this can not work with coap://
.
All contributions you make to our web site (including this wiki) are governed by our Terms of Use, so please take the time to actually read it. Your interactions with the Eclipse Foundation web properties and any information you may provide us about yourself are governed by our Privacy Policy.