net: lwm2m: Fix Server Object SSID access

Server Object SSID should only have Read access.
LightweightM2M-1.1-int-256 confirmance test validate
that write operation to SSID should return error.
Overwrite SSID affect dead block for lwm2m engine and
only reset will heal.

Fix by adding bootstrap overwrite access for Security and
Server object when bootstrap is active.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
This commit is contained in:
Juha Heiskanen 2022-02-01 02:45:52 -08:00 committed by Carles Cufí
commit a03deb8ef3
6 changed files with 24 additions and 9 deletions

View file

@ -2485,6 +2485,21 @@ static int lwm2m_write_handler_opaque(struct lwm2m_engine_obj_inst *obj_inst,
return opaque_ctx.len;
}
bool lwm2m_engine_bootstrap_override(struct lwm2m_ctx *client_ctx, struct lwm2m_obj_path *path)
{
if (!client_ctx->bootstrap_mode) {
/* Bootstrap is not active override is not possible then */
return false;
}
if (path->obj_id == LWM2M_OBJECT_SECURITY_ID || path->obj_id == LWM2M_OBJECT_SERVER_ID) {
/* Bootstrap server have a access to Security and Server object */
return true;
}
return false;
}
/* This function is exposed for the content format writers */
int lwm2m_write_handler(struct lwm2m_engine_obj_inst *obj_inst,
struct lwm2m_engine_res *res,