<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mesh TX after node reset</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/30730/mesh-tx-after-node-reset</link><description>Hello, 
 I have a statically provisioned mesh network (keys and addresses are pre-set in code to make it simple for now) in which each device periodically broadcasts it&amp;#39;s status to the mesh for other devices to be aware of (to illustrate it it might be</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Mar 2018 17:22:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/30730/mesh-tx-after-node-reset" /><item><title>RE: Mesh TX after node reset</title><link>https://devzone.nordicsemi.com/thread/123747?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 17:22:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75a12bae-77fc-4bf8-87e6-736380c4ba5c</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am very sorry for the delays, I have been a lot out-of-office lately.&lt;/p&gt;
&lt;p&gt;The sequence number is in net_state.c. Current &amp;quot;maximum allocated&amp;quot; is in m_net_state.seqnum_max_available, and also written to flash. Maximum value gets bumped and written to flash in seqnum_block_allocate(). It gets bumped by NETWORK_SEQNUM_FLASH_BLOCK_SIZE which is defined in nrf_mesh_config_core.h, so that is where you configure how much is &amp;quot;allocated&amp;quot; each time if you should need that.&lt;/p&gt;
&lt;p&gt;The maximum value is fetched from flash as part of net_state_recover_from_flash(), which iterates through the entries searching for the FLASH_HANDLE_SEQNUM handle. Note that it then calls seqnum_block_allocate() in order to allocate a new block. (This recovery is done after reset, and so one must continue past the previously allocated maximum value in order to be sure the sequence number is higher.)&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh TX after node reset</title><link>https://devzone.nordicsemi.com/thread/121801?ContentTypeID=1</link><pubDate>Fri, 23 Feb 2018 13:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b56b1c3-4ba1-48e6-93fa-a26b95ea527d</guid><dc:creator>PB</dc:creator><description>&lt;p&gt;I am working on a setup for throughput testing and&amp;nbsp;since my code already uses persistent storage that would probably be the case as I had to disable mesh PS to avoid colisions (or migrating to Mesh SDK storage). I understand the security risks and this is not a concern at this moment and just wanted to see where to look for the current value of message sequence ID. I&amp;#39;ve looked into packet and packet_buffer sources but couldn&amp;#39;t find the variable storing the sequence number.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh TX after node reset</title><link>https://devzone.nordicsemi.com/thread/121791?ContentTypeID=1</link><pubDate>Fri, 23 Feb 2018 12:38:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea045126-21c7-4d4b-acd5-56ee4ca73f34</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;It sounds like this is a separate issue. Thing is, it keeps its sequence number in RAM, but it also has written a higher number in Flash. On reboot it starts from that higher number. Whenever the sequence number in RAM reaches the number in Flash, a new number is written to Flash. You can look at it as &amp;quot;allocating&amp;quot; blocks of sequence numbers to itself, and since on a reboot it does not remember how far it has come in the current block it will start from the next one. So if you have not done anything to change this behavior then it should not have to do with sequence numbering.&lt;/p&gt;
&lt;p&gt;Please note that the place it should start from cannot be hard coded, as it must start higher each time.&lt;/p&gt;
&lt;p&gt;Also note that always accepting sequence ID 0 would be a huge security hole, as it opens for replay attacks, which is exactly what sequence numbering is supposed to protect against in the first place.&lt;/p&gt;
&lt;p&gt;You should figure out, through debugging, what sequence numbers the node is using, to see if that is indeed the issue here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh TX after node reset</title><link>https://devzone.nordicsemi.com/thread/121711?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2018 15:46:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6545b632-443d-4ad7-9860-3671337d58e5</guid><dc:creator>PB</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;My case&amp;nbsp;of reset&amp;nbsp;is&amp;nbsp;&amp;quot;SoC reset&amp;quot;. After reset the device load&amp;#39;s it&amp;#39;s&amp;nbsp;previously stored (from fstorage or even hard-coded to remove fstorage issue out of the question) so it&amp;#39;s provisioned.&lt;/p&gt;
&lt;p&gt;Maybe fast forwarding of the node to catch up with the network could be done by somehow extracting last received mesh message sequence ID or changing that other nodes of the mesh network clear the replay protection if they encounter a message with sequence ID = 0 for example?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh TX after node reset</title><link>https://devzone.nordicsemi.com/thread/121702?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2018 15:32:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61306a50-6106-4614-9d90-bc31b26dae64</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If by &amp;quot;reset&amp;quot; you mean the &amp;quot;node reset&amp;quot; functionality, which means the node is unprovisioned and then provisioned again, with the same address both before and after, then yes. It may be the counter that you mention.&lt;/p&gt;
&lt;p&gt;Bluetooth Mesh implements replay protection by each message from a particular address including a sequence number. Each node in the network keeps track of how far each address has come in this sequencing, and when a message contains an outdated sequence number it is discarded as a potential replay attack.&lt;/p&gt;
&lt;p&gt;Also by specification, the sequencing is reset to start from 0 on &amp;quot;node reset&amp;quot;. So when provisioning the node with the same address, all messages from that address will look like replay attempts until it overtakes the highest sequence number sent from that address previously.&lt;/p&gt;
&lt;p&gt;Recommended in the Bluetooth Mesh specification is to use a new address after node reset. The alternative would be to remove the unprovisioned device from the replay protection arrays of all other nodes, for which there is no specified mechanism.&lt;/p&gt;
&lt;p&gt;I do not know any good way to bump the sequence number as you suggest. Because of the inner workings of our Bluetooth Mesh implementation, the sequence number does get bumped every time you reboot the device (i.e. SoC reset, not &amp;quot;node reset&amp;quot;,) but there is really no simple way to know how far all the other nodes think that the node has counted previously.&lt;/p&gt;
&lt;p&gt;If by &amp;quot;reset&amp;quot; you do not mean &amp;quot;node reset&amp;quot;, then I have no clue. Then you should provide some more detailed information, optimally some example code for easily showcasing / reproducing the behavior.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>