<?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>LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61438/lwm2m-dtls-nbiot-proper-implementation</link><description>Hi, 
 I am trying to implement energy efficient(batt powered) application for nrf9160, using UDP/DTLS/LWM2M as comm stack. Got &amp;quot;hello world&amp;quot; working, but now I am really confused about many details. Hope you can help me. 
 Question 1: Operator NAT/firewall</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 05 Jun 2020 13:34:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61438/lwm2m-dtls-nbiot-proper-implementation" /><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/253560?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2020 13:34:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5895589b-57d2-4cdd-8204-e676aea39284</guid><dc:creator>jp</dc:creator><description>&lt;p&gt;Thanks for all your work on this &lt;a href="https://devzone.nordicsemi.com/members/fastfox"&gt;fastfox&lt;/a&gt; , your workaround worked for me, and the DTLS Connection ID extension was something I was not aware of.&lt;/p&gt;
&lt;p&gt;Hoping Nordic will support this, as soon as they can, as it will save 100s of bytes every registration update.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;John&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/253035?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 13:20:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89b5f5e2-70a8-44f3-b6cc-abef43d12203</guid><dc:creator>Jan Tore Guggedal</dc:creator><description>&lt;p&gt;Yeah, I agree that there could be an option to skip straight to the session resumption.&lt;br /&gt;It makes sense to keep the ACK timeout at 10 seconds, especially on NB-IoT networks.&lt;br /&gt;&lt;br /&gt;BR,&lt;/p&gt;
&lt;p&gt;Jan Tore&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/253000?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 12:36:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b7fd5d3-90ed-42f6-af08-b6b25650d6a0</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;Ok,&lt;/p&gt;
&lt;p&gt;I already started to agree with you that this is LWM2M thing and I wrote and issue to zephyr to get some feedback about what they think&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/25935"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/25935&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have the&amp;nbsp;CONFIG_COAP_INIT_ACK_TIMEOUT_MS already set to 10s, because with very small values you got bursts of retransmissions.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Anyway, I believe it would be better to go to the resumption immediately and not via some fail -&amp;gt; retry -&amp;gt; fail -&amp;gt; close&amp;amp;reopen scenario&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252985?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 12:04:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a88046c3-5375-4d1d-a194-ab719df9af09</guid><dc:creator>Jan Tore Guggedal</dc:creator><description>&lt;p&gt;Adding a bit more to my previous answer, I didn&amp;#39;t properly explaing why I think this is LwM2M (implementation) issue.&lt;br /&gt;&lt;br /&gt;It looks like LwM2M has mechanism for retrying packet sends 3 times with doubling back-off time, starting at 10 seconds. After that it closes and reopens socket, which triggers DTLS resumption. So to properly work around this, there would have to be a way to detect that the NAT rules are removed. Usually you can assume this after ~60 seconds of UDP inactivity between client and server, but this is highly network dependent.&lt;/p&gt;
&lt;p&gt;From the Leshan PCAP file, it looks like the client just assumes that the DTLS session is gone before attempting to send data. This is a viable workaround also for the nRF91 device, though I don&amp;#39;t know if it&amp;#39;s configurable or if you will have to make some code changes in the LwM2M engine.&lt;br /&gt;&lt;br /&gt;Update: I poked around a bit, and this seems to actually be a CoAP thing. You can&amp;nbsp;adjust CONFIG_COAP_INIT_ACK_TIMEOUT_MS in your prj.conf to reduce the retry time and have resumption kick in faster.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252977?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 11:34:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad6e104f-7cff-4250-a4a7-412adb35167d</guid><dc:creator>Jan Tore Guggedal</dc:creator><description>&lt;p&gt;The session resumption happens because the (D)TLS session caching socket option is set by default on the version of BSD library that you&amp;#39;re using. So if you stick to that, the modem will always try to resume the previoud session and let the server decide what to do.&lt;/p&gt;
&lt;p&gt;So this mainly sounds like an LwM2M issue now that it looks like session resumption is working as intended. Let me know if you don&amp;#39;t fully agree on this.&lt;br /&gt;My familiarity with LwM2M is unfortunately very limited, so I&amp;#39;m not much help on that front.&lt;br /&gt;I know the issue has been reported internally, which will hopefully give results on the LwM2M debugging.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jan Tore&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252972?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 11:17:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e81c832-e3d1-4990-9b38-da813dfd8cde</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;Indeed, I completely missed that session ID in packet #42.&lt;/p&gt;
&lt;p&gt;What happens in the upper layer(lwm2m) is that registration update timeouts(because server does not respond). Registration update and retries are in packets 38, 39 and 40.&lt;/p&gt;
&lt;p&gt;After this lwm2m closes the socket(which causes the Alert, packet 41) and starts a new&amp;nbsp;socket to re-register. This socket open causes the Client hello(42), which, as you said, looks like resume.&lt;/p&gt;
&lt;p&gt;Don&amp;#39;t know what to think here. Something obviously triggers the resume, but I hope it is not only closing and opening the socket. I could try to hack lwm2m to do that anyway&lt;/p&gt;
&lt;p&gt;I also need to continue working to get those modem traces...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252963?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 10:54:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4264f7e-697d-495b-aafb-ed5aba48d542</guid><dc:creator>Jan Tore Guggedal</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I looked up that nrfxlib version, and it&amp;nbsp;is with TLS caching enabled by default.&lt;/p&gt;
&lt;p&gt;Thanks for claryfying the bootstrap at the beginning. I think the Encrypted alert is sent to notify the server that the connection can be closed. The server also responds in packet 21. I&amp;#39;m not sure about the error message in the application log,&amp;nbsp;unfortunately. It seems to happen after the bootstrap procedure is completed, so it could be unrelated to these issues. I think we would need modem traces from the device side to get to the bottom of that one.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m starting to wonder if might have misunderstood the issue here, as I see session resumption is being used in&amp;nbsp;ip_port_changes_90s&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ip_5F00_port_5F00_changes_5F00_90s.pcapng" rel="noopener noreferrer" target="_blank"&gt;.&lt;/a&gt;pcapng:&lt;/p&gt;
&lt;p&gt;Looking at the next time the NAT routing has timed out (new src port), we get the seconds Encrypted alert in packet 41. After that, session resumption is attemped in client hello in packet 42. The server responds that it recognizes the session ID in packet 43, and the session is resume, and both server and client notify each other to change cipher spec.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Please correct me if I&amp;#39;m missing the issue here.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Jan Tore&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252956?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 10:11:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40b28548-505f-4ce1-968c-ad3bd6a77dbf</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Did you notice that the connection that ends to alerts is a separate connection to different port? It is actually the bootstrap server connection. Maybe I should try to do the connection completely without the bootstrap.&lt;/p&gt;
&lt;p&gt;nrfxlib is at this version&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrfxlib/commit/7d5e7624ec7fdb071ab8def3ae772e5ee5b65f21"&gt;https://github.com/nrfconnect/sdk-nrfxlib/commit/7d5e7624ec7fdb071ab8def3ae772e5ee5b65f21&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;and yes, there is one error printed when boostrap operation completes&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;00&amp;gt; [00:00:37.000,762] &amp;lt;inf&amp;gt; net_lwm2m_rd_client: Bootstrap data transfer done!
00&amp;gt; [network2.c] [0x2002302c] D Bootstrap transfer complete
00&amp;gt; [network2.c] [0x2002302c] D &amp;#39;0/1/0&amp;#39;: &amp;#39;coaps://lwm2m.ycfwydu.com:8601&amp;#39; &amp;#39;0x00&amp;#39;
00&amp;gt; [00:00:37.001,159] &amp;lt;dbg&amp;gt; net_lwm2m_engine.lwm2m_engine_get: path:1/0/0, buf:0x20029e0e, buflen:2
00&amp;gt; [00:00:37.001,251] &amp;lt;dbg&amp;gt; net_lwm2m_engine.lwm2m_engine_get: path:1/0/1, buf:0x20029e0e, buflen:2
00&amp;gt; [00:00:37.001,678] &amp;lt;err&amp;gt; net_lwm2m_engine: Err sending response: -22&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252940?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 09:26:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71a6abbb-3a6e-4fa3-bf43-b15d8af0a83f</guid><dc:creator>Jan Tore Guggedal</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I had a look at&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ip_5F00_port_5F00_changes_5F00_90s.pcapng" rel="noopener noreferrer" target="_blank"&gt;ip_port_changes_90s.pcapng&lt;/a&gt;, and it seems like (D)TLS caching is already enabled. The session ID is at least provided in the client hello message, but it seems like the server side has closed that session, possibly because of the preceeding alert message.&amp;nbsp;You can check which nrfxlib revision you are using by executing &amp;quot;west status&amp;quot; which should print the revision of all repositories west has imported for you. That will show if you have the revision where TLS caching is enabled by default or not.&lt;/p&gt;
&lt;p&gt;The alert messages from the device are curious, and looks likely to be the source of trouble here. Could you try to enable&amp;nbsp; CONFIG_LWM2M_LOG_LEVEL_DBG=y and see if that yields any useful information, in particular related to the alert message?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jan Tore&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252889?ContentTypeID=1</link><pubDate>Wed, 03 Jun 2020 06:12:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc306f12-e0d7-444c-bf82-46c45a72319b</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;I did try to set cache before like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrf_sec_session_cache_t session_cache = 1;
if (nrf_setsockopt(client_ctx-&amp;gt;sock_fd, NRF_SOL_SECURE, NRF_SO_SEC_SESSION_CACHE, &amp;amp;session_cache, sizeof(session_cache)) &amp;lt; 0) {
	LOG_ERR(&amp;quot;setsockopt NRF_SO_SEC_SESSION_CACHE: %d&amp;quot;, errno);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Right after this setsockopt&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/358dcc1bde6a79abb3167e994fe7aec66968adaf/subsys/net/lib/lwm2m/lwm2m_engine.c#L4241"&gt;https://github.com/zephyrproject-rtos/zephyr/blob/358dcc1bde6a79abb3167e994fe7aec66968adaf/subsys/net/lib/lwm2m/lwm2m_engine.c#L4241&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But that had no effect, and I just retried and confirmed that&lt;/p&gt;
&lt;p&gt;I can see TLS_SESSION_CACHE was just added to master, so I can&amp;#39;t use that in 1.2. Does it make any difference in which way the opt is set? Should I try it on master?(I assume that the problem lies in modem side)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252680?ContentTypeID=1</link><pubDate>Tue, 02 Jun 2020 10:52:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e3f3af4-253b-4df5-9d8c-957b825b6800</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;DO you see a different behavior if you set the TLS_SESSION_CACHE socket option explicitly?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/include/net/socket.h#L126"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/include/net/socket.h#L126&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Edit: Note that the option must be set using setsockopt(), not the non-offloaded nrf_setsockopt().&lt;/p&gt;
&lt;p&gt;Or, you can use nrf_setsockopt() and NRF_SO_SEC_SESSION_CACHE.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252358?ContentTypeID=1</link><pubDate>Fri, 29 May 2020 10:13:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46f5977c-ce3d-4012-a20e-5dc9099446c2</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi, both of you.&lt;/p&gt;
&lt;p&gt;These are good questions, but I am not familiar enough with the fine details to give an answer myself.&lt;/p&gt;
&lt;p&gt;I have forwarded them to our developers and will get back to you when I have an answer.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252127?ContentTypeID=1</link><pubDate>Thu, 28 May 2020 10:21:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b307cd2b-e29c-4108-97b9-34837b1eeb1b</guid><dc:creator>jp</dc:creator><description>&lt;p&gt;Yes, I think it needs to be a configurable timeout, as it is network dependent, and using the worst case of 20 seconds would cut short the access window from the server, if your network keeps the session for 2 minutes for example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252075?ContentTypeID=1</link><pubDate>Thu, 28 May 2020 06:38:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2594fb27-18d2-4e19-b311-0f098aecc1e3</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;I&amp;#39;ve tried to read all the related RFCs bacwards and fowards, but can&amp;#39;t really find any&amp;nbsp;detail spec/timer/something&amp;nbsp;about &amp;quot;When should client do session resumption&amp;quot; There are some hints e.g. in&amp;nbsp;&lt;a href="https://tools.ietf.org/html/rfc7925"&gt;https://tools.ietf.org/html/rfc7925&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;For the case where the IP address and port number
changes, it is necessary to recreate the record layer using
session resumption.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and LWM2M spec itself&amp;nbsp;&lt;a href="http://openmobilealliance.org/release/LightweightM2M/V1_0_2-20180209-A/OMA-TS-LightweightM2M-V1_0_2-20180209-A.pdf"&gt;http://openmobilealliance.org/release/LightweightM2M/V1_0_2-20180209-A/OMA-TS-LightweightM2M-V1_0_2-20180209-A.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Note: During
the time the LwM2M Client has been sleeping the IP address assigned to it may have been released and / or existing
NAT bindings may have been released. If this is the case, then the client needs to re-run the DTLS handshake with
the LwM2M Server since an IP address and/or port number change will destroy the existing security context. For
performance and efficiency reasons it is RECOMMENDED to utilize the DTLS session resumption.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So my conclusion is that it is CLIENT side implementation detail about when to do resumption. And since client can&amp;#39;t really know when IP address changes, I would assume that NRF91 has some internal logic to start the resumption. Whether it is a hardcoded timeout, configurable timeout or something else, I hope that &lt;a href="https://devzone.nordicsemi.com/members/didrik-rokhaug"&gt;Didrik Rokhaug&lt;/a&gt; can shed some more light here&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/252037?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 16:21:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d14cc042-6f6e-48a4-9dff-cd6b7069e092</guid><dc:creator>jp</dc:creator><description>&lt;p&gt;Hi Didrik, how can the server reject the DTLS session when the communication is coming from a different IP address, and it doesn&amp;#39;t recognise the packet?&lt;/p&gt;
&lt;p&gt;Is there some way for the nRF9160 to invalidate the DTLS session?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;John&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/251943?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 12:17:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:382b2c7e-ab74-48b0-bdfb-94221cd96d68</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;That is a good question, I need to investigate that.&lt;/p&gt;
&lt;p&gt;I thought that it is up to the client to decide that, but it might very well be that it is somehow negotiated in initial handshake. Is there any default values for this timeout in modem or can it be adjusted somehow?&lt;/p&gt;
&lt;p&gt;I am not even sure what is the term to look for here. I think RFCs are talking about &amp;quot;idle timeout&amp;quot; and &amp;quot;session timeout&amp;quot; both meaning that session is no longer valid. But what we need is &amp;quot;do resumption timeout&amp;quot;, which is network depended and always smaller than &amp;quot;idle timeout&amp;quot;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f914.svg" title="Thinking"&gt;&amp;#x1f914;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/251876?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 09:30:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c77423f-893f-47e0-a9d3-b55ef6d28a04</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Do you know what the DTLS timeout on the server is?&lt;/p&gt;
&lt;p&gt;The modem assumes that the connection is valid, and will not initiate a new DTLS session unless the server rejects the old one.&lt;/p&gt;
&lt;p&gt;So what might have happened is that the modem tries to use the &amp;quot;old&amp;quot; session, which is still valid. That means that a new DTLS handshake is unnecessary, hence no client hello.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/251862?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 08:56:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fb294f3-b772-4e5e-a56c-31211fe98aef</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;Hi, I already tried to take modem traces, but failed to figure out exactly how to do that in my custom PCB. I&amp;#39;ll give it another try or rewrite the SW to evaluation board.&lt;/p&gt;
&lt;p&gt;[quote userid="81181" url="~/f/nordic-q-a/61438/lwm2m-dtls-nbiot-proper-implementation/251849"][/quote]&lt;/p&gt;
&lt;p&gt;Are you sure that you have configured the client and the server to use TLS?&lt;/p&gt;
&lt;p&gt;Where the data encrypted?&lt;/p&gt;
&lt;p&gt;Or, could it be that you simply missed the client hello?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Yes, I&amp;nbsp; am sure. But it is DTSL to be exact.&lt;/p&gt;
&lt;p&gt;Yes, data is encrypted&lt;/p&gt;
&lt;p&gt;Possible of course, but very unlikely since I have tested this tens of times. I&amp;#39;ll attach&amp;nbsp;two pcaps here. From there(90s) you can see that packet #37 at time 102 is application data. This is the registration update. With a working client(leshan_client) the same registration update starts with client hello + resumption&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ip_5F00_port_5F00_changes_5F00_90s.pcapng"&gt;devzone.nordicsemi.com/.../ip_5F00_port_5F00_changes_5F00_90s.pcapng&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ip_5F00_port_5F00_changes_5F00_leshan_5F00_client.pcapng"&gt;devzone.nordicsemi.com/.../ip_5F00_port_5F00_changes_5F00_leshan_5F00_client.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/251849?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 08:29:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08c0b537-d90a-4a11-9792-13b11eed3dcd</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;If you take a &lt;a href="https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/getting-started-cellular/posts/how-to-get-modem-trace-using-trace-collector-in-nrf-connect"&gt;modem trace&lt;/a&gt;, we can see what is happening from the device side as well.&lt;/p&gt;
&lt;p&gt;However, if the modem provides a session ID in the client hello message, that is the session cache in action. If the server still recognizes the ID, then a full TSL negotiation is not needed.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="fastfox"]If I connect to my server using NRF91, I can only see application data(no client hello and thus no session resumption) when it is making registration update[/quote]
&lt;p&gt;&amp;nbsp;Are you sure that you have configured the client and the server to use TLS?&lt;/p&gt;
&lt;p&gt;Where the data encrypted?&lt;/p&gt;
&lt;p&gt;Or, could it be that you simply missed the client hello?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/251456?ContentTypeID=1</link><pubDate>Mon, 25 May 2020 11:21:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6230d7ce-00f7-47b5-99c4-fce3784d3902</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is just not sinking into my brains now&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f61e.svg" title="Disappointed"&gt;&amp;#x1f61e;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I am using 1.2.0 modem firmware and tag&amp;nbsp;v1.2.0 from nrf-connect SDK&lt;/p&gt;
&lt;p&gt;If I connect to my server using, e.g. leshan client, session resumption works and I see that the client is sending client hello when making registration update&lt;/p&gt;
&lt;p&gt;If I connect to my server using NRF91, I can only see application data(no client hello and thus no session resumption) when it is making registration update&lt;/p&gt;
&lt;p&gt;And I can&amp;#39;t find any code that would set any session caches in nrf-connect SDK(or any of the sub repositories).&lt;/p&gt;
&lt;p&gt;So you say that session cache is enabled by default, but it does not look like that from what I see.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Edit: While staring at the pcaps, I also realized that modem is sending session ID in the very first client hello to the server. I really mean the first message to the server after device power-cycle. That is strange...&lt;/p&gt;
&lt;p&gt;Edit2: Ok that was probably TCP+TLS connection to the same domain name that caused the session ID to exist. Unfortunately, removing another connection does not make it work any better.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/250683?ContentTypeID=1</link><pubDate>Tue, 19 May 2020 11:38:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f7a536d-f994-4551-bcb3-7e5a268831c6</guid><dc:creator>Didrik Rokhaug</dc:creator><description>[quote user="fastfox"]And&amp;nbsp;the ?random? crashes caused by activating the cache will be fixed in 1.3.0, which will be release at unknown date?[/quote]
&lt;p&gt;&amp;nbsp;I am sorry, but my memory failed me a little. The bug was fixed in mwf v1.2.0, so the fix is already out.&lt;/p&gt;
&lt;p&gt;If you are using NCS v1.2.0, TLS session caching is enabled by default.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="fastfox"]What is the API?[/quote]
&lt;p&gt;&amp;nbsp;Here is you would &lt;strong&gt;disable&lt;/strong&gt; session caching:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;nrf_socket.h&amp;gt;

