Skip to content

Commit

Permalink
Bluetooth: Fix powering on with privacy and advertising
Browse files Browse the repository at this point in the history
In order to enable advertising with privacy enabled, SMP has to be
registered in order to generate new RPA. During power on, it will be
registered at the very end which is the reason why advertising is not
enabled and it's not possible to enable it anymore due to mismatch
between hci_dev settings and actual controller state.

This fixes this problem by moving SMP registration earlier, just after
controller is powered (which is ok, because LE SMP will be already able
to decide on identity address to be used), but before advertising is
enabled.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Andrzej Kaczmarek authored and Marcel Holtmann committed Nov 23, 2015
1 parent 568f44f commit e59a554
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -7305,13 +7305,6 @@ static void powered_complete(struct hci_dev *hdev, u8 status, u16 opcode)
BT_DBG("status 0x%02x", status);

if (!status) {
/* Register the available SMP channels (BR/EDR and LE) only
* when successfully powering on the controller. This late
* registration is required so that LE SMP can clearly
* decide if the public address or static address is used.
*/
smp_register(hdev);

restart_le_actions(hdev);
hci_update_background_scan(hdev);
}
Expand Down Expand Up @@ -7423,6 +7416,13 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
return 0;

if (powered) {
/* Register the available SMP channels (BR/EDR and LE) only
* when successfully powering on the controller. This late
* registration is required so that LE SMP can clearly
* decide if the public address or static address is used.
*/
smp_register(hdev);

if (powered_update_hci(hdev) == 0)
return 0;

Expand Down

0 comments on commit e59a554

Please sign in to comment.