diff --git a/nimble/host/mesh/src/net.c b/nimble/host/mesh/src/net.c index 410074c64..861271a74 100644 --- a/nimble/host/mesh/src/net.c +++ b/nimble/host/mesh/src/net.c @@ -558,7 +558,7 @@ void bt_mesh_rpl_reset(void) } } -void bt_mesh_iv_update(u32_t iv_index, bool iv_update) +bool bt_mesh_iv_update(u32_t iv_index, bool iv_update) { int i; @@ -568,13 +568,13 @@ void bt_mesh_iv_update(u32_t iv_index, bool iv_update) if (iv_index != bt_mesh.iv_index) { BT_WARN("IV Index mismatch: 0x%08x != 0x%08x", iv_index, bt_mesh.iv_index); - return; + return false; } if (iv_update) { /* Nothing to do */ BT_DBG("Already in IV Update in Progress state"); - return; + return false; } } else { /* We're currently in Normal mode */ @@ -583,7 +583,7 @@ void bt_mesh_iv_update(u32_t iv_index, bool iv_update) iv_index > bt_mesh.iv_index + 42) { BT_ERR("IV Index out of sync: " "0x%08x != 0x%08x", iv_index, bt_mesh.iv_index); - return; + return false; } if (iv_index > bt_mesh.iv_index + 1) { @@ -597,19 +597,19 @@ void bt_mesh_iv_update(u32_t iv_index, bool iv_update) if (iv_index == bt_mesh.iv_index + 1 && !iv_update) { BT_WARN("Ignoring new index in normal mode", iv_index, bt_mesh.iv_index); - return; + return false; } if (!iv_update) { /* Nothing to do */ BT_DBG("Already in Normal mode"); - return; + return false; } if (iv_index != bt_mesh.iv_index + 1) { BT_WARN("Wrong new IV Index: 0x%08x != 0x%08x + 1", iv_index, bt_mesh.iv_index); - return; + return false; } } @@ -618,7 +618,7 @@ void bt_mesh_iv_update(u32_t iv_index, bool iv_update) if (delta < K_HOURS(96)) { BT_WARN("IV Update before minimum duration"); - return; + return false; } } @@ -626,7 +626,7 @@ void bt_mesh_iv_update(u32_t iv_index, bool iv_update) if (!iv_update && bt_mesh_tx_in_progress()) { BT_WARN("IV Update deferred because of pending transfer"); bt_mesh.pending_update = 1; - return; + return false; } do_update: @@ -655,6 +655,8 @@ do_update: bt_mesh_net_beacon_update(&bt_mesh.sub[i]); } } + + return false; } int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct os_mbuf *buf, diff --git a/nimble/host/mesh/src/net.h b/nimble/host/mesh/src/net.h index 2ee860c71..2fd12b05c 100644 --- a/nimble/host/mesh/src/net.h +++ b/nimble/host/mesh/src/net.h @@ -279,7 +279,7 @@ bt_mesh_net_beacon_update(struct bt_mesh_subnet *sub); void bt_mesh_rpl_reset(void); -void +bool bt_mesh_iv_update(u32_t iv_index, bool iv_update); struct bt_mesh_subnet *