]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
Bluetooth: Add hci_bdaddr_is_rpa convenience function
authorJohan Hedberg <johan.hedberg@intel.com>
Tue, 18 Feb 2014 08:19:34 +0000 (10:19 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 18 Feb 2014 08:47:03 +0000 (00:47 -0800)
When implementing support for Resolvable Private Addresses (RPAs) we'll
need to in several places be able to identify such addresses. This patch
adds a simple convenience function to do the identification of the
address type.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_core.h

index eac422337582b58a5a41b37a812c467aa0bcf64e..86ea4bab9e77742da71dcf9e4e5bd91ffab59f05 100644 (file)
@@ -1071,6 +1071,17 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
        return false;
 }
 
+static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type)
+{
+       if (addr_type != 0x01)
+               return false;
+
+       if ((bdaddr->b[5] & 0xc0) == 0x40)
+              return true;
+
+       return false;
+}
+
 int hci_register_cb(struct hci_cb *hcb);
 int hci_unregister_cb(struct hci_cb *hcb);