You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2019/07/12 13:46:42 UTC

[mynewt-nimble] 05/12: nimble/ll: Send truncated when error on parsing ext header

This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 41a33b9a314a2de7d05e1793f091f1e86cc71f9e
Author: Ɓukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Thu Jul 11 10:02:32 2019 +0200

    nimble/ll: Send truncated when error on parsing ext header
---
 nimble/controller/src/ble_ll_scan.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 2ec8dc8..7e19143 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -2575,9 +2575,19 @@ ble_ll_hci_send_ext_adv_report(uint8_t ptype, uint8_t *adva, uint8_t adva_type,
 
     datalen = ble_ll_scan_parse_ext_hdr(om, adva, adva_type, inita, inita_type, hdr, evt);
     if (datalen < 0) {
-        /* XXX what should we do here? send some trimmed event? */
-        ble_hci_trans_buf_free((uint8_t *)evt);
         rc = -1;
+        /* If we were in the middle of advertising report, let us send truncated report. */
+        if (aux_data &&
+                BLE_LL_AUX_CHECK_FLAG(aux_data, BLE_LL_SENT_EVENT_TO_HOST) &&
+                BLE_LL_AUX_CHECK_FLAG(aux_data, BLE_LL_AUX_CHAIN_BIT)) {
+            evt->evt_type |= (BLE_HCI_ADV_DATA_STATUS_TRUNCATED);
+            BLE_LL_AUX_SET_FLAG(aux_data, BLE_LL_AUX_TRUNCATED_SENT);
+
+            ble_ll_hci_event_send((uint8_t *)evt);
+            goto done;
+        }
+
+        ble_hci_trans_buf_free((uint8_t *)evt);
         goto done;
     }