diff options
-rw-r--r-- | include/net/bluetooth/mgmt.h | 1 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 28 |
2 files changed, 27 insertions, 2 deletions
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index fe8eef00e9ca..0c737e4b8f57 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -98,6 +98,7 @@ struct mgmt_rp_read_index_list { | |||
98 | #define MGMT_SETTING_DEBUG_KEYS 0x00001000 | 98 | #define MGMT_SETTING_DEBUG_KEYS 0x00001000 |
99 | #define MGMT_SETTING_PRIVACY 0x00002000 | 99 | #define MGMT_SETTING_PRIVACY 0x00002000 |
100 | #define MGMT_SETTING_CONFIGURATION 0x00004000 | 100 | #define MGMT_SETTING_CONFIGURATION 0x00004000 |
101 | #define MGMT_SETTING_STATIC_ADDRESS 0x00008000 | ||
101 | 102 | ||
102 | #define MGMT_OP_READ_INFO 0x0004 | 103 | #define MGMT_OP_READ_INFO 0x0004 |
103 | #define MGMT_READ_INFO_SIZE 0 | 104 | #define MGMT_READ_INFO_SIZE 0 |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 967f07fdbbbe..d185a9800983 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -583,6 +583,7 @@ static u32 get_supported_settings(struct hci_dev *hdev) | |||
583 | settings |= MGMT_SETTING_ADVERTISING; | 583 | settings |= MGMT_SETTING_ADVERTISING; |
584 | settings |= MGMT_SETTING_SECURE_CONN; | 584 | settings |= MGMT_SETTING_SECURE_CONN; |
585 | settings |= MGMT_SETTING_PRIVACY; | 585 | settings |= MGMT_SETTING_PRIVACY; |
586 | settings |= MGMT_SETTING_STATIC_ADDRESS; | ||
586 | } | 587 | } |
587 | 588 | ||
588 | if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) || | 589 | if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) || |
@@ -638,6 +639,25 @@ static u32 get_current_settings(struct hci_dev *hdev) | |||
638 | if (test_bit(HCI_PRIVACY, &hdev->dev_flags)) | 639 | if (test_bit(HCI_PRIVACY, &hdev->dev_flags)) |
639 | settings |= MGMT_SETTING_PRIVACY; | 640 | settings |= MGMT_SETTING_PRIVACY; |
640 | 641 | ||
642 | /* The current setting for static address has two purposes. The | ||
643 | * first is to indicate if the static address will be used and | ||
644 | * the second is to indicate if it is actually set. | ||
645 | * | ||
646 | * This means if the static address is not configured, this flag | ||
647 | * will never bet set. If the address is configured, then if the | ||
648 | * address is actually used decides if the flag is set or not. | ||
649 | * | ||
650 | * For single mode LE only controllers and dual-mode controllers | ||
651 | * with BR/EDR disabled, the existence of the static address will | ||
652 | * be evaluated. | ||
653 | */ | ||
654 | if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) || | ||
655 | !test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) || | ||
656 | !bacmp(&hdev->bdaddr, BDADDR_ANY)) { | ||
657 | if (bacmp(&hdev->static_addr, BDADDR_ANY)) | ||
658 | settings |= MGMT_SETTING_STATIC_ADDRESS; | ||
659 | } | ||
660 | |||
641 | return settings; | 661 | return settings; |
642 | } | 662 | } |
643 | 663 | ||
@@ -4498,10 +4518,14 @@ static int set_static_address(struct sock *sk, struct hci_dev *hdev, | |||
4498 | 4518 | ||
4499 | bacpy(&hdev->static_addr, &cp->bdaddr); | 4519 | bacpy(&hdev->static_addr, &cp->bdaddr); |
4500 | 4520 | ||
4501 | err = cmd_complete(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS, 0, NULL, 0); | 4521 | err = send_settings_rsp(sk, MGMT_OP_SET_STATIC_ADDRESS, hdev); |
4522 | if (err < 0) | ||
4523 | goto unlock; | ||
4502 | 4524 | ||
4503 | hci_dev_unlock(hdev); | 4525 | err = new_settings(hdev, sk); |
4504 | 4526 | ||
4527 | unlock: | ||
4528 | hci_dev_unlock(hdev); | ||
4505 | return err; | 4529 | return err; |
4506 | } | 4530 | } |
4507 | 4531 | ||