mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-25 18:35:17 +00:00
l2cap ertm: allow SDU of szie MPS in first packet that contains L2CAP SDU Length
This commit is contained in:
parent
5dcb6ca761
commit
826c39d019
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
|
||||
### Fixed
|
||||
- L2CAP: fix issue with outgoing connection before read remote supported complete when other channels exist
|
||||
- L2CAP ERTM: allow SDU of szie MPS in first packet that contains L2CAP SDU Length
|
||||
- HFP: decline incoming RFCOMM connection after outgoing connection was started
|
||||
|
||||
## Changes September 2018
|
||||
|
25
src/l2cap.c
25
src/l2cap.c
@ -3200,11 +3200,26 @@ static void l2cap_acl_classic_handler(hci_con_handle_t handle, uint8_t *packet,
|
||||
}
|
||||
|
||||
// get SDU
|
||||
const uint8_t * sdu_data = &packet[COMPLETE_L2CAP_HEADER+2];
|
||||
uint16_t sdu_len = size-(COMPLETE_L2CAP_HEADER+2+fcs_size);
|
||||
const uint8_t * payload_data = &packet[COMPLETE_L2CAP_HEADER+2];
|
||||
uint16_t payload_len = size-(COMPLETE_L2CAP_HEADER+2+fcs_size);
|
||||
|
||||
// assert SDU size is smaller or equal to our buffers
|
||||
if (sdu_len > l2cap_channel->local_mps) break;
|
||||
uint16_t max_payload_size = 0;
|
||||
switch (sar){
|
||||
case L2CAP_SEGMENTATION_AND_REASSEMBLY_UNSEGMENTED_L2CAP_SDU:
|
||||
case L2CAP_SEGMENTATION_AND_REASSEMBLY_START_OF_L2CAP_SDU:
|
||||
// SDU Length + MPS
|
||||
max_payload_size = l2cap_channel->local_mps + 2;
|
||||
break;
|
||||
case L2CAP_SEGMENTATION_AND_REASSEMBLY_CONTINUATION_OF_L2CAP_SDU:
|
||||
case L2CAP_SEGMENTATION_AND_REASSEMBLY_END_OF_L2CAP_SDU:
|
||||
max_payload_size = l2cap_channel->local_mps;
|
||||
break;
|
||||
}
|
||||
if (payload_len > max_payload_size){
|
||||
log_info("payload len %u > max payload %u -> drop packet", payload_len, max_payload_size);
|
||||
break;
|
||||
}
|
||||
|
||||
// check ordering
|
||||
if (l2cap_channel->expected_tx_seq == tx_seq){
|
||||
@ -3213,7 +3228,7 @@ static void l2cap_acl_classic_handler(hci_con_handle_t handle, uint8_t *packet,
|
||||
l2cap_channel->req_seq = l2cap_channel->expected_tx_seq;
|
||||
|
||||
// process SDU
|
||||
l2cap_ertm_handle_in_sequence_sdu(l2cap_channel, sar, sdu_data, sdu_len);
|
||||
l2cap_ertm_handle_in_sequence_sdu(l2cap_channel, sar, payload_data, payload_len);
|
||||
|
||||
// process stored segments
|
||||
while (1){
|
||||
@ -3243,7 +3258,7 @@ static void l2cap_acl_classic_handler(hci_con_handle_t handle, uint8_t *packet,
|
||||
int delta = (tx_seq - l2cap_channel->expected_tx_seq) & 0x3f;
|
||||
if (delta < 2){
|
||||
// store segment
|
||||
l2cap_ertm_handle_out_of_sequence_sdu(l2cap_channel, sar, delta, sdu_data, sdu_len);
|
||||
l2cap_ertm_handle_out_of_sequence_sdu(l2cap_channel, sar, delta, payload_data, payload_len);
|
||||
|
||||
log_info("Received unexpected frame TxSeq %u but expected %u -> send S-SREJ", tx_seq, l2cap_channel->expected_tx_seq);
|
||||
l2cap_channel->send_supervisor_frame_selective_reject = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user