Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp595696ybi; Wed, 17 Jul 2019 01:50:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpHDeWVsM/Lr3pWCcXrMGWxlC9k//r9FpFooeyIEe5Ea7CsD3yVd9Qhb9GzkHauFpD5oQ0 X-Received: by 2002:a17:90b:8cd:: with SMTP id ds13mr40443034pjb.141.1563353459450; Wed, 17 Jul 2019 01:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563353459; cv=none; d=google.com; s=arc-20160816; b=m/agIyGvokLnIhc54h6XJG5L3fVEhaI81kTiefQccvzE4Ax8Ie3RIG2As75aGZnjDl EGZD1RRWUE0yjLUXcfGHNovSUGBQTBJNkkLAwapzz16Z6VPcd6CPpY3m211mtJ9dH4LG qpnW091wS5A7p7EW/jsUiXuBv1fkto6mluuaiPHQmsZJXxEG/WcaakC2491arHo86xEI 9nAgF/ROQSMncVwW07vaW/HiaHqaAg4N2mcHbJGjMpSkuO7mIfrwCwgT22MCWFtDgStu aEIRJVB3pJ/+1vWLQpvMA03z7UbzVQA/r06Sli43Znz4SSqmoQ6nZ63qq2Nyrk241Ad/ IfTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=9C1OaM2ubRaQdUHNUot0RdCNrlYgzHu9Ql1cSkC90QA=; b=HLRCMxurN0myT3zIUM1vOGj8HLWQtt6QyRykx4mSnde5vpDZRQ/Xue1Plr8mG4Wl// JX/EW0LpAfTrf02azQ8B5h8Dw9uTR/Gx3Tu8QpBFuDnLFG4nV9+zunoyC3Gw97ZzWbJ+ kZ8+Db9o8lRe28w9O4VoctUhRUcVJ/kwq9Nq1PsrAtMc6iLTe0YG+L9B0v+ub4GLY5S2 37kRDcJZ2LRhkLlampMykmnUuUpnV+D8iqZ19At6UvtyTZ9n82kZAXtooAerz7PZvAI+ f4UVs4tr+Yz+/hVM6UnYkONGQcrFllwa3I3CDwsx6gAfIKc+MaeIc/2ssUsZZNjO6t81 ZEOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=ZBp3Qi+o; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si21193408plr.34.2019.07.17.01.50.38; Wed, 17 Jul 2019 01:50:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=ZBp3Qi+o; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729703AbfGQIs7 (ORCPT + 99 others); Wed, 17 Jul 2019 04:48:59 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:44399 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728080AbfGQIs6 (ORCPT ); Wed, 17 Jul 2019 04:48:58 -0400 Received: by mail-lf1-f67.google.com with SMTP id r15so10937354lfm.11 for ; Wed, 17 Jul 2019 01:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silvair-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=9C1OaM2ubRaQdUHNUot0RdCNrlYgzHu9Ql1cSkC90QA=; b=ZBp3Qi+odak/Fn22oRZidt6KYL848U7T0vu/yCaIfLFjNBd3YlzqrbEkHZ1HBBBC2F 4VOOZTVcuikh4Uumun7TlVuWB/GoSBj+tCqll+3oXUQyBKlShlYqk+8xj1BerOeyERlu kyQgBEZNnevU/L6qi+oFV8zrGwMHJC4NWjaNNafasDlImHMeC+YgxGKsJJ4Ml0pqtEnN W4kO1qYr9JyxZXNOMWbwaQQFn7rrTYr2f+1QCumt+RdYKLi+CewfwO2ugRFjgGKAvxNW Ptjuo8s8XrBwNe1/t8RqlI0iutZZq2j3vkOC5IcZ3DschOqQHyLL5iJGMRLqwStrvPxZ VzPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=9C1OaM2ubRaQdUHNUot0RdCNrlYgzHu9Ql1cSkC90QA=; b=W4GmIYuennlGLJI3GXdiAk6xRgVyZ4QBWTLZ2o2h6NP3xoQe17UsTztOGv334rM6DI vD0y+T6GJQKb/EsFRqfvdQ4kmKiuWnWC1Tcw45Z6VPaqtrWhe149tzuiOAgO+eOWIlsg 1Y17n6nwcuuanH3N5aN6g/q/pNE6IzzLkfZ6lzaSJURTJ8H1xH9SaWBS9cxIc2CY50Pb QUEdkWOQ7EwyiZvVodpoArrPSGkAQc8R1srF0B0MHLgsT9pPTvn+v5ZiUB/7lOtpq227 kAf2Mz5sM46Uw+j003Su4FX8te63Ip3wgewV6Sqg70vY7YdJMmhUnxWiH6gQV1Do3MPB tbng== X-Gm-Message-State: APjAAAVZBm196May11ua3tEP47P134UXaiI2k0NxtfF4+nBQJni+8bZn Eon0AiV7mXg6nMGaEgkbYahDtQ== X-Received: by 2002:a19:f007:: with SMTP id p7mr17176998lfc.24.1563353337132; Wed, 17 Jul 2019 01:48:57 -0700 (PDT) Received: from mlowasrzechonek2133 ([31.0.84.191]) by smtp.gmail.com with ESMTPSA id k27sm3638813lfm.90.2019.07.17.01.48.55 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 17 Jul 2019 01:48:56 -0700 (PDT) Date: Wed, 17 Jul 2019 10:48:53 +0200 From: =?utf-8?Q?Micha=C5=82?= Lowas-Rzechonek To: Brian Gix Cc: linux-bluetooth@vger.kernel.org, inga.stotland@intel.com Subject: Re: [PATCH BlueZ 3/3] mesh: Propagate Net Index up Rx message chain Message-ID: <20190717084853.copy2f3dc7oaglf4@mlowasrzechonek2133> Mail-Followup-To: Brian Gix , linux-bluetooth@vger.kernel.org, inga.stotland@intel.com References: <20190716225644.11449-1-brian.gix@intel.com> <20190716225644.11449-4-brian.gix@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190716225644.11449-4-brian.gix@intel.com> User-Agent: NeoMutt/20180716 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 Silvair http://silvair.com Jasnogórska 44, 31-358 Krakow, POLAND