提交 157029ba 编写于 作者: M Marcel Holtmann 提交者: Johan Hedberg

Bluetooth: Fix LE SMP channel source address and source address type

The source address and source address type of the LE SMP channel can
either be the public address of the controller or the static random
address configured by the host.

Right now the public address is used for the LE SMP channel and
obviously that is not correct if the controller operates with the
configured static random address.
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
上级 111e4bcc
...@@ -2950,11 +2950,30 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid) ...@@ -2950,11 +2950,30 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid)
l2cap_chan_set_defaults(chan); l2cap_chan_set_defaults(chan);
bacpy(&chan->src, &hdev->bdaddr); if (cid == L2CAP_CID_SMP) {
if (cid == L2CAP_CID_SMP) /* If usage of static address is forced or if the devices
chan->src_type = BDADDR_LE_PUBLIC; * does not have a public address, then listen on the static
else * 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;
}
} else {
bacpy(&chan->src, &hdev->bdaddr);
chan->src_type = BDADDR_BREDR; chan->src_type = BDADDR_BREDR;
}
chan->state = BT_LISTEN; chan->state = BT_LISTEN;
chan->mode = L2CAP_MODE_BASIC; chan->mode = L2CAP_MODE_BASIC;
chan->imtu = L2CAP_DEFAULT_MTU; chan->imtu = L2CAP_DEFAULT_MTU;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册