aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorArman Uguray <armansito@chromium.org>2015-03-28 15:38:58 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-03-28 16:31:57 -0400
commitfaccb950f7170c37c9c2e1f82a6e33cd7a23a5c9 (patch)
tree54d814512e6bb47fdc8aa91de0c96273f841fc13 /net/bluetooth
parent600b21507eb64bcd85bb87d06c2c2c451b565f02 (diff)
Bluetooth: Fix using global connectable settings for adv
This patch fixes a bug where ADV_NONCONN_IND was being used for advertising instances >0 while the global connectable setting was set to "on". Signed-off-by: Arman Uguray <armansito@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/mgmt.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index fb2e764c6211..d998ec360598 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -985,9 +985,10 @@ static u32 get_adv_instance_flags(struct hci_dev *hdev, u8 instance)
985 /* Instance 0 always manages the "Tx Power" and "Flags" fields */ 985 /* Instance 0 always manages the "Tx Power" and "Flags" fields */
986 flags = MGMT_ADV_FLAG_TX_POWER | MGMT_ADV_FLAG_MANAGED_FLAGS; 986 flags = MGMT_ADV_FLAG_TX_POWER | MGMT_ADV_FLAG_MANAGED_FLAGS;
987 987
988 /* For instance 0, assemble the flags from global settings */ 988 /* For instance 0, the HCI_ADVERTISING_CONNECTABLE setting corresponds
989 if (hci_dev_test_flag(hdev, HCI_ADVERTISING_CONNECTABLE) || 989 * to the "connectable" instance flag.
990 get_connectable(hdev)) 990 */
991 if (hci_dev_test_flag(hdev, HCI_ADVERTISING_CONNECTABLE))
991 flags |= MGMT_ADV_FLAG_CONNECTABLE; 992 flags |= MGMT_ADV_FLAG_CONNECTABLE;
992 993
993 return flags; 994 return flags;
@@ -1242,7 +1243,12 @@ static void enable_advertising(struct hci_request *req)
1242 1243
1243 instance = get_current_adv_instance(hdev); 1244 instance = get_current_adv_instance(hdev);
1244 flags = get_adv_instance_flags(hdev, instance); 1245 flags = get_adv_instance_flags(hdev, instance);
1245 connectable = (flags & MGMT_ADV_FLAG_CONNECTABLE); 1246
1247 /* If the "connectable" instance flag was not set, then choose between
1248 * ADV_IND and ADV_NONCONN_IND based on the global connectable setting.
1249 */
1250 connectable = (flags & MGMT_ADV_FLAG_CONNECTABLE) ||
1251 get_connectable(hdev);
1246 1252
1247 /* Set require_privacy to true only when non-connectable 1253 /* Set require_privacy to true only when non-connectable
1248 * advertising is used. In that case it is fine to use a 1254 * advertising is used. In that case it is fine to use a