<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>Azure IoT Hub Library with OpenThread</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/86933/azure-iot-hub-library-with-openthread</link><description>Hello Everyone, 
 We are working on a new product using the nrf52840 and OpenThread.Our current product uses the Azure IoT Hub and we were wondering if we could use the library used by the nrf91. 
 According to Didrik in a post on Devzone It should be</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Wed, 11 May 2022 11:53:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/86933/azure-iot-hub-library-with-openthread" /><item><title>RE: Azure IoT Hub Library with OpenThread</title><link>https://test-devzone.nordicsemi.com/thread/367390?ContentTypeID=1</link><pubDate>Wed, 11 May 2022 11:53:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac98b09d-828b-44ae-b565-25f04e462080</guid><dc:creator>user76616</dc:creator><description>&lt;p&gt;According to zephyr\subsys\net\lib\dns\resolve.c:1153 getting mapped ipv4 through getaddrinfo will not work.&lt;br /&gt;I am able to use the OpenThread Libraries to resolve DNS requests through the NAT64 interface.&lt;br /&gt;&lt;br /&gt;I will be trying to make small modifications to the nRFConnect Azure library to use Openthread sockets to test if connections will actually work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Azure IoT Hub Library with OpenThread</title><link>https://test-devzone.nordicsemi.com/thread/367055?ContentTypeID=1</link><pubDate>Tue, 10 May 2022 06:07:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49272362-e723-4ebb-8979-a48d08aa02ca</guid><dc:creator>user109070</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Were you able to make this work? I&amp;#39;d be really interested as I am about to implement a similar solution, so any head-start would be appreciated.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Azure IoT Hub Library with OpenThread</title><link>https://test-devzone.nordicsemi.com/thread/365613?ContentTypeID=1</link><pubDate>Fri, 29 Apr 2022 13:47:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:031c5698-892a-40bb-9cd7-9e48d2166dea</guid><dc:creator>user76616</dc:creator><description>&lt;p&gt;Debugging shows the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/reference/networking/dns_resolve.html?highlight=dns_eai_canceled#c.dns_resolve_status.DNS_EAI_CANCELED"&gt;DNS_EAI_CANCELED&lt;/a&gt; is the result of a timeout.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m also getting a timeout using the OpenThread specific DNS API&amp;#39;s&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;

#include &amp;lt;openthread/dns_client.h&amp;gt;

void ot_dns_response(otError aError, const otDnsAddressResponse *aResponse, void *aContext)
{

	char address_string[OT_IP6_ADDRESS_STRING_SIZE];
	otIp6Address address;
	uint32_t ttl;

	// Fails with error 28
	// [00:00:19.219,787] &amp;lt;inf&amp;gt; net_l2_openthread: State changed! Flags: 0x00000200 Current role: 3
	// [00:00:21.184,112] &amp;lt;err&amp;gt; coap_server: ot_dns_response failed 28

	if (aError == OT_ERROR_NONE)
	{
		uint16_t index = 0;

		LOG_INF(&amp;quot;ot_dns_response Success&amp;quot;);

		while (otDnsAddressResponseGetAddress(aResponse, index, &amp;amp;address, &amp;amp;ttl) == OT_ERROR_NONE)
		{
			otIp6AddressToString(&amp;amp;address, address_string, sizeof(address_string));
			LOG_INF(&amp;quot;ip: %s, TTL:%u &amp;quot;, address_string, ttl);
			index++;
		}
	}
	else
	{
		LOG_ERR(&amp;quot;ot_dns_response failed %d&amp;quot;, aError);
	}
}

otDnsQueryConfig config;
const otDnsQueryConfig *current_config;
void set_ot_dns_config(void)
{
	otError error;
	current_config = otDnsClientGetDefaultConfig(ot_context-&amp;gt;instance);

	memcpy(&amp;amp;config, current_config, sizeof(otDnsQueryConfig));

	config.mNat64Mode = OT_DNS_NAT64_ALLOW;
	config.mRecursionFlag = OT_DNS_FLAG_RECURSION_DESIRED;
	config.mMaxTxAttempts = 2;
	config.mResponseTimeout = 1000;
	config.mServerSockAddr.mPort = 53;

	error = otIp6AddressFromString(&amp;quot;FDAA:BB:1::2&amp;quot;, &amp;amp;config.mServerSockAddr.mAddress);
	if (error != OT_ERROR_NONE)
		LOG_ERR(&amp;quot;otIp6AddressFromString failed %d&amp;quot;, error);

	otDnsClientSetDefaultConfig(ot_context-&amp;gt;instance, &amp;amp;config);

	current_config = otDnsClientGetDefaultConfig(ot_context-&amp;gt;instance);
}

