eclipse-wakaama / wakaama

Eclipse Wakaama is a C implementation of the Open Mobile Alliance's LightWeight M2M protocol (LWM2M).
BSD 3-Clause "New" or "Revised" License
492 stars 373 forks source link

CoAP Packet Deduplication #791

Open mlasch opened 3 weeks ago

mlasch commented 3 weeks ago

According to rfc 7252, section "4.5. Message Deduplication", duplicate received packets must be dropped. Also "The recipient SHOULD acknowledge each duplicate copy of a Confirmable message using the same Acknowledgement or Reset message [...]".

Wakaama identifies a duplicate message based on the message id and the session it was received from. Duplicate messages are then processed only once for the first message, subsequent messages are acked with the corresponding CoAP response code, but not processed further. Duplicate messages are ignored for a predefined time period EXCHANGE_LIFETIME.

boaks commented 3 weeks ago

If the response has payload, also that payload is intended to be sent back in cases of deduplication, not only the response code.

mlasch commented 3 weeks ago

If the response has payload, also that payload is intended to be sent back in cases of deduplication, not only the response code.

ok, this means we have to store the whole response message with content type etc. to properly answer duplicate messages. This will consume quite some amount of memory. But I agree, it makes sense.