hci: ignore classic onnection complete in wrong state

This commit is contained in:
Matthias Ringwald 2022-11-01 10:09:27 +01:00
parent 97600fc86b
commit 893b4ccd70

View File

@ -3470,6 +3470,16 @@ static void event_handler(uint8_t *packet, uint16_t size){
addr_type = BD_ADDR_TYPE_ACL;
conn = hci_connection_for_bd_addr_and_type(addr, addr_type);
if (conn) {
switch (conn->state){
// expected states
case ACCEPTED_CONNECTION_REQUEST:
case SENT_CREATE_CONNECTION:
break;
// unexpected state -> ignore
default:
// don't forward event to app
return;
}
if (!packet[2]){
conn->state = OPEN;
conn->con_handle = little_endian_read_16(packet, 3);