Bluetooth: Mesh: Check if app key is bound in Model Publication Set

Th Configuration Server should respond with and Invalid AppKey Index
status code when the AppKey identified by AppKeyIndex is not known to
the node or is not bound to the model identified by the ModelIdentifier.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
This commit is contained in:
Michał Narajowski 2021-09-07 13:14:48 +02:00 committed by Anas Nashif
commit 343c0bd2d3
3 changed files with 5 additions and 4 deletions

View file

@ -216,7 +216,7 @@ static uint8_t _mod_pub_set(struct bt_mesh_model *model, uint16_t pub_addr,
return STATUS_SUCCESS;
}
if (!bt_mesh_app_key_exists(app_idx)) {
if (!bt_mesh_app_key_exists(app_idx) || !bt_mesh_model_has_key(model, app_idx)) {
return STATUS_INVALID_APPKEY;
}