Commit a83ed81e authored by Marcel Holtmann's avatar Marcel Holtmann

Bluetooth: Use helper function to determine BR/EDR OOB data present

When replying to the IO capability request for Secure Simple Pairing and
Secure Connections, the OOB data present fields needs to set. Instead of
making the calculation inline, split this into a separate helper
function.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 6665d057
...@@ -3855,6 +3855,21 @@ static u8 hci_get_auth_req(struct hci_conn *conn) ...@@ -3855,6 +3855,21 @@ static u8 hci_get_auth_req(struct hci_conn *conn)
return (conn->remote_auth & ~0x01) | (conn->auth_type & 0x01); return (conn->remote_auth & ~0x01) | (conn->auth_type & 0x01);
} }
static u8 bredr_oob_data_present(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
struct oob_data *data;
data = hci_find_remote_oob_data(hdev, &conn->dst, BDADDR_BREDR);
if (!data)
return 0x00;
if (conn->out || test_bit(HCI_CONN_REMOTE_OOB, &conn->flags))
return 0x01;
return 0x00;
}
static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
{ {
struct hci_ev_io_capa_request *ev = (void *) skb->data; struct hci_ev_io_capa_request *ev = (void *) skb->data;
...@@ -3906,12 +3921,7 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -3906,12 +3921,7 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
conn->auth_type &= HCI_AT_NO_BONDING_MITM; conn->auth_type &= HCI_AT_NO_BONDING_MITM;
cp.authentication = conn->auth_type; cp.authentication = conn->auth_type;
cp.oob_data = bredr_oob_data_present(conn);
if (hci_find_remote_oob_data(hdev, &conn->dst, BDADDR_BREDR) &&
(conn->out || test_bit(HCI_CONN_REMOTE_OOB, &conn->flags)))
cp.oob_data = 0x01;
else
cp.oob_data = 0x00;
hci_send_cmd(hdev, HCI_OP_IO_CAPABILITY_REPLY, hci_send_cmd(hdev, HCI_OP_IO_CAPABILITY_REPLY,
sizeof(cp), &cp); sizeof(cp), &cp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment