diff options
author | h.sandeep <h.sandeep@samsung.com> | 2016-11-15 16:48:34 +0530 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2016-12-14 13:53:29 +0900 |
commit | 9612b4f578275e35d4d8586d923e36161e90a056 (patch) | |
tree | 1eb2c77e7e541bd94b4f9ac590f62c8d44392f7b /net | |
parent | 71e3eb2264f0dd8c4acbe7bee07903b6cccf8e3f (diff) |
Bluetooth: Add MGMT interface for setting IRK
It is required to set IRK from BlueZ if privacy feature is disabled,
so this patch adds setting IRK interface to MGMT.
Change-Id: I68183b6003c6292e0f7c95b8fe9c0d04890063b5
Signed-off-by: h.sandeep <h.sandeep@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/mgmt.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 565b4400663b..3fbcfdbe219d 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -7809,6 +7809,31 @@ void mgmt_le_data_length_change_complete(struct hci_dev *hdev, mgmt_event(MGMT_EV_LE_DATA_LENGTH_CHANGED, hdev, &ev, sizeof(ev), NULL); } + +static int set_irk(struct sock *sk, struct hci_dev *hdev, void *cp_data, + u16 len) +{ + struct mgmt_cp_set_irk *cp = cp_data; + int err; + + BT_DBG("request for %s", hdev->name); + + hci_dev_lock(hdev); + + if (!lmp_le_capable(hdev)) { + err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_IRK, + MGMT_STATUS_NOT_SUPPORTED); + goto unlocked; + } + + memcpy(hdev->irk, cp->irk, sizeof(hdev->irk)); + + err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_IRK, 0, NULL, 0); + +unlocked: + hci_dev_unlock(hdev); + return err; +} #endif /* TIZEN_BT */ static bool ltk_is_valid(struct mgmt_ltk_info *key) @@ -9710,6 +9735,7 @@ static const struct hci_mgmt_handler tizen_mgmt_handlers[] = { MGMT_LE_READ_HOST_SUGGESTED_DATA_LENGTH_SIZE }, { set_le_data_length_params, MGMT_LE_SET_DATA_LENGTH_SIZE }, + { set_irk, MGMT_SET_IRK_SIZE }, }; #endif |