mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-20 19:57:56 +00:00
host/mesh: Store network at the end of provisioning
After #31176, the network would get stored immediately in bt_mesh_net_create, causing the address and devicekey to get stored as their zero-initialized version, as they're only being set in the bt_mesh_comp_provision call, which fires after. This is port of a281d10cff8d0e626fcc31897649f4312c794a4e
This commit is contained in:
committed by
Krzysztof Kopyściński
parent
0c6d730e7a
commit
94b3c4a9d3
@@ -134,6 +134,10 @@ int bt_mesh_provision(const uint8_t net_key[16], uint16_t net_idx,
|
||||
bt_mesh_lpn_group_add(BT_MESH_ADDR_ALL_NODES);
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
|
||||
bt_mesh_net_pending_net_store();
|
||||
}
|
||||
|
||||
bt_mesh_start();
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -137,11 +137,6 @@ static void msg_cache_add(struct bt_mesh_net_rx *rx)
|
||||
msg_cache_next %= ARRAY_SIZE(msg_cache);
|
||||
}
|
||||
|
||||
static void store_net(void)
|
||||
{
|
||||
bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_NET_PENDING);
|
||||
}
|
||||
|
||||
static void store_iv(bool only_duration)
|
||||
{
|
||||
bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_IV_PENDING);
|
||||
@@ -197,7 +192,6 @@ int bt_mesh_net_create(uint16_t idx, uint8_t flags, const uint8_t key[16],
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
|
||||
BT_DBG("Storing network information persistently");
|
||||
store_net();
|
||||
bt_mesh_subnet_store(idx);
|
||||
store_iv(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user