Bluetooth: Mesh: Add a flag for DevKey-only based models
This prevents a Configuration Client from binding an app key to a model that only supports DevKey-based security. Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
This commit is contained in:
parent
7f1b296a0c
commit
08f0d1c742
4 changed files with 15 additions and 11 deletions
|
@ -1893,9 +1893,9 @@ static int mod_app_bind(struct bt_mesh_model *model,
|
|||
goto send_status;
|
||||
}
|
||||
|
||||
/* Configuration Server only allows device key based access */
|
||||
if (model == mod) {
|
||||
LOG_ERR("Client tried to bind AppKey to Configuration Model");
|
||||
/* Some models only allow device key based access */
|
||||
if (mod->flags & BT_MESH_MOD_DEVKEY_ONLY) {
|
||||
LOG_ERR("Client tried to bind AppKey to DevKey based model");
|
||||
status = STATUS_CANNOT_BIND;
|
||||
goto send_status;
|
||||
}
|
||||
|
@ -2535,6 +2535,7 @@ static int cfg_srv_init(struct bt_mesh_model *model)
|
|||
* device-key is allowed to access this model.
|
||||
*/
|
||||
model->keys[0] = BT_MESH_KEY_DEV_LOCAL;
|
||||
model->flags |= BT_MESH_MOD_DEVKEY_ONLY;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue