aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--net/bluetooth/hci_core.c4
-rw-r--r--net/bluetooth/mgmt.c50
3 files changed, 18 insertions, 38 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 9078da681f16..3404f9bd2da0 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1325,8 +1325,6 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1325void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1325void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1326 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1326 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1327void mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1327void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1328int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1329int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1330void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent); 1328void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent);
1331void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk); 1329void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk);
1332void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk, 1330void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 25ed6d3de410..72eb41424d04 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3275,7 +3275,7 @@ int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
3275 3275
3276 list_add(&entry->list, &hdev->blacklist); 3276 list_add(&entry->list, &hdev->blacklist);
3277 3277
3278 return mgmt_device_blocked(hdev, bdaddr, type); 3278 return 0;
3279} 3279}
3280 3280
3281int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) 3281int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
@@ -3294,7 +3294,7 @@ int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
3294 list_del(&entry->list); 3294 list_del(&entry->list);
3295 kfree(entry); 3295 kfree(entry);
3296 3296
3297 return mgmt_device_unblocked(hdev, bdaddr, type); 3297 return 0;
3298} 3298}
3299 3299
3300struct bdaddr_list *hci_white_list_lookup(struct hci_dev *hdev, 3300struct bdaddr_list *hci_white_list_lookup(struct hci_dev *hdev,
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 408468c07a8a..ba5e215a7561 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3773,11 +3773,16 @@ static int block_device(struct sock *sk, struct hci_dev *hdev, void *data,
3773 hci_dev_lock(hdev); 3773 hci_dev_lock(hdev);
3774 3774
3775 err = hci_blacklist_add(hdev, &cp->addr.bdaddr, cp->addr.type); 3775 err = hci_blacklist_add(hdev, &cp->addr.bdaddr, cp->addr.type);
3776 if (err < 0) 3776 if (err < 0) {
3777 status = MGMT_STATUS_FAILED; 3777 status = MGMT_STATUS_FAILED;
3778 else 3778 goto done;
3779 status = MGMT_STATUS_SUCCESS; 3779 }
3780
3781 mgmt_event(MGMT_EV_DEVICE_BLOCKED, hdev, &cp->addr, sizeof(cp->addr),
3782 sk);
3783 status = MGMT_STATUS_SUCCESS;
3780 3784
3785done:
3781 err = cmd_complete(sk, hdev->id, MGMT_OP_BLOCK_DEVICE, status, 3786 err = cmd_complete(sk, hdev->id, MGMT_OP_BLOCK_DEVICE, status,
3782 &cp->addr, sizeof(cp->addr)); 3787 &cp->addr, sizeof(cp->addr));
3783 3788
@@ -3803,11 +3808,16 @@ static int unblock_device(struct sock *sk, struct hci_dev *hdev, void *data,
3803 hci_dev_lock(hdev); 3808 hci_dev_lock(hdev);
3804 3809
3805 err = hci_blacklist_del(hdev, &cp->addr.bdaddr, cp->addr.type); 3810 err = hci_blacklist_del(hdev, &cp->addr.bdaddr, cp->addr.type);
3806 if (err < 0) 3811 if (err < 0) {
3807 status = MGMT_STATUS_INVALID_PARAMS; 3812 status = MGMT_STATUS_INVALID_PARAMS;
3808 else 3813 goto done;
3809 status = MGMT_STATUS_SUCCESS; 3814 }
3815
3816 mgmt_event(MGMT_EV_DEVICE_UNBLOCKED, hdev, &cp->addr, sizeof(cp->addr),
3817 sk);
3818 status = MGMT_STATUS_SUCCESS;
3810 3819
3820done:
3811 err = cmd_complete(sk, hdev->id, MGMT_OP_UNBLOCK_DEVICE, status, 3821 err = cmd_complete(sk, hdev->id, MGMT_OP_UNBLOCK_DEVICE, status,
3812 &cp->addr, sizeof(cp->addr)); 3822 &cp->addr, sizeof(cp->addr));
3813 3823
@@ -6346,34 +6356,6 @@ void mgmt_discovering(struct hci_dev *hdev, u8 discovering)
6346 mgmt_event(MGMT_EV_DISCOVERING, hdev, &ev, sizeof(ev), NULL); 6356 mgmt_event(MGMT_EV_DISCOVERING, hdev, &ev, sizeof(ev), NULL);
6347} 6357}
6348 6358
6349int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
6350{
6351 struct pending_cmd *cmd;
6352 struct mgmt_ev_device_blocked ev;
6353
6354 cmd = mgmt_pending_find(MGMT_OP_BLOCK_DEVICE, hdev);
6355
6356 bacpy(&ev.addr.bdaddr, bdaddr);
6357 ev.addr.type = type;
6358
6359 return mgmt_event(MGMT_EV_DEVICE_BLOCKED, hdev, &ev, sizeof(ev),
6360 cmd ? cmd->sk : NULL);
6361}
6362
6363int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
6364{
6365 struct pending_cmd *cmd;
6366 struct mgmt_ev_device_unblocked ev;
6367
6368 cmd = mgmt_pending_find(MGMT_OP_UNBLOCK_DEVICE, hdev);
6369
6370 bacpy(&ev.addr.bdaddr, bdaddr);
6371 ev.addr.type = type;
6372
6373 return mgmt_event(MGMT_EV_DEVICE_UNBLOCKED, hdev, &ev, sizeof(ev),
6374 cmd ? cmd->sk : NULL);
6375}
6376
6377static void adv_enable_complete(struct hci_dev *hdev, u8 status) 6359static void adv_enable_complete(struct hci_dev *hdev, u8 status)
6378{ 6360{
6379 BT_DBG("%s status %u", hdev->name, status); 6361 BT_DBG("%s status %u", hdev->name, status);