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
498 stars 374 forks source link

Client SEND operation does not use fragmentation leading to oversized CoAP packets #770

Open sergioGras opened 5 months ago

sergioGras commented 5 months ago

Description

I encountered an issue where the client SEND operation does not use the existing fragmentation logic implemented for server WRITE operation. This results in the creation of oversized CoAP packet when large payloads are sent, which the server then rejects due to exceeding the maximum packet size limit.

Steps to Reproduce

  1. Start the server and example client.
  2. Add a new resource that exceeds the 2048 byte limit.
  3. Attempt to send the resource from the client using the SEND method (lwm2m_send).
  4. Observe that the payload is not fragmented and is sent in a single large CoAP packet.

Expected Behavior

The client SEND operation should fragment large payloads into multiple CoAP packets, similar to how the server-side WRITE operation handles them.

Possible Fix

The issue can be resolved by utilizing the _transaction_setpayload method in the _lwm2msend method, similar to its usage in the server WRITE operation, instead of the currently used _coap_setpayload.