Skip to content

Commit 85e7818

Browse files
PavelVPVcarlescufi
authored andcommitted
Bluetooth: Mesh: Don't process unprovisioned beacon without callback
If `struct bt_mesh_prov::unprovisioned_beacon` callback is not set, don't process the beacon. Signed-off-by: Pavel Vasilyev <[email protected]>
1 parent 20b7881 commit 85e7818

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

subsys/bluetooth/mesh/beacon.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ static void unprovisioned_beacon_recv(struct net_buf_simple *buf)
193193
uint32_t uri_hash_val;
194194
uint32_t *uri_hash = NULL;
195195

196+
prov = bt_mesh_prov_get();
197+
198+
if (!prov->unprovisioned_beacon) {
199+
return;
200+
}
201+
196202
if (buf->len != 18 && buf->len != 22) {
197203
BT_ERR("Invalid unprovisioned beacon length (%u)", buf->len);
198204
return;
@@ -208,13 +214,9 @@ static void unprovisioned_beacon_recv(struct net_buf_simple *buf)
208214

209215
BT_DBG("uuid %s", bt_hex(uuid, 16));
210216

211-
prov = bt_mesh_prov_get();
212-
213-
if (prov->unprovisioned_beacon) {
214-
prov->unprovisioned_beacon(uuid,
215-
(bt_mesh_prov_oob_info_t)oob_info,
216-
uri_hash);
217-
}
217+
prov->unprovisioned_beacon(uuid,
218+
(bt_mesh_prov_oob_info_t)oob_info,
219+
uri_hash);
218220
}
219221

220222
static void sub_update_beacon_observation(struct bt_mesh_subnet *sub)

0 commit comments

Comments
 (0)