Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: Mesh: Node Reset Not Clear Bind Key Information #21379

Closed
LingaoM opened this issue Dec 13, 2019 · 3 comments
Closed

Bluetooth: Mesh: Node Reset Not Clear Bind Key Information #21379

LingaoM opened this issue Dec 13, 2019 · 3 comments
Labels
area: Bluetooth Mesh bug The issue is a bug, or the PR is fixing a bug

Comments

@LingaoM
Copy link
Collaborator

LingaoM commented Dec 13, 2019

After receive node reset message, local node exec bt_mesh_reset
mod->flag will be fill in some values, but bt_mesh_comp_unprovision clear those mod->flag cause

static void store_pending_mod(struct bt_mesh_model *mod,
struct bt_mesh_elem *elem, bool vnd,
bool primary, void *user_data)
{
if (!mod->flags) {
return;
}
if (mod->flags & BT_MESH_MOD_BIND_PENDING) {
mod->flags &= ~BT_MESH_MOD_BIND_PENDING;
store_pending_mod_bind(mod, vnd);
}
if (mod->flags & BT_MESH_MOD_SUB_PENDING) {
mod->flags &= ~BT_MESH_MOD_SUB_PENDING;
store_pending_mod_sub(mod, vnd);
}
if (mod->flags & BT_MESH_MOD_PUB_PENDING) {
mod->flags &= ~BT_MESH_MOD_PUB_PENDING;
store_pending_mod_pub(mod, vnd);
}
not executed.
void bt_mesh_reset(void)
{
if (!atomic_test_bit(bt_mesh.flags, BT_MESH_VALID)) {
return;
}
bt_mesh.iv_index = 0U;
bt_mesh.seq = 0U;
memset(bt_mesh.flags, 0, sizeof(bt_mesh.flags));
k_delayed_work_cancel(&bt_mesh.ivu_timer);
bt_mesh_cfg_reset();
bt_mesh_rx_reset();
bt_mesh_tx_reset();
if (IS_ENABLED(CONFIG_BT_MESH_LOW_POWER)) {
bt_mesh_lpn_disable(true);
}
if (IS_ENABLED(CONFIG_BT_MESH_FRIEND)) {
bt_mesh_friend_clear_net_idx(BT_MESH_KEY_ANY);
}
if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
bt_mesh_proxy_gatt_disable();
}
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
bt_mesh_clear_net();
}
(void)memset(bt_mesh.dev_key, 0, sizeof(bt_mesh.dev_key));
bt_mesh_scan_disable();
bt_mesh_beacon_disable();
bt_mesh_comp_unprovision();
if (IS_ENABLED(CONFIG_BT_MESH_PROV)) {
bt_mesh_prov_reset();
}

void bt_mesh_comp_unprovision(void)
{
BT_DBG("");
dev_primary_addr = BT_MESH_ADDR_UNASSIGNED;
bt_mesh_model_foreach(mod_init, NULL);
}
u16_t bt_mesh_primary_addr(void)
{
return dev_primary_addr;
}

@LingaoM LingaoM added the bug The issue is a bug, or the PR is fixing a bug label Dec 13, 2019
@aescolar
Copy link
Member

CC @jhedberg

@jhedberg
Copy link
Member

@LingoMeng so you're saying the model configuration doesn't end up being removed from flash although the rest of the network configuration is? Are you planning to submit a PR for this? Btw, I didn't see you quote the exact place where mod->flags gets cleared. Your second quote contains bt_dev.flags which is a different variable. @trond-snekvik FYI.

@LingaoM
Copy link
Collaborator Author

LingaoM commented Dec 13, 2019

Sorry, maybe I initialized this value in the model initialization callback. model_init[i].init,

@LingaoM LingaoM closed this as completed Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Mesh bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

No branches or pull requests

3 participants