Bluetooth: Mesh: Fix creating initial beacon data

There was a chance that initial beacons for subnets would be sent with
uninitialized data. Make sure we initialize the beacon data each time
when we create a new subnet.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2017-11-25 09:46:51 +02:00 committed by Johan Hedberg
commit 6e2a3863ac
2 changed files with 6 additions and 0 deletions

View file

@ -1936,6 +1936,9 @@ static void net_key_add(struct bt_mesh_model *model,
sub->net_idx = idx;
/* Make sure we have valid beacon data to be sent */
bt_mesh_net_beacon_update(sub);
if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
sub->node_id = BT_MESH_NODE_IDENTITY_STOPPED;
bt_mesh_proxy_beacon_send(sub);

View file

@ -477,6 +477,9 @@ int bt_mesh_net_create(u16_t idx, u8_t flags, const u8_t key[16],
/* Set initial IV Update procedure state time-stamp */
bt_mesh.last_update = k_uptime_get();
/* Make sure we have valid beacon data to be sent */
bt_mesh_net_beacon_update(sub);
return 0;
}