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

OpenThread IPv6 TTL

Dear Support,

I have a question about the IPv6 networking with OpenThread. I do have an mesh network with about 50 nodes (PCA10059) and implemented CoAP servers and clients to communicate with each other.

My question is: I need to know how much hops a message took from the CoAP client to the server. Is there a possibility to get the TTL value from the message incoming on server side? Unfortunately I didn't found an API from OpenThread where I can read the TTL value.

Thank you

Best Regards 

Rouben

Parents
  • Hi,

    The otMessageInfo structure has a mHopLimit member. This is decremented by each router that forwards the message. By default, this is set to OPENTHREAD_CONFIG_IP6_HOP_LIMIT_DEFAULT.

    Note that Thread has a maximum path cost of 16. The path cost for a single hos may be between 1 and 4 depending on the link quality. Thread uses proactive routing calculation, you can get the path cost to another router from otThreadGetRouterInfo::mPathCost (have a look at the CLI source code on how this is implemented).

    If you search the Thread specifications for "hop count", you will find more details on how hop count works.

    Best regards,
    Jørgen

  • Hi Jørgen,

    that works perfectly with the otMessageInfo structure, thank you. I found an other mistake, I have made. I subscribed and sent the CoAP message to a Link-Local IPv6 address (ff02::4). I changed that and I can know read out the number of hops the message has taken. 

    I have another question to you. I read out the message ID from the CoAP message ( otCoapMessageGetMessageId(p_request) ). If I send the message to the Link-Local IPv6 (ff02::4) address the ID was valid. But if I send it to a Mesh-Local address (ff03::4) the ID is always 0. Is it possible to get the message ID with the Mesh-Local address?

    Thank you very much.

    Best regards,

    Rouben  

Reply
  • Hi Jørgen,

    that works perfectly with the otMessageInfo structure, thank you. I found an other mistake, I have made. I subscribed and sent the CoAP message to a Link-Local IPv6 address (ff02::4). I changed that and I can know read out the number of hops the message has taken. 

    I have another question to you. I read out the message ID from the CoAP message ( otCoapMessageGetMessageId(p_request) ). If I send the message to the Link-Local IPv6 (ff02::4) address the ID was valid. But if I send it to a Mesh-Local address (ff03::4) the ID is always 0. Is it possible to get the message ID with the Mesh-Local address?

    Thank you very much.

    Best regards,

    Rouben  

Children
No Data
Related