Message ID | 20230214145609.kernel.v1.1.Ibe4d3a42683381c1e78b8c3aa67b53fc74437ae9@changeid (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [kernel,v1] Bluetooth: hci_sync: Resume adv with no RPA when active scan | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | fail | WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 21: B1 Line exceeds max length (100>80): "- Always pause advertising when active scan, but resume the advertising if the host is not using RPA" |
tedd_an/SubjectPrefix | success | Gitlint PASS |
tedd_an/BuildKernel | success | BuildKernel PASS |
tedd_an/CheckAllWarning | success | CheckAllWarning PASS |
tedd_an/CheckSparse | success | CheckSparse PASS |
tedd_an/CheckSmatch | success | CheckSparse PASS |
tedd_an/BuildKernel32 | success | BuildKernel32 PASS |
tedd_an/TestRunnerSetup | success | TestRunnerSetup PASS |
tedd_an/TestRunner_l2cap-tester | success | TestRunner PASS |
tedd_an/TestRunner_iso-tester | success | TestRunner PASS |
tedd_an/TestRunner_bnep-tester | success | TestRunner PASS |
tedd_an/TestRunner_mgmt-tester | success | TestRunner PASS |
tedd_an/TestRunner_rfcomm-tester | success | TestRunner PASS |
tedd_an/TestRunner_sco-tester | success | TestRunner PASS |
tedd_an/TestRunner_ioctl-tester | success | TestRunner PASS |
tedd_an/TestRunner_mesh-tester | success | TestRunner PASS |
tedd_an/TestRunner_smp-tester | success | TestRunner PASS |
tedd_an/TestRunner_userchan-tester | success | TestRunner PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=721882 ---Test result--- Test Summary: CheckPatch PASS 0.58 seconds GitLint FAIL 0.54 seconds SubjectPrefix PASS 0.08 seconds BuildKernel PASS 31.28 seconds CheckAllWarning PASS 33.77 seconds CheckSparse PASS 38.16 seconds CheckSmatch PASS 106.49 seconds BuildKernel32 PASS 30.27 seconds TestRunnerSetup PASS 430.27 seconds TestRunner_l2cap-tester PASS 15.86 seconds TestRunner_iso-tester PASS 16.35 seconds TestRunner_bnep-tester PASS 5.39 seconds TestRunner_mgmt-tester PASS 106.72 seconds TestRunner_rfcomm-tester PASS 8.65 seconds TestRunner_sco-tester PASS 7.81 seconds TestRunner_ioctl-tester PASS 9.10 seconds TestRunner_mesh-tester PASS 6.75 seconds TestRunner_smp-tester PASS 7.82 seconds TestRunner_userchan-tester PASS 5.61 seconds IncrementalBuild PASS 27.87 seconds Details ############################## Test: GitLint - FAIL Desc: Run gitlint Output: [kernel,v1] Bluetooth: hci_sync: Resume adv with no RPA when active scan WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 21: B1 Line exceeds max length (100>80): "- Always pause advertising when active scan, but resume the advertising if the host is not using RPA" --- Regards, Linux Bluetooth
Hi Zhengping, On Tue, Feb 14, 2023 at 2:56 PM Zhengping Jiang <jiangzp@google.com> wrote: > > The address resolution should be disabled during the active scan, > so all the advertisements can reach the host. The advertising > has to be paused before disabling the address resolution, > because the advertising will prevent any changes to the resolving > list and the address resolution status. Skipping this will cause > the hci error and the discovery failure. It is probably a good idea to quote the spec saying: 7.8.44 LE Set Address Resolution Enable command This command shall not be used when: • Advertising (other than periodic advertising) is enabled, > If the host is using RPA, the controller needs to generate RPA for > the advertising, so the advertising must remain paused during the > active scan. > > If the host is not using RPA, the advertising can be resumed after > disabling the address resolution. > > Fixes: 9afc675edeeb ("Bluetooth: hci_sync: allow advertise when scan without RPA") > Signed-off-by: Zhengping Jiang <jiangzp@google.com> > --- > > Changes in v1: > - Always pause advertising when active scan, but resume the advertising if the host is not using RPA > > net/bluetooth/hci_sync.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c > index 117eedb6f709..edbf9faf7fa1 100644 > --- a/net/bluetooth/hci_sync.c > +++ b/net/bluetooth/hci_sync.c > @@ -2402,7 +2402,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev) > u8 filter_policy; > int err; > > - /* Pause advertising if resolving list can be used as controllers are > + /* Pause advertising if resolving list can be used as controllers > * cannot accept resolving list modifications while advertising. > */ > if (use_ll_privacy(hdev)) { > @@ -5397,7 +5397,7 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) > /* Pause advertising since active scanning disables address resolution > * which advertising depend on in order to generate its RPAs. > */ > - if (use_ll_privacy(hdev) && hci_dev_test_flag(hdev, HCI_PRIVACY)) { > + if (use_ll_privacy(hdev)) { > err = hci_pause_advertising_sync(hdev); > if (err) { > bt_dev_err(hdev, "pause advertising failed: %d", err); > @@ -5416,6 +5416,10 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) > goto failed; > } > > + // Resume paused advertising if the host is not using RPA > + if (use_ll_privacy(hdev) && !hci_dev_test_flag(hdev, HCI_PRIVACY)) > + hci_resume_advertising_sync(hdev); > + > /* All active scans will be done with either a resolvable private > * address (when privacy feature has been enabled) or non-resolvable > * private address. > -- > 2.39.1.581.gbfd45094c4-goog I think it is better that we add something like hci_pause_addr_resolution so we can make it check all the conditions, such as pausing advertising and resuming if needed. Btw, we do seem to have proper checks for these conditions on the emulator: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/emulator/btdev.c#n4090 But perhaps there is no test which attempts to enable LL Privacy without enabling Local Privacy, so it would be great if you could update mgmt-tester adding a test that emulates such behavior.
Hi Luiz, Thanks for the comment. I will submit a new patch to address that. I notice in the spec, it is mentioned > Note: This command does not affect the generation of Resolvable Private Addresses. How should I understand this note? Does it mean even if the address resolution is disabled, the controller can still generate RPA for advertising? Does it mean the advertising can always be resumed during active scan? Thanks, Zhengping On Tue, Feb 14, 2023 at 4:09 PM Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote: > > Hi Zhengping, > > On Tue, Feb 14, 2023 at 2:56 PM Zhengping Jiang <jiangzp@google.com> wrote: > > > > The address resolution should be disabled during the active scan, > > so all the advertisements can reach the host. The advertising > > has to be paused before disabling the address resolution, > > because the advertising will prevent any changes to the resolving > > list and the address resolution status. Skipping this will cause > > the hci error and the discovery failure. > > It is probably a good idea to quote the spec saying: > > 7.8.44 LE Set Address Resolution Enable command > > This command shall not be used when: > • Advertising (other than periodic advertising) is enabled, > > > If the host is using RPA, the controller needs to generate RPA for > > the advertising, so the advertising must remain paused during the > > active scan. > > > > If the host is not using RPA, the advertising can be resumed after > > disabling the address resolution. > > > > Fixes: 9afc675edeeb ("Bluetooth: hci_sync: allow advertise when scan without RPA") > > Signed-off-by: Zhengping Jiang <jiangzp@google.com> > > --- > > > > Changes in v1: > > - Always pause advertising when active scan, but resume the advertising if the host is not using RPA > > > > net/bluetooth/hci_sync.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c > > index 117eedb6f709..edbf9faf7fa1 100644 > > --- a/net/bluetooth/hci_sync.c > > +++ b/net/bluetooth/hci_sync.c > > @@ -2402,7 +2402,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev) > > u8 filter_policy; > > int err; > > > > - /* Pause advertising if resolving list can be used as controllers are > > + /* Pause advertising if resolving list can be used as controllers > > * cannot accept resolving list modifications while advertising. > > */ > > if (use_ll_privacy(hdev)) { > > @@ -5397,7 +5397,7 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) > > /* Pause advertising since active scanning disables address resolution > > * which advertising depend on in order to generate its RPAs. > > */ > > - if (use_ll_privacy(hdev) && hci_dev_test_flag(hdev, HCI_PRIVACY)) { > > + if (use_ll_privacy(hdev)) { > > err = hci_pause_advertising_sync(hdev); > > if (err) { > > bt_dev_err(hdev, "pause advertising failed: %d", err); > > @@ -5416,6 +5416,10 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) > > goto failed; > > } > > > > + // Resume paused advertising if the host is not using RPA > > + if (use_ll_privacy(hdev) && !hci_dev_test_flag(hdev, HCI_PRIVACY)) > > + hci_resume_advertising_sync(hdev); > > + > > /* All active scans will be done with either a resolvable private > > * address (when privacy feature has been enabled) or non-resolvable > > * private address. > > -- > > 2.39.1.581.gbfd45094c4-goog > > I think it is better that we add something like > hci_pause_addr_resolution so we can make it check all the conditions, > such as pausing advertising and resuming if needed. Btw, we do seem to > have proper checks for these conditions on the emulator: > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/emulator/btdev.c#n4090 > > But perhaps there is no test which attempts to enable LL Privacy > without enabling Local Privacy, so it would be great if you could > update mgmt-tester adding a test that emulates such behavior. > > -- > Luiz Augusto von Dentz
Hi Zhengping, On Tue, Feb 14, 2023 at 4:28 PM Zhengping Jiang <jiangzp@google.com> wrote: > > Hi Luiz, > > Thanks for the comment. I will submit a new patch to address that. > > I notice in the spec, it is mentioned > > Note: This command does not affect the generation of Resolvable Private Addresses. Where is that mentioned? > How should I understand this note? Does it mean even if the address > resolution is disabled, the controller can still generate RPA for > advertising? Does it mean the advertising can always be resumed > during active scan? I think it may be related to the fact that it only affects the addr resolution of remote devices, that said if you are active scanning that probably means the user wants to setup a new device thus why we don't enable any filtering like accept list, etc, so it is not really useful to keep address resolution active either way. > Thanks, > Zhengping > > On Tue, Feb 14, 2023 at 4:09 PM Luiz Augusto von Dentz > <luiz.dentz@gmail.com> wrote: > > > > Hi Zhengping, > > > > On Tue, Feb 14, 2023 at 2:56 PM Zhengping Jiang <jiangzp@google.com> wrote: > > > > > > The address resolution should be disabled during the active scan, > > > so all the advertisements can reach the host. The advertising > > > has to be paused before disabling the address resolution, > > > because the advertising will prevent any changes to the resolving > > > list and the address resolution status. Skipping this will cause > > > the hci error and the discovery failure. > > > > It is probably a good idea to quote the spec saying: > > > > 7.8.44 LE Set Address Resolution Enable command > > > > This command shall not be used when: > > • Advertising (other than periodic advertising) is enabled, > > > > > If the host is using RPA, the controller needs to generate RPA for > > > the advertising, so the advertising must remain paused during the > > > active scan. > > > > > > If the host is not using RPA, the advertising can be resumed after > > > disabling the address resolution. > > > > > > Fixes: 9afc675edeeb ("Bluetooth: hci_sync: allow advertise when scan without RPA") > > > Signed-off-by: Zhengping Jiang <jiangzp@google.com> > > > --- > > > > > > Changes in v1: > > > - Always pause advertising when active scan, but resume the advertising if the host is not using RPA > > > > > > net/bluetooth/hci_sync.c | 8 ++++++-- > > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c > > > index 117eedb6f709..edbf9faf7fa1 100644 > > > --- a/net/bluetooth/hci_sync.c > > > +++ b/net/bluetooth/hci_sync.c > > > @@ -2402,7 +2402,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev) > > > u8 filter_policy; > > > int err; > > > > > > - /* Pause advertising if resolving list can be used as controllers are > > > + /* Pause advertising if resolving list can be used as controllers > > > * cannot accept resolving list modifications while advertising. > > > */ > > > if (use_ll_privacy(hdev)) { > > > @@ -5397,7 +5397,7 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) > > > /* Pause advertising since active scanning disables address resolution > > > * which advertising depend on in order to generate its RPAs. > > > */ > > > - if (use_ll_privacy(hdev) && hci_dev_test_flag(hdev, HCI_PRIVACY)) { > > > + if (use_ll_privacy(hdev)) { > > > err = hci_pause_advertising_sync(hdev); > > > if (err) { > > > bt_dev_err(hdev, "pause advertising failed: %d", err); > > > @@ -5416,6 +5416,10 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) > > > goto failed; > > > } > > > > > > + // Resume paused advertising if the host is not using RPA > > > + if (use_ll_privacy(hdev) && !hci_dev_test_flag(hdev, HCI_PRIVACY)) > > > + hci_resume_advertising_sync(hdev); > > > + > > > /* All active scans will be done with either a resolvable private > > > * address (when privacy feature has been enabled) or non-resolvable > > > * private address. > > > -- > > > 2.39.1.581.gbfd45094c4-goog > > > > I think it is better that we add something like > > hci_pause_addr_resolution so we can make it check all the conditions, > > such as pausing advertising and resuming if needed. Btw, we do seem to > > have proper checks for these conditions on the emulator: > > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/emulator/btdev.c#n4090 > > > > But perhaps there is no test which attempts to enable LL Privacy > > without enabling Local Privacy, so it would be great if you could > > update mgmt-tester adding a test that emulates such behavior. > > > > -- > > Luiz Augusto von Dentz
Hi Luiz, > Where is that mentioned? It is just below the command on "7.8.44 LE Set Address Resolution Enable command". On "4.7 RESOLVING LIST", there is another note: > Note: The Controller may generate Resolvable Private Addresses even when address resolution is disabled. If this is the case, then the comment in the kernel (hci_active_scan_sync) is not accurate. > /* Pause advertising since active scanning disables address resolution > * which advertising depend on in order to generate its RPAs. > */ > I think it may be related to the fact that it only affects the addr > resolution of remote devices, that said if you are active scanning > that probably means the user wants to setup a new device thus why we > don't enable any filtering like accept list, etc, so it is not really > useful to keep address resolution active either way. That makes sense. When the local privacy is enabled, I assume the host RPA will change when advertising. I haven't tested that scenario, but if RPA generation is not related to disable/enable address resolution, why should the advertising be paused when active scan? Thanks, Zhengping > > > Thanks, > > Zhengping > > > > On Tue, Feb 14, 2023 at 4:09 PM Luiz Augusto von Dentz > > <luiz.dentz@gmail.com> wrote: > > > > > > Hi Zhengping, > > > > > > On Tue, Feb 14, 2023 at 2:56 PM Zhengping Jiang <jiangzp@google.com> wrote: > > > > > > > > The address resolution should be disabled during the active scan, > > > > so all the advertisements can reach the host. The advertising > > > > has to be paused before disabling the address resolution, > > > > because the advertising will prevent any changes to the resolving > > > > list and the address resolution status. Skipping this will cause > > > > the hci error and the discovery failure. > > > > > > It is probably a good idea to quote the spec saying: > > > > > > 7.8.44 LE Set Address Resolution Enable command > > > > > > This command shall not be used when: > > > • Advertising (other than periodic advertising) is enabled, > > > > > > > If the host is using RPA, the controller needs to generate RPA for > > > > the advertising, so the advertising must remain paused during the > > > > active scan. > > > > > > > > If the host is not using RPA, the advertising can be resumed after > > > > disabling the address resolution. > > > > > > > > Fixes: 9afc675edeeb ("Bluetooth: hci_sync: allow advertise when scan without RPA") > > > > Signed-off-by: Zhengping Jiang <jiangzp@google.com> > > > > --- > > > > > > > > Changes in v1: > > > > - Always pause advertising when active scan, but resume the advertising if the host is not using RPA > > > > > > > > net/bluetooth/hci_sync.c | 8 ++++++-- > > > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c > > > > index 117eedb6f709..edbf9faf7fa1 100644 > > > > --- a/net/bluetooth/hci_sync.c > > > > +++ b/net/bluetooth/hci_sync.c > > > > @@ -2402,7 +2402,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev) > > > > u8 filter_policy; > > > > int err; > > > > > > > > - /* Pause advertising if resolving list can be used as controllers are > > > > + /* Pause advertising if resolving list can be used as controllers > > > > * cannot accept resolving list modifications while advertising. > > > > */ > > > > if (use_ll_privacy(hdev)) { > > > > @@ -5397,7 +5397,7 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) > > > > /* Pause advertising since active scanning disables address resolution > > > > * which advertising depend on in order to generate its RPAs. > > > > */ > > > > - if (use_ll_privacy(hdev) && hci_dev_test_flag(hdev, HCI_PRIVACY)) { > > > > + if (use_ll_privacy(hdev)) { > > > > err = hci_pause_advertising_sync(hdev); > > > > if (err) { > > > > bt_dev_err(hdev, "pause advertising failed: %d", err); > > > > @@ -5416,6 +5416,10 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) > > > > goto failed; > > > > } > > > > > > > > + // Resume paused advertising if the host is not using RPA > > > > + if (use_ll_privacy(hdev) && !hci_dev_test_flag(hdev, HCI_PRIVACY)) > > > > + hci_resume_advertising_sync(hdev); > > > > + > > > > /* All active scans will be done with either a resolvable private > > > > * address (when privacy feature has been enabled) or non-resolvable > > > > * private address. > > > > -- > > > > 2.39.1.581.gbfd45094c4-goog > > > > > > I think it is better that we add something like > > > hci_pause_addr_resolution so we can make it check all the conditions, > > > such as pausing advertising and resuming if needed. Btw, we do seem to > > > have proper checks for these conditions on the emulator: > > > > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/emulator/btdev.c#n4090 > > > > > > But perhaps there is no test which attempts to enable LL Privacy > > > without enabling Local Privacy, so it would be great if you could > > > update mgmt-tester adding a test that emulates such behavior. > > > > > > -- > > > Luiz Augusto von Dentz > > > > -- > Luiz Augusto von Dentz
Hi Zhengping, On Tue, Feb 14, 2023 at 5:20 PM Zhengping Jiang <jiangzp@google.com> wrote: > > Hi Luiz, > > > Where is that mentioned? > It is just below the command on "7.8.44 LE Set Address Resolution > Enable command". > > On "4.7 RESOLVING LIST", there is another note: > > Note: The Controller may generate Resolvable Private Addresses even when address resolution is disabled. Note that the term used here is 'may' not 'shall' so I don't think we can take for granted that the controller will keep generating a new RPA while address resolution is disabled, in fact I think this is sort of a bad idea since as part of the resolving list is the actual IRK and the procedures to update those entries requires address resolution to be stopped, in fact I think the spec is sort of responsible for creating this confusion when it mixed up remote IRK with local IRK in the same list. > If this is the case, then the comment in the kernel > (hci_active_scan_sync) is not accurate. > > /* Pause advertising since active scanning disables address resolution > > * which advertising depend on in order to generate its RPAs. > > */ > > > I think it may be related to the fact that it only affects the addr > > resolution of remote devices, that said if you are active scanning > > that probably means the user wants to setup a new device thus why we > > don't enable any filtering like accept list, etc, so it is not really > > useful to keep address resolution active either way. > That makes sense. When the local privacy is enabled, I assume the host > RPA will change > when advertising. I haven't tested that scenario, but if RPA > generation is not related to disable/enable > address resolution, why should the advertising be paused when active scan? Initially it was because we wanted to disable address resolution which requires both scan and advertising to be disabled to begin with, then there is the fact that there is no fine control over how the controller would priority the scanning and advertising states, and there is also the situation where a incoming connection may come in when advertising is enabled then we have a connection competing with scanning which creates even more problems, not to mention not all controllers do support scanning and advertising simultaneously. > Thanks, > Zhengping > > > > > > Thanks, > > > Zhengping > > > > > > On Tue, Feb 14, 2023 at 4:09 PM Luiz Augusto von Dentz > > > <luiz.dentz@gmail.com> wrote: > > > > > > > > Hi Zhengping, > > > > > > > > On Tue, Feb 14, 2023 at 2:56 PM Zhengping Jiang <jiangzp@google.com> wrote: > > > > > > > > > > The address resolution should be disabled during the active scan, > > > > > so all the advertisements can reach the host. The advertising > > > > > has to be paused before disabling the address resolution, > > > > > because the advertising will prevent any changes to the resolving > > > > > list and the address resolution status. Skipping this will cause > > > > > the hci error and the discovery failure. > > > > > > > > It is probably a good idea to quote the spec saying: > > > > > > > > 7.8.44 LE Set Address Resolution Enable command > > > > > > > > This command shall not be used when: > > > > • Advertising (other than periodic advertising) is enabled, > > > > > > > > > If the host is using RPA, the controller needs to generate RPA for > > > > > the advertising, so the advertising must remain paused during the > > > > > active scan. > > > > > > > > > > If the host is not using RPA, the advertising can be resumed after > > > > > disabling the address resolution. > > > > > > > > > > Fixes: 9afc675edeeb ("Bluetooth: hci_sync: allow advertise when scan without RPA") > > > > > Signed-off-by: Zhengping Jiang <jiangzp@google.com> > > > > > --- > > > > > > > > > > Changes in v1: > > > > > - Always pause advertising when active scan, but resume the advertising if the host is not using RPA > > > > > > > > > > net/bluetooth/hci_sync.c | 8 ++++++-- > > > > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > > > > > > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c > > > > > index 117eedb6f709..edbf9faf7fa1 100644 > > > > > --- a/net/bluetooth/hci_sync.c > > > > > +++ b/net/bluetooth/hci_sync.c > > > > > @@ -2402,7 +2402,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev) > > > > > u8 filter_policy; > > > > > int err; > > > > > > > > > > - /* Pause advertising if resolving list can be used as controllers are > > > > > + /* Pause advertising if resolving list can be used as controllers > > > > > * cannot accept resolving list modifications while advertising. > > > > > */ > > > > > if (use_ll_privacy(hdev)) { > > > > > @@ -5397,7 +5397,7 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) > > > > > /* Pause advertising since active scanning disables address resolution > > > > > * which advertising depend on in order to generate its RPAs. > > > > > */ > > > > > - if (use_ll_privacy(hdev) && hci_dev_test_flag(hdev, HCI_PRIVACY)) { > > > > > + if (use_ll_privacy(hdev)) { > > > > > err = hci_pause_advertising_sync(hdev); > > > > > if (err) { > > > > > bt_dev_err(hdev, "pause advertising failed: %d", err); > > > > > @@ -5416,6 +5416,10 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) > > > > > goto failed; > > > > > } > > > > > > > > > > + // Resume paused advertising if the host is not using RPA > > > > > + if (use_ll_privacy(hdev) && !hci_dev_test_flag(hdev, HCI_PRIVACY)) > > > > > + hci_resume_advertising_sync(hdev); > > > > > + > > > > > /* All active scans will be done with either a resolvable private > > > > > * address (when privacy feature has been enabled) or non-resolvable > > > > > * private address. > > > > > -- > > > > > 2.39.1.581.gbfd45094c4-goog > > > > > > > > I think it is better that we add something like > > > > hci_pause_addr_resolution so we can make it check all the conditions, > > > > such as pausing advertising and resuming if needed. Btw, we do seem to > > > > have proper checks for these conditions on the emulator: > > > > > > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/emulator/btdev.c#n4090 > > > > > > > > But perhaps there is no test which attempts to enable LL Privacy > > > > without enabling Local Privacy, so it would be great if you could > > > > update mgmt-tester adding a test that emulates such behavior. > > > > > > > > -- > > > > Luiz Augusto von Dentz > > > > > > > > -- > > Luiz Augusto von Dentz
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 117eedb6f709..edbf9faf7fa1 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -2402,7 +2402,7 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev) u8 filter_policy; int err; - /* Pause advertising if resolving list can be used as controllers are + /* Pause advertising if resolving list can be used as controllers * cannot accept resolving list modifications while advertising. */ if (use_ll_privacy(hdev)) { @@ -5397,7 +5397,7 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) /* Pause advertising since active scanning disables address resolution * which advertising depend on in order to generate its RPAs. */ - if (use_ll_privacy(hdev) && hci_dev_test_flag(hdev, HCI_PRIVACY)) { + if (use_ll_privacy(hdev)) { err = hci_pause_advertising_sync(hdev); if (err) { bt_dev_err(hdev, "pause advertising failed: %d", err); @@ -5416,6 +5416,10 @@ static int hci_active_scan_sync(struct hci_dev *hdev, uint16_t interval) goto failed; } + // Resume paused advertising if the host is not using RPA + if (use_ll_privacy(hdev) && !hci_dev_test_flag(hdev, HCI_PRIVACY)) + hci_resume_advertising_sync(hdev); + /* All active scans will be done with either a resolvable private * address (when privacy feature has been enabled) or non-resolvable * private address.
The address resolution should be disabled during the active scan, so all the advertisements can reach the host. The advertising has to be paused before disabling the address resolution, because the advertising will prevent any changes to the resolving list and the address resolution status. Skipping this will cause the hci error and the discovery failure. If the host is using RPA, the controller needs to generate RPA for the advertising, so the advertising must remain paused during the active scan. If the host is not using RPA, the advertising can be resumed after disabling the address resolution. Fixes: 9afc675edeeb ("Bluetooth: hci_sync: allow advertise when scan without RPA") Signed-off-by: Zhengping Jiang <jiangzp@google.com> --- Changes in v1: - Always pause advertising when active scan, but resume the advertising if the host is not using RPA net/bluetooth/hci_sync.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)