aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-01-14 18:43:09 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2015-01-15 05:54:30 -0500
commit157029ba3014e2025170c7bf83bbe7d4ccb16692 (patch)
tree0f4533650d8d03e3520a928978c1eeba689d5227
parent111e4bccd1e27f0703936aadf41f227a9226e031 (diff)
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: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--net/bluetooth/smp.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 04e49f8f0982..3e4de935f667 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -2950,11 +2950,30 @@ create_chan:
2950 2950
2951 l2cap_chan_set_defaults(chan); 2951 l2cap_chan_set_defaults(chan);
2952 2952
2953 bacpy(&chan->src, &hdev->bdaddr); 2953 if (cid == L2CAP_CID_SMP) {
2954 if (cid == L2CAP_CID_SMP) 2954 /* If usage of static address is forced or if the devices
2955 chan->src_type = BDADDR_LE_PUBLIC; 2955 * does not have a public address, then listen on the static
2956 else 2956 * address.
2957 *
2958 * In case BR/EDR has been disabled on a dual-mode controller
2959 * and a static address has been configued, then listen on
2960 * the static address instead.
2961 */
2962 if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) ||
2963 !bacmp(&hdev->bdaddr, BDADDR_ANY) ||
2964 (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) &&
2965 bacmp(&hdev->static_addr, BDADDR_ANY))) {
2966 bacpy(&chan->src, &hdev->static_addr);
2967 chan->src_type = BDADDR_LE_RANDOM;
2968 } else {
2969 bacpy(&chan->src, &hdev->bdaddr);
2970 chan->src_type = BDADDR_LE_PUBLIC;
2971 }
2972 } else {
2973 bacpy(&chan->src, &hdev->bdaddr);
2957 chan->src_type = BDADDR_BREDR; 2974 chan->src_type = BDADDR_BREDR;
2975 }
2976
2958 chan->state = BT_LISTEN; 2977 chan->state = BT_LISTEN;
2959 chan->mode = L2CAP_MODE_BASIC; 2978 chan->mode = L2CAP_MODE_BASIC;
2960 chan->imtu = L2CAP_DEFAULT_MTU; 2979 chan->imtu = L2CAP_DEFAULT_MTU;