summaryrefslogtreecommitdiff
path: root/btio
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-12-30 14:10:48 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2013-12-30 14:15:58 +0200
commitdf8c06486747af65b8c9cf5f03994526a695e9d8 (patch)
tree7f292d505944d237f869fc983ef5bbe9b22c6d36 /btio
parent5acde7b7efc51e18ffeb3d8cafe59beaf9b68631 (diff)
downloadbluez-df8c06486747af65b8c9cf5f03994526a695e9d8.tar.gz
btio: Fix falling back to L2CAP_OPTIONS if BT_RCVMTU fails
Diffstat (limited to 'btio')
-rw-r--r--btio/btio.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/btio/btio.c b/btio/btio.c
index 8631cd40e..7ef7ec777 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -977,11 +977,16 @@ static gboolean l2cap_get(int sock, GError **err, BtIOOption opt1,
if (src.l2_bdaddr_type != BDADDR_BREDR) {
if (getsockopt(sock, SOL_BLUETOOTH, BT_RCVMTU,
- &l2o.imtu, &len) < 0) {
+ &l2o.imtu, &len) == 0)
+ goto parse_opts;
+
+ /* Non-LE CoC enabled kernels will return one of these
+ * in which case we need to fall back to L2CAP_OPTIONS.
+ */
+ if (errno != EPROTONOSUPPORT && errno != ENOPROTOOPT) {
ERROR_FAILED(err, "getsockopt(BT_RCVMTU)", errno);
return FALSE;
}
- goto parse_opts;
}
if (getsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, &l2o, &len) < 0) {