From 9acfc7fb5cef07c5fcfdfc2d4775e257f15b60fa Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 31 Jan 2018 08:49:13 +0100 Subject: [PATCH] Bluetooth: controller: Fix to restrict addr set in initiator Fix controller implementation to restrict HCI LE Set Random Address command when advertising and/or active scanning and/or initiator state is enable. Fixes LL.TS.5.0.2 conformance tests: LL/CON/INI/BV-01-C [Connection Initiation] LL/SEC/ADV/BV-01-C [Advertising With Static Address] LL/SEC/SCN/BV-01-C [Random Address Scanning] Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ctrl.c | 4 +++- subsys/bluetooth/controller/ll_sw/ll_addr.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.c b/subsys/bluetooth/controller/ll_sw/ctrl.c index c69b7088e55..7a036c571b4 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.c +++ b/subsys/bluetooth/controller/ll_sw/ctrl.c @@ -10250,8 +10250,10 @@ u32_t radio_scan_is_enabled(void) { /* NOTE: BIT(0) - passive scanning enabled * BIT(1) - active scanning enabled + * BIT(2) - initiator enabled */ - return (u32_t)_radio.scanner.is_enabled << _radio.scanner.type; + return ((u32_t)_radio.scanner.is_enabled << _radio.scanner.type) | + (_radio.scanner.conn ? BIT(2) : 0); } u32_t radio_scan_filter_pol_get(void) diff --git a/subsys/bluetooth/controller/ll_sw/ll_addr.c b/subsys/bluetooth/controller/ll_sw/ll_addr.c index 7e2aa30e05e..cea0218f077 100644 --- a/subsys/bluetooth/controller/ll_sw/ll_addr.c +++ b/subsys/bluetooth/controller/ll_sw/ll_addr.c @@ -43,7 +43,7 @@ u8_t *ll_addr_get(u8_t addr_type, u8_t *bdaddr) u32_t ll_addr_set(u8_t addr_type, u8_t const *const bdaddr) { if (radio_adv_is_enabled() || - (radio_scan_is_enabled() & BIT(1))) { + (radio_scan_is_enabled() & (BIT(1) | BIT(2)))) { return BT_HCI_ERR_CMD_DISALLOWED; }