Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>, linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/3] Bluetooth: Fix LE SMP channel source address and source address type
Date: Thu, 15 Jan 2015 12:53:43 +0200	[thread overview]
Message-ID: <20150115105343.GA16451@t440s.lan> (raw)
In-Reply-To: <20150115102520.GA9910@t440s.lan>

Hi,

On Thu, Jan 15, 2015, Johan Hedberg wrote:
> On Wed, Jan 14, 2015, Marcel Holtmann wrote:
> > +	if (cid == L2CAP_CID_SMP) {
> > +		/* If usage of static address is forced or if the devices
> > +		 * does not have a public address, then listen on the static
> > +		 * address.
> > +		 *
> > +		 * In case BR/EDR has been disabled on a dual-mode controller
> > +		 * and a static address has been configued, then listen on
> > +		 * the static address instead.
> > +		 */
> > +		if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) ||
> > +		    !bacmp(&hdev->bdaddr, BDADDR_ANY) ||
> > +		    (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) &&
> > +		     bacmp(&hdev->static_addr, BDADDR_ANY))) {
> > +			bacpy(&chan->src, &hdev->static_addr);
> > +			chan->src_type = BDADDR_LE_RANDOM;
> > +		} else {
> > +			bacpy(&chan->src, &hdev->bdaddr);
> > +			chan->src_type = BDADDR_LE_PUBLIC;
> > +		}
> 
> I think this can be simply substituted with:
> 
> 	hci_copy_identity_address(hdev, &chan->src, &chan->src_type);

Actually I got this wrong. The l2cap_chan uses a different address types
than the hci_dev uses (e.g. BDADDR_LE_RANDOM vs ADDR_LE_DEV_RANDOM), so
the patch is correct. However, we might still want to later simplify
this using a helper function or macro.

Johan

  reply	other threads:[~2015-01-15 10:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 23:43 [PATCH 1/3] Bluetooth: Fix LE SMP channel source address and source address type Marcel Holtmann
2015-01-15 10:25 ` Johan Hedberg
2015-01-15 10:53   ` Johan Hedberg [this message]
2015-01-15 11:07 ` Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150115105343.GA16451@t440s.lan \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox