Commit 63406504 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan Committed by Marcel Holtmann

Bluetooth: Don't send RFC for Basic Mode if only it is supported

If the remote side doesn't support Enhanced Retransmission Mode neither
Streaming Mode, we shall not send the RFC option.

Some devices that only supports Basic Mode do not understanding the RFC
option. This patch fixes the regression found with these devices.
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 28e9509b
...@@ -2527,6 +2527,10 @@ static int l2cap_build_conf_req(struct sock *sk, void *data) ...@@ -2527,6 +2527,10 @@ static int l2cap_build_conf_req(struct sock *sk, void *data)
if (pi->imtu != L2CAP_DEFAULT_MTU) if (pi->imtu != L2CAP_DEFAULT_MTU)
l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu); l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->imtu);
if (!(pi->conn->feat_mask & L2CAP_FEAT_ERTM) &&
!(pi->conn->feat_mask & L2CAP_FEAT_STREAMING))
break;
rfc.mode = L2CAP_MODE_BASIC; rfc.mode = L2CAP_MODE_BASIC;
rfc.txwin_size = 0; rfc.txwin_size = 0;
rfc.max_transmit = 0; rfc.max_transmit = 0;
...@@ -2534,6 +2538,8 @@ static int l2cap_build_conf_req(struct sock *sk, void *data) ...@@ -2534,6 +2538,8 @@ static int l2cap_build_conf_req(struct sock *sk, void *data)
rfc.monitor_timeout = 0; rfc.monitor_timeout = 0;
rfc.max_pdu_size = 0; rfc.max_pdu_size = 0;
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
(unsigned long) &rfc);
break; break;
case L2CAP_MODE_ERTM: case L2CAP_MODE_ERTM:
...@@ -2546,6 +2552,9 @@ static int l2cap_build_conf_req(struct sock *sk, void *data) ...@@ -2546,6 +2552,9 @@ static int l2cap_build_conf_req(struct sock *sk, void *data)
if (L2CAP_DEFAULT_MAX_PDU_SIZE > pi->conn->mtu - 10) if (L2CAP_DEFAULT_MAX_PDU_SIZE > pi->conn->mtu - 10)
rfc.max_pdu_size = cpu_to_le16(pi->conn->mtu - 10); rfc.max_pdu_size = cpu_to_le16(pi->conn->mtu - 10);
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
(unsigned long) &rfc);
if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS)) if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS))
break; break;
...@@ -2566,6 +2575,9 @@ static int l2cap_build_conf_req(struct sock *sk, void *data) ...@@ -2566,6 +2575,9 @@ static int l2cap_build_conf_req(struct sock *sk, void *data)
if (L2CAP_DEFAULT_MAX_PDU_SIZE > pi->conn->mtu - 10) if (L2CAP_DEFAULT_MAX_PDU_SIZE > pi->conn->mtu - 10)
rfc.max_pdu_size = cpu_to_le16(pi->conn->mtu - 10); rfc.max_pdu_size = cpu_to_le16(pi->conn->mtu - 10);
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
(unsigned long) &rfc);
if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS)) if (!(pi->conn->feat_mask & L2CAP_FEAT_FCS))
break; break;
...@@ -2577,9 +2589,6 @@ static int l2cap_build_conf_req(struct sock *sk, void *data) ...@@ -2577,9 +2589,6 @@ static int l2cap_build_conf_req(struct sock *sk, void *data)
break; break;
} }
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
(unsigned long) &rfc);
/* FIXME: Need actual value of the flush timeout */ /* FIXME: Need actual value of the flush timeout */
//if (flush_to != L2CAP_DEFAULT_FLUSH_TO) //if (flush_to != L2CAP_DEFAULT_FLUSH_TO)
// l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, pi->flush_to); // l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, pi->flush_to);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment