<?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>BLE MESH : Replay Cache limitations</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/88402/ble-mesh-replay-cache-limitations</link><description>Howdy all, 
 I have noticed that there are some limitations regarding the replay cache in BLE mesh devices. 
 Environment: 
 1. nrf52840 
 2. MESH_SDK V5.00 
 I have developed a PC application with a GUI interface which enables us to interact with Mesh</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Jun 2022 13:30:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/88402/ble-mesh-replay-cache-limitations" /><item><title>RE: BLE MESH : Replay Cache limitations</title><link>https://devzone.nordicsemi.com/thread/370717?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 13:30:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f228687-e37d-4b75-ae26-a51ece1e457b</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1. Yes,&amp;nbsp;The max size of backend part for the file cannot be more than `UINT16_MAX`. That means (sizeof(replay_cache_entry_t) + szizeof(uint16_t)) * REPLAY_CACHE_ENTRIES &amp;lt;= UINT16_MAX.&lt;/p&gt;
&lt;p&gt;2. Using NON_PERSISTENT for replay cache is not according to the mesh spec.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE MESH : Replay Cache limitations</title><link>https://devzone.nordicsemi.com/thread/370672?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 11:39:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f3042a8-e1a7-42e8-afa1-86b52e95a88b</guid><dc:creator>Chris_Dev</dc:creator><description>&lt;p&gt;I understand that it is limited by RAM, that is why I have mentioned that I have done a memory optimization. What I am trying to show to you are two problems:&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;strong&gt;&lt;em&gt;1. When increasing REPLAY_CACHE_ENTRIES to a much larger number, say 4095, I get a mesh assert in mesh_config_backend.c:&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;line 110: &amp;nbsp;NRF_MESH_ASSERT(size_guard &amp;lt;= UINT16_MAX);&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Probably because the mesh config entry for the replay cache is too large?&lt;/em&gt;&lt;/strong&gt;&amp;quot;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;&lt;strong&gt;2. I tried working around this by setting:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;#define REPLAY_CACHE_STORAGE_STRATEGY MESH_CONFIG_STRATEGY_NON_PERSISTENT&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;br /&gt;Now I am getting an assert in packet_buffer.c:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;line 249: NRF_MESH_ASSERT(m_get_packet(p_buffer, p_buffer-&amp;gt;head)-&amp;gt;packet_state !=&lt;br /&gt; PACKET_BUFFER_MEM_STATE_RESERVED);&lt;/strong&gt;&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Somehow the replay cache in RAM and the mesh configuration (FLASH) is not scaling correctly? Maybe somewhere I should increase the number of flash pages the mesh config uses? Also, when I am explicitly stating:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;#define REPLAY_CACHE_STORAGE_STRATEGY MESH_CONFIG_STRATEGY_NON_PERSISTENT&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;I would expect that the replay cache will never be stored in flash (mesh config), so the size of &lt;strong&gt;REPLAY_CACHE_ENTRIES &lt;/strong&gt;should only be dependent on RAM, but now I am getting mesh asserts? Do you see what I am trying to point out?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE MESH : Replay Cache limitations</title><link>https://devzone.nordicsemi.com/thread/370587?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 07:24:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7b46237-68d6-4470-a209-876f8bf1da0c</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can increase this number, the trade-off is the bigger size of the m_replay_cache table ( 8 bytes/entry) and the longer time it takes for the node to check the list to avoid a replay attack.&amp;nbsp;The size is limited by the free RAM memory your application has.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;-Amanda&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE MESH : Replay Cache limitations</title><link>https://devzone.nordicsemi.com/thread/370161?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 10:07:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42dbcc25-a08e-4c8a-831f-b1f71a086f8a</guid><dc:creator>Chris_Dev</dc:creator><description>&lt;p&gt;&lt;strong&gt;l&lt;/strong&gt;Hi Amanda, &lt;/p&gt;
&lt;p&gt;Perfect, thanks so much.&lt;/p&gt;
&lt;p&gt;Then just back to enabling a device to communicate with more unicast addresses:&lt;/p&gt;
&lt;p&gt;I have done a memory optimization and I have increased &lt;strong&gt;REPLAY_CACHE_ENTRIES&lt;/strong&gt; &lt;strong&gt;&lt;/strong&gt;to say 1030. That seems to work fine. I am experiencing 2 issues though:&lt;/p&gt;
&lt;p&gt;1. When increasing &lt;strong&gt;REPLAY_CACHE_ENTRIES&lt;/strong&gt; to a much larger number, say 4095, I get a mesh assert in &lt;strong&gt;mesh_config_backend.c:&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;line 110: &amp;nbsp;&lt;em&gt;&lt;strong&gt;NRF_MESH_ASSERT(size_guard &amp;lt;= UINT16_MAX);&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;Probably because the config entry for the replay cache is too large?&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I tried working around this by setting:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;#define REPLAY_CACHE_STORAGE_STRATEGY MESH_CONFIG_STRATEGY_NON_PERSISTENT&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;Now I am getting an assert in &lt;strong&gt;packet_buffer.c:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;line 249:&lt;strong&gt; NRF_MESH_ASSERT(m_get_packet(p_buffer, p_buffer-&amp;gt;head)-&amp;gt;packet_state !=&lt;br /&gt; PACKET_BUFFER_MEM_STATE_RESERVED);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;What is the right way of expanding the replay cache so that the node can communicate with more devices?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE MESH : Replay Cache limitations</title><link>https://devzone.nordicsemi.com/thread/370128?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 08:03:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61918893-5e56-47d1-9551-ddf8f969b093</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Mesh Profile Specification, section 3.10.7 Node Removal procedure, paragraph 3:&lt;br /&gt; &lt;em&gt;&amp;quot;After a node is removed from a network, its unicast addresses may be reused by a Provisioner. A Provisioner shall only reuse these addresses after the current IV Index (at the time of removal) has been updated (see Section 3.10.5) in order to enable the SEQ numbers to be reused.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The spec requires the provisioner to wait with reusing unicast addresses until there has been a full IV Index Update cycle.&amp;nbsp;In other words, you should not reuse that 0x20 address before the IV Index has been updated.&lt;/p&gt;
&lt;div&gt;Regards,&lt;br /&gt;Amanda&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>