diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/mgmt.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 0110a75661ef..fbc8edf7dc1f 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -510,6 +510,39 @@ static u8 *create_uuid32_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len) | |||
510 | return ptr; | 510 | return ptr; |
511 | } | 511 | } |
512 | 512 | ||
513 | static u8 *create_uuid128_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len) | ||
514 | { | ||
515 | u8 *ptr = data, *uuids_start = NULL; | ||
516 | struct bt_uuid *uuid; | ||
517 | |||
518 | if (len < 18) | ||
519 | return ptr; | ||
520 | |||
521 | list_for_each_entry(uuid, &hdev->uuids, list) { | ||
522 | if (uuid->size != 128) | ||
523 | continue; | ||
524 | |||
525 | if (!uuids_start) { | ||
526 | uuids_start = ptr; | ||
527 | uuids_start[0] = 1; | ||
528 | uuids_start[1] = EIR_UUID128_ALL; | ||
529 | ptr += 2; | ||
530 | } | ||
531 | |||
532 | /* Stop if not enough space to put next UUID */ | ||
533 | if ((ptr - data) + 16 > len) { | ||
534 | uuids_start[1] = EIR_UUID128_SOME; | ||
535 | break; | ||
536 | } | ||
537 | |||
538 | memcpy(ptr, uuid->uuid, 16); | ||
539 | ptr += 16; | ||
540 | uuids_start[0] += 16; | ||
541 | } | ||
542 | |||
543 | return ptr; | ||
544 | } | ||
545 | |||
513 | static void create_eir(struct hci_dev *hdev, u8 *data) | 546 | static void create_eir(struct hci_dev *hdev, u8 *data) |
514 | { | 547 | { |
515 | u8 *ptr = data; | 548 | u8 *ptr = data; |
@@ -555,6 +588,7 @@ static void create_eir(struct hci_dev *hdev, u8 *data) | |||
555 | 588 | ||
556 | ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); | 589 | ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); |
557 | ptr = create_uuid32_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); | 590 | ptr = create_uuid32_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); |
591 | ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); | ||
558 | } | 592 | } |
559 | 593 | ||
560 | static int update_eir(struct hci_dev *hdev) | 594 | static int update_eir(struct hci_dev *hdev) |