linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] mesh: Always set net modes based on node feature settings
@ 2020-08-18 22:22 Inga Stotland
  2020-08-18 22:22 ` [PATCH BlueZ 2/2] mesh: Check for enabled modes when dst is fixed address Inga Stotland
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Inga Stotland @ 2020-08-18 22:22 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, Inga Stotland

The network settings such as relay, beacon, proxy and friend are
always set based on local node feature settings. This change makes
the net modes intialization unconditional, to include the "No Support"
setting on node level which should result in the disabled mode in net.c
---
 mesh/node.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index 1eeffeb8b..ebc111a62 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -399,24 +399,16 @@ static bool init_storage_dir(struct mesh_node *node)
 
 static void update_net_settings(struct mesh_node *node)
 {
-	uint8_t mode;
+	struct mesh_net *net = node->net;
 
-	mode = node->proxy;
-	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
-		mesh_net_set_proxy_mode(node->net, mode == MESH_MODE_ENABLED);
+	mesh_net_set_proxy_mode(net, node->proxy == MESH_MODE_ENABLED);
 
-	mode = node->friend;
-	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
-		mesh_net_set_friend_mode(node->net, mode == MESH_MODE_ENABLED);
+	mesh_net_set_friend_mode(net, node->friend == MESH_MODE_ENABLED);
 
-	mode = node->relay.mode;
-	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
-		mesh_net_set_relay_mode(node->net, mode == MESH_MODE_ENABLED,
+	mesh_net_set_relay_mode(net, node->relay.mode == MESH_MODE_ENABLED,
 					node->relay.cnt, node->relay.interval);
 
-	mode = node->beacon;
-	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
-		mesh_net_set_beacon_mode(node->net, mode == MESH_MODE_ENABLED);
+	mesh_net_set_beacon_mode(net, node->beacon == MESH_MODE_ENABLED);
 }
 
 static bool init_from_storage(struct mesh_config_node *db_node,
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ 2/2] mesh: Check for enabled modes when dst is fixed address
  2020-08-18 22:22 [PATCH BlueZ 1/2] mesh: Always set net modes based on node feature settings Inga Stotland
@ 2020-08-18 22:22 ` Inga Stotland
  2020-08-18 22:50 ` [BlueZ,1/2] mesh: Always set net modes based on node feature settings bluez.test.bot
  2020-08-20 14:27 ` [PATCH BlueZ 1/2] " Gix, Brian
  2 siblings, 0 replies; 4+ messages in thread
From: Inga Stotland @ 2020-08-18 22:22 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, Inga Stotland

This moves the check for incoming messages addressed to fixed addresses,
e.g. RELAY, PROXY, FRIEND. If the corresponding feature is not enabled,
the message is not processed.
---
 mesh/model.c | 21 ---------------------
 mesh/net.c   |  9 +++++++++
 2 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/mesh/model.c b/mesh/model.c
