mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 12:35:25 +00:00
l2cap-ertm: query remote extended feature mask before accepting connection request
This commit is contained in:
parent
450ad7ecde
commit
5260604380
14
src/l2cap.c
14
src/l2cap.c
@ -1422,8 +1422,15 @@ static void l2cap_hci_event_handler(uint8_t packet_type, uint16_t cid, uint8_t *
|
||||
switch (channel->state){
|
||||
case L2CAP_STATE_WAIT_INCOMING_SECURITY_LEVEL_UPDATE:
|
||||
if (actual_level >= required_level){
|
||||
#ifdef ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
|
||||
// we need to know if ERTM is supported before sending a config response
|
||||
hci_connection_t * connection = hci_connection_for_handle(channel->con_handle);
|
||||
connection->l2cap_state.information_state = L2CAP_INFORMATION_STATE_W2_SEND_EXTENDED_FEATURE_REQUEST;
|
||||
channel->state = L2CAP_STATE_WAIT_INCOMING_EXTENDED_FEATURES;
|
||||
#else
|
||||
channel->state = L2CAP_STATE_WAIT_CLIENT_ACCEPT_OR_REJECT;
|
||||
l2cap_emit_incoming_connection(channel);
|
||||
l2cap_emit_incoming_connection(channel);
|
||||
#endif
|
||||
} else {
|
||||
channel->reason = 0x0003; // security block
|
||||
channel->state = L2CAP_STATE_WILL_SEND_CONNECTION_RESPONSE_DECLINE;
|
||||
@ -1919,6 +1926,11 @@ static void l2cap_signaling_handler_dispatch( hci_con_handle_t handle, uint8_t *
|
||||
if (channel->state == L2CAP_STATE_WAIT_OUTGOING_EXTENDED_FEATURES){
|
||||
channel->state = L2CAP_STATE_WILL_SEND_CONNECTION_REQUEST;
|
||||
}
|
||||
// respond to connection request
|
||||
if (channel->state == L2CAP_STATE_WAIT_INCOMING_EXTENDED_FEATURES){
|
||||
channel->state = L2CAP_STATE_WAIT_CLIENT_ACCEPT_OR_REJECT;
|
||||
l2cap_emit_incoming_connection(channel);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ typedef enum {
|
||||
L2CAP_STATE_WAIT_REMOTE_SUPPORTED_FEATURES,
|
||||
L2CAP_STATE_WAIT_INCOMING_SECURITY_LEVEL_UPDATE,
|
||||
L2CAP_STATE_WAIT_OUTGOING_SECURITY_LEVEL_UPDATE,
|
||||
L2CAP_STATE_WAIT_INCOMING_EXTENDED_FEATURES, // only for Enhanced Retransmission Mode
|
||||
L2CAP_STATE_WAIT_OUTGOING_EXTENDED_FEATURES, // only for Enhanced Retransmission Mode
|
||||
L2CAP_STATE_WAIT_CLIENT_ACCEPT_OR_REJECT,
|
||||
L2CAP_STATE_WAIT_CONNECT_RSP, // from peer
|
||||
|
Loading…
x
Reference in New Issue
Block a user