Skip to contentSkip to conversation

Bluetooth: Use special function to send filter management index events

PATCH In review Marcel Holtmann 1 participant 1 message Mar 15, 2015

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH v3 3/14 Bluetooth: Use special function to send filter management index events

For sending Index Added, Index Removed, Unconfigured Index Added and Unconfigured Index Removed managment events the new helper functions allows taking into account if these events are enabled for a certain management socket or not.

---
 include/net/bluetooth/hci.h |  6 +++++
 net/bluetooth/hci_sock.c    | 10 +++++++
 net/bluetooth/mgmt.c        | 64 +++++++++++++++++++++++++++++++++++----------
 3 files changed, 66 insertions(+), 14 deletions(-)
include/net/bluetooth/hci.h +6 -0
index d942fedbaedd..0995ec755959 100644
@@ -179,6 +179,12 @@ enum {
 	HCI_RESET,
 };
 
+/* HCI socket flags */
+enum {
+	HCI_MGMT_INDEX_EVENTS,
+	HCI_MGMT_UNCONF_INDEX_EVENTS,
+};
+
 /*
  * BR/EDR and/or LE controller flags: the flags defined here should represent
  * states from the controller.
net/bluetooth/hci_sock.c +10 -0
index 174a353a7dcf..00775c4fef83 100644
@@ -817,6 +817,16 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
 			goto done;
 		}
 
+		/* At the moment the index and unconfigured index events
+		 * are enabled unconditionally. Setting them on each
+		 * socket when binding keeps this functionality. They
+		 * however might be cleared later and then sending of these
+		 * events will be disabled, but that is then intentional.
+		 */
+		if (haddr.hci_channel == HCI_CHANNEL_CONTROL) {
+			hci_sock_set_flag(sk, HCI_MGMT_INDEX_EVENTS);
+			hci_sock_set_flag(sk, HCI_MGMT_UNCONF_INDEX_EVENTS);
+		}
 		break;
 	}
 
net/bluetooth/mgmt.c +50 -14

90 lines not on this page · raw message

Signature · 1 line
2.1.0