diff options
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r-- | net/bluetooth/smp.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index c09a821f381d..c91c19bfc0a8 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -1252,7 +1252,10 @@ static void smp_distribute_keys(struct smp_chan *smp) | |||
1252 | 1252 | ||
1253 | csrk = kzalloc(sizeof(*csrk), GFP_KERNEL); | 1253 | csrk = kzalloc(sizeof(*csrk), GFP_KERNEL); |
1254 | if (csrk) { | 1254 | if (csrk) { |
1255 | csrk->master = 0x00; | 1255 | if (hcon->sec_level > BT_SECURITY_MEDIUM) |
1256 | csrk->type = MGMT_CSRK_LOCAL_AUTHENTICATED; | ||
1257 | else | ||
1258 | csrk->type = MGMT_CSRK_LOCAL_UNAUTHENTICATED; | ||
1256 | memcpy(csrk->val, sign.csrk, sizeof(csrk->val)); | 1259 | memcpy(csrk->val, sign.csrk, sizeof(csrk->val)); |
1257 | } | 1260 | } |
1258 | smp->slave_csrk = csrk; | 1261 | smp->slave_csrk = csrk; |
@@ -2352,7 +2355,10 @@ static int smp_cmd_sign_info(struct l2cap_conn *conn, struct sk_buff *skb) | |||
2352 | 2355 | ||
2353 | csrk = kzalloc(sizeof(*csrk), GFP_KERNEL); | 2356 | csrk = kzalloc(sizeof(*csrk), GFP_KERNEL); |
2354 | if (csrk) { | 2357 | if (csrk) { |
2355 | csrk->master = 0x01; | 2358 | if (conn->hcon->sec_level > BT_SECURITY_MEDIUM) |
2359 | csrk->type = MGMT_CSRK_REMOTE_AUTHENTICATED; | ||
2360 | else | ||
2361 | csrk->type = MGMT_CSRK_REMOTE_UNAUTHENTICATED; | ||
2356 | memcpy(csrk->val, rp->csrk, sizeof(csrk->val)); | 2362 | memcpy(csrk->val, rp->csrk, sizeof(csrk->val)); |
2357 | } | 2363 | } |
2358 | smp->csrk = csrk; | 2364 | smp->csrk = csrk; |
@@ -2951,24 +2957,14 @@ create_chan: | |||
2951 | l2cap_chan_set_defaults(chan); | 2957 | l2cap_chan_set_defaults(chan); |
2952 | 2958 | ||
2953 | if (cid == L2CAP_CID_SMP) { | 2959 | if (cid == L2CAP_CID_SMP) { |
2954 | /* If usage of static address is forced or if the devices | 2960 | u8 bdaddr_type; |
2955 | * does not have a public address, then listen on the static | 2961 | |
2956 | * address. | 2962 | hci_copy_identity_address(hdev, &chan->src, &bdaddr_type); |
2957 | * | 2963 | |
2958 | * In case BR/EDR has been disabled on a dual-mode controller | 2964 | if (bdaddr_type == ADDR_LE_DEV_PUBLIC) |
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; | 2965 | chan->src_type = BDADDR_LE_PUBLIC; |
2971 | } | 2966 | else |
2967 | chan->src_type = BDADDR_LE_RANDOM; | ||
2972 | } else { | 2968 | } else { |
2973 | bacpy(&chan->src, &hdev->bdaddr); | 2969 | bacpy(&chan->src, &hdev->bdaddr); |
2974 | chan->src_type = BDADDR_BREDR; | 2970 | chan->src_type = BDADDR_BREDR; |