void resolve_ot_dns(void)
{
	otError error;
	error = otDnsClientResolveAddress(ot_context-&amp;gt;instance, &amp;quot;ing.nl&amp;quot;, &amp;amp;ot_dns_response, ot_context-&amp;gt;instance, &amp;amp;config);
	if (error != OT_ERROR_NONE)
	{
		LOG_ERR(&amp;quot;ot_dns_response resolve_dns %d&amp;quot;, error);
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your suggestions. I&amp;#39;m going to try and increase logging and let you know. Any suggestion to which NET component I should set to debug logging?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Azure IoT Hub Library with OpenThread</title><link>https://test-devzone.nordicsemi.com/thread/365609?ContentTypeID=1</link><pubDate>Fri, 29 Apr 2022 13:38:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27efeb31-b72e-45dc-8443-1fda05deaad5</guid><dc:creator>user14926</dc:creator><description>&lt;p&gt;Can you use the &lt;a href="https://github.com/openthread/openthread/blob/02e61a2edd80417e9b8f9a5f4c1b2dad4ac486b4/src/cli/cli.cpp#L1573-L1574"&gt;OpenThread specific DNS API used by the ot-cli&lt;/a&gt; in the Azure IoT Hub case as well?&lt;/p&gt;
&lt;p&gt;If not, you need to debug the application to see where it fails (increase log levels would be a good start), and/or do a &lt;a href="https://infocenter.nordicsemi.com/topic/ug_sniffer_802154/UG/sniffer_802154/intro_802154.html"&gt;on-air sniffer trace&lt;/a&gt; of the Thread traffic, to see if the DNS is sent to any destination.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Azure IoT Hub Library with OpenThread</title><link>https://test-devzone.nordicsemi.com/thread/365577?ContentTypeID=1</link><pubDate>Fri, 29 Apr 2022 11:59:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e0b032d-2f00-42c0-b0fa-22c7e6c366f6</guid><dc:creator>user76616</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve checked by running tcpdump on the RPi OTBR device.&lt;/p&gt;
&lt;p&gt;With OT-CLI I see the DNS requests coming through in the tcpdump:&lt;/p&gt;
&lt;p style="font-family:Calibri;font-size:11pt;margin:0in;padding-left:30px;" lang="en-US"&gt;pi@raspberrypi:~ $ sudo tcpdump -vnni wpan0&lt;/p&gt;
&lt;p style="font-family:Calibri;font-size:11pt;margin:0in;padding-left:30px;" lang="en-US"&gt;tcpdump: listening on wpan0, link-type LINUX_SLL (Linux cooked v1), snapshot length 262144 bytes&lt;/p&gt;
&lt;p style="font-family:Calibri;font-size:11pt;margin:0in;padding-left:30px;" lang="en-US"&gt;14:04:33.770137 IP6 (hlim 64, next-header UDP (17) payload length: 36) fd35:ad25:a99f:8c75:a301:6d0:492:8a96.49153 &amp;gt; fdaa:bb:1::2.53: [udp sum ok] 54430+ AAAA? reddit.com. (28)&lt;/p&gt;
&lt;p style="font-family:Calibri;font-size:11pt;margin:0in;padding-left:30px;" lang="en-US"&gt;14:04:33.831836 IP6 (flowlabel 0x67ac1, hlim 64, next-header UDP (17) payload length: 148) fdaa:bb:1::2.53 &amp;gt; fd35:ad25:a99f:8c75:a301:6d0:492:8a96.49153: [udp sum ok] 54430 4/0/0 reddit.com. AAAA 64:ff9b::9765:818c, reddit.com. AAAA 64:ff9b::9765:c18c, reddit.com. AAAA 64:ff9b::9765:18c, reddit.com. AAAA 64:ff9b::9765:418c (140)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I do not see any activity with my resolve_dns() function&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Azure IoT Hub Library with OpenThread</title><link>https://test-devzone.nordicsemi.com/thread/365244?ContentTypeID=1</link><pubDate>Wed, 27 Apr 2022 14:53:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff8fca7f-dc75-433b-8cc3-4463c8d0e62d</guid><dc:creator>user14926</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Looks like error code -101 means that the request was cancelled (&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/reference/networking/dns_resolve.html?highlight=dns_eai_canceled#c.dns_resolve_status.DNS_EAI_CANCELED"&gt;DNS_EAI_CANCELED&lt;/a&gt;). Have you checked with a sniffer trace if the request is actually sent over the air, and if it is sent to the correct address and port (compared to the OT CLI command)?&lt;/p&gt;
&lt;p&gt;From an earlier test case, it looks like the request will be cancelled if a &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/97b83ffc2c9b1cdde01bdea8412fc5f8a921410b/tests/net/socket/getaddrinfo/prj.conf#L26"&gt;local DNS server&lt;/a&gt; is &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/97b83ffc2c9b1cdde01bdea8412fc5f8a921410b/tests/net/socket/getaddrinfo/src/main.c#L19-L20"&gt;not present&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Azure IoT Hub Library with OpenThread</title><link>https://test-devzone.nordicsemi.com/thread/364478?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 12:36:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2febe140-afaf-427c-8c04-dc06fe0f8244</guid><dc:creator>user76616</dc:creator><description>&lt;p&gt;Hello &lt;span&gt;J&amp;oslash;rgen&lt;/span&gt;,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve tried to set the correct Server, but I am getting an error in the callback.&lt;/p&gt;
&lt;p&gt;I configure the DNS and try to resolve when the device connects to the Thread network. Also before the error in dns_result_cb, I get a error &amp;quot;&amp;lt;err&amp;gt; net_otPlat_radio: Error while calling otIp6Send&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void set_dns_config(void)
{
	int ret;
	const char *dns_server = &amp;quot;FDAA:BB:1::2&amp;quot;;
	struct dns_resolve_context *dnsctx;

	dnsctx = dns_resolve_get_default();
	ret = dns_resolve_reconfigure(dnsctx, &amp;amp;dns_server, NULL);
}

void dns_result_cb(enum dns_resolve_status status,
				   struct dns_addrinfo *info,
				   void *user_data)
{
	// fails with -101
	// &amp;lt;inf&amp;gt; net_l2_openthread: State changed! Flags: 0x00000064 Current role: 3
	// &amp;lt;err&amp;gt; net_otPlat_radio: Error while calling otIp6Send
	// &amp;lt;inf&amp;gt; coap_server: dns_result_cb Failed: -101
	if (status == 0)
	{
		LOG_INF(&amp;quot;dns_result_cb Success&amp;quot;);
	}
	else
	{
		LOG_INF(&amp;quot;dns_result_cb Failed: %d&amp;quot;, status);
	}
	return;
}

void resolve_dns(void)
{
	int ret;
	struct dns_resolve_context *dnsctx;

	dnsctx = dns_resolve_get_default();
	ret = dns_resolve_name(dnsctx,
						   &amp;quot;reddit.com&amp;quot;,
						   DNS_QUERY_TYPE_AAAA,
						   NULL,
						   dns_result_cb,
						   NULL,
						   1000);
	if (ret != 0)
	{
		LOG_ERR(&amp;quot;resolve_dns %d&amp;quot;, ret);
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Maybe I am missing a configuration, the command in OT CLI example d&lt;span class="EOP SCXO246517243 BCX8" style="background-color:#ffffff;color:windowtext;font-size:11pt;font-style:normal;font-weight:400;letter-spacing:normal;line-height:18px;margin:0px;padding:0px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;"&gt;oes work.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="TextRun SCXO246517243 BCX8" style="background-color:#ffffff;color:windowtext;font-size:11pt;font-style:normal;font-weight:400;letter-spacing:normal;line-height:18px;margin:0px;padding:0px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;" lang="EN-US"&gt;&lt;span class="SpellingError SCXO246517243 BCX8" style="background-color:inherit;background-image:url(&amp;#39;data:image/gif;base64,R0lGODlhBQAEAJECAP////8AAAAAAAAAACH5BAEAAAIALAAAAAAFAAQAAAIIlGAXCCHrTCgAOw==&amp;#39;);background-position:left bottom;background-repeat:repeat-x;border-bottom:1px solid transparent;margin:0px;padding:0px;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;uart:~$ ot dns resolve reddit.com fdaa:bb:1::2 53 1000 2 1
DNS response for reddit.com. - 64:ff9b:0:0:0:0:9765:c18c TTL:67 64:ff9b:0:0:0:0:9765:818c TTL:67 64:ff9b:0:0:0:0:9765:18c TTL:67 64:ff9b:0:0:0:0:9765:418c TTL:67
Done&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="EOP SCXO246517243 BCX8" style="background-color:#ffffff;color:windowtext;font-size:11pt;font-style:normal;font-weight:400;letter-spacing:normal;line-height:18px;margin:0px;padding:0px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="EOP SCXO246517243 BCX8" style="background-color:#ffffff;color:windowtext;font-size:11pt;font-style:normal;font-weight:400;letter-spacing:normal;line-height:18px;margin:0px;padding:0px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Azure IoT Hub Library with OpenThread</title><link>https://test-devzone.nordicsemi.com/thread/364158?ContentTypeID=1</link><pubDate>Thu, 21 Apr 2022 09:24:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:170491b9-4890-4572-8890-f7c16ce95339</guid><dc:creator>user14926</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It looks like getaddrinfo() internally calls&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1-1/subsys/net/lib/sockets/getaddrinfo.c#L115-L117"&gt;&lt;span&gt;dns_get_addr_info()&lt;/span&gt;&lt;/a&gt;, so you may be able to call&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/reference/networking/dns_resolve.html#c.dns_resolve_init"&gt;&lt;span&gt;dns_resolve_init()&lt;/span&gt;&lt;/a&gt;&amp;nbsp;or &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/reference/networking/dns_resolve.html#c.dns_resolve_reconfigure"&gt;dns_resolve_reconfigure&lt;/a&gt;&lt;span&gt;() to set the DNS server address.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You may also use the Kconfigs &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_DNS_SERVER_IP_ADDRESSES.html"&gt;DNS_SERVER_IP_ADDRESSES&lt;/a&gt;&amp;nbsp;and &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/search.html?q=CONFIG_DNS_SERVER"&gt;CONFIG_DNS_SERVERx&lt;/a&gt;&amp;nbsp;to specify the DNS servers used by the DNS resolve library.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>