diff mbox series

[BlueZ] tools/mesh-cfgclient: Add local address check

Message ID 20230320175825.321702-1-inga.stotland@gmail.com (mailing list archive)
State New, archived
Headers show
Series [BlueZ] tools/mesh-cfgclient: Add local address check | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Inga Stotland March 20, 2023, 5:58 p.m. UTC
This adds a check if a request to start scanning for unprovisioned
devices is issued with the local address.
---
 tools/mesh-cfgclient.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

bluez.test.bot@gmail.com March 20, 2023, 7:12 p.m. UTC | #1
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=731984

---Test result---

Test Summary:
CheckPatch                    PASS      0.42 seconds
GitLint                       PASS      0.29 seconds
BuildEll                      PASS      26.24 seconds
BluezMake                     PASS      752.49 seconds
MakeCheck                     PASS      10.85 seconds
MakeDistcheck                 PASS      147.56 seconds
CheckValgrind                 PASS      241.11 seconds
CheckSmatch                   PASS      320.46 seconds
bluezmakeextell               PASS      96.56 seconds
IncrementalBuild              PASS      607.54 seconds
ScanBuild                     PASS      958.94 seconds



---
Regards,
Linux Bluetooth
Stotland, Inga March 20, 2023, 8:14 p.m. UTC | #2
Do not apply: fix not needed.

On Mon, 2023-03-20 at 10:58 -0700, Inga Stotland wrote:
> This adds a check if a request to start scanning for unprovisioned
> devices is issued with the local address.
> ---
>  tools/mesh-cfgclient.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/mesh-cfgclient.c b/tools/mesh-cfgclient.c
> index 6d2d34409..8369b345d 100644
> --- a/tools/mesh-cfgclient.c
> +++ b/tools/mesh-cfgclient.c
> @@ -58,6 +58,12 @@
>  #define DEFAULT_CFG_FILE       "config_db.json"
>  #define DEFAULT_EXPORT_FILE    "export_db.json"
>  
> +/*
> + *The default unicast address assigned to a node generated with
> + * Create() method
> + */
> +#define OWN_PRIMARY_ADDR       0x0001
> +
>  struct meshcfg_el {
>         const char *path;
>         uint8_t index;
> @@ -777,7 +783,7 @@ static void attach_node_reply(struct l_dbus_proxy
> *proxy,
>         }
>  
>         /* Read own node composition */
> -       if (!cfgcli_get_comp(0x0001, 128))
> +       if (!cfgcli_get_comp(OWN_PRIMARY_ADDR, 128))
>                 l_error("Failed to read own composition");
>  
>         return;
> @@ -868,7 +874,7 @@ static void scan_start(void *user_data, uint16_t
> dst, uint32_t model)
>  {
>         struct scan_data *data;
>  
> -       if (model != (0xffff0000 | RPR_SVR_MODEL))
> +       if (model != (0xffff0000 | RPR_SVR_MODEL) || dst !=
> OWN_PRIMARY_ADDR)
>                 return;
>  
>         data = l_malloc(sizeof(struct scan_data));
> @@ -2364,8 +2370,8 @@ static struct l_dbus_message
> *join_complete(struct l_dbus *dbus,
>         keys_add_net_key(PRIMARY_NET_IDX);
>         mesh_db_add_net_key(PRIMARY_NET_IDX);
>  
> -       remote_add_node(app.uuid, 0x0001, 1, PRIMARY_NET_IDX);
> -       mesh_db_add_node(app.uuid, 0x0001, 1, PRIMARY_NET_IDX);
> +       remote_add_node(app.uuid, OWN_PRIMARY_ADDR, 1,
> PRIMARY_NET_IDX);
> +       mesh_db_add_node(app.uuid, OWN_PRIMARY_ADDR, 1,
> PRIMARY_NET_IDX);
>  
>         mesh_db_add_provisioner("BlueZ mesh-cfgclient", app.uuid,
>                                         low_addr, high_addr,
diff mbox series

Patch

diff --git a/tools/mesh-cfgclient.c b/tools/mesh-cfgclient.c
index 6d2d34409..8369b345d 100644
--- a/tools/mesh-cfgclient.c
+++ b/tools/mesh-cfgclient.c
@@ -58,6 +58,12 @@ 
 #define DEFAULT_CFG_FILE	"config_db.json"
 #define DEFAULT_EXPORT_FILE	"export_db.json"
 
+/*
+ *The default unicast address assigned to a node generated with
+ * Create() method
+ */
+#define OWN_PRIMARY_ADDR	0x0001
+
 struct meshcfg_el {
 	const char *path;
 	uint8_t index;
@@ -777,7 +783,7 @@  static void attach_node_reply(struct l_dbus_proxy *proxy,
 	}
 
 	/* Read own node composition */
-	if (!cfgcli_get_comp(0x0001, 128))
+	if (!cfgcli_get_comp(OWN_PRIMARY_ADDR, 128))
 		l_error("Failed to read own composition");
 
 	return;
@@ -868,7 +874,7 @@  static void scan_start(void *user_data, uint16_t dst, uint32_t model)
 {
 	struct scan_data *data;
 
-	if (model != (0xffff0000 | RPR_SVR_MODEL))
+	if (model != (0xffff0000 | RPR_SVR_MODEL) || dst != OWN_PRIMARY_ADDR)
 		return;
 
 	data = l_malloc(sizeof(struct scan_data));
@@ -2364,8 +2370,8 @@  static struct l_dbus_message *join_complete(struct l_dbus *dbus,
 	keys_add_net_key(PRIMARY_NET_IDX);
 	mesh_db_add_net_key(PRIMARY_NET_IDX);
 
-	remote_add_node(app.uuid, 0x0001, 1, PRIMARY_NET_IDX);
-	mesh_db_add_node(app.uuid, 0x0001, 1, PRIMARY_NET_IDX);
+	remote_add_node(app.uuid, OWN_PRIMARY_ADDR, 1, PRIMARY_NET_IDX);
+	mesh_db_add_node(app.uuid, OWN_PRIMARY_ADDR, 1, PRIMARY_NET_IDX);
 
 	mesh_db_add_provisioner("BlueZ mesh-cfgclient", app.uuid,
 					low_addr, high_addr,