l2cap-ertm: store remote config in optional ertm mode, too

This commit is contained in:
Matthias Ringwald 2017-07-16 21:56:34 +02:00
parent 38f62777f8
commit 25cd60d37c

View File

@ -1708,27 +1708,22 @@ static void l2cap_signaling_handle_configure_request(l2cap_channel_t *channel, u
l2cap_channel_mode_t mode = (l2cap_channel_mode_t) command[pos]; l2cap_channel_mode_t mode = (l2cap_channel_mode_t) command[pos];
switch(channel->mode){ switch(channel->mode){
case L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION: case L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION:
if (channel->ertm_mandatory){ // Store remote config
// ERTM mandatory, but remote doens't offer ERTM -> disconnect channel->remote_tx_window_size = command[pos+1];
if (mode != L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION){ channel->remote_max_transmit = command[pos+2];
channel->state = L2CAP_STATE_WILL_SEND_DISCONNECT_REQUEST; channel->remote_retransmission_timeout_ms = little_endian_read_16(command, pos + 3);
} else { channel->remote_monitor_timeout_ms = little_endian_read_16(command, pos + 5);
// Both sides selected ERTM log_info("FC&C config: tx window: %u, max transmit %u, retrans timeout %u, monitor timeout %u",
channel->remote_tx_window_size = command[pos+1]; channel->remote_tx_window_size,
channel->remote_max_transmit = command[pos+2]; channel->remote_max_transmit,
channel->remote_retransmission_timeout_ms = little_endian_read_16(command, pos + 3); channel->remote_retransmission_timeout_ms,
channel->remote_monitor_timeout_ms = little_endian_read_16(command, pos + 5); channel->remote_monitor_timeout_ms);
log_info("FC&C config: tx window: %u, max transmit %u, retrans timeout %u, monitor timeout %u", // we store remote MPS in remote_mtu, might need to get re-evaluated
channel->remote_tx_window_size, channel->remote_mtu = little_endian_read_16(command, pos + 7);
channel->remote_max_transmit, // If ERTM mandatory, but remote doens't offer ERTM -> disconnect
channel->remote_retransmission_timeout_ms, if (channel->ertm_mandatory && mode != L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION){
channel->remote_monitor_timeout_ms); channel->state = L2CAP_STATE_WILL_SEND_DISCONNECT_REQUEST;
// we store remote MPS in remote_mtu, might need to get re-evaluated
channel->remote_mtu = little_endian_read_16(command, pos + 7);
channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_MTU);
}
} else { } else {
// ERTM is optional
channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_MTU); channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_MTU);
} }
break; break;