You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/09/05 11:46:58 UTC
[GitHub] rymanluk closed pull request #164: nimble/ll: Certification fixes
rymanluk closed pull request #164: nimble/ll: Certification fixes
URL: https://github.com/apache/mynewt-nimble/pull/164
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/nimble/controller/include/controller/ble_ll.h b/nimble/controller/include/controller/ble_ll.h
index a0ba581c..eaa30f38 100644
--- a/nimble/controller/include/controller/ble_ll.h
+++ b/nimble/controller/include/controller/ble_ll.h
@@ -417,6 +417,9 @@ int ble_ll_is_rpa(uint8_t *addr, uint8_t addr_type);
/* Is 'addr' our device address? 'addr_type' is public (0) or random (!=0) */
int ble_ll_is_our_devaddr(uint8_t *addr, int addr_type);
+/* Get identity address 'addr_type' is public (0) or random (!=0) */
+uint8_t *ble_ll_get_our_devaddr(uint8_t addr_type);
+
/**
* Called to put a packet on the Link Layer transmit packet queue.
*
diff --git a/nimble/controller/include/controller/ble_ll_resolv.h b/nimble/controller/include/controller/ble_ll_resolv.h
index e1dbbf31..5401a70f 100644
--- a/nimble/controller/include/controller/ble_ll_resolv.h
+++ b/nimble/controller/include/controller/ble_ll_resolv.h
@@ -80,6 +80,8 @@ void ble_ll_resolv_list_reset(void);
void ble_ll_resolv_get_priv_addr(struct ble_ll_resolv_entry *rl, int local,
uint8_t *addr);
+void ble_ll_resolv_set_peer_rpa(int index, uint8_t *rpa);
+
/* Generate a resolvable private address. */
int ble_ll_resolv_gen_rpa(uint8_t *addr, uint8_t addr_type, uint8_t *rpa,
int local);
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index 0cf4d84a..42bd73d4 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -526,6 +526,23 @@ ble_ll_is_our_devaddr(uint8_t *addr, int addr_type)
return rc;
}
+/**
+ * Get identity address
+ *
+ * @param addr_type Random (1). Public(0)
+ *
+ * @return pointer to identity address of given type.
+ */
+uint8_t*
+ble_ll_get_our_devaddr(uint8_t addr_type)
+{
+ if (addr_type) {
+ return g_random_addr;
+ }
+
+ return g_dev_addr;
+}
+
/**
* Wait for response timeout function
*
diff --git a/nimble/controller/src/ble_ll_adv.c b/nimble/controller/src/ble_ll_adv.c
index c914201f..d813c94d 100644
--- a/nimble/controller/src/ble_ll_adv.c
+++ b/nimble/controller/src/ble_ll_adv.c
@@ -193,33 +193,29 @@ static void ble_ll_adv_sm_stop_timeout(struct ble_ll_adv_sm *advsm);
static void
ble_ll_adv_rpa_update(struct ble_ll_adv_sm *advsm)
{
- ble_ll_resolv_gen_rpa(advsm->peer_addr, advsm->peer_addr_type,
- advsm->adva, 1);
+ if (ble_ll_resolv_gen_rpa(advsm->peer_addr, advsm->peer_addr_type,
+ advsm->adva, 1)) {
+ advsm->flags |= BLE_LL_ADV_SM_FLAG_TX_ADD;
+ } else {
+ if (advsm->own_addr_type & 1) {
+ advsm->flags |= BLE_LL_ADV_SM_FLAG_TX_ADD;
+ } else {
+ advsm->flags &= ~BLE_LL_ADV_SM_FLAG_TX_ADD;
+ }
+ }
if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_DIRECTED) {
- ble_ll_resolv_gen_rpa(advsm->peer_addr, advsm->peer_addr_type,
- advsm->initiator_addr, 0);
- if (ble_ll_is_rpa(advsm->initiator_addr, 1)) {
+ if (ble_ll_resolv_gen_rpa(advsm->peer_addr, advsm->peer_addr_type,
+ advsm->initiator_addr, 0)) {
advsm->flags |= BLE_LL_ADV_SM_FLAG_RX_ADD;
} else {
- if (advsm->own_addr_type & 1) {
+ if (advsm->peer_addr_type & 1) {
advsm->flags |= BLE_LL_ADV_SM_FLAG_RX_ADD;
} else {
advsm->flags &= ~BLE_LL_ADV_SM_FLAG_RX_ADD;
}
}
}
-
- /* May have to reset txadd bit */
- if (ble_ll_is_rpa(advsm->adva, 1)) {
- advsm->flags |= BLE_LL_ADV_SM_FLAG_TX_ADD;
- } else {
- if (advsm->own_addr_type & 1) {
- advsm->flags |= BLE_LL_ADV_SM_FLAG_TX_ADD;
- } else {
- advsm->flags &= ~BLE_LL_ADV_SM_FLAG_TX_ADD;
- }
- }
}
/**
@@ -1824,13 +1820,20 @@ ble_ll_adv_set_enable(uint8_t instance, uint8_t enable, int duration,
advsm = &g_ble_ll_adv_sm[instance];
- if (advsm->flags & BLE_LL_ADV_SM_FLAG_ADV_DATA_INCOMPLETE) {
- return BLE_ERR_CMD_DISALLOWED;
- }
-
rc = BLE_ERR_SUCCESS;
if (enable == 1) {
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
+ if (advsm->flags & BLE_LL_ADV_SM_FLAG_ADV_DATA_INCOMPLETE) {
+ return BLE_ERR_CMD_DISALLOWED;
+ }
+
+ if (ble_ll_hci_adv_mode_ext() &&
+ (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_SCANNABLE) &&
+ !(advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_LEGACY) &&
+ SCAN_RSP_DATA_LEN(advsm) == 0) {
+ return BLE_ERR_CMD_DISALLOWED;
+ }
+
/* handle specifics of HD dir adv enabled in legacy way */
if (duration < 0) {
if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_HD_DIRECTED) {
@@ -2048,7 +2051,9 @@ ble_ll_adv_set_adv_data(uint8_t *cmd, uint8_t cmd_len, uint8_t instance,
/* check if type of advertising support adv data */
if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_LEGACY) {
if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_DIRECTED) {
- return BLE_ERR_INV_HCI_CMD_PARMS;
+ if (ble_ll_hci_adv_mode_ext()) {
+ return BLE_ERR_INV_HCI_CMD_PARMS;
+ }
}
} else {
if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_SCANNABLE) {
@@ -2789,6 +2794,9 @@ ble_ll_adv_conn_req_rxd(uint8_t *rxbuf, struct ble_mbuf_hdr *hdr,
/* Retain the resolvable private address that we received. */
memcpy(advsm->adv_rpa, inita, BLE_DEV_ADDR_LEN);
+ /* Update resolving list with current peer RPA */
+ ble_ll_resolv_set_peer_rpa(advsm->adv_rpa_index, inita);
+
/*
* Overwrite received inita with identity address since that
* is used from now on.
@@ -3394,11 +3402,13 @@ ble_ll_adv_send_conn_comp_ev(struct ble_ll_conn_sm *connsm,
uint8_t *
ble_ll_adv_get_local_rpa(struct ble_ll_adv_sm *advsm)
{
- uint8_t *rpa;
+ uint8_t *rpa = NULL;
- rpa = NULL;
if (advsm->own_addr_type > BLE_HCI_ADV_OWN_ADDR_RANDOM) {
- rpa = advsm->adva;
+ if ((advsm->flags & BLE_LL_ADV_SM_FLAG_TX_ADD) &&
+ ble_ll_is_rpa(advsm->adva, 1)) {
+ rpa = advsm->adva;
+ }
}
return rpa;
diff --git a/nimble/controller/src/ble_ll_conn.c b/nimble/controller/src/ble_ll_conn.c
index 0d19f05a..f0557d6b 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -2983,6 +2983,11 @@ ble_ll_init_rx_pkt_in(uint8_t pdu_type, uint8_t *rxbuf,
if (connsm->rpa_index >= 0) {
ble_ll_scan_set_peer_rpa(rxbuf + BLE_LL_PDU_HDR_LEN);
+
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
+ /* Update resolving list with current peer RPA */
+ ble_ll_resolv_set_peer_rpa(connsm->rpa_index, rxbuf + BLE_LL_PDU_HDR_LEN);
+#endif
}
/* Connection has been created. Stop scanning */
@@ -3246,21 +3251,36 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok,
// no break
#endif
case BLE_ADV_PDU_TYPE_ADV_DIRECT_IND:
+ /*
+ * If we expect our address to be private and the INITA is not,
+ * we dont respond!
+ */
+ inita_is_rpa = (uint8_t)ble_ll_is_rpa(init_addr, init_addr_type);
+ if (!inita_is_rpa) {
/*
- * If we expect our address to be private and the INITA is not,
+ * If we expect our address to be private and the InitA is not,
* we dont respond!
+ *
+ * TODO: Probably we could not care for this if privacy is on.
+ * Leave if for now.
*/
- inita_is_rpa = (uint8_t)ble_ll_is_rpa(init_addr, init_addr_type);
if (connsm->own_addr_type > BLE_HCI_ADV_OWN_ADDR_RANDOM) {
- if (!inita_is_rpa) {
- goto init_rx_isr_exit;
- }
- } else {
- if (!ble_ll_is_our_devaddr(init_addr, addr_type)) {
- goto init_rx_isr_exit;
- }
+ goto init_rx_isr_exit;
}
- break;
+
+ /* Resolving will be done later. Check if identity InitA matches */
+ if (!ble_ll_is_our_devaddr(init_addr, init_addr_type)) {
+ goto init_rx_isr_exit;
+ }
+ }
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY) == 0
+ else {
+ /* If privacy is off - reject RPA InitA*/
+ goto init_rx_isr_exit;
+ }
+#endif
+
+ break;
default:
goto init_rx_isr_exit;
}
@@ -3290,21 +3310,54 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok,
!inita_is_rpa) {
goto init_rx_isr_exit;
}
+
+ /*
+ * If the InitA is a RPA, we must see if it resolves based on the
+ * identity address of the resolved ADVA.
+ */
+ if (init_addr && inita_is_rpa &&
+ !ble_ll_resolv_rpa(init_addr,
+ g_ble_ll_resolv_list[index].rl_local_irk)) {
+ goto init_rx_isr_exit;
+ }
+
} else {
if (chk_wl) {
goto init_rx_isr_exit;
}
+
+ /* Could not resolved InitA */
+ if (init_addr && inita_is_rpa) {
+ goto init_rx_isr_exit;
+ }
}
- } else if (init_addr && ble_ll_resolv_enabled()) {
+ } else if (init_addr) {
- /* Let's see if we have IRK with that peer. If so lets make sure
- * privacy mode is correct together with initA
- */
+ /* If resolving is off and InitA is RPA we reject advertising */
+ if (inita_is_rpa && !ble_ll_resolv_enabled()) {
+ goto init_rx_isr_exit;
+ }
+
+ /* Let's see if we have IRK with that peer.*/
rl = ble_ll_resolv_list_find(adv_addr, addr_type);
+
+ /* Lets make sure privacy mode is correct together with InitA in case it
+ * is identity address
+ */
if (rl && !inita_is_rpa &&
(rl->rl_priv_mode == BLE_HCI_PRIVACY_NETWORK)) {
goto init_rx_isr_exit;
}
+
+ /*
+ * If the InitA is a RPA, we must see if it resolves based on the
+ * identity address of the resolved ADVA.
+ */
+ if (inita_is_rpa) {
+ if (!rl || !ble_ll_resolv_rpa(init_addr, rl->rl_local_irk)) {
+ goto init_rx_isr_exit;
+ }
+ }
}
#endif
@@ -3321,18 +3374,6 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok,
}
ble_hdr->rxinfo.flags |= BLE_MBUF_HDR_F_DEVMATCH;
- /*
- * If the inita is a RPA, we must see if it resolves based on the
- * identity address of the resolved ADVA.
- */
- if (init_addr && inita_is_rpa) {
- if ((index < 0) ||
- !ble_ll_resolv_rpa(init_addr,
- g_ble_ll_resolv_list[index].rl_local_irk)) {
- goto init_rx_isr_exit;
- }
- }
-
/* For CONNECT_IND we don't go into RX state */
conn_req_end_trans = BLE_PHY_TRANSITION_NONE;
diff --git a/nimble/controller/src/ble_ll_hci.c b/nimble/controller/src/ble_ll_hci.c
index 419e2a5a..93fdd98d 100644
--- a/nimble/controller/src/ble_ll_hci.c
+++ b/nimble/controller/src/ble_ll_hci.c
@@ -658,6 +658,7 @@ ble_ll_is_valid_adv_mode(uint8_t ocf)
case BLE_HCI_OCF_LE_SET_SCAN_PARAMS:
case BLE_HCI_OCF_LE_SET_SCAN_ENABLE:
case BLE_HCI_OCF_LE_SET_SCAN_RSP_DATA:
+ case BLE_HCI_OCF_LE_RD_ADV_CHAN_TXPWR:
if (hci_adv_mode == ADV_MODE_EXT) {
return false;
}
@@ -671,6 +672,20 @@ ble_ll_is_valid_adv_mode(uint8_t ocf)
case BLE_HCI_OCF_LE_SET_EXT_SCAN_ENABLE:
case BLE_HCI_OCF_LE_SET_EXT_SCAN_PARAM:
case BLE_HCI_OCF_LE_SET_EXT_SCAN_RSP_DATA:
+ case BLE_HCI_OCF_LE_RD_MAX_ADV_DATA_LEN:
+ case BLE_HCI_OCF_LE_RD_NUM_OF_ADV_SETS:
+ case BLE_HCI_OCF_LE_REMOVE_ADV_SET:
+ case BLE_HCI_OCF_LE_CLEAR_ADV_SETS:
+ case BLE_HCI_OCF_LE_SET_PER_ADV_PARAMS:
+ case BLE_HCI_OCF_LE_SET_PER_ADV_DATA:
+ case BLE_HCI_OCF_LE_SET_PER_ADV_ENABLE:
+ case BLE_HCI_OCF_LE_PER_ADV_CREATE_SYNC:
+ case BLE_HCI_OCF_LE_PER_ADV_CREATE_SYNC_CANCEL:
+ case BLE_HCI_OCF_LE_PER_ADV_TERM_SYNC:
+ case BLE_HCI_OCF_LE_ADD_DEV_TO_PER_ADV_LIST:
+ case BLE_HCI_OCF_LE_REM_DEV_FROM_PER_ADV_LIST:
+ case BLE_HCI_OCF_LE_CLEAR_PER_ADV_LIST:
+ case BLE_HCI_OCF_LE_RD_PER_ADV_LIST_SIZE:
if (hci_adv_mode == ADV_MODE_LEGACY) {
return false;
}
@@ -1076,8 +1091,11 @@ ble_ll_hci_le_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen,
* This code is here because we add 256 to the return code to denote
* that the reply to this command should be command status (as opposed to
* command complete).
+ *
+ * For unknown HCI command let us return always command status as per
+ * specification Bluetooth 5, Vol. 2, Chapter 4.4
*/
- if (ble_ll_hci_le_cmd_send_cmd_status(ocf)) {
+ if (ble_ll_hci_le_cmd_send_cmd_status(ocf) || rc == BLE_ERR_UNKNOWN_HCI_CMD) {
rc += (BLE_ERR_MAX + 1);
}
diff --git a/nimble/controller/src/ble_ll_resolv.c b/nimble/controller/src/ble_ll_resolv.c
index 98bd2972..4f0308d7 100644
--- a/nimble/controller/src/ble_ll_resolv.c
+++ b/nimble/controller/src/ble_ll_resolv.c
@@ -534,6 +534,18 @@ ble_ll_resolv_get_priv_addr(struct ble_ll_resolv_entry *rl, int local,
OS_EXIT_CRITICAL(sr);
}
+void
+ble_ll_resolv_set_peer_rpa(int index, uint8_t *rpa)
+{
+ os_sr_t sr;
+ struct ble_ll_resolv_entry *rl;
+
+ OS_ENTER_CRITICAL(sr);
+ rl = &g_ble_ll_resolv_list[index];
+ memcpy(rl->rl_peer_rpa, rpa, BLE_DEV_ADDR_LEN);
+ OS_EXIT_CRITICAL(sr);
+}
+
/**
* Generate a resolvable private address.
*
diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index 82d80de8..e6a47a31 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -737,35 +737,30 @@ ble_ll_hci_send_adv_report(uint8_t subev, uint8_t evtype,uint8_t event_len,
* @param scansm
*/
static void
-ble_ll_scan_send_adv_report(uint8_t pdu_type, uint8_t txadd, struct os_mbuf *om,
- struct ble_mbuf_hdr *hdr,
- struct ble_ll_scan_sm *scansm)
+ble_ll_scan_send_adv_report(uint8_t pdu_type, uint8_t *adva, uint8_t adva_type,
+ uint8_t *inita, uint8_t inita_type,
+ struct os_mbuf *om,
+ struct ble_mbuf_hdr *hdr,
+ struct ble_ll_scan_sm *scansm)
{
int rc;
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
- int index;
-#endif
uint8_t *rxbuf = om->om_data;
uint8_t evtype;
uint8_t subev;
- uint8_t *adv_addr;
- uint8_t *inita;
- uint8_t addr_type;
uint8_t adv_data_len;
uint8_t event_len;
- inita = NULL;
-
if (pdu_type == BLE_ADV_PDU_TYPE_ADV_DIRECT_IND) {
- inita = rxbuf + BLE_LL_PDU_HDR_LEN + BLE_DEV_ADDR_LEN;
- if ((inita[5] & 0x40)) {
+ if (ble_ll_is_rpa(inita, inita_type)) {
/* For resolvable we send separate event */
subev = BLE_HCI_LE_SUBEV_DIRECT_ADV_RPT;
+ event_len = BLE_HCI_LE_ADV_DIRECT_RPT_LEN;
} else {
subev = BLE_HCI_LE_SUBEV_ADV_RPT;
+ event_len = BLE_HCI_LE_ADV_RPT_MIN_LEN;
}
evtype = BLE_HCI_ADV_RPT_EVTYPE_DIR_IND;
- event_len = BLE_HCI_LE_ADV_DIRECT_RPT_LEN;
+
adv_data_len = 0;
} else {
subev = BLE_HCI_LE_SUBEV_ADV_RPT;
@@ -784,46 +779,34 @@ ble_ll_scan_send_adv_report(uint8_t pdu_type, uint8_t txadd, struct os_mbuf *om,
os_mbuf_adj(om, BLE_LL_PDU_HDR_LEN + BLE_DEV_ADDR_LEN);
}
- if (txadd) {
- addr_type = BLE_HCI_ADV_OWN_ADDR_RANDOM;
- } else {
- addr_type = BLE_HCI_ADV_OWN_ADDR_PUBLIC;
- }
-
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
if (BLE_MBUF_HDR_RESOLVED(hdr)) {
- index = scansm->scan_rpa_index;
- adv_addr = g_ble_ll_resolv_list[index].rl_identity_addr;
/*
* NOTE: this looks a bit odd, but the resolved address types
* are 2 greater than the unresolved ones in the spec, so
* we just add 2 here.
*/
- addr_type = g_ble_ll_resolv_list[index].rl_addr_type + 2;
- } else {
- adv_addr = rxbuf + BLE_LL_PDU_HDR_LEN;
+ adva_type += 2;
}
-#else
- adv_addr = rxbuf + BLE_LL_PDU_HDR_LEN;
#endif
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
if (scansm->ext_scanning) {
rc = ble_ll_hci_send_legacy_ext_adv_report(evtype,
- addr_type, adv_addr,
+ adva_type, adva,
hdr->rxinfo.rssi,
adv_data_len, om,
inita);
} else {
rc = ble_ll_hci_send_adv_report(subev, evtype, event_len,
- addr_type, adv_addr,
+ adva_type, adva,
hdr->rxinfo.rssi,
adv_data_len, om,
inita);
}
#else
rc = ble_ll_hci_send_adv_report(subev, evtype, event_len,
- addr_type, adv_addr,
+ adva_type, adva,
hdr->rxinfo.rssi,
adv_data_len, om,
inita);
@@ -831,7 +814,7 @@ ble_ll_scan_send_adv_report(uint8_t pdu_type, uint8_t txadd, struct os_mbuf *om,
if (!rc) {
/* If filtering, add it to list of duplicate addresses */
if (scansm->scan_filt_dups) {
- ble_ll_scan_add_dup_adv(adv_addr, txadd, subev, evtype);
+ ble_ll_scan_add_dup_adv(adva, adva_type, subev, evtype);
}
}
}
@@ -892,10 +875,10 @@ ble_ll_scan_chk_filter_policy(uint8_t pdu_type, uint8_t *adv_addr,
/* If we are using the whitelist, check that first */
if (use_whitelist && (pdu_type != BLE_ADV_PDU_TYPE_SCAN_RSP)) {
- /* If there was a devmatch, we will allow the PDU */
- if (devmatch) {
- return 0;
- } else {
+ /* If device does not match let us skip this PDU.
+ * If device matches, lets check for InitA further in the code
+ */
+ if (!devmatch) {
return 1;
}
}
@@ -2380,6 +2363,7 @@ ble_ll_scan_rx_pkt_in(uint8_t ptype, struct os_mbuf *om, struct ble_mbuf_hdr *hd
{
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
int index;
+ struct ble_ll_resolv_entry *rl;
#endif
uint8_t *rxbuf = om->om_data;
uint8_t *adv_addr = NULL;
@@ -2414,13 +2398,6 @@ ble_ll_scan_rx_pkt_in(uint8_t ptype, struct os_mbuf *om, struct ble_mbuf_hdr *hd
goto scan_continue;
}
- /* Check the scanner filter policy */
- if (ble_ll_scan_chk_filter_policy(ptype, adv_addr, txadd, init_addr,
- init_addr_type,
- BLE_MBUF_HDR_DEVMATCH(hdr))) {
- goto scan_continue;
- }
-
ident_addr = adv_addr;
ident_addr_type = txadd;
@@ -2429,9 +2406,31 @@ ble_ll_scan_rx_pkt_in(uint8_t ptype, struct os_mbuf *om, struct ble_mbuf_hdr *hd
if (index >= 0) {
ident_addr = g_ble_ll_resolv_list[index].rl_identity_addr;
ident_addr_type = g_ble_ll_resolv_list[index].rl_addr_type;
+
+ if (ble_ll_is_rpa(init_addr, init_addr_type)) {
+ /* Let's try resolve InitA. */
+ if (ble_ll_resolv_rpa(init_addr, g_ble_ll_resolv_list[index].rl_local_irk)) {
+ init_addr = ble_ll_get_our_devaddr(scansm->own_addr_type & 1);
+ init_addr_type = scansm->own_addr_type;
+ }
+ }
+ } else if (init_addr && ble_ll_resolv_enabled() && ble_ll_is_rpa(init_addr, init_addr_type)) {
+ /* If we are here it means AdvA is identity. Check if initA is RPA */
+ rl = ble_ll_resolv_list_find(ident_addr, ident_addr_type);
+ if (rl && ble_ll_resolv_rpa(init_addr, rl->rl_local_irk)) {
+ init_addr = ble_ll_get_our_devaddr(scansm->own_addr_type & 1);
+ init_addr_type = scansm->own_addr_type;
+ }
}
#endif
+ /* Check the scanner filter policy */
+ if (ble_ll_scan_chk_filter_policy(ptype, adv_addr, txadd, init_addr,
+ init_addr_type,
+ BLE_MBUF_HDR_DEVMATCH(hdr))) {
+ goto scan_continue;
+ }
+
/*
* XXX: The BLE spec is a bit unclear here. What if we get a scan
* response from an advertiser that we did not send a request to?
@@ -2525,7 +2524,8 @@ ble_ll_scan_rx_pkt_in(uint8_t ptype, struct os_mbuf *om, struct ble_mbuf_hdr *hd
#endif
/* Send the advertising report */
- ble_ll_scan_send_adv_report(ptype, ident_addr_type, om, hdr, scansm);
+ ble_ll_scan_send_adv_report(ptype, ident_addr, ident_addr_type,
+ init_addr, init_addr_type, om, hdr, scansm);
scan_continue:
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services