Bluetooth: Require streaming mode when it is requested for a socket

The L2CAP specification has two ways to support streaming mode: Allow
fallback to ERTM or basic mode when the remote device requests one of
those modes, or make the connection fail unless both sides agree on
streaming mode.

The current code does not properly support either method.  This change
makes a streaming mode connection fail if the remote device does not
also request streaming mode.

CRs-fixed: 336291
Change-Id: Id26f963a5e15d18e85a2faf2f8f01848e2a73fa4
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
This commit is contained in:
Mat Martineau 2012-02-03 16:24:42 -08:00 committed by Stephen Boyd
parent 08168d3622
commit ee9ccbb803

View file

@ -611,8 +611,16 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
case L2CAP_MODE_BASIC: case L2CAP_MODE_BASIC:
l2cap_pi(sk)->conf_state &= ~L2CAP_CONF_STATE2_DEVICE; l2cap_pi(sk)->conf_state &= ~L2CAP_CONF_STATE2_DEVICE;
break; break;
case L2CAP_MODE_ERTM:
case L2CAP_MODE_STREAMING: case L2CAP_MODE_STREAMING:
if (!disable_ertm) {
/* No fallback to ERTM or Basic mode */
l2cap_pi(sk)->conf_state |=
L2CAP_CONF_STATE2_DEVICE;
break;
}
err = -EINVAL;
break;
case L2CAP_MODE_ERTM:
if (!disable_ertm) if (!disable_ertm)
break; break;
/* fall through */ /* fall through */