Skip to content

Commit 534c7f2

Browse files
Juha Heiskanencarlescufi
authored andcommitted
net: lwm2m: Fixed LwM2M message wrong error response
LwM2M was not reported properly case when message "Accept" coap option was not not supported. In that case LwM2M transport specification define 4.06 "Not Accepted" Signed-off-by: Juha Heiskanen <[email protected]>
1 parent d835c1b commit 534c7f2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

subsys/net/lib/lwm2m/lwm2m_message_handling.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ static int select_writer(struct lwm2m_output_context *out, uint16_t accept)
618618

619619
default:
620620
LOG_WRN("Unknown content type %u", accept);
621-
return -ENOMSG;
621+
return -ECANCELED;
622622
}
623623

624624
return 0;
@@ -2100,6 +2100,8 @@ int handle_request(struct coap_packet *request, struct lwm2m_message *msg)
21002100
msg->code = COAP_RESPONSE_CODE_UNSUPPORTED_CONTENT_FORMAT;
21012101
} else if (r == -EACCES) {
21022102
msg->code = COAP_RESPONSE_CODE_UNAUTHORIZED;
2103+
} else if (r == -ECANCELED) {
2104+
msg->code = COAP_RESPONSE_CODE_NOT_ACCEPTABLE;
21032105
} else {
21042106
/* Failed to handle the request */
21052107
msg->code = COAP_RESPONSE_CODE_INTERNAL_ERROR;

0 commit comments

Comments
 (0)