<?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>Hard coded context ID of 0 in the Serial LTE Modem application (nRF SDK 2.0.0)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89106/hard-coded-context-id-of-0-in-the-serial-lte-modem-application-nrf-sdk-2-0-0</link><description>Hi! 
 I am using the Serial LTE Modem application from the nRF Connect SDK v.2.0.0 
 In the source code for this app, every call to: 
 
 int util_resolve_host(int cid, const char *host, uint16_t port, int family, struct sockaddr *sa) 
 
 has a hardcoded</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 Jun 2022 13:30:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89106/hard-coded-context-id-of-0-in-the-serial-lte-modem-application-nrf-sdk-2-0-0" /><item><title>RE: Hard coded context ID of 0 in the Serial LTE Modem application (nRF SDK 2.0.0)</title><link>https://devzone.nordicsemi.com/thread/374558?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 13:30:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:333638db-f7da-4fa4-9141-9fac3d0126c0</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;&amp;nbsp;Hans Jørgen,&lt;br /&gt;&lt;br /&gt;It is good to hear that the issue has been resolved.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hard coded context ID of 0 in the Serial LTE Modem application (nRF SDK 2.0.0)</title><link>https://devzone.nordicsemi.com/thread/373864?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2022 08:39:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64c2c1c7-61af-4615-b851-d6bfcfce03dd</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi Hans Jørgen,&lt;br /&gt;&lt;br /&gt;You could apply these&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/pull/8043/"&gt;changes&lt;/a&gt;. This should work regardless if your network allows non-zero primary context or not. Cid 0 is assumed as primary context (in init state), but it can be overridden with &amp;lt;cid&amp;gt; parameter in AT command.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hard coded context ID of 0 in the Serial LTE Modem application (nRF SDK 2.0.0)</title><link>https://devzone.nordicsemi.com/thread/373666?ContentTypeID=1</link><pubDate>Wed, 22 Jun 2022 11:49:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c66ca4d6-9321-4a4f-b4d9-111c133aad95</guid><dc:creator>Hans Jorgen Grimstad</dc:creator><description>&lt;p&gt;Hi !&lt;/p&gt;
&lt;p&gt;It seems that the best solution for me was to add the following configs to the prj.conf (instead of defining the context with +CGDCONT, activating with +CGACT and then deactivating the default with +CGACT)&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;CONFIG_PDN=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;CONFIG_PDN_DEFAULTS_OVERRIDE=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;CONFIG_PDN_SYS_INIT=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;CONFIG_PDN_DEFAULT_APN=&amp;quot;&amp;lt;our APN&amp;gt;&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;CONFIG_PDN_DEFAULT_FAM_IPV4V6=y&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Best Regards&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Hans J&amp;oslash;rgen Grimstad&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Lab5e AS&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hard coded context ID of 0 in the Serial LTE Modem application (nRF SDK 2.0.0)</title><link>https://devzone.nordicsemi.com/thread/373536?ContentTypeID=1</link><pubDate>Tue, 21 Jun 2022 18:36:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b37e1676-c824-43e9-8b6a-21c9579e6df9</guid><dc:creator>Hans Jorgen Grimstad</dc:creator><description>&lt;p&gt;Hi !&lt;/p&gt;
&lt;p&gt;I am not trying to use multiple PDP contexts.&lt;/p&gt;
&lt;p&gt;I created a new one using +CGDCONT and then deactivated the default context with +CGACT. I then ended up with a single active context with a context id == 1. The non-zero id breaks any attempts to use the context to&amp;nbsp;transfer data in the SLM code.&lt;/p&gt;
&lt;p&gt;The SLM code works just fine for AT#XSENDTO and AT#XRECVFROM if the correct (non-zero) cid is transferred in the calls to&amp;nbsp;&lt;span&gt;util_get_ip_addr and&amp;nbsp;util_resolve_host, so I don&amp;#39;t quite understand why it isn&amp;#39;t supported.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The source code documentation for these two functions&amp;nbsp;is also clear about this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp;* @param[in] cid PDP Context ID as defined in &amp;quot;+CGDCONT&amp;quot; command (0~10).&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;If&amp;nbsp;it&amp;#39;s the case that only a single context with an id of 0 is permitted in this version of SLM, maybe it would have been better to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Explicitly include the CONFIG_PDN_DEFAULT_APN and CONFIG_PDN_DEFAULTS_OVERRIDE configs (along with maybe a comment or two) in the SLM prj.conf, since this would make it a bit more explicit (I guess that by using these I can specify my own default context that will end up with a cid == 0 ?)&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Disallow creation of PDP contexts with a non-zero id in the +CGDCONT command, since being able to create a seemingly ok PDP context that can&amp;#39;t be used for sending data is a somewhat confusing user experience.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;gt;&amp;nbsp;&lt;span&gt;For socket send and receive, previously mentioned socket option can be used to bind secondary PDP context.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Which socket option are you referring to ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards&lt;/p&gt;
&lt;p&gt;Hans J&amp;oslash;rgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hard coded context ID of 0 in the Serial LTE Modem application (nRF SDK 2.0.0)</title><link>https://devzone.nordicsemi.com/thread/373507?ContentTypeID=1</link><pubDate>Tue, 21 Jun 2022 14:43:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6be37fba-2f21-46eb-b9f9-ae9b8c5954e3</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi Hans Jørgen,&lt;br /&gt;&lt;br /&gt;Currently, multiple PDP contexts are supported only by &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/serial_lte_modem/doc/ICMP_AT_commands.html#icmp-echo-request-xping"&gt;ICMP echo request #XPING&lt;/a&gt; and &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/serial_lte_modem/doc/SOCKET_AT_commands.html"&gt;socket #XSOCKET&lt;/a&gt;. For socket send and receive, previously mentioned socket option can be used to bind secondary PDP context.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hard coded context ID of 0 in the Serial LTE Modem application (nRF SDK 2.0.0)</title><link>https://devzone.nordicsemi.com/thread/373414?ContentTypeID=1</link><pubDate>Tue, 21 Jun 2022 11:10:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eed58db-87d0-42dd-8a0b-f9a86975d094</guid><dc:creator>Hans Jorgen Grimstad</dc:creator><description>&lt;p&gt;Hi !&lt;/p&gt;
&lt;p&gt;It seems that the same hardcoded cid is present in calls to :&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;void util_get_ip_addr(int cid, char *addr4, char *addr6)&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;Running &lt;/span&gt;&lt;span style="font-family:inherit;"&gt;AT#XBIND will result in:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;lt;err&amp;gt; slm_sock: Get local IPv4 address failed&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If I tweak the SLM source code and pass the correct cid, then AT#XBIND and AT#XRECVFROM behaves as expected.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Hans J&amp;oslash;rgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hard coded context ID of 0 in the Serial LTE Modem application (nRF SDK 2.0.0)</title><link>https://devzone.nordicsemi.com/thread/373298?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2022 15:11:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e0c795f-47da-4cbf-b4d1-dcbea4823340</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I have reported your finding internally. I&amp;#39;ll get back to you when I get new information, possibly till the end of this week.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>