Search code examples
ipv6openthread

Obtaining MTD IPv6 address


My topology is:

T1 - T2 - T4
   - T3 -

Thread MTD devices (T4) have assigned it's IPv6 address randomly.

How to address packets to T4 from T1 (FTD via NCP, wpan0 interface), if I don't know that address. How to resolve it?

I tried with Service API, but no success. Can service be registered on MTD and if yes, will the thread network assign service RLOC16 to


Solution

  • The simplest way -I think- is to send a broadcast request message (using a multicast address e.g. ff03::2), on which every device has to reply.

    As soon as you get the response message from a device, you should be able to get the IPv6 address of the sender as well. The sender address info is located in the otMessageInfo.

    See example on cli_udp_example.cpp on git.

    void UdpExample::HandleUdpReceive(otMessage *aMessage, const otMessageInfo *aMessageInfo)