Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1191468rwi; Mon, 10 Oct 2022 12:33:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lLP2GaXUJWOH8hshV8dsarcOI+N5cagGAQKtpRGerzV17XcX8pz7af1RWhNe8JFty98YA X-Received: by 2002:a17:906:4795:b0:787:434f:d754 with SMTP id cw21-20020a170906479500b00787434fd754mr16663710ejc.268.1665430405858; Mon, 10 Oct 2022 12:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665430405; cv=none; d=google.com; s=arc-20160816; b=PZZF3rZFpgn9Ma+EKEy/oQezKtvgUepmUsfCxRiMaxqOCtV5f8grnaDs7JX3+zQNwg XN6TsrjWns+AKZ+Pc5Kj0e9PA4sFC8MJ6RRT7iBxk6tVbelD1kNawZltwopxoLqXC4Yc PDJCo8TVe9m3oMtPpjeeZS7+TouXY4pg5/SATPkc2g+Y2qFdVndMeQ5kx1pTfLoGOqn0 Lb8OYS8c9Yszk7mFLlbYTELP0tiA9gFsphkDYd5ofYql2QO6IT1/pokggiYTpv9uMkfg 7rAxtSCmNQ4La96eARCxIGRublCVS5D+qYduiOWWWBnrNejqhYEZHGYxPqxWB1Ka0KX0 /8Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+IzfqkaQR+lumGiDT6SOc/p6YG9+wojOX5AhJzrGJnQ=; b=gO94krPnbwPx1vwmIhRMmW+r6RVfk4pQgfujUbf1vAZP5WdmQLdpRbCQDAY2dnq7fT /pejKCFmtFkI0pptwMAm7xUiJeOtQ3+t+6i7q38yD886Z4f3+6xjyOov84NNpaSp08xx DClxs1hygejgseL20+56FMS1fI+JYimd7JfV4hsKB17HuTJvMMl54FkWg51vJmrxlDsU zR1Qd/aQqufvz4md8D+JpDFbM+dKW+4uJBgTNBnphxj+sz8uIGcIk3tarqUjJatIL+/m 3LXkDsZ21jwSyvW7RWF4xDplTlaG3uq/nK4tOL+B5SVfZ39/QeCNynpX5/FC0cIQGD5e HQsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=U0Q6PQh8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd10-20020a170907628a00b007835897050asi11282471ejc.83.2022.10.10.12.32.47; Mon, 10 Oct 2022 12:33:25 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=U0Q6PQh8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229471AbiJJT0V (ORCPT + 99 others); Mon, 10 Oct 2022 15:26:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbiJJT0U (ORCPT ); Mon, 10 Oct 2022 15:26:20 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C53186CF4F for ; Mon, 10 Oct 2022 12:26:13 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id d6so17941933lfs.10 for ; Mon, 10 Oct 2022 12:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+IzfqkaQR+lumGiDT6SOc/p6YG9+wojOX5AhJzrGJnQ=; b=U0Q6PQh8shD6oyt9iEeK7Q/OqnbGiaVFZGBeCGzZ8Lc/0s4gFqYYbgQJX5gPI3GZvd +IvgCk1H+TNLr3KNO2mxnFBSS2CaI5rhJ5BYGeGqpPxkMnpUp8pzmfz1npZ7UdqtUMih 54ELmls+y/atiL/cWSzMv69PfQaPoCcxNUssjO5LxmBLFh0ZLF0zQNNeBrrLmRjAY/Vw SPiII2totgt+oJMCQMJ2NmlcTbs4PI5kYpLZhML/Wgp+I757QpD00Vr4dKoEg+w/APLF TMGAu7wSOn3sM9kMrKjgDDE7ppclfkPQ1YJoLRnVKb36b7Gw9LiHCdU+v1m77GVLxMPF k1nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+IzfqkaQR+lumGiDT6SOc/p6YG9+wojOX5AhJzrGJnQ=; b=fxjvs9yt0WmGkrtSbaTf5bCuDQiMPWrtvp8/ywAWUGWt+v0p9vkjgzDePOwG9Y7j8C 1z8NauD/vjcdesGf2JYWHTyGXOw9pmy4tuQZBZt6d+4TFBy2dMU+3l8uNNcof9QL+FW6 ph1FYxNVzBfc2urfR/9HdoPjZg7SLi0lJiiN7Vsm7oWilqvqdCeJDvbAS9LFARx0wA+F zoWJBDHUkoqmOLH1Hfg90wDPTVgqXVNy4CLA5nsqBfjgCklO/AVvE7CvwtHlw38i+wM+ qgN07CNspecjALLYAFOEDgoAhnMq8uh8OeDFDsn0VyN2/UOTfiGRpe48dQn7aKSG2s59 V7ew== X-Gm-Message-State: ACrzQf1Xs79urm+LsYkhvO3sMNv7eoI4gqWRuoKG5PKQkZH4ehnUkA1c A9kK7has3FdzWvqtnuNuCzetBlMgIAgRkClzgMY= X-Received: by 2002:ac2:5f56:0:b0:4a2:40f6:266c with SMTP id 22-20020ac25f56000000b004a240f6266cmr6934678lfz.564.1665429970916; Mon, 10 Oct 2022 12:26:10 -0700 (PDT) MIME-Version: 1.0 References: <20221009174216.17533-1-pav@iki.fi> <71ac3f7a801192980142beb34d618770802d9a4c.camel@iki.fi> In-Reply-To: <71ac3f7a801192980142beb34d618770802d9a4c.camel@iki.fi> From: Luiz Augusto von Dentz Date: Mon, 10 Oct 2022 12:25:59 -0700 Message-ID: Subject: Re: [PATCH] Bluetooth: hci_conn: Fix CIS connection dst_type handling To: Pauli Virtanen Cc: linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Pauli, On Mon, Oct 10, 2022 at 12:08 PM Pauli Virtanen wrote: > > 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. Lets move to iso.c and make the conversion before the calls into 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. -- Luiz Augusto von Dentz