From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/2] btdev: Check advertising/scanning states when changing Resolving List
Date: Mon, 7 Jun 2021 11:41:33 -0700 [thread overview]
Message-ID: <20210607184134.2664349-2-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20210607184134.2664349-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Resolving List cannot be changed when advertising/scanning:
• Advertising (other than periodic advertising) is enabled,
• Scanning is enabled, or
• an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection, or
HCI_LE_Periodic_Advertising_Create_Sync command is outstanding.
---
emulator/btdev.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index bfee0ed7b..eba9f57f9 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -3566,6 +3566,16 @@ static int cmd_add_rl(struct btdev *dev, const void *data, uint8_t len)
bool exists = false;
int i, pos = -1;
+ /* This command shall not be used when address resolution is enabled in
+ * the Controller and:
+ * • Advertising (other than periodic advertising) is enabled,
+ * • Scanning is enabled, or
+ * • an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection,
+ * or HCI_LE_Periodic_Advertising_Create_Sync command is outstanding.
+ */
+ if (dev->le_adv_enable || dev->le_scan_enable)
+ return -EPERM;
+
/* Valid range for address type is 0x00 to 0x01 */
if (cmd->addr_type > 0x01)
return -EINVAL;
@@ -3607,6 +3617,16 @@ static int cmd_remove_rl(struct btdev *dev, const void *data, uint8_t len)
uint8_t status;
int i;
+ /* This command shall not be used when address resolution is enabled in
+ * the Controller and:
+ * • Advertising (other than periodic advertising) is enabled,
+ * • Scanning is enabled, or
+ * • an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection,
+ * or HCI_LE_Periodic_Advertising_Create_Sync command is outstanding.
+ */
+ if (dev->le_adv_enable || dev->le_scan_enable)
+ return -EPERM;
+
/* Valid range for address type is 0x00 to 0x01 */
if (cmd->addr_type > 0x01)
return -EINVAL;
@@ -3634,6 +3654,16 @@ static int cmd_clear_rl(struct btdev *dev, const void *data, uint8_t len)
{
uint8_t status;
+ /* This command shall not be used when address resolution is enabled in
+ * the Controller and:
+ * • Advertising (other than periodic advertising) is enabled,
+ * • Scanning is enabled, or
+ * • an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection,
+ * or HCI_LE_Periodic_Advertising_Create_Sync command is outstanding.
+ */
+ if (dev->le_adv_enable || dev->le_scan_enable)
+ return -EPERM;
+
rl_clear(dev);
status = BT_HCI_ERR_SUCCESS;
@@ -3699,6 +3729,16 @@ static int cmd_set_rl_enable(struct btdev *dev, const void *data, uint8_t len)
const struct bt_hci_cmd_le_set_resolv_enable *cmd = data;
uint8_t status;
+ /* This command shall not be used when address resolution is enabled in
+ * the Controller and:
+ * • Advertising (other than periodic advertising) is enabled,
+ * • Scanning is enabled, or
+ * • an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection,
+ * or HCI_LE_Periodic_Advertising_Create_Sync command is outstanding.
+ */
+ if (dev->le_adv_enable || dev->le_scan_enable)
+ return -EPERM;
+
/* Valid range for address resolution enable is 0x00 to 0x01 */
if (cmd->enable > 0x01)
return -EINVAL;
--
2.31.1
next prev parent reply other threads:[~2021-06-07 18:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-07 18:41 [PATCH BlueZ 1/2] btdev: Check advertising/scanning states when changing White List Luiz Augusto von Dentz
2021-06-07 18:41 ` Luiz Augusto von Dentz [this message]
2021-06-09 4:05 ` [BlueZ,1/2] " bluez.test.bot
2021-06-09 20:21 ` Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210607184134.2664349-2-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox