Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1167887rwi; Mon, 10 Oct 2022 12:12:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60x0OGzurckSq3nBSBfqTAi4Ic1mFGZfhu8U7ufGDwcgOj1XV+JYAyl8qxW9rzkuywCWnW X-Received: by 2002:a17:907:74a:b0:77e:9455:b4e3 with SMTP id xc10-20020a170907074a00b0077e9455b4e3mr16140608ejb.471.1665429129460; Mon, 10 Oct 2022 12:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665429129; cv=none; d=google.com; s=arc-20160816; b=qcORsu5fsR9cX+zSnxn+7wnIQ6hZp4F/+eGfni10FLGXpnfX+R4INTv//e96aRpw9J OOt9Iux7jSL1FX+WDVvyKbhRo0HriZ2UCKZDe76YtiP3DZ46X8j11/GUFtJX3xNyWMJL ZRuHJgatJlZhqcYJQ70GWdYNV8BfGYNoD7cINZVjc3gvnFVDDg54VEaLWrNtKb0PHKD1 UJQZJuTw02I7SfOSh7bEjSwbTnur2V131W9sJIuJWf5f1947Nl3FtPVTLGXxcRvf5mi6 HlPTYFgNSq8kLR6u6zMi7J1pnVRmdiMLWURhArValFRhyq9ZB9Bq5NmeHG6h3JQbZPhp UfZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=6G+p/cOzaYLjF9QkQfzMTYwR/pNIDUBjmKdo8F00P8c=; b=k6dOBDQ/UbgdXlPZBdWgOYoiEffse8uwJ9bTrMd0OJOmVh3t+BxKy2G8i62VDeXEI0 QvjYnawUr/dxJVZiFQtR1Fx65Fo1wX8FPpMGn+S5ByhSrPWc8TWrzZiOMxGCJQo8TZNn nKfjD/3Z5L4wUXvfX7O3XUMmXQVVZrcdekYQTcv6jVlSi1nibz5rJWln7Pg8/9DV5nn3 8TBirK/vAmiUz3KNfyly50XTLIuN0Q/gKTuvbNW5FdBZYMKSrbvG6JxMFGp0S+OmeMId YKz5JzD1NMVCGsmxjXYJuyjvE0XeRuCwIPROKcU4uu6x+okffkrTNqmCTK1hT0uvTC9v HVnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne22-20020a1709077b9600b0078b2fed72b9si12981557ejc.111.2022.10.10.12.11.29; Mon, 10 Oct 2022 12:12:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229703AbiJJTKB convert rfc822-to-8bit (ORCPT + 99 others); Mon, 10 Oct 2022 15:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbiJJTKB (ORCPT ); Mon, 10 Oct 2022 15:10:01 -0400 X-Greylist: delayed 90 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 10 Oct 2022 12:09:57 PDT Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF56527154 for ; Mon, 10 Oct 2022 12:09:56 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 63B85240105 for ; Mon, 10 Oct 2022 21:08:25 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MmT2w4VTbz6tpW; Mon, 10 Oct 2022 21:08:24 +0200 (CEST) Message-ID: <71ac3f7a801192980142beb34d618770802d9a4c.camel@iki.fi> Subject: Re: [PATCH] Bluetooth: hci_conn: Fix CIS connection dst_type handling From: Pauli Virtanen To: Luiz Augusto von Dentz Cc: linux-bluetooth@vger.kernel.org Date: Mon, 10 Oct 2022 19:08:23 +0000 In-Reply-To: References: <20221009174216.17533-1-pav@iki.fi> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NEUTRAL autolearn=ham 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 Hi Luiz, su, 2022-10-09 kello 14:45 -0700, Luiz Augusto von Dentz kirjoitti: [clip] > > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c > > index 9777e7b109ee..78d8b8b7fd72 100644 > > --- a/net/bluetooth/hci_conn.c > > +++ b/net/bluetooth/hci_conn.c > > @@ -1691,12 +1691,19 @@ struct hci_conn *hci_bind_cis(struct hci_dev *hdev, bdaddr_t *dst, > > { > > struct hci_conn *cis; > > > > + /* Convert from ISO socket address type to HCI address type */ > > + if (dst_type == BDADDR_LE_PUBLIC) > > + dst_type = ADDR_LE_DEV_PUBLIC; > > + else > > + dst_type = ADDR_LE_DEV_RANDOM; > > + > > cis = hci_conn_hash_lookup_cis(hdev, dst, dst_type); > > if (!cis) { > > cis = hci_conn_add(hdev, ISO_LINK, dst, HCI_ROLE_MASTER); > > if (!cis) > > return ERR_PTR(-ENOMEM); > > cis->cleanup = cis_cleanup; > > + cis->dst_type = dst_type; > > } > > > > if (cis->state == BT_CONNECTED) > > @@ -2075,20 +2082,21 @@ struct hci_conn *hci_connect_cis(struct hci_dev *hdev, bdaddr_t *dst, > > { > > struct hci_conn *le; > > struct hci_conn *cis; > > + u8 hci_dst_type; > > > > /* Convert from ISO socket address type to HCI address type */ > > if (dst_type == BDADDR_LE_PUBLIC) > > - dst_type = ADDR_LE_DEV_PUBLIC; > > + hci_dst_type = ADDR_LE_DEV_PUBLIC; > > else > > - dst_type = ADDR_LE_DEV_RANDOM; > > + hci_dst_type = ADDR_LE_DEV_RANDOM; > > Nice catch, though I think we should make sure these types are not > from hci_conn.c as the name suggest these should be dealing HCI > procedures so it doesn't make much sense to propagate types other than > HCI. Not sure I parse right: You want to move the conversions to the callsite in iso.c? Or change the variable name here? If the former, there are a few other instances of these in hci_conn.c. > > if (hci_dev_test_flag(hdev, HCI_ADVERTISING)) > > - le = hci_connect_le(hdev, dst, dst_type, false, > > + le = hci_connect_le(hdev, dst, hci_dst_type, false, > > BT_SECURITY_LOW, > > HCI_LE_CONN_TIMEOUT, > > HCI_ROLE_SLAVE); > > else > > - le = hci_connect_le_scan(hdev, dst, dst_type, > > + le = hci_connect_le_scan(hdev, dst, hci_dst_type, > > BT_SECURITY_LOW, > > HCI_LE_CONN_TIMEOUT, > > CONN_REASON_ISO_CONNECT); > > -- > > 2.37.3 > > > > While at it probably makes sense to introduce a test to iso-tester > that uses random address rather than always using public, that way we > can make sure we exercise this code with CI.