nimble/controller: Fix for directed advertising report Whenever scan filtering is 0x02 and initA is not resolved RPA, we should send to host LE Direct Advertising Report event instead of LE Advertising Report. If InitA is not a RPA we should rather drop the adv packet.
With this patch we also stop to determine subevent type on own_address_type as this is not related. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/bf72b358 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/bf72b358 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/bf72b358 Branch: refs/heads/master Commit: bf72b358b0d79e37bb0ab8fc3240beacdb0f7c42 Parents: 28531b9 Author: Åukasz Rymanowski <lukasz.rymanow...@codecoup.pl> Authored: Mon Apr 3 15:42:06 2017 +0200 Committer: Åukasz Rymanowski <lukasz.rymanow...@codecoup.pl> Committed: Mon Apr 3 16:19:57 2017 +0200 ---------------------------------------------------------------------- net/nimble/controller/src/ble_ll_scan.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bf72b358/net/nimble/controller/src/ble_ll_scan.c ---------------------------------------------------------------------- diff --git a/net/nimble/controller/src/ble_ll_scan.c b/net/nimble/controller/src/ble_ll_scan.c index f5eca7f..4fa866c 100644 --- a/net/nimble/controller/src/ble_ll_scan.c +++ b/net/nimble/controller/src/ble_ll_scan.c @@ -404,12 +404,14 @@ ble_ll_hci_send_adv_report(uint8_t pdu_type, uint8_t txadd, uint8_t *rxbuf, inita = NULL; subev = BLE_HCI_LE_SUBEV_ADV_RPT; if (pdu_type == BLE_ADV_PDU_TYPE_ADV_DIRECT_IND) { - if (scansm->own_addr_type > BLE_HCI_ADV_OWN_ADDR_RANDOM) { - inita = rxbuf + BLE_LL_PDU_HDR_LEN + BLE_DEV_ADDR_LEN; - if ((inita[5] & 0x40) == 0x40) { - subev = BLE_HCI_LE_SUBEV_DIRECT_ADV_RPT; - } + inita = rxbuf + BLE_LL_PDU_HDR_LEN + BLE_DEV_ADDR_LEN; + if ((inita[5] & 0x40) == 0x40) { + subev = BLE_HCI_LE_SUBEV_DIRECT_ADV_RPT; + } else { + /* Let's ignore it if address is not resolvable */ + return; } + evtype = BLE_HCI_ADV_RPT_EVTYPE_DIR_IND; event_len = BLE_HCI_LE_ADV_DIRECT_RPT_LEN; adv_data_len = 0;