Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[trel-dnssd] trel platform selects first peer address instead of wider scope one #2116

Open
abtink opened this issue Dec 5, 2023 · 2 comments

Comments

@abtink
Copy link
Member

abtink commented Dec 5, 2023

The trel platform implementation seem to select the first address (at index [0]) when invoking callback to reprot a discovered TREL peer info:

peerInfo.mRemoved = false;
memcpy(&peerInfo.mSockAddr.mAddress, &aInstanceInfo.mAddresses[0], sizeof(peerInfo.mSockAddr.mAddress));
peerInfo.mSockAddr.mPort = aInstanceInfo.mPort;
peerInfo.mTxtData = aInstanceInfo.mTxtData.data();
peerInfo.mTxtLength = aInstanceInfo.mTxtData.size();

The platform/trel.h documenation mentions:

...
 * events are not guaranteed, however. When a TREL service instance is discovered, a new ongoing DNS-SD query for an
 * AAAA record should be started on the hostname indicated in the SRV record of the discovered instance. If multiple
 * host IPv6 addressees are discovered for a peer, one with highest scope among all addresses MUST be reported (if
 * there are multiple address at same scope, one must be selected randomly).
 *

This behavior seems to be missing in the current implementation.


Thanks To @gabekassel for noticing that different peers seems to be using a mixture of ULA/GUA addresses:

Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Input: trel peers
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: | No  | Ext MAC Address  | Ext PAN Id       | IPv6 Socket Address                              |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: +-----+------------------+------------------+--------------------------------------------------+
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |   1 | f2295d25707238d4 | dcbc1020cee5f6af | [2603:7000:c00:a315:8:3e3:857f:e5d4]:59248       |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |   2 | be860a24c6976a2c | dcbc1020cee5f6af | [fdbc:1020:cee5:f6af:829:8a3c:7f40:396a]:57947   |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |   3 | 0efd70f1c6ded375 | dcbc1020cee5f6af | [fdbc:1020:cee5:f6af:4f7:a1ac:6f7f:1ebb]:63834   |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |   4 | 0320674a52350037 | dcbc1020cee5f6af | [fd38:eb5c:f30e:1:6697:14ff:fe5b:ad92]:49635     |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |   5 | 6ab2f87ca6ca8952 | dcbc1020cee5f6af | [fdbc:1020:cee5:f6af:1c0f:dcc3:56f6:d71d]:65458  |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |   6 | 1a00eed7a68c2657 | dcbc1020cee5f6af | [fdbc:1020:cee5:f6af:88a:f289:c402:41d7]:58104   |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |   7 | ca7f47968e01c42c | dcbc1020cee5f6af | [fdbc:1020:cee5:f6af:102b:222e:a28a:c46d]:59180  |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |   8 | 4a26f1158748ddf2 | dcbc1020cee5f6af | [fdbc:1020:cee5:f6af:1c96:2ba9:12f1:186b]:62782  |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |   9 | 8a32076938e722c7 | dcbc1020cee5f6af | [2603:7000:c00:a315:c6a8:16ff:fe21:dad4]:59246   |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |  10 | 5e515b7ebb4cc45e | 30b0cd0eb498ae7c | [fdbc:1020:cee5:f6af:4945:c045:b65b:d6c0]:64705  |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |  11 | b6aedcf9c86863ba | dcbc1020cee5f6af | [fdbc:1020:cee5:f6af:2:fd54:3ef1:be4f]:62431     |
Dec  4 18:21:49.145 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |  12 | 8262022218ce4872 | dcbc1020cee5f6af | [fdbc:1020:cee5:f6af:1caa:1d4f:963f:9b58]:55343  |
Dec  4 18:21:49.146 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |  13 | 32e5835da26a658d | dcbc1020cee5f6af | [2603:7000:c00:a315:c6a8:16ff:fe27:8b14]:50566   |
Dec  4 18:21:49.146 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: |  14 | 6679afc43e7cf38e | dcbc1020cee5f6af | [fdbc:1020:cee5:f6af:1099:e91f:6dd0:c7fa]:62185  |
Dec  4 18:21:49.146 eero local5.debug otbr-agent[666778]: [D] Cli-----------: Output: Done```
@abtink
Copy link
Member Author

abtink commented Dec 5, 2023

One point on this: Using wider scope would be better but at the end, as long as we can reach the other peer using the selected address, it should be fine and things should work okay.

@abtink abtink changed the title [trel-dnssd] trel platform selects first peer address instead of highest scope one [trel-dnssd] trel platform selects first peer address instead of wider scope one Dec 5, 2023
@abtink
Copy link
Member Author

abtink commented Dec 5, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant