Skip to content

Commit c21372e

Browse files
rbtchcjukkar
authored andcommitted
net: lwm2m: do not expose security object
According to LwM2M specification 5.2.7.3 Bootstrap DISOCVER, security object is only reported to the bootstrap server. Correct the behavior to (1) report server object to the server (2) do not report security object at registration time Signed-off-by: Robert Chou <[email protected]>
1 parent ede588a commit c21372e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

subsys/net/lib/lwm2m/lwm2m_engine.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,11 @@ u16_t lwm2m_get_rd_data(u8_t *client_data, u16_t size)
586586
int len;
587587

588588
SYS_SLIST_FOR_EACH_CONTAINER(&engine_obj_list, obj, node) {
589+
/* Security obj MUST NOT be part of registration message */
590+
if (obj->obj_id == LWM2M_OBJECT_SECURITY_ID) {
591+
continue;
592+
}
593+
589594
len = snprintf(temp, sizeof(temp), "%s</%u>",
590595
(pos > 0) ? "," : "", obj->obj_id);
591596
if (pos + len >= size) {
@@ -1816,8 +1821,10 @@ static int do_discover_op(struct lwm2m_engine_context *context)
18161821
out->outlen += strlen(DISCOVER_PREFACE);
18171822

18181823
SYS_SLIST_FOR_EACH_CONTAINER(&engine_obj_inst_list, obj_inst, node) {
1819-
/* avoid discovery for security and server objects */
1820-
if (obj_inst->obj->obj_id <= LWM2M_OBJECT_SERVER_ID) {
1824+
/* TODO: support bootstrap discover
1825+
* Avoid discovery for security object (5.2.7.3)
1826+
*/
1827+
if (obj_inst->obj->obj_id == LWM2M_OBJECT_SECURITY_ID) {
18211828
continue;
18221829
}
18231830

0 commit comments

Comments
 (0)