0

I can’t find out how to use otThreadGetChildNextIp6Address. I am using two devices, one is the leader and the other is a child. I need the leader to get child addresses, is it possible to do it with this API?

I have tried with arguments below but it returned OT_ERROR_NOT_FOUND.

  • aChildIndex: I have set it to 0. I am quite sure the issue does not come from the index as I used otThreadGetChildInfoByIndex above with 0 index and it works fine.
  • aIterator: I have created a otChildIp6AddressIterator variable and I have passed its address to the API.
  • aAddress: I have created a otIp6Address variable and I have passed its address to the API.

Have I missed something?

toydarian
  • 4,246
  • 5
  • 23
  • 35
Tester
  • 5
  • 2
  • 2
    Your answer has some formatting problems. Try to improve that. Use `\`` brackets for paths and code fragments. To highlight apps' names or interface, use a **bold** (`**` brackets) or *italic* (`*` brackets) font. To start from a new line use *double space* at the end of the line - the question'll be way more clear than using *Enter* everywhere. Adding some `:` would be nice too. – maciejwww Apr 14 '21 at 18:52
  • 1
    Don't use salutations: [Should 'Hi', 'thanks', taglines, and salutations be removed from posts?](https://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts) – maciejwww Apr 14 '21 at 18:52

1 Answers1

0

See the OpenThread CLI implementation for an example of using otThreadGetChildNextIp6Address().

jhui
  • 694
  • 4
  • 3
  • I have already seen the CLI implementation of this function. I use it the same way as CLI does but for some reasons, according to the debugger, `OT_ERROR_NOT_FOUND` is returned in `Child::GetNextIp6Address` because mIp6Address seems to be unspecified. I can read correctly the addresses directly on the child device, so I can't figure why the leader keeps saying that the child addresses are unspecified. – Tester Apr 19 '21 at 09:27
  • Is your child a Full Thread Device (FTD)? Thread Routers do not maintain IPv6 addresses for children that are FTDs. – jhui Apr 19 '21 at 20:46
  • Yes, you are right. Now, I can get correctly the Mesh Local one but the others seem not to be registered. How can I register all child’s addresses to get them all using `otThreadGetChildNextIp6Address` ? I guess the problem comes from my `AddressRegistrationMode` which seems to be set to `kAppendMeshLocalOnly`. Is there a way to set it to `kAppendAllAddresses` ? – Tester Apr 23 '21 at 13:29
  • Thread does not provide a mechanism for a Full Thread Device (FTD) operating in the child role to register its addresses with its Parent. – jhui Apr 26 '21 at 21:21
  • My child was FTD, that is why I was not able to get anything. But now, the child is MTD as you suggested. Its parent (FTD) needs to get the addresses (all of them) of this child. I tried using `otThreadGetChildNextIp6Address` but I only get the Mesh local address. What can I do to get all the child’s addresses ? – Tester Apr 29 '21 at 14:17
  • An MTD should register all non-link-local IPv6 addresses with its parent. Are you seeing non-link-local IPv6 addresses on the MTD that are not retrievable on the parent? – jhui Apr 29 '21 at 18:52
  • On child board : `otIp6GetUnicastAddresses` returns 3 addresses (Link-local, Mesh-local EID and RLOC). On parent board : `otThreadGetChildNextIp6Address` returns only Mesh-local EID. If an MTD is supposed to register all non-link-local IPv6 addresses, then I should see the RLOC too right ? – Tester Apr 30 '21 at 09:31
  • Child devices do not need to register the RLOC because it is constructed from the Router ID and Child ID. Currently, `otThreadGetChildNextIp6Address()` only returns registered IPv6 addresses. You can obtain the RLOC16 by using `otThreadGetChildInfoByIndex()`. – jhui Apr 30 '21 at 14:46
  • It works using `otThreadGetChildInfoByIndex`, thank you. – Tester May 05 '21 at 13:55