Commit 68ae6639b6dff117ba37f648f1611a4629abadf0

Authored by Gustavo F. Padovan
Committed by Marcel Holtmann
1 parent a0e55a32af

Bluetooth: Fix regression with L2CAP configuration in Basic Mode

Basic Mode is the default mode of operation of a L2CAP entity. In
this case the RFC (Retransmission and Flow Control) configuration
option should not be used at all.

Normally remote L2CAP implementation should just ignore this option,
but it can cause various side effects with other Bluetooth stacks
that are not capable of handling unknown options.

Signed-off-by: Gustavo F. Padovan <gustavo@las.ic.unicamp.br>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

Showing 1 changed file with 8 additions and 3 deletions Side-by-side Diff

net/bluetooth/l2cap.c
... ... @@ -2394,6 +2394,10 @@
2394 2394 rfc.monitor_timeout = L2CAP_DEFAULT_MONITOR_TO;
2395 2395  
2396 2396 pi->conf_state |= L2CAP_CONF_MODE_DONE;
  2397 +
  2398 + l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
  2399 + sizeof(rfc), (unsigned long) &rfc);
  2400 +
2397 2401 break;
2398 2402  
2399 2403 case L2CAP_MODE_STREAMING:
... ... @@ -2401,6 +2405,10 @@
2401 2405 pi->max_pdu_size = rfc.max_pdu_size;
2402 2406  
2403 2407 pi->conf_state |= L2CAP_CONF_MODE_DONE;
  2408 +
  2409 + l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
  2410 + sizeof(rfc), (unsigned long) &rfc);
  2411 +
2404 2412 break;
2405 2413  
2406 2414 default:
... ... @@ -2409,9 +2417,6 @@
2409 2417 memset(&rfc, 0, sizeof(rfc));
2410 2418 rfc.mode = pi->mode;
2411 2419 }
2412   -
2413   - l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
2414   - sizeof(rfc), (unsigned long) &rfc);
2415 2420  
2416 2421 if (result == L2CAP_CONF_SUCCESS)
2417 2422 pi->conf_state |= L2CAP_CONF_OUTPUT_DONE;