This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Nordic (OpenThread) Thread Border Router - Mesh Local Prefix

Hello,

i have been struggling with this issue for several days now, maybe due to my limited knowledge of thread networks.

I'm developing a solution where some devices (based on the NRF52840) wake up several (once, twice or something like that) times a day, connect to a MQTT-SN gateway and send some data they recorded during the day. The MQTT-SN is part of the Nordic Border Router on a raspberry pi (last image available at the moment, 4.1.0-1alpha).

As long as i understand, the MQTT-SN gateway configuration includes a "GatewayUDP6Broadcast" address used to broadcast the gateway ipv6 address to clients during the discovery procedure.

I configured my end devices as sleepy end devices (setting  radio_mode = THREAD_RADIO_MODE_RX_OFF_WHEN_IDLE in thread_configuration_t structure), therefore the standard multicast address ff03::1 will not work for the GatewayUDP6Broadcast. Instead, I read in the thread protocol specification that i need to use a special realm-local unicast prefix-based multicast  address that is derived from the mesh local prefix (chapter 5.2.3.2 of thread specification, v. 1.1.1).

Since i need to hardcode such address in the MQTT-SN gateway configuration file, i need to force a known mesh-local prefix in my thread network.

However, I was unable to do so. I tried to set the thread_on_mesh_prefix to the prefix I want to use in /etc/border_router.conf file, but it didn't work...

I managed to obtain some results by using wpanctl form command with -M <mesh_prefix>, however this solution did not work all the times (i don't know why) and was not very robust to reboots of the raspberry. 

Can you please give me some advice on this matter? I'm not even sure that this is the correct approach for this kind of issues.

Thanks!

  • I don't see why that would be necessary, and why not just reading it out would be just as good, but I can check with our Thread team.

    I'll let you know when I hear from them.

    Best regards,

    Edvin

  • Hello,

    I received a reply today:

    In case you have full control of the Thread network, you can pre-commission the devices with specific Mesh Local Prefix by using the function:

    otThreadSetMeshLocalPrefix() (https://github.com/openthread/openthread/blob/master/include/openthread/thread.h#L457 )

    This API has to be called before the interface and Thread is brought up.

    On Border Router, if you want to change the default Mesh Local Prefix in the /etc/border_router.conf file, please execute "wpanctl leave & sudo reboot", or else the NCP will use the Operational Dataset stored in the flash.

    Please remember that in a regular network, the Mesh Local Prefix might be randomly chosen, and all devices receive the Operational Dataset (which includes the Mesh Local Prefix) during the Commissioning process. We don't have built in support for automatic change of the GatewayUDP6Broadcast value in the paho_mqttsn_gateway.conf gile. What you can do is to implement a small script wich will react on changes of MeshLocalPrefiz from wpantund/wpanctl and adjust the value of the GatewatUDP6Broadcast field and restart the Paho MWTT-SN gateway.

    Another alternative could be to subscribe to some random multicast address on all MQTT-SN client devices, including SEDs (e.g. FF03::cafe) using the "otIp6SubscribteMulticastAddress" API (https://github.com/openthread/openthread/blob/master/include/openthread/ip6.h#L307 ) and then use this address in the GatewayUDP6Broadcast field. This way, you won't be dependent on the MeshLocalPrefix, but at the same time you will create a proprietary solution.

    BR,

    Edvin

Related