Skip to content

Commit 5052814

Browse files
committed
[nrf noup] bluetooth: host: fix compilation of auto-swap feature
This is a follow up commit for 93b8dd9 where auto-swap feature was added. This commit fixes compilation of Host without the feature enabled. nrf-squash! [nrf noup] bluetooth: host: Add support for bonding with same peer Signed-off-by: Pavel Vasilyev <[email protected]>
1 parent a6a46c9 commit 5052814

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

subsys/bluetooth/host/keys.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ void bt_keys_clear(struct bt_keys *keys)
325325

326326
LOG_DBG("%s (keys 0x%04x)", bt_addr_le_str(&keys->addr), keys->keys);
327327

328-
if ((keys->flags & BT_KEYS_ID_CONFLICT) != 0) {
328+
if (IS_ENABLED(CONFIG_BT_ID_AUTO_SWAP_MATCHING_BONDS) &&
329+
(keys->flags & BT_KEYS_ID_CONFLICT) != 0) {
329330
/* We need to check how many conflicting keys left. If there is only one conflicting
330331
* key left, we can remove the BT_KEYS_ID_CONFLICT flag from it so that Host don't
331332
* need to check and update the Resolving List whenever this is needed. The key

tests/bluetooth/host/id/mocks/adv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ DEFINE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_legacy, struct bt_le_ext_adv *,
1515
DEFINE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_ext, struct bt_le_ext_adv *, bool,
1616
const struct bt_le_ext_adv_start_param *);
1717
DEFINE_FAKE_VOID_FUNC(bt_le_ext_adv_foreach, bt_le_ext_adv_foreach_cb, void *);
18+
DEFINE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_adv_lookup_by_id, uint8_t);

tests/bluetooth/host/id/mocks/adv.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ typedef void (*bt_le_ext_adv_foreach_cb)(struct bt_le_ext_adv *adv, void *data);
1818
FAKE(bt_le_adv_lookup_legacy) \
1919
FAKE(bt_le_ext_adv_get_index) \
2020
FAKE(bt_le_adv_set_enable_ext) \
21-
FAKE(bt_le_ext_adv_foreach)
21+
FAKE(bt_le_ext_adv_foreach) \
22+
FAKE(bt_adv_lookup_by_id)
2223

2324
DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable, struct bt_le_ext_adv *, bool);
2425
DECLARE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_le_adv_lookup_legacy);
@@ -27,3 +28,4 @@ DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_legacy, struct bt_le_ext_adv *
2728
DECLARE_FAKE_VALUE_FUNC(int, bt_le_adv_set_enable_ext, struct bt_le_ext_adv *, bool,
2829
const struct bt_le_ext_adv_start_param *);
2930
DECLARE_FAKE_VOID_FUNC(bt_le_ext_adv_foreach, bt_le_ext_adv_foreach_cb, void *);
31+
DECLARE_FAKE_VALUE_FUNC(struct bt_le_ext_adv *, bt_adv_lookup_by_id, uint8_t);

tests/bluetooth/host/id/mocks/keys.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010

1111
DEFINE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_find_irk, uint8_t, const bt_addr_le_t *);
1212
DEFINE_FAKE_VOID_FUNC(bt_keys_foreach_type, enum bt_keys_type, bt_keys_foreach_type_cb, void *);
13+
DEFINE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_get_addr, uint8_t, const bt_addr_le_t *);

tests/bluetooth/host/id/mocks/keys.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ typedef void (*bt_keys_foreach_type_cb)(struct bt_keys *keys, void *data);
1515
/* List of fakes used by this unit tester */
1616
#define KEYS_FFF_FAKES_LIST(FAKE) \
1717
FAKE(bt_keys_find_irk) \
18-
FAKE(bt_keys_foreach_type)
18+
FAKE(bt_keys_foreach_type) \
19+
FAKE(bt_keys_get_addr)
1920

2021
DECLARE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_find_irk, uint8_t, const bt_addr_le_t *);
2122
DECLARE_FAKE_VOID_FUNC(bt_keys_foreach_type, enum bt_keys_type, bt_keys_foreach_type_cb, void *);
23+
DECLARE_FAKE_VALUE_FUNC(struct bt_keys *, bt_keys_get_addr, uint8_t, const bt_addr_le_t *);

0 commit comments

Comments
 (0)