eclipse-leshan / leshan

Java Library for LWM2M
https://www.eclipse.org/leshan/
BSD 3-Clause "New" or "Revised" License
652 stars 407 forks source link

Response code 2.31 treated as invalid on WriteRequest #494

Closed danielhqv closed 6 years ago

danielhqv commented 6 years ago

We're facing an issue were one of our clients (using Wakaama) is returning 2.31 response codes on Block transfer writes. As far as I can see this is a valid response for block transfers, but it is rejected in LwM2mResponseBuilder since it only accepts CHANGED 2.04 as response for WriteRequests.

Is this correct behavior by Leshan?

sbernard31 commented 6 years ago

Blockwise transfer should done transparently by Californium. So a 2.31 response should not go up to the Leshan Layer.

Could you share the wireshark/tpcdump capture ? This could help to understand the issue.

Which version of Leshan/Californium are you using ?

danielhqv commented 6 years ago

I'll see if my colleague that is working on the client can fix that. But the 2.31 response is mentioned several times in the LwM2m spec, doesn't the example in section E.6.2 indicate that a Lwm2m client correctly could return a 2.31?

sbernard31 commented 6 years ago

Returning a 2.31 code is ok. But when californium get this code it will return a new block request until it get the complete payload. Then it will create an "artificial" 2.04 response which will be passed to the Leshan stack.

So the client is authorized to send 2.31 response and californium should handle it correctly and hide it to Leshan.

My understanding is that if Leshan get this kind of response this means there is an issue somewhere, maybe at client side maybe at californium side.

danielhqv commented 6 years ago

OK, thanks for the clarification. We're going to investigate this further, I'll open a new issue if necessary.