index 961391f13..b44e2f669 100644
--- a/mesh/model.c
+++ b/mesh/model.c
@@ -937,27 +937,6 @@ bool mesh_model_rx(struct mesh_node *node, bool szmict, uint32_t seq0,
 	if (!num_ele || IS_UNASSIGNED(addr))
 		goto done;
 
-	/*
-	 * In case of fixed group  addresses check if the
-	 * corresponding mode is enabled.
-	 */
-	if (dst == PROXIES_ADDRESS &&
-			(node_proxy_mode_get(node) != MESH_MODE_ENABLED))
-		goto done;
-
-	if (dst == FRIENDS_ADDRESS &&
-			(node_friend_mode_get(node) != MESH_MODE_ENABLED))
-		goto done;
-
-	if (dst == RELAYS_ADDRESS) {
-		uint8_t cnt;
-		uint16_t interval;
-
-		if (node_relay_mode_get(node, &cnt, &interval) !=
-							MESH_MODE_ENABLED)
-			goto done;
-	}
-
 	is_subscription = !(IS_UNICAST(dst));
 
 	for (i = 0; i < num_ele; i++) {
diff --git a/mesh/net.c b/mesh/net.c
index 26440b02d..115a76944 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -1658,6 +1658,15 @@ static bool msg_rxed(struct mesh_net *net, bool frnd, uint32_t iv_index,
 	}
 
 not_for_friend:
+	if (dst == FRIENDS_ADDRESS && !net->friend_enable)
+		return false;
+
+	if (dst == RELAYS_ADDRESS && !net->relay.enable)
+		return false;
+
+	if (dst == PROXIES_ADDRESS && !net->proxy_enable)
+		return false;
+
 	return mesh_model_rx(net->node, szmic, seqAuth, seq, iv_index, net_idx,
 						src, dst, key_aid, data, size);
 }
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ,1/2] mesh: Always set net modes based on node feature settings
  2020-08-18 22:22 [PATCH BlueZ 1/2] mesh: Always set net modes based on node feature settings Inga Stotland
  2020-08-18 22:22 ` [PATCH BlueZ 2/2] mesh: Check for enabled modes when dst is fixed address Inga Stotland
@ 2020-08-18 22:50 ` bluez.test.bot
  2020-08-20 14:27 ` [PATCH BlueZ 1/2] " Gix, Brian
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2020-08-18 22:50 UTC (permalink / raw)
  To: linux-bluetooth, inga.stotland

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]


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.
While we are preparing for reviewing the patches, we found the following
issue/warning.

Test Result:
checkpatch Failed

Outputs:
WARNING:TYPO_SPELLING: 'intialization' may be misspelled - perhaps 'initialization'?
#8: 
the net modes intialization unconditional, to include the "No Support"

- total: 0 errors, 1 warnings, 29 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.



---
Regards,
Linux Bluetooth

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ 1/2] mesh: Always set net modes based on node feature settings
  2020-08-18 22:22 [PATCH BlueZ 1/2] mesh: Always set net modes based on node feature settings Inga Stotland
  2020-08-18 22:22 ` [PATCH BlueZ 2/2] mesh: Check for enabled modes when dst is fixed address Inga Stotland
  2020-08-18 22:50 ` [BlueZ,1/2] mesh: Always set net modes based on node feature settings bluez.test.bot
@ 2020-08-20 14:27 ` Gix, Brian
  2 siblings, 0 replies; 4+ messages in thread
From: Gix, Brian @ 2020-08-20 14:27 UTC (permalink / raw)
  To: linux-bluetooth, Stotland, Inga

Applied patchset with spelling correction

On Tue, 2020-08-18 at 15:22 -0700, Inga Stotland wrote:
> The network settings such as relay, beacon, proxy and friend are
> always set based on local node feature settings. This change makes
> the net modes intialization unconditional, to include the "No Support"
> setting on node level which should result in the disabled mode in net.c
> ---
>  mesh/node.c | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/mesh/node.c b/mesh/node.c
> index 1eeffeb8b..ebc111a62 100644
> --- a/mesh/node.c
> +++ b/mesh/node.c
> @@ -399,24 +399,16 @@ static bool init_storage_dir(struct mesh_node *node)
>  
>  static void update_net_settings(struct mesh_node *node)
>  {
> -	uint8_t mode;
> +	struct mesh_net *net = node->net;
>  
> -	mode = node->proxy;
> -	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
> -		mesh_net_set_proxy_mode(node->net, mode == MESH_MODE_ENABLED);
> +	mesh_net_set_proxy_mode(net, node->proxy == MESH_MODE_ENABLED);
>  
> -	mode = node->friend;
> -	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
> -		mesh_net_set_friend_mode(node->net, mode == MESH_MODE_ENABLED);
> +	mesh_net_set_friend_mode(net, node->friend == MESH_MODE_ENABLED);
>  
> -	mode = node->relay.mode;
> -	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
> -		mesh_net_set_relay_mode(node->net, mode == MESH_MODE_ENABLED,
> +	mesh_net_set_relay_mode(net, node->relay.mode == MESH_MODE_ENABLED,
>  					node->relay.cnt, node->relay.interval);
>  
> -	mode = node->beacon;
> -	if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED)
> -		mesh_net_set_beacon_mode(node->net, mode == MESH_MODE_ENABLED);
> +	mesh_net_set_beacon_mode(net, node->beacon == MESH_MODE_ENABLED);
>  }
>  
>  static bool init_from_storage(struct mesh_config_node *db_node,

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-20 14:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 22:22 [PATCH BlueZ 1/2] mesh: Always set net modes based on node feature settings Inga Stotland
2020-08-18 22:22 ` [PATCH BlueZ 2/2] mesh: Check for enabled modes when dst is fixed address Inga Stotland
2020-08-18 22:50 ` [BlueZ,1/2] mesh: Always set net modes based on node feature settings bluez.test.bot
2020-08-20 14:27 ` [PATCH BlueZ 1/2] " Gix, Brian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).