Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
From: "Gix, Brian" <brian.gix@intel.com>
To: "linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	"Stotland, Inga" <inga.stotland@intel.com>
Subject: Re: [PATCH BlueZ v3] mesh: Handle messages sent to a fixed group address
Date: Sun, 8 Sep 2019 14:18:57 +0000
Message-ID: <0a5008f93d4b2d7e82a7e8d68a6444d2284d98f7.camel@intel.com> (raw)
In-Reply-To: <20190907060759.5298-1-inga.stotland@intel.com>

Applied

On Fri, 2019-09-06 at 23:07 -0700, Inga Stotland wrote:
> This handles the case when an inbound message is addressed to
> a fixed group, i.e., all-proxies, all-friends, all-relays and
> all-nodes. The message is delivered to a primary element only,
> and, with the exception of all-nodes case, if the corresponding
> feature is enabled on the node.
> ---
>  mesh/mesh-defs.h |  2 ++
>  mesh/model.c     | 32 +++++++++++++++++++++++++++++++-
>  2 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/mesh/mesh-defs.h b/mesh/mesh-defs.h
> index 1219e4939..8f28fc89b 100644
> --- a/mesh/mesh-defs.h
> +++ b/mesh/mesh-defs.h
> @@ -118,4 +118,6 @@
>  #define IS_GROUP(x)		((((x) >= GROUP_ADDRESS_LOW) && \
>  					((x) < FIXED_GROUP_HIGH)) || \
>  					((x) == ALL_NODES_ADDRESS))
> +
> +#define IS_FIXED_GROUP_ADDRESS(x)	((x) >= PROXIES_ADDRESS)
>  #define IS_ALL_NODES(x)	((x) == ALL_NODES_ADDRESS)
> diff --git a/mesh/model.c b/mesh/model.c
> index 8f3d67ecf..a06b684a5 100644
> --- a/mesh/model.c
> +++ b/mesh/model.c
> @@ -311,7 +311,7 @@ static void forward_model(void *a, void *b)
>  		return;
>  
>  	dst = fwd->dst;
> -	if (dst == fwd->unicast || IS_ALL_NODES(dst))
> +	if (dst == fwd->unicast || IS_FIXED_GROUP_ADDRESS(dst))
>  		fwd->has_dst = true;
>  	else if (fwd->virt) {
>  		virt = l_queue_find(mod->virtuals, simple_match, fwd->virt);
> @@ -886,8 +886,30 @@ 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++) {
>  		struct l_queue *models;
>  
> @@ -927,6 +949,14 @@ bool mesh_model_rx(struct mesh_node *node, bool szmict, uint32_t seq0,
>  		/* If the message was to unicast address, we are done */
>  		if (!is_subscription && ele_idx == i)
>  			break;
> +
> +		/*
> +		 * For the fixed group addresses, i.e., all-proxies,
> +		 * all-friends, all-relays, all-nodes, the message is delivered
> +		 * to a primary element only.
> +		 */
> +		if (IS_FIXED_GROUP_ADDRESS(dst))
> +			break;
>  	}
>  
>  done:

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-07  6:07 Inga Stotland
2019-09-08 14:18 ` Gix, Brian [this message]

Reply instructions:

You may reply publically 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=0a5008f93d4b2d7e82a7e8d68a6444d2284d98f7.camel@intel.com \
    --to=brian.gix@intel.com \
    --cc=inga.stotland@intel.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

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org linux-bluetooth@archiver.kernel.org
	public-inbox-index linux-bluetooth


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/ public-inbox