mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
ble_mesh: stack: Fix kr from non-primary subnet shouldn't ignore
For case MESH/NODE/KR/BV-02-C
This commit is contained in:
@@ -374,9 +374,19 @@ static void secure_beacon_recv(struct net_buf_simple *buf)
|
|||||||
|
|
||||||
cache_add(data, sub);
|
cache_add(data, sub);
|
||||||
|
|
||||||
/* If we have NetKey0 accept initiation only from it */
|
/* Spec v1.0.1, Section 3.8.4:
|
||||||
|
* If a node on a primary subnet receives an update on
|
||||||
|
* the primary subnet, it shall propagate the IV update
|
||||||
|
* to all other subnets. If a node on a primary subnet
|
||||||
|
* receives an IV update on any other subnet, the update
|
||||||
|
* shall be ignored.
|
||||||
|
* If a node on a primary subnet receives an key update
|
||||||
|
* on any other subnet, the update shall not be ignored.
|
||||||
|
*/
|
||||||
if (bt_mesh_primary_subnet_exist() &&
|
if (bt_mesh_primary_subnet_exist() &&
|
||||||
sub->net_idx != BLE_MESH_KEY_PRIMARY) {
|
sub->net_idx != BLE_MESH_KEY_PRIMARY &&
|
||||||
|
BLE_MESH_IV_UPDATE(flags) &&
|
||||||
|
!BLE_MESH_KEY_REFRESH(flags)) {
|
||||||
BT_WARN("Ignoring secure beacon on non-primary subnet");
|
BT_WARN("Ignoring secure beacon on non-primary subnet");
|
||||||
goto update_stats;
|
goto update_stats;
|
||||||
}
|
}
|
||||||
@@ -390,7 +400,15 @@ static void secure_beacon_recv(struct net_buf_simple *buf)
|
|||||||
bt_mesh_beacon_ivu_initiator(false);
|
bt_mesh_beacon_ivu_initiator(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
iv_change = bt_mesh_net_iv_update(iv_index, BLE_MESH_IV_UPDATE(flags));
|
/* If a node on a primary subnet receives an IV update on any other subnet,
|
||||||
|
* the IV update shall be ignored. And if a node on a non-primary subnet
|
||||||
|
* receives an IV update on primary subnet, the IV update shall be ignored,
|
||||||
|
* because it doesn't have a primary network key.
|
||||||
|
*/
|
||||||
|
if ((bt_mesh_primary_subnet_exist() && sub->net_idx == BLE_MESH_KEY_PRIMARY) ||
|
||||||
|
(!bt_mesh_primary_subnet_exist() && sub->net_idx != BLE_MESH_KEY_PRIMARY)) {
|
||||||
|
iv_change = bt_mesh_net_iv_update(iv_index, BLE_MESH_IV_UPDATE(flags));
|
||||||
|
}
|
||||||
|
|
||||||
kr_change = bt_mesh_kr_update(sub, BLE_MESH_KEY_REFRESH(flags), new_key);
|
kr_change = bt_mesh_kr_update(sub, BLE_MESH_KEY_REFRESH(flags), new_key);
|
||||||
if (kr_change) {
|
if (kr_change) {
|
||||||
|
Reference in New Issue
Block a user