Skip to contentSkip to conversation

btmgmt: Add support to enable LL privacy

PATCH In review Sathish Narasimman 4 participants 7 messages Apr 5, 2021 – Apr 14, 2021 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btmgmt: Add support to enable LL privacy

If the Bluetooth controller supports LL privacy this command will be used to test the same.
"sudo btmgmt power off"
"sudo btmgmt llprivacy on"
"sudo btmgmt power on"

---
 tools/btmgmt.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
tools/btmgmt.c +38 -0
index 93d244ff8ec8..4a53c3768fe9 100644
@@ -2261,6 +2261,42 @@ static void cmd_bredr(int argc, char **argv)
 	cmd_setting(MGMT_OP_SET_BREDR, argc, argv);
 }
 
+static void ll_rpa_resoln_rsp(uint8_t status, uint16_t len, const void *param,
+			      void *user_data)
+{
+	if (status != 0)
+		error("Could not set LL RPA resolution with status 0x%02x (%s)",
+		      status, mgmt_errstr(status));
+	else
+		print("LL RPA Resolution successfully set");
+
+	bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_set_ll_rpa_resoln(int argc, char **argv)
+{
+	/* 15c0a148-c273-11ea-b3de-0242ac130004 */
+	static const uint8_t rpa_resolution_uuid[16] = {
+				0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
+				0xea, 0x11, 0x73, 0xc2, 0x48, 0xa1, 0xc0, 0x15,
+	};
+	struct mgmt_cp_set_exp_feature cp;
+	uint16_t index;
+
+	memset(&cp, 0, sizeof(cp));
+	memcpy(cp.uuid, rpa_resolution_uuid, 16);
+
+	index = mgmt_index;
+	if (index == MGMT_INDEX_NONE)
+		index = 0;
+
+	if (parse_setting(argc, argv, &cp.action) == false)
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+	mgmt_send(mgmt, MGMT_OP_SET_EXP_FEATURE, index,
+		  sizeof(cp), &cp, ll_rpa_resoln_rsp, NULL, NULL);
+}
+
 static void cmd_privacy(int argc, char **argv)
 {
 	struct mgmt_cp_set_privacy cp;
@@ -5243,6 +5279,8 @@ static const struct bt_shell_menu main_menu = {
 		cmd_bredr,		"Toggle BR/EDR support",	},
 	{ "privacy",		"<on/off>",
 		cmd_privacy,		"Toggle privacy support"	},
+	{ "llprivacy",		"<on/off>",
+		cmd_set_ll_rpa_resoln,	"Toggle LL privacy support"	},
 	{ "class",		"<major> <minor>",
 		cmd_class,		"Set device major/minor class"	},
 	{ "disconnect", 	"[-t type] <remote address>",
Signature · 1 line
2.17.1
#1 lore raw

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=460883

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild: Setup ELL - PASS

##############################
Test: CheckBuild: Setup - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS

##############################
Test: CheckBuild w/external ell - PASS

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Sathish Narasimman

Hi Sathish,

Quoted 60 lines · Sathish Narasimman

If the Bluetooth controller supports LL privacy this command will be used to test the same.
"sudo btmgmt power off"
"sudo btmgmt llprivacy on"
"sudo btmgmt power on"

---
 tools/btmgmt.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
tools/btmgmt.c +36 -0
index 93d244ff8ec8..4a53c3768fe9 100644
@@ -2261,6 +2261,42 @@ static void cmd_bredr(int argc, char **argv)
        cmd_setting(MGMT_OP_SET_BREDR, argc, argv);
 }
 
+static void ll_rpa_resoln_rsp(uint8_t status, uint16_t len, const void *param,
+                             void *user_data)
+{
+       if (status != 0)
+               error("Could not set LL RPA resolution with status 0x%02x (%s)",
+                     status, mgmt_errstr(status));
+       else
+               print("LL RPA Resolution successfully set");
+
+       bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_set_ll_rpa_resoln(int argc, char **argv)
+{
+       /* 15c0a148-c273-11ea-b3de-0242ac130004 */
+       static const uint8_t rpa_resolution_uuid[16] = {
+                               0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
+                               0xea, 0x11, 0x73, 0xc2, 0x48, 0xa1, 0xc0, 0x15,
+       };
+       struct mgmt_cp_set_exp_feature cp;
+       uint16_t index;
+
+       memset(&cp, 0, sizeof(cp));
+       memcpy(cp.uuid, rpa_resolution_uuid, 16);
+
+       index = mgmt_index;
+       if (index == MGMT_INDEX_NONE)
+               index = 0;
+
+       if (parse_setting(argc, argv, &cp.action) == false)
+               return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+       mgmt_send(mgmt, MGMT_OP_SET_EXP_FEATURE, index,
+                 sizeof(cp), &cp, ll_rpa_resoln_rsp, NULL, NULL);
+}
+
 static void cmd_privacy(int argc, char **argv)
 {
        struct mgmt_cp_set_privacy cp;

tools/btmgmt.c static const struct bt_shell_menu main_menu = { · line 5283

Quoted 5 lines
tools/btmgmt.c +2 -0
@@ -5243,6 +5279,8 @@ static const struct bt_shell_menu main_menu = {
                cmd_bredr,              "Toggle BR/EDR support",        },
        { "privacy",            "<on/off>",
                cmd_privacy,            "Toggle privacy support"        },
+       { "llprivacy",          "<on/off>",
+               cmd_set_ll_rpa_resoln,  "Toggle LL privacy support"     },

Let's have it as a parameter of privacy command <on/off/ll> so when a user enters ll it enables link-layer privacy.

Quoted 6 lines
tools/btmgmt.c +0 -1
        { "class",              "<major> <minor>",
                cmd_class,              "Set device major/minor class"  },
        { "disconnect",         "[-t type] <remote address>",
--

2.17.1

Signature · 1 line
Luiz Augusto von Dentz
maintainer
#3 lore raw

Hi Luiz,

Quoted 59 lines
Quoted 59 lines

If the Bluetooth controller supports LL privacy this command will be used to test the same.
"sudo btmgmt power off"
"sudo btmgmt llprivacy on"
"sudo btmgmt power on"

---
tools/btmgmt.c | 38 ++++++++++++++++++++++++++++++++++++++

1 file changed, 38 insertions(+)
tools/btmgmt.c +36 -0
index 93d244ff8ec8..4a53c3768fe9 100644
@@ -2261,6 +2261,42 @@ static void cmd_bredr(int argc, char **argv)
       cmd_setting(MGMT_OP_SET_BREDR, argc, argv);
 }
 
+static void ll_rpa_resoln_rsp(uint8_t status, uint16_t len, const void *param,
+                             void *user_data)
+{
+       if (status != 0)
+               error("Could not set LL RPA resolution with status 0x%02x (%s)",
+                     status, mgmt_errstr(status));
+       else
+               print("LL RPA Resolution successfully set");
+
+       bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_set_ll_rpa_resoln(int argc, char **argv)
+{
+       /* 15c0a148-c273-11ea-b3de-0242ac130004 */
+       static const uint8_t rpa_resolution_uuid[16] = {
+                               0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
+                               0xea, 0x11, 0x73, 0xc2, 0x48, 0xa1, 0xc0, 0x15,
+       };
+       struct mgmt_cp_set_exp_feature cp;
+       uint16_t index;
+
+       memset(&cp, 0, sizeof(cp));
+       memcpy(cp.uuid, rpa_resolution_uuid, 16);
+
+       index = mgmt_index;
+       if (index == MGMT_INDEX_NONE)
+               index = 0;
+
+       if (parse_setting(argc, argv, &cp.action) == false)
+               return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+       mgmt_send(mgmt, MGMT_OP_SET_EXP_FEATURE, index,
+                 sizeof(cp), &cp, ll_rpa_resoln_rsp, NULL, NULL);
+}
+
 static void cmd_privacy(int argc, char **argv)
 {
       struct mgmt_cp_set_privacy cp;
@@ -5243,6 +5279,8 @@ static const struct bt_shell_menu main_menu = {
Quoted 8 lines

tools/btmgmt.c static const struct bt_shell_menu main_menu = { · line 5283

Quoted 5 lines
tools/btmgmt.c +2 -0
               cmd_bredr,              "Toggle BR/EDR support",        },
       { "privacy",            "<on/off>",
               cmd_privacy,            "Toggle privacy support"        },
+       { "llprivacy",          "<on/off>",
+               cmd_set_ll_rpa_resoln,  "Toggle LL privacy support"     },

Let's have it as a parameter of privacy command <on/off/ll> so when a user enters ll it enables link-layer privacy.

please don’t. The privacy setting means that we start using RPAs.

Also what is wrong with exp-privacy command that I already added.

Regards

Marcel

#4 lore raw

Hi

Quoted 75 lines

-----Original Message-----
From: Marcel Holtmann <[email protected]>
Sent: Tuesday, April 6, 2021 1:31 PM
To: Luiz Augusto von Dentz <[email protected]>
Cc: Narasimman, Sathish <[email protected]>; linux- [email protected]; Tumkur Narayan, Chethan <[email protected]>; Srivatsa, Ravishankar <[email protected]>
Subject: Re: [Bluez PATCH] btmgmt: Add support to enable LL privacy

Hi Luiz,

Quoted 54 lines
Quoted 54 lines

If the Bluetooth controller supports LL privacy this command will be used to test the same.
"sudo btmgmt power off"
"sudo btmgmt llprivacy on"
"sudo btmgmt power on"

---
tools/btmgmt.c | 38 ++++++++++++++++++++++++++++++++++++++

1 file changed, 38 insertions(+)
tools/btmgmt.c index renamed from tools/btmgmt.c +0 -0

93d244ff8ec8..4a53c3768fe9 100644

tools/btmgmt.c +33 -0
@@ -2261,6 +2261,42 @@ static void cmd_bredr(int argc, char **argv)
       cmd_setting(MGMT_OP_SET_BREDR, argc, argv); }
 
+static void ll_rpa_resoln_rsp(uint8_t status, uint16_t len, const void *param,
+                             void *user_data) {
+       if (status != 0)
+               error("Could not set LL RPA resolution with status 0x%02x (%s)",
+                     status, mgmt_errstr(status));
+       else
+               print("LL RPA Resolution successfully set");
+
+       bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_set_ll_rpa_resoln(int argc, char **argv) {
+       /* 15c0a148-c273-11ea-b3de-0242ac130004 */
+       static const uint8_t rpa_resolution_uuid[16] = {
+                               0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
+                               0xea, 0x11, 0x73, 0xc2, 0x48, 0xa1, 0xc0, 0x15,
+       };
+       struct mgmt_cp_set_exp_feature cp;
+       uint16_t index;
+
+       memset(&cp, 0, sizeof(cp));
+       memcpy(cp.uuid, rpa_resolution_uuid, 16);
+
+       index = mgmt_index;
+       if (index == MGMT_INDEX_NONE)
+               index = 0;
+
+       if (parse_setting(argc, argv, &cp.action) == false)
+               return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+       mgmt_send(mgmt, MGMT_OP_SET_EXP_FEATURE, index,
+                 sizeof(cp), &cp, ll_rpa_resoln_rsp, NULL, NULL); }
+
 static void cmd_privacy(int argc, char **argv) {
       struct mgmt_cp_set_privacy cp; @@ -5243,6 +5279,8 @@ static
 const struct bt_shell_menu main_menu = {
Quoted 8 lines

tools/btmgmt.c static const struct bt_shell_menu main_menu = { · line 5283

Quoted 5 lines
tools/btmgmt.c +2 -0
               cmd_bredr,              "Toggle BR/EDR support",        },
       { "privacy",            "<on/off>",
               cmd_privacy,            "Toggle privacy support"        },
+       { "llprivacy",          "<on/off>",
+               cmd_set_ll_rpa_resoln,  "Toggle LL privacy support"     },

Let's have it as a parameter of privacy command <on/off/ll> so when a user enters ll it enables link-layer privacy.

Quoted 3 lines

please don’t. The privacy setting means that we start using RPAs.

Also what is wrong with exp-privacy command that I already added.

Gentle Reminder.

Quoted 4 lines

Regards

Marcel

Regards
Sathish N

maintainer
#5 lore raw

Hi Sathish,

Quoted 63 lines
Quoted 63 lines
Quoted 62 lines
Quoted 49 lines

If the Bluetooth controller supports LL privacy this command will be used to test the same.
"sudo btmgmt power off"
"sudo btmgmt llprivacy on"
"sudo btmgmt power on"

---
tools/btmgmt.c | 38 ++++++++++++++++++++++++++++++++++++++

1 file changed, 38 insertions(+)
tools/btmgmt.c index renamed from tools/btmgmt.c +0 -0

93d244ff8ec8..4a53c3768fe9 100644

tools/btmgmt.c +31 -0
@@ -2261,6 +2261,42 @@ static void cmd_bredr(int argc, char **argv)
      cmd_setting(MGMT_OP_SET_BREDR, argc, argv); }
 
+static void ll_rpa_resoln_rsp(uint8_t status, uint16_t len, const void *param,
+                             void *user_data) {
+       if (status != 0)
+               error("Could not set LL RPA resolution with status 0x%02x (%s)",
+                     status, mgmt_errstr(status));
+       else
+               print("LL RPA Resolution successfully set");
+
+       bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_set_ll_rpa_resoln(int argc, char **argv) {
+       /* 15c0a148-c273-11ea-b3de-0242ac130004 */
+       static const uint8_t rpa_resolution_uuid[16] = {
+                               0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
+                               0xea, 0x11, 0x73, 0xc2, 0x48, 0xa1, 0xc0, 0x15,
+       };
+       struct mgmt_cp_set_exp_feature cp;
+       uint16_t index;
+
+       memset(&cp, 0, sizeof(cp));
+       memcpy(cp.uuid, rpa_resolution_uuid, 16);
+
+       index = mgmt_index;
+       if (index == MGMT_INDEX_NONE)
+               index = 0;
+
+       if (parse_setting(argc, argv, &cp.action) == false)
+               return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+       mgmt_send(mgmt, MGMT_OP_SET_EXP_FEATURE, index,

tools/btmgmt.c static void cmd_bredr(int argc, char **argv)

Quoted 10 lines
tools/btmgmt.c +4 -0
+                 sizeof(cp), &cp, ll_rpa_resoln_rsp, NULL, NULL); }
+
 static void cmd_privacy(int argc, char **argv) {
      struct mgmt_cp_set_privacy cp; @@ -5243,6 +5279,8 @@ static
 const struct bt_shell_menu main_menu = {
              cmd_bredr,              "Toggle BR/EDR support",        },
      { "privacy",            "<on/off>",
              cmd_privacy,            "Toggle privacy support"        },
+       { "llprivacy",          "<on/off>",
+               cmd_set_ll_rpa_resoln,  "Toggle LL privacy support"     },

Let's have it as a parameter of privacy command <on/off/ll> so when a user enters ll it enables link-layer privacy.

Quoted 5 lines
Quoted 3 lines

please don’t. The privacy setting means that we start using RPAs.

Also what is wrong with exp-privacy command that I already added.

Gentle Reminder.

gentle reminder of what? Please re-read my response.

Regards

Marcel

#6 lore raw

Hi Marcel

Quoted 77 lines

-----Original Message-----
From: Marcel Holtmann <[email protected]>
Sent: Wednesday, April 14, 2021 3:37 PM
To: Narasimman, Sathish <[email protected]>
Cc: Luiz Augusto von Dentz <[email protected]>; linux- [email protected]; Tumkur Narayan, Chethan <[email protected]>; Srivatsa, Ravishankar <[email protected]>
Subject: Re: [Bluez PATCH] btmgmt: Add support to enable LL privacy

Hi Sathish,

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

If the Bluetooth controller supports LL privacy this command will be used to test the same.
"sudo btmgmt power off"
"sudo btmgmt llprivacy on"
"sudo btmgmt power on"

---
tools/btmgmt.c | 38 ++++++++++++++++++++++++++++++++++++++

1 file changed, 38 insertions(+)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

tools/btmgmt.c static void cmd_bredr(int argc, char **argv) · line 2263

Quoted 8 lines
tools/btmgmt.c index renamed from tools/btmgmt.c +0 -0

93d244ff8ec8..4a53c3768fe9 100644

tools/btmgmt.c +1 -0
@@ -2261,6 +2261,42 @@ static void cmd_bredr(int argc, char **argv)
      cmd_setting(MGMT_OP_SET_BREDR, argc, argv); }
 
+static void ll_rpa_resoln_rsp(uint8_t status, uint16_t len, const void

*param,

Quoted 45 lines
Quoted 45 lines
Quoted 44 lines
Quoted 31 lines
tools/btmgmt.c +31 -0
+                             void *user_data) {
+       if (status != 0)
+               error("Could not set LL RPA resolution with status 0x%02x (%s)",
+                     status, mgmt_errstr(status));
+       else
+               print("LL RPA Resolution successfully set");
+
+       bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_set_ll_rpa_resoln(int argc, char **argv) {
+       /* 15c0a148-c273-11ea-b3de-0242ac130004 */
+       static const uint8_t rpa_resolution_uuid[16] = {
+                               0x04, 0x00, 0x13, 0xac, 0x42, 0x02, 0xde, 0xb3,
+                               0xea, 0x11, 0x73, 0xc2, 0x48, 0xa1, 0xc0, 0x15,
+       };
+       struct mgmt_cp_set_exp_feature cp;
+       uint16_t index;
+
+       memset(&cp, 0, sizeof(cp));
+       memcpy(cp.uuid, rpa_resolution_uuid, 16);
+
+       index = mgmt_index;
+       if (index == MGMT_INDEX_NONE)
+               index = 0;
+
+       if (parse_setting(argc, argv, &cp.action) == false)
+               return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+       mgmt_send(mgmt, MGMT_OP_SET_EXP_FEATURE, index,
+                 sizeof(cp), &cp, ll_rpa_resoln_rsp, NULL, NULL);

tools/btmgmt.c static void cmd_bredr(int argc, char **argv)

Quoted 10 lines
tools/btmgmt.c +4 -0
+ }
+
 static void cmd_privacy(int argc, char **argv) {
      struct mgmt_cp_set_privacy cp; @@ -5243,6 +5279,8 @@ static
 const struct bt_shell_menu main_menu = {
              cmd_bredr,              "Toggle BR/EDR support",        },
      { "privacy",            "<on/off>",
              cmd_privacy,            "Toggle privacy support"        },
+       { "llprivacy",          "<on/off>",
+               cmd_set_ll_rpa_resoln,  "Toggle LL privacy support"     },

Let's have it as a parameter of privacy command <on/off/ll> so when a user enters ll it enables link-layer privacy.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

please don’t. The privacy setting means that we start using RPAs.

Also what is wrong with exp-privacy command that I already added.

Gentle Reminder.

gentle reminder of what? Please re-read my response.

My mistake. Was misunderstood that the comment was regarding what Luiz asked to Change.

Also, I didn’t rebased the latest code. Found your latest code.

Quoted 3 lines

Regards

Marcel

Regards
Sathish N