From ac1b8f65b9bf38f0d203f844a8cdae961d68cb7f Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Tue, 30 Jun 2020 01:30:05 +0200 Subject: [PATCH] nimble/ll: Ignore PDUs received after scan disabled We should better ignore any PDU that was received in LL after scanner was disabled since they may not be handled as they should be. --- nimble/controller/src/ble_ll_scan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c index 930d88a4e..11ccbed4c 100644 --- a/nimble/controller/src/ble_ll_scan.c +++ b/nimble/controller/src/ble_ll_scan.c @@ -3021,7 +3021,8 @@ ble_ll_scan_rx_pkt_in_on_legacy(uint8_t pdu_type, struct os_mbuf *om, if (!BLE_MBUF_HDR_DEVMATCH(hdr) || !BLE_MBUF_HDR_CRC_OK(hdr) || - BLE_MBUF_HDR_IGNORED(hdr)) { + BLE_MBUF_HDR_IGNORED(hdr) || + !scansm->scan_enabled) { return; } @@ -3075,7 +3076,8 @@ ble_ll_scan_rx_pkt_in_on_aux(uint8_t pdu_type, struct os_mbuf *om, BLE_MBUF_HDR_IGNORED(hdr) || BLE_MBUF_HDR_AUX_INVALID(hdr) || (aux_data->flags_ll & BLE_LL_AUX_FLAG_SCAN_ERROR) || - (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND)) { + (pdu_type != BLE_ADV_PDU_TYPE_ADV_EXT_IND) || + !scansm->scan_enabled) { if (aux_data) { ble_ll_scan_end_adv_evt(aux_data); ble_ll_scan_aux_data_unref(aux_data);