Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3344734pxu; Tue, 8 Dec 2020 09:34:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxV73m3vaVrDtbGxL4BOyi/IgJIm7ZON/qV0+UKkim+fnOyYPI+Ht/SccT4n3qn8VhqaUS X-Received: by 2002:a17:906:1916:: with SMTP id a22mr23980850eje.536.1607448845982; Tue, 08 Dec 2020 09:34:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607448845; cv=none; d=google.com; s=arc-20160816; b=lm41ND0k50C6KKih4paY/HMoi0XPUlIprnQ2veeTRZHE6PJvmaGETWRjs/FytefXjt LOuA+msDGiktIpjueMzEZoCa6j8g9OOSxvr8OYzXpCbbp0GEwFtxJQAqvzXvXsGygXkV b1jg4ud5+E9fRsKOUX9cG3U5U53EPgDw/sP3mxW0efx2ePuPHobX/xz/F7aX7MAiXI4V bapC2LmtlCqOPn/W5v6gV1ci+tX8kblZc7Jqn9zS5rEBD0tpCvFR4H8C4QhKyH7+8WOW j1wvw8lC44IwHwW/sUxmh9ydxvskvqpVJznyyLwvfs/mVj3GEAL03eGpqffkl1rTOW0j U0tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=7S2ZRx8/KRVwMhaENgJzLPi8GfwF5084y4mdKcts4Xw=; b=HuVFAxwUnf/nYwgYazmjwVaL3LpaieFKd1j+02/jz/+XL7H60hBYW1DOJrACHqc79q 9tEYjH4mIvNpzRgpW3+qE6q0O+fEaCEA2WjE1HKPTv9OgvE/n1+66iw4P+8SYUJQ4ZrV Vi/D6QYqogu5pet1k/0gQBZrWnL9qYdSgeSATk+Il8xayDLg0nBNaGT2XTBYMdPrEJSG zKPUXCTqrpD4DnZv2AGYmwplSiX6O5kh3DpW14/6+cSnwZ+3iDXiNi4xPpUGHwr5p4iR imVudGDvMrqlSpYrF029VjqPDglbQT4qFzAhscGXB0qyuXlZhUjR5VQ+sNKd/Tqnt0Un Md7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si11951294edo.433.2020.12.08.09.33.24; Tue, 08 Dec 2020 09:34:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729691AbgLHR36 (ORCPT + 99 others); Tue, 8 Dec 2020 12:29:58 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:45587 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728495AbgLHR36 (ORCPT ); Tue, 8 Dec 2020 12:29:58 -0500 X-Originating-IP: 82.255.60.242 Received: from localhost.localdomain (lns-bzn-39-82-255-60-242.adsl.proxad.net [82.255.60.242]) (Authenticated sender: hadess@hadess.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 91F4B1C0004; Tue, 8 Dec 2020 17:29:15 +0000 (UTC) From: Bastien Nocera To: linux-bluetooth@vger.kernel.org Cc: Florian Dollinger Subject: [PATCH] Bluetooth: L2CAP: Try harder to accept device not knowing options Date: Tue, 8 Dec 2020 18:29:12 +0100 Message-Id: <20201208172912.4352-1-hadess@hadess.net> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The current implementation of L2CAP options negotiation will continue the negotiation when a device responds with L2CAP_CONF_UNACCEPT ("unaccepted options"), but not when the device replies with L2CAP_CONF_UNKNOWN ("unknown options"). Trying to continue the negotiation without ERTM support will allow Bluetooth-capable XBox One controllers (notably models 1708 and 1797) to connect. btmon before patch: > ACL Data RX: Handle 256 flags 0x02 dlen 16 #64 [hci0] 59.182702 L2CAP: Connection Response (0x03) ident 2 len 8 Destination CID: 64 Source CID: 64 Result: Connection successful (0x0000) Status: No further information available (0x0000) < ACL Data TX: Handle 256 flags 0x00 dlen 23 #65 [hci0] 59.182744 L2CAP: Configure Request (0x04) ident 3 len 15 Destination CID: 64 Flags: 0x0000 Option: Retransmission and Flow Control (0x04) [mandatory] Mode: Basic (0x00) TX window size: 0 Max transmit: 0 Retransmission timeout: 0 Monitor timeout: 0 Maximum PDU size: 0 > ACL Data RX: Handle 256 flags 0x02 dlen 16 #66 [hci0] 59.183948 L2CAP: Configure Request (0x04) ident 1 len 8 Destination CID: 64 Flags: 0x0000 Option: Maximum Transmission Unit (0x01) [mandatory] MTU: 1480 < ACL Data TX: Handle 256 flags 0x00 dlen 18 #67 [hci0] 59.183994 L2CAP: Configure Response (0x05) ident 1 len 10 Source CID: 64 Flags: 0x0000 Result: Success (0x0000) Option: Maximum Transmission Unit (0x01) [mandatory] MTU: 1480 > ACL Data RX: Handle 256 flags 0x02 dlen 15 #69 [hci0] 59.187676 L2CAP: Configure Response (0x05) ident 3 len 7 Source CID: 64 Flags: 0x0000 Result: Failure - unknown options (0x0003) 04 . < ACL Data TX: Handle 256 flags 0x00 dlen 12 #70 [hci0] 59.187722 L2CAP: Disconnection Request (0x06) ident 4 len 4 Destination CID: 64 Source CID: 64 > ACL Data RX: Handle 256 flags 0x02 dlen 12 #73 [hci0] 59.192714 L2CAP: Disconnection Response (0x07) ident 4 len 4 Destination CID: 64 Source CID: 64 btmon after patch: > ACL Data RX: Handle 256 flags 0x02 dlen 16 #248 [hci0] 103.502970 L2CAP: Connection Response (0x03) ident 5 len 8 Destination CID: 65 Source CID: 65 Result: Connection pending (0x0001) Status: No further information available (0x0000) > ACL Data RX: Handle 256 flags 0x02 dlen 16 #249 [hci0] 103.504184 L2CAP: Connection Response (0x03) ident 5 len 8 Destination CID: 65 Source CID: 65 Result: Connection successful (0x0000) Status: No further information available (0x0000) < ACL Data TX: Handle 256 flags 0x00 dlen 23 #250 [hci0] 103.504398 L2CAP: Configure Request (0x04) ident 6 len 15 Destination CID: 65 Flags: 0x0000 Option: Retransmission and Flow Control (0x04) [mandatory] Mode: Basic (0x00) TX window size: 0 Max transmit: 0 Retransmission timeout: 0 Monitor timeout: 0 Maximum PDU size: 0 > ACL Data RX: Handle 256 flags 0x02 dlen 16 #251 [hci0] 103.505472 L2CAP: Configure Request (0x04) ident 3 len 8 Destination CID: 65 Flags: 0x0000 Option: Maximum Transmission Unit (0x01) [mandatory] MTU: 1480 < ACL Data TX: Handle 256 flags 0x00 dlen 18 #252 [hci0] 103.505689 L2CAP: Configure Response (0x05) ident 3 len 10 Source CID: 65 Flags: 0x0000 Result: Success (0x0000) Option: Maximum Transmission Unit (0x01) [mandatory] MTU: 1480 > ACL Data RX: Handle 256 flags 0x02 dlen 15 #254 [hci0] 103.509165 L2CAP: Configure Response (0x05) ident 6 len 7 Source CID: 65 Flags: 0x0000 Result: Failure - unknown options (0x0003) 04 . < ACL Data TX: Handle 256 flags 0x00 dlen 12 #255 [hci0] 103.509426 L2CAP: Configure Request (0x04) ident 7 len 4 Destination CID: 65 Flags: 0x0000 < ACL Data TX: Handle 256 flags 0x00 dlen 12 #257 [hci0] 103.511870 L2CAP: Connection Request (0x02) ident 8 len 4 PSM: 1 (0x0001) Source CID: 66 > ACL Data RX: Handle 256 flags 0x02 dlen 14 #259 [hci0] 103.514121 L2CAP: Configure Response (0x05) ident 7 len 6 Source CID: 65 Flags: 0x0000 Result: Success (0x0000) Signed-off-by: Florian Dollinger Co-developed-by: Florian Dollinger --- net/bluetooth/l2cap_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 1ab27b90ddcb..3ab95ea2cd80 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4513,6 +4513,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, } goto done; + case L2CAP_CONF_UNKNOWN: case L2CAP_CONF_UNACCEPT: if (chan->num_conf_rsp <= L2CAP_CONF_MAX_CONF_RSP) { char req[64]; -- 2.29.2