Re: [PATCH BlueZ 3/3] mesh: Propagate Net Index up Rx message chain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Brian,

On 07/16, Brian Gix wrote:
> When a model receives a message, it is required by the spec
> to respond using the same credentials. When an App Key is used,
> this is trivial because App keys are bound to Net keys, so only
> the App Index is required.  Messages received on a Device key
> however, need the Net Index preserved from original message for
> re-use during the response.
> ---
>  mesh/cfgmod-server.c | 154 ++++++++++++++++++++++++++++-----------------------
>  mesh/model.c         | 129 +++++++++++++++++++++---------------------
>  mesh/model.h         |  10 ++--
>  mesh/net.c           |  92 +++++++++++++++++-------------
>  mesh/net.h           |   6 +-
>  mesh/node.c          |  10 ++--
>  6 files changed, 214 insertions(+), 187 deletions(-)
> 
(...)
> diff --git a/mesh/net.c b/mesh/net.c
> index a5693f154..ba52867c4 100644
> --- a/mesh/net.c
> +++ b/mesh/net.c
> @@ -119,7 +119,6 @@ struct mesh_net {
>  	unsigned int pkt_id;
>  	unsigned int bea_id;
>  	unsigned int beacon_id;
> -	unsigned int key_id_next;
>  	unsigned int sar_id_next;
>  
>  	bool friend_enable;
> @@ -203,7 +202,7 @@ struct mesh_sar {
>  	bool frnd_cred;
>  	uint8_t ttl;
>  	uint8_t last_seg;
> -	uint8_t key_id;
> +	uint8_t key_aid;
>  	uint8_t buf[4]; /* Large enough for ACK-Flags and MIC */
>  };
>  
> @@ -225,7 +224,7 @@ struct msg_rx {
>  	union {
>  		struct {
>  			uint16_t app_idx;
> -			uint8_t key_id;
> +			uint8_t key_aid;
>  		} m;
>  		struct {
>  			uint16_t seq0;
> @@ -668,7 +667,6 @@ struct mesh_net *mesh_net_new(struct mesh_node *node)
>  	net->node = node;
>  	net->pkt_id = 0;
>  	net->bea_id = 0;
> -	net->key_id_next = 0;
>  
>  	net->beacon_enable = true;
>  	net->proxy_enable = false;
> @@ -676,7 +674,7 @@ struct mesh_net *mesh_net_new(struct mesh_node *node)
>  
>  	net->seq_num = 0x000000;
>  	net->src_addr = 0x0000;
> -	net->default_ttl = 0x00;
> +	net->default_ttl = 0x7f;
(...)
> @@ -3408,18 +3421,17 @@ bool mesh_net_app_send(struct mesh_net *net, bool frnd_cred, uint16_t src,
>  	if (!src || !dst)
>  		return false;
>  
> -	if (ttl == 0xff)
> +	if (ttl == DEFAULT_TTL)
>  		ttl = net->default_ttl;
(...)

I would keep these in a separate patch, it's not really related to key
ids/indexes.

Otherwise, LGTM!

-- 
Michał Lowas-Rzechonek <michal.lowas-rzechonek@xxxxxxxxxxx>
Silvair http://silvair.com
Jasnogórska 44, 31-358 Krakow, POLAND



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux