History

Bluetooth: Send device found event on name resolve failure

Introducing NAME_REQUEST_FAILED flag that will be sent together with device found event on name resolve failure. This will provide the userspace with an information so it can decide not to resolve the name for these devices in the future.

Archie Pusaka committed 4 years ago

Commit ea13aed1 parent 79786563 files · +19 −13Browse files

Unified · Split

3 files
  1. include/net/bluetooth/mgmt.h +5 −4
  2. net/bluetooth/hci_event.c +4 −7
  3. net/bluetooth/mgmt.c +10 −2
include/net/bluetooth/mgmt.h+5−4
@@ -936,10 +936,11 @@ struct mgmt_ev_auth_failed { · 935 unmodified lines
936936 __u8 status;
937937 } __packed;
938938
939−#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01
940−#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02
941−#define MGMT_DEV_FOUND_NOT_CONNECTABLE 0x04
942−#define MGMT_DEV_FOUND_INITIATED_CONN 0x08
939+#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01
940+#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02
941+#define MGMT_DEV_FOUND_NOT_CONNECTABLE 0x04
942+#define MGMT_DEV_FOUND_INITIATED_CONN 0x08
943+#define MGMT_DEV_FOUND_NAME_REQUEST_FAILED 0x10
943944
944945 #define MGMT_EV_DEVICE_FOUND 0x0012
945946 struct mgmt_ev_device_found {
net/bluetooth/hci_event.c+4−7
@@ -2175,13 +2175,10 @@ static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn, · 2174 unmodified lines
21752175 return;
21762176
21772177 list_del(&e->list);
2178− if (name) {
2179− e->name_state = NAME_KNOWN;
2180− mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00,
2181− e->data.rssi, name, name_len);
2182− } else {
2183− e->name_state = NAME_NOT_KNOWN;
2184− }
2178+
2179+ e->name_state = name ? NAME_KNOWN : NAME_NOT_KNOWN;
2180+ mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00, e->data.rssi,
2181+ name, name_len);
21852182
21862183 if (hci_resolve_next_name(hdev))
21872184 return;
net/bluetooth/mgmt.c+10−2
@@ -9615,6 +9615,7 @@ void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, · 9614 unmodified lines
96159615 struct mgmt_ev_device_found *ev;
96169616 char buf[sizeof(*ev) + HCI_MAX_NAME_LENGTH + 2];
96179617 u16 eir_len;
9618+ u32 flags;
96189619
96199620 ev = (struct mgmt_ev_device_found *) buf;
96209621
@@ -9624,10 +9625,17 @@ void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, · 3 unmodified lines
96249625 ev->addr.type = link_to_bdaddr(link_type, addr_type);
96259626 ev->rssi = rssi;
96269627
9627− eir_len = eir_append_data(ev->eir, 0, EIR_NAME_COMPLETE, name,
9628− name_len);
9628+ if (name) {
9629+ eir_len = eir_append_data(ev->eir, 0, EIR_NAME_COMPLETE, name,
9630+ name_len);
9631+ flags = 0;
9632+ } else {
9633+ eir_len = 0;
9634+ flags = MGMT_DEV_FOUND_NAME_REQUEST_FAILED;
9635+ }
96299636
96309637 ev->eir_len = cpu_to_le16(eir_len);
9638+ ev->flags = cpu_to_le32(flags);
96319639
96329640 mgmt_event(MGMT_EV_DEVICE_FOUND, hdev, ev, sizeof(*ev) + eir_len, NULL);
96339641 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t