Bluetooth: Fix connecting to devices that use RPA

This fix a regression that cause identity address to be passed to
LE Create Connection HCI command. This was affecting connecting to
iPhone. Regression was introduced in beaf30fda7de1476c742a
(Bluetooth: Simplify check_pending_conn function).

check_pending_conn now takes two addresses: ID and real address.
ID is used to find connection object and real is used in LE Create
Connection HCI command. If no IRK is present both addresses have
same value. This is to avoid double lookup of ID address for every
advertising report.

Change-Id: I6b86a698087889c4e6c2a1cbc9a688a804cfeb84
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-10-02 10:10:39 +02:00 committed by Anas Nashif
commit 5deb2667dd

View file

@ -656,7 +656,8 @@ static void le_conn_update_complete(struct bt_buf *buf)
bt_conn_put(conn);
}
static void check_pending_conn(const bt_addr_le_t *addr, uint8_t evtype)
static void check_pending_conn(const bt_addr_le_t *id_addr,
const bt_addr_le_t *addr, uint8_t evtype)
{
struct bt_conn *conn;
@ -665,7 +666,7 @@ static void check_pending_conn(const bt_addr_le_t *addr, uint8_t evtype)
return;
}
conn = bt_conn_lookup_state(addr, BT_CONN_CONNECT_SCAN);
conn = bt_conn_lookup_state(id_addr, BT_CONN_CONNECT_SCAN);
if (!conn) {
return;
}
@ -1070,7 +1071,7 @@ static void le_adv_report(struct bt_buf *buf)
}
#if defined(CONFIG_BLUETOOTH_CONN)
check_pending_conn(addr, info->evt_type);
check_pending_conn(addr, &info->addr, info->evt_type);
#endif /* CONFIG_BLUETOOTH_CONN */
/* Get next report iteration by moving pointer to right offset
* in buf according to spec 4.2, Vol 2, Part E, 7.7.65.2.