nrf_sec_session_cache_t session_cache = 0;

nrf_setsockopt(socket, NRF_SOL_SECURE,

        NRF_SO_SEC_SESSION_CACHE, &amp;amp;session_cache,

        sizeof(session_cache));&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/250660?ContentTypeID=1</link><pubDate>Tue, 19 May 2020 10:22:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dda29791-e1f3-4eae-892c-939d46902467</guid><dc:creator>fastfox</dc:creator><description>&lt;p&gt;Thanks for clarifications. Just to make sure that I understood this correctly&lt;/p&gt;
&lt;blockquote class="quote"&gt;
&lt;div class="quote-content"&gt;&lt;/div&gt;
&lt;/blockquote&gt;
[quote userid="81181" url="~/f/nordic-q-a/61438/lwm2m-dtls-nbiot-proper-implementation/250430"][/quote]
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; It is, but at the moment, there is a bug that can casue the modem to crash when (D)TLS session caching is enabled. The bug will be fixed in the next modem release.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As I am not seeing&amp;nbsp;session resumption, it means that I have to explicitly enable the session caching somehow, right? What is the API? I found this post where it says that you have to use nrf_setsock_opt&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/55335/dtls-session-resumption-on-nrf9160-modem-fw-v1-1-0"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/55335/dtls-session-resumption-on-nrf9160-modem-fw-v1-1-0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And&amp;nbsp;the ?random? crashes caused by activating the cache will be fixed in 1.3.0, which will be release at unknown date?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And to make this work right now, the only option is to not use offloaded NRF sockets at all, but something else instead, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M + DTLS + NBIoT proper implementation</title><link>https://devzone.nordicsemi.com/thread/250430?ContentTypeID=1</link><pubDate>Mon, 18 May 2020 12:08:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83cf5bbb-bd5f-4176-aee1-872e3522521c</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Question 1: Operator NAT/firewall rules and NRF9160 DTLS implementation[/quote]
&lt;p&gt;&amp;nbsp;In the DTLS header, there will be a session token indicating which DTLS session the packet belongs to.&lt;/p&gt;
&lt;p&gt;It is up to the server to decide if the session has timed out or not. So as long as all communication is initiated by the device, the NAT/firewall rules should not be a huge problem.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]It looks like&amp;nbsp;resumption does not work in NRF or is not implemented at all?[/quote]
&lt;p&gt;&amp;nbsp;It is, but at the moment, there is a bug that can casue the modem to crash when (D)TLS session caching is enabled. The bug will be fixed in the next modem release.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Question 2: It looks like DTLS connection(to LWM2M bootstrap server) always ends to TLS ALERT sent by nrf91. Any idea why? Is this a feature? Other clients do not do that.[/quote]
&lt;p&gt;&amp;nbsp;While I can not say for certain without more information (a &lt;a href="https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/getting-started-cellular/posts/how-to-get-modem-trace-using-trace-collector-in-nrf-connect"&gt;modem trace&lt;/a&gt; is the most helpfull), I have two hyptohesis:&lt;/p&gt;
&lt;p&gt;1. The server&amp;#39;s certificates are too large. The nRF9160 only supports TLS frames up to 2048 bytes.&lt;/p&gt;
&lt;p&gt;2. The nRF9160 does not support SNI at the moment. This will be added in the next modem release.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Question 3: Zephyr does not support QUEUE mode. If I understood the LWM2M spec correctly, QUEUE mode is exactly what low power NB-IoT application needs, but zephyr LWM2M stack does not support it. Do you have any idea how Nordic users tend to solve this? Implement queues as server side application on top of LWM2M? Use different LWM2M client?[/quote]
&lt;p&gt;&amp;nbsp;Please take a look at &lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/2252"&gt;https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/2252&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>