aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-02-27 23:37:31 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2014-02-28 02:31:31 -0500
commit0f36b589e4eea0a0a27349992def2ea7beb45182 (patch)
tree38be5a29ecec8afb0cae9f6cb893fab9935b7b0f
parentd2ab0ac18df8735fb1431e63446e803dcd2e7326 (diff)
Bluetooth: Track LE white list modification via HCI commands
When the LE white list gets changed via HCI commands make sure that the internal storage of the white list entries gets updated. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--net/bluetooth/hci_event.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 162235633bf5..674bfdc3ecc3 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1038,6 +1038,49 @@ static void hci_cc_le_read_white_list_size(struct hci_dev *hdev,
1038 hdev->le_white_list_size = rp->size; 1038 hdev->le_white_list_size = rp->size;
1039} 1039}
1040 1040
1041static void hci_cc_le_clear_white_list(struct hci_dev *hdev,
1042 struct sk_buff *skb)
1043{
1044 __u8 status = *((__u8 *) skb->data);
1045
1046 BT_DBG("%s status 0x%2.2x", hdev->name, status);
1047
1048 if (!status)
1049 hci_white_list_clear(hdev);
1050}
1051
1052static void hci_cc_le_add_to_white_list(struct hci_dev *hdev,
1053 struct sk_buff *skb)
1054{
1055 struct hci_cp_le_add_to_white_list *sent;
1056 __u8 status = *((__u8 *) skb->data);
1057
1058 BT_DBG("%s status 0x%2.2x", hdev->name, status);
1059
1060 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_ADD_TO_WHITE_LIST);
1061 if (!sent)
1062 return;
1063
1064 if (!status)
1065 hci_white_list_add(hdev, &sent->bdaddr, sent->bdaddr_type);
1066}
1067
1068static void hci_cc_le_del_from_white_list(struct hci_dev *hdev,
1069 struct sk_buff *skb)
1070{
1071 struct hci_cp_le_del_from_white_list *sent;
1072 __u8 status = *((__u8 *) skb->data);
1073
1074 BT_DBG("%s status 0x%2.2x", hdev->name, status);
1075
1076 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_DEL_FROM_WHITE_LIST);
1077 if (!sent)
1078 return;
1079
1080 if (!status)
1081 hci_white_list_del(hdev, &sent->bdaddr, sent->bdaddr_type);
1082}
1083
1041static void hci_cc_le_read_supported_states(struct hci_dev *hdev, 1084static void hci_cc_le_read_supported_states(struct hci_dev *hdev,
1042 struct sk_buff *skb) 1085 struct sk_buff *skb)
1043{ 1086{
@@ -2378,6 +2421,18 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2378 hci_cc_le_read_white_list_size(hdev, skb); 2421 hci_cc_le_read_white_list_size(hdev, skb);
2379 break; 2422 break;
2380 2423
2424 case HCI_OP_LE_CLEAR_WHITE_LIST:
2425 hci_cc_le_clear_white_list(hdev, skb);
2426 break;
2427
2428 case HCI_OP_LE_ADD_TO_WHITE_LIST:
2429 hci_cc_le_add_to_white_list(hdev, skb);
2430 break;
2431
2432 case HCI_OP_LE_DEL_FROM_WHITE_LIST:
2433 hci_cc_le_del_from_white_list(hdev, skb);
2434 break;
2435
2381 case HCI_OP_LE_READ_SUPPORTED_STATES: 2436 case HCI_OP_LE_READ_SUPPORTED_STATES:
2382 hci_cc_le_read_supported_states(hdev, skb); 2437 hci_cc_le_read_supported_states(hdev, skb);
2383 break; 2438 break;