forked from espressif/esp-idf
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) {
|
||||||
|
@ -252,7 +252,7 @@ static uint8_t _mod_pub_set(struct bt_mesh_model *model, uint16_t pub_addr,
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For case MESH/NODE/CFG/MP/BI-03-C, need to check if appkey
|
/* For case MESH/NODE/CFG/MP/BI-03-C, need to check if appkey
|
||||||
* is bound to model identified by the ModelIdentifier.
|
* is bound to model identified by the ModelIdentifier.
|
||||||
*/
|
*/
|
||||||
if (!bt_mesh_app_key_find(app_idx) ||
|
if (!bt_mesh_app_key_find(app_idx) ||
|
||||||
|
@ -1672,7 +1672,7 @@ int bt_mesh_pb_gatt_recv(struct bt_mesh_conn *conn, struct net_buf_simple *buf)
|
|||||||
|
|
||||||
/* For case MESH/NODE/PROV/BI-03-C, if the link is closed, when the node receive
|
/* For case MESH/NODE/PROV/BI-03-C, if the link is closed, when the node receive
|
||||||
* a Provisioning PDU , it will send a Provisioning Failed PDU with the Error Code
|
* a Provisioning PDU , it will send a Provisioning Failed PDU with the Error Code
|
||||||
* field set to Unexpected PDU(0x03).
|
* field set to Unexpected PDU(0x03).
|
||||||
*/
|
*/
|
||||||
if (bt_mesh_atomic_test_bit(link.flags, LINK_INVALID)) {
|
if (bt_mesh_atomic_test_bit(link.flags, LINK_INVALID)) {
|
||||||
BT_WARN("Unexpected msg 0x%02x on invalid link", type);
|
BT_WARN("Unexpected msg 0x%02x on invalid link", type);
|
||||||
|
Reference in New Issue
Block a user