Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoAP Packet Deduplication #791

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mlasch
Copy link
Contributor

@mlasch mlasch commented Jun 19, 2024

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.

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.
Test CoAP message deduplication functions.
@mlasch mlasch requested a review from LukasWoodtli June 19, 2024 12:00
@boaks
Copy link

boaks commented Jun 19, 2024

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

@@ -817,6 +817,8 @@ typedef int (*lwm2m_bootstrap_callback_t)(lwm2m_context_t *contextP, void *sessi
void *userData);
#endif

typedef struct _coap_msg_dedup_ coap_msg_dedup_t;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear if this really belongs here. Probably it does together with the complete struct definition as we need it in the context. But then it should probably be prefixed by lwm2m_

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to store the list somewhere, the lwm2m context was the easiest place, for that I needed this forward declaration. The message duplication tracking list is an implementation detail of the CoAP layer and might fit better there. The context structure was available everywhere I needed access though. Problem is, there is no clean separation between LwM2M and CoAP in Wakaama.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we don't have that nice separation between CoAP and LwM2M. But the forward declaration doesn't work properly together with the typedef.

@mlasch
Copy link
Contributor Author

mlasch commented Jun 19, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants