<?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>OpenThread CoAP Multicast Message ID</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63670/openthread-coap-multicast-message-id</link><description>Hello Support 
 I have a question about the function &amp;quot; uint16_t otCoapMessageGetMessageId(const otMessage *aMessage); &amp;quot;. I need to know the message ID for my application. 
 
 On client side: 
 I send some multicast messages from CoAP clients to servers</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 05 Aug 2020 11:39:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63670/openthread-coap-multicast-message-id" /><item><title>RE: OpenThread CoAP Multicast Message ID</title><link>https://devzone.nordicsemi.com/thread/263201?ContentTypeID=1</link><pubDate>Wed, 05 Aug 2020 11:39:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef753b6c-384a-4f36-9248-5731ccaa449d</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Following is the reply from our Thread Team:&lt;br /&gt;--&lt;/p&gt;
&lt;p&gt;The OpenThread CoAP implementation does not provide a reliable way of fetching the CoAP Message ID after it is sent.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;With this PR:&lt;/p&gt;
&lt;pre&gt;&lt;a href="https://github.com/openthread/openthread/pull/3419"&gt;https://github.com/openthread/openthread/pull/3419&lt;/a&gt; &lt;/pre&gt;
&lt;p&gt;the way of handling extra CoAP information such as Message ID was changed. Previously such information was kept in the CoAP Header structure, but right now it is kept in unused space in the Message Buffer itself.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To give you a better understanding, the Message Buffer may contain a few headers i.e:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;| IPv6 Header | MPL Header | UDP Header | CoAP Header | Payload |&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When a CoAP message is created, it allocates only space for CoAP and UDP Headers, and reserves space to prepend lower-layer headers:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;| Reserved                 | UDP Header | CoAP Header | Payload |&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(Reserved takes up the space of IPv6 Header and MPL Header)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The current CoAP implementation takes advantage of that, and puts temporarily needed information in the reserved space, because those are needed only to construct the CoAP message):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;| CoAP Helper Data         | UCP Header | CoAP Header | Payload |&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;After the packet is sent to the IP layer, the Reserved space is filled with the IPv6 (and for FF03::1 also MPL Header).&lt;/p&gt;
&lt;p&gt;This effectively overwrites the CoAP Helper data (which includes the Message ID).&lt;/p&gt;
&lt;p&gt;Luckily (but not on purpose), the Message ID is at the top of the CoAP Helper Data, and if the MPL Header is not used, then the CoAP Message ID information persists.&lt;/p&gt;
&lt;p&gt;In case the MPL Header is inserted it fully overwrites the CoAP Message ID as well.&lt;/p&gt;
&lt;p&gt;Why do you need to know what the Message ID of the CoAP message is? In the CoAP implementations I know this is always handled internally.&lt;/p&gt;
&lt;p&gt;If you need a workaround, you can increase the reserved space allocated by the IP layer to prevent the CoAP Helper Data (Message ID) being overwritten. For example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;diff --git a/src/core/net/ip6.cpp b/src/core/net/ip6.cpp
index d85dfb13e..0a1a72756 100644
--- a/src/core/net/ip6.cpp
+++ b/src/core/net/ip6.cpp
@@ -70,7 +70,7 @@ Ip6::Ip6(Instance &amp;amp;aInstance)
 Message *Ip6::NewMessage(uint16_t aReserved, const Message::Settings &amp;amp;aSettings)
 {
     return Get&amp;lt;MessagePool&amp;gt;().New(Message::kTypeIp6,
-                                  sizeof(Header) + sizeof(HopByHopHeader) + sizeof(OptionMpl) + aReserved, aSettings);
+                                  sizeof(Header) + sizeof(HopByHopHeader) + sizeof(OptionMpl) + aReserved + sizeof(uint32_t), aSettings);
 }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;--&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OpenThread CoAP Multicast Message ID</title><link>https://devzone.nordicsemi.com/thread/263009?ContentTypeID=1</link><pubDate>Tue, 04 Aug 2020 12:50:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de0f2a72-1ed0-40f0-9eb0-1a4ffcaccc90</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. I was on vacation the last 14 days.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have not received a reply on my internal ticket, unfortunately. I will ping it.&lt;/p&gt;
&lt;p&gt;Did you try to debug into&amp;nbsp;&lt;span&gt;getMessageID() to see why the returned ID was wrong?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;BR,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Edvin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OpenThread CoAP Multicast Message ID</title><link>https://devzone.nordicsemi.com/thread/262334?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2020 09:00:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed716cc6-f6d5-4628-8140-2c0442e9631e</guid><dc:creator>Rouben</dc:creator><description>&lt;p&gt;Hello Edvin&lt;/p&gt;
&lt;p&gt;Thank you for your support.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I was not able to find a solution. Do you have any news regarding this issue?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Rouben&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OpenThread CoAP Multicast Message ID</title><link>https://devzone.nordicsemi.com/thread/259734?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2020 14:57:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b002ae57-f26b-469c-9336-e9c5242dd54f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Roiben,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This looks a bit like a bug. I can see the message ID on the sniffer trace, so there is no reason why the client shouldn&amp;#39;t already have this ID at the time when it transmit it. I will have to double check this with our Thread team. I will let you know when I hear something from them. Please note that some additional delay may be expected due to summer holidays.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can of course look at the implementation of this message, since you have already built the latest version, you have access to the source code.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>