mirror of https://gitee.com/openkylin/linux.git
Bluetooth: Use defines in in hci_get_auth_req()
Make the code in hci_get_auth_req() more readable by using the defined macros instead of inlining magic numbers. Signed-off-by: Mikel Astiz <mikel.astiz@bmw-carit.de> Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
This commit is contained in:
parent
a77b15a60c
commit
acabae96df
|
@ -3024,17 +3024,20 @@ static void hci_key_refresh_complete_evt(struct hci_dev *hdev,
|
||||||
static u8 hci_get_auth_req(struct hci_conn *conn)
|
static u8 hci_get_auth_req(struct hci_conn *conn)
|
||||||
{
|
{
|
||||||
/* If remote requests dedicated bonding follow that lead */
|
/* If remote requests dedicated bonding follow that lead */
|
||||||
if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) {
|
if (conn->remote_auth == HCI_AT_DEDICATED_BONDING ||
|
||||||
|
conn->remote_auth == HCI_AT_DEDICATED_BONDING_MITM) {
|
||||||
/* If both remote and local IO capabilities allow MITM
|
/* If both remote and local IO capabilities allow MITM
|
||||||
* protection then require it, otherwise don't */
|
* protection then require it, otherwise don't */
|
||||||
if (conn->remote_cap == 0x03 || conn->io_capability == 0x03)
|
if (conn->remote_cap == HCI_IO_NO_INPUT_OUTPUT ||
|
||||||
return 0x02;
|
conn->io_capability == HCI_IO_NO_INPUT_OUTPUT)
|
||||||
|
return HCI_AT_DEDICATED_BONDING;
|
||||||
else
|
else
|
||||||
return 0x03;
|
return HCI_AT_DEDICATED_BONDING_MITM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If remote requests no-bonding follow that lead */
|
/* If remote requests no-bonding follow that lead */
|
||||||
if (conn->remote_auth == 0x00 || conn->remote_auth == 0x01)
|
if (conn->remote_auth == HCI_AT_NO_BONDING ||
|
||||||
|
conn->remote_auth == HCI_AT_NO_BONDING_MITM)
|
||||||
return conn->remote_auth | (conn->auth_type & 0x01);
|
return conn->remote_auth | (conn->auth_type & 0x01);
|
||||||
|
|
||||||
return conn->auth_type;
|
return conn->auth_type;
|
||||||
|
|
Loading…
Reference in New Issue