Bluetooth: Use NULL for "any" connection with bt_conn_lookup_state_le()

An all zeroes address is in principle not valid, but prototype devices
have been seen using it. To avoid false-positives with the
bt_conn_lookup_state_le() API use a NULL pointer rather than
BT_ADDR_LE_ANY to indicate that any connection in the specified state
is of interest.

Change-Id: I42a1946e47173b17be295b1b7e97a654dbdcdc6a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-01-28 18:58:55 -05:00 committed by Anas Nashif
commit a9404225e5
2 changed files with 2 additions and 3 deletions

View file

@ -753,8 +753,7 @@ struct bt_conn *bt_conn_lookup_state_le(const bt_addr_le_t *peer,
continue;
}
if (bt_addr_le_cmp(peer, BT_ADDR_LE_ANY) &&
bt_addr_le_cmp(peer, &conns[i].le.dst)) {
if (peer && bt_addr_le_cmp(peer, &conns[i].le.dst)) {
continue;
}

View file

@ -1303,7 +1303,7 @@ int bt_le_scan_update(bool fast_scan)
}
#if defined(CONFIG_BLUETOOTH_CENTRAL)
conn = bt_conn_lookup_state_le(BT_ADDR_LE_ANY, BT_CONN_CONNECT_SCAN);
conn = bt_conn_lookup_state_le(NULL, BT_CONN_CONNECT_SCAN);
if (!conn) {
return 0;
}