From d1c75df86007c2cf26ae99f992bdd719813fb931 Mon Sep 17 00:00:00 2001 From: Prasad Alatkar Date: Tue, 5 Jan 2021 20:19:09 +0530 Subject: [PATCH] NimBLE host: Modify `ble_gap_wl_set` to support clearing complete whitelist * Modify test case `*_wl_bad_args` to accept 0 whitelist entries. --- nimble/host/src/ble_gap.c | 5 ----- nimble/host/test/src/ble_gap_test.c | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c index 17ff4eae0..7eb9d36f2 100644 --- a/nimble/host/src/ble_gap.c +++ b/nimble/host/src/ble_gap.c @@ -2246,11 +2246,6 @@ ble_gap_wl_set(const ble_addr_t *addrs, uint8_t white_list_count) ble_hs_lock(); - if (white_list_count == 0) { - rc = BLE_HS_EINVAL; - goto done; - } - for (i = 0; i < white_list_count; i++) { if (addrs[i].type != BLE_ADDR_PUBLIC && addrs[i].type != BLE_ADDR_RANDOM) { diff --git a/nimble/host/test/src/ble_gap_test.c b/nimble/host/test/src/ble_gap_test.c index 7496e3168..876ef8f25 100644 --- a/nimble/host/test/src/ble_gap_test.c +++ b/nimble/host/test/src/ble_gap_test.c @@ -449,9 +449,10 @@ TEST_CASE_SELF(ble_gap_test_case_wl_bad_args) ble_gap_test_util_init(); - /*** 0 white list entries. */ + /*** 0 white list entries. This is acceptable now with the wl_set API + * change. */ rc = ble_hs_test_util_wl_set(NULL, 0, 0, 0); - TEST_ASSERT(rc == BLE_HS_EINVAL); + TEST_ASSERT(rc == 0); /*** Invalid address type. */ rc = ble_hs_test_util_wl_set(