When an AppKey is deleted from a node, the configuration update
is sent to the element model only if the model was bound to this
AppKey.
---
mesh/model.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mesh/model.c b/mesh/model.c
index acdd94f7b..d998a9caa 100644
--- a/mesh/model.c
+++ b/mesh/model.c
@@ -650,7 +650,7 @@ static void model_unbind_idx(struct mesh_node *node, struct mesh_model *mod,
/* Internal model */
mod->cbs->bind(idx, ACTION_DELETE);
- if (mod->pub && idx != mod->pub->idx)
+ if (!mod->pub || idx != mod->pub->idx)
return;
/* Remove model publication if the publication key is unbound */
@@ -1319,7 +1319,8 @@ void mesh_model_app_key_delete(struct mesh_node *node, struct l_queue *models,
for (; entry; entry = entry->next) {
struct mesh_model *model = entry->data;
- model_unbind_idx(node, model, app_idx);
+ if (has_binding(model->bindings, app_idx))
+ model_unbind_idx(node, model, app_idx);
}
}
--
2.21.0