If a known appkey is added for a different netkey, the status reply
should be Invalid NetKey.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
key = l_queue_find(app_keys, match_key_index, L_UINT_TO_PTR(app_idx));
if (key) {
- if (memcmp(new_key, key->key, 16) == 0)
+ if (key->net_idx != net_idx)
+ return MESH_STATUS_INVALID_NETKEY;
+ else if (memcmp(new_key, key->key, 16) == 0)
return MESH_STATUS_SUCCESS;
else
return MESH_STATUS_IDX_ALREADY_STORED;