<?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>20 peers on Peer Manager but 8 peers on SoftDevice</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46218/20-peers-on-peer-manager-but-8-peers-on-softdevice</link><description>Peer Manager in recent SDKs supports up to 20 peers but SoftDevice functions like sd_ble_gap_whitelist_set() and sd_ble_gap_device_identities_set() are able to handle up to 8 addresses only. How to whitelist and get resolved peers #9-20?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Nov 2019 11:21:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46218/20-peers-on-peer-manager-but-8-peers-on-softdevice" /><item><title>RE: 20 peers on Peer Manager but 8 peers on SoftDevice</title><link>https://devzone.nordicsemi.com/thread/221036?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2019 11:21:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eaf20cd-2de2-4a6b-b5d9-a0960bda5194</guid><dc:creator>Basprog</dc:creator><description>&lt;p&gt;Hi Einar, is there any news for internal feature request you&amp;#39;ve created more than a half year ago and three desire points mentioned above this post?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 20 peers on Peer Manager but 8 peers on SoftDevice</title><link>https://devzone.nordicsemi.com/thread/182739?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2019 12:40:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:560de53f-eca6-4d0b-b1ab-215eeaa11c41</guid><dc:creator>Basprog</dc:creator><description>&lt;p&gt;Got it. Thank you. So I&amp;#39;m in waiting for Nordic to expand usability as following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;span style="background-color:#ffffff;"&gt;sd_ble_gap_whitelist_set() and&amp;nbsp;sd_ble_gap_device_identities_set() take up to 16 addresses and keys;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color:#ffffff;"&gt;SoftDevice &lt;/span&gt;sets &lt;span style="background-color:#ffffff;"&gt;addr_id_peer&lt;/span&gt; = 1 if there was a match to any of 16 IRKs;&lt;/li&gt;
&lt;li&gt;Peer Manager uses AAR.STATUS to check which one of 16 IRKs matched to avoid iteration over them by calling sd_ecb_block_encrypt().&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 20 peers on Peer Manager but 8 peers on SoftDevice</title><link>https://devzone.nordicsemi.com/thread/182620?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2019 12:47:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bdb0c09-fb82-414b-88b3-0b0475c81b68</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="Baspro"]Am I also right that software whitelisting by above mentioned way is the only solution in case of more than 8 bonds?[/quote]
&lt;p&gt;Yes, doing it in SW is the only option of you need to handle a whitelist of more than 8 IRKs.&lt;/p&gt;
[quote user="Baspro"]If yes, is the any way for the application to report a matched peer_id to Peer Manager to avoid reiteration over all bonds?[/quote]
&lt;p&gt;I have not been able to look into how you can do that, but I would think it should be possible with some adjustments to the peer manager. Unfortunately I will not be able to look into it in more detail until next week, due to Easter.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 20 peers on Peer Manager but 8 peers on SoftDevice</title><link>https://devzone.nordicsemi.com/thread/182579?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2019 11:32:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ff9faa4-a8ab-4e7f-9944-0f35b3b1ffba</guid><dc:creator>Basprog</dc:creator><description>&lt;p&gt;Am I also right that software whitelisting by above mentioned way is the only solution in case of more than 8 bonds?&lt;/p&gt;
&lt;p&gt;If yes, is there any way for the application to report a matched peer_id to Peer Manager to avoid reiteration over all bonds?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 20 peers on Peer Manager but 8 peers on SoftDevice</title><link>https://devzone.nordicsemi.com/thread/182570?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2019 10:42:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68608c1b-1f91-4952-9603-ea6dcf3d517b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You are right that the AAR support up to 16 IRKs. The old S110 SoftDevice for the nRF51 series had a limit of 8 IRKs, due to some related SW processing in the SoftDevice, and that limitation has been kept in the nRF52 SoftDevices. I have not been able to confirm whether it the reason for not supporting more than 8 is valid for the nRF52 as well, but I have created an internal feature request so that it can be considered and potentially added in a future release. You should not expect that to happen any time soon, though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 20 peers on Peer Manager but 8 peers on SoftDevice</title><link>https://devzone.nordicsemi.com/thread/182428?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2019 14:31:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44542fba-6477-48d6-a9db-96cc6d64a70d</guid><dc:creator>Basprog</dc:creator><description>&lt;p&gt;Dear Einar, let me dispute with you.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/46218/20-peers-on-peer-manager-but-8-peers-on-softdevice/182367"]The limitation of 8 MAC address and IRK&amp;#39;s is due to a HW limitation[/quote]
&lt;p&gt;RADIO can in truth whitelist up to 8 public/static addresses. While AAR is able to handle up to 16 IRKs (actually up to 15, one slot is occupied by device own IRK) &amp;ndash; SoftDevice does simply not fully use it up to my mind.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/46218/20-peers-on-peer-manager-but-8-peers-on-softdevice/182367"]You could allow any device to connect, and then simply disconnect if the device is not one of the devices that are allowed to connect[/quote]
&lt;p&gt;I understand this as a suggestion of software whitelisting. OK, let&amp;#39;s assume I&amp;#39;ll follow this way, particularly: no calls of sd_ble_gap_whitelist_set() nor sd_ble_gap_device_identities_set(), on &lt;span style="background-color:#ffffff;"&gt;BLE_GAP_EVT_ADV_REPORT&lt;/span&gt; iterate over all bonded peers (public/static addresses by 6-byte comparison, resolvable addresses by call of sd_ecb_block_encrypt()) then, if any matched, call of sd_ble_gap_connect().&lt;/p&gt;
&lt;p&gt;If I&amp;#39;m right with solution on your suggestion, let&amp;#39;s get a closer look into&amp;nbsp;im_ble_evt_handler() which will handle BLE_GAP_EVT_CONNECTED: it does the same (iterates over all bonded peers the same way as above) just to find matched peer_id. So my supplementary question is following: why did Nordic limit access to the whole 16 slots of AAR resulted in double semi-software iteration in case of more than 8 bonds?&lt;/p&gt;
&lt;p&gt;For the semi-software I mean&amp;nbsp;change endianness of a key and clear/cipher texts in software then call of sd_ecb_block_encrypt() for the &lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;each&lt;/span&gt;&lt;/strong&gt; bond while we have AAR which does all the job in hardware for up to 16 keys.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/46218/20-peers-on-peer-manager-but-8-peers-on-softdevice/182367"]The peer manager supports an arbitrary number of bonds, only limited by the available flash (this can be more than 20). The number 20 probably comes from the maximum number of simultaneous connections[/quote]
&lt;p&gt;The source of probable cross-mixing of maximum numbers of bonds and connections is following declaration at &lt;span style="background-color:#ffffff;"&gt;id_manager.c:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define IM_MAX_CONN_HANDLES             (20)

static im_connection_t m_connections[IM_MAX_CONN_HANDLES];&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 20 peers on Peer Manager but 8 peers on SoftDevice</title><link>https://devzone.nordicsemi.com/thread/182367?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2019 11:54:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abe79df3-ed31-4b4a-9826-af03ebbe2106</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]Peer Manager in recent SDKs supports up to 20 peers but SoftDevice functions like&amp;nbsp;&lt;span&gt;sd_ble_gap_whitelist_set() and sd_ble_gap_device_identities_set() do able to handle up to 8 addresses only&lt;/span&gt;[/quote]
&lt;p&gt;The limitation of 8 MAC address and IRK&amp;#39;s is due to a HW limitation, as filtering happens in the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/radio.html?cp=3_0_0_5_19"&gt;RADIO &lt;/a&gt;peripheral itself. The peer manager supports an arbitrary number of bonds, only limited by the available flash (this can be more than 20). The number 20 probably comes from the maximum number of simultaneous connections, which is 20 for recent SoftDevice versions.&lt;/p&gt;
[quote user=""]How to whitelist and get resolved peers #9-20?[/quote]
&lt;p&gt;&amp;nbsp;It is not possible. However, there are a few alternative approaches that might be used:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You could allow any device to connect, and then simply disconnect if the device is not one of the devices that are allowed to connect (a conceptual whitelist). There is a possibility for a form of denial of service attack here, where attackers could constantly try to connect, but it is probably not a real problem in most applications.&lt;/li&gt;
&lt;li&gt;You could alternate so that you only advertise with a whitelist of 8 peers for some time, then advertise to a different set of 8 peers etc. before returning back to the initial 8 peers. And so on. This will of course increase the time it takes for a peer to connect if it is not one of the currently accepted peers.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>