Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2157346pxb; Fri, 25 Mar 2022 12:06:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzr8+WawQ2fAkw4a1AAZoRB3Od4m2PVtMYxjBulnJt7ZPaBoKRwyG0ZI2IA6plFIuHdtqi4 X-Received: by 2002:a17:90b:3886:b0:1c6:b478:788b with SMTP id mu6-20020a17090b388600b001c6b478788bmr26655498pjb.75.1648235201100; Fri, 25 Mar 2022 12:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648235201; cv=none; d=google.com; s=arc-20160816; b=re41nz/vXQtXrlOhpp9917WJol5WtiZrrD7Ya3H62VL0YBpbsU/tftJUzm/PtcIhFN y1HqFvwq7PA3dDyNbbkglPjzYOVGxlwhA7uLFy6KT5V8wFBz5rZvaZQhgnkRSFWm/Oq9 Uw9rFB4kzejcn9c9aJGuSaq3ThQZI2tUAM2QUoRS5xsAULIz0zi8DHvdBXOyPSMyw7Lp dFcW1gev8kaJm6d5bXQPwatALH7qgiu6Ydaiwr3tZSy/HBMoNSV7mjvmYdgcu7pedVLI /UqYgJrWSV3IQhp5XyLBovV8pQOP2EgGk0kx4O5lQzhdpirxZ+L+cg4mjdmiDY27xovI MmDg== 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:to:from:dkim-signature; bh=0+DZPJ4UeslbfD6dBYHluzn4a6G41JzfoQ0WMq18L8U=; b=AyxMxF25I9wE/wYp0dMjmnwqlsZcn+Ti7ZBbSkkjH0NGuDXYRT2fXzm5soW6/WndZI K5ExaJQVXxSBPQh2LQbIfYG0DlilL5oYyIENqPx8i8OKSPV+muOiV3qQ5XszQ69Et9Qh DFdmUuoY/87iU5T15cScMLBTLVVnYu7+inP/X9VwLhk2KY3hw+MUTYTCTyyqf8fFhhmp pJAxfCI3gakk6ey1XqTIC/uYCshJmsCvEhNUMrAW24/lmlq1q6dH3wc/kGKIAJSuqBFg ONC5Vnq4EAK/08uwIXMJivlqZFf/M3YWu4R8ZhiebpHQTHSnxuuMbFi96tagyW279pOw xsyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Xjv7nlDl; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bh5-20020a056a02020500b0038202624720si3344697pgb.187.2022.03.25.12.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:06:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Xjv7nlDl; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4A871210280; Fri, 25 Mar 2022 11:17:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354199AbiCXVie (ORCPT + 99 others); Thu, 24 Mar 2022 17:38:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344622AbiCXVid (ORCPT ); Thu, 24 Mar 2022 17:38:33 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9076B6E52 for ; Thu, 24 Mar 2022 14:37:00 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id bx5so5836176pjb.3 for ; Thu, 24 Mar 2022 14:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=0+DZPJ4UeslbfD6dBYHluzn4a6G41JzfoQ0WMq18L8U=; b=Xjv7nlDlvksa1107J/upF26/2fzC72qkmnFKWV5oibMfnw8aMf+K6bcDbp3Glz5/xW jAvSiaQGR+MYrjBxCIwMZZZXGhKF7IJd6TaN0o+TyoLe0VclnmDpwf3NI51HnFiKHXmS SODxAbKaWhREUVlN8hNdiR7flI5SVqoWSWtjn954fPVpofLZF6+7Bq3Hl2SrtYXEU9OO eIaK1ibv/ng+oc0Mvhrgclb064M/w+r2/zkH/eeG1qabhkqUSW1O8eo7rbW+PpN8Phpe 2sSIXz4HMlyD69e7bNklxDHJK3QojPvEb5Miy5UZ4hlUIQNyLsEmuH8GsG+Su2lKbcjR iVFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=0+DZPJ4UeslbfD6dBYHluzn4a6G41JzfoQ0WMq18L8U=; b=geENczKnwtQtpOeOB9j+HzAOAxKukiVDf9K0NL3ziFZdPtgbehpfpYeObBnS/I3H0W VDw3pXd8f2OWhcXwD+vR8UERZu0RlWise8+5u3HNwqRoiPlc4iQzlAd/PLZ8a+RG34xE rEgLjOTq0aFKWR4ArTyB/F7AE2gpJIyBV8YIu1WbPpp1o0O4Uhq5Z3dZ2YwCMU2xqecd A/Fz0ZReT9UQ3hRc2b4QA8EIxtibs1G2kvn4657hy8szl2bB7VjTJ30PsTBzo9vX0+G6 n9UjmLWqAp0XiG/KHj3cSeWacw6EHN+PCMoUi0dvnYotGIKT2nN69W1+SY/vWEpDL5BL VSyQ== X-Gm-Message-State: AOAM530ohuqHqN4Gr9AroMb8wdaCyKqAqZ2VGdzVkwXopTyePXkgh1BL fE2Yg+DcNZ02Mj/5Lp12fFYw3g45S4I= X-Received: by 2002:a17:90a:7147:b0:1bd:24ac:13bd with SMTP id g7-20020a17090a714700b001bd24ac13bdmr20852742pjs.70.1648157820039; Thu, 24 Mar 2022 14:37:00 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id g5-20020a056a0023c500b004fae15ab86dsm4696489pfc.52.2022.03.24.14.36.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 14:36:59 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/2] adapter: Fix adding SDP records when operating on LE only mode Date: Thu, 24 Mar 2022 14:36:57 -0700 Message-Id: <20220324213658.59479-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz If mode is set to BT_MODE_LE SDP protocol won't be operational so it is useless to attempt to add records. --- src/adapter.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/adapter.c b/src/adapter.c index 1fcf75ec4..e8b84ccda 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -1227,6 +1227,13 @@ int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec) { int ret; + /* + * If the controller does not support BR/EDR operation, + * there is no point in trying to add SDP records. + */ + if (btd_opts.mode == BT_MODE_LE) + return -ENOTSUP; + DBG("%s", adapter->path); ret = add_record_to_server(&adapter->bdaddr, rec); @@ -1240,10 +1247,17 @@ int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec) void adapter_service_remove(struct btd_adapter *adapter, uint32_t handle) { - sdp_record_t *rec = sdp_record_find(handle); + sdp_record_t *rec; + /* + * If the controller does not support BR/EDR operation, + * there is no point in trying to remote SDP records. + */ + if (btd_opts.mode == BT_MODE_LE) + return; DBG("%s", adapter->path); + rec = sdp_record_find(handle); if (!rec) return; -- 2.35.1