Skip to content

[dnssd] deduplicate service instance updates#3461

Merged
jwhui merged 1 commit into
openthread:mainfrom
jwhui:trel-dnssd-dedup-updates
Jul 9, 2026
Merged

[dnssd] deduplicate service instance updates#3461
jwhui merged 1 commit into
openthread:mainfrom
jwhui:trel-dnssd-dedup-updates

Conversation

@jwhui

@jwhui jwhui commented Jul 9, 2026

Copy link
Copy Markdown
Member

When OTBR_MDNS=mDNSResponder is enabled, redundant service browse and resolve callbacks can occur for already discovered TREL peers. Because TrelDnssd::OnTrelServiceInstanceAdded unconditionally called OnTrelServiceInstanceRemoved right at the start of the function, each duplicate mDNS update triggered peer removal (kDnssdRemoved) followed by peer re-addition (kReAdded).

This continuous state cycling in OpenThread's TrelPeerTable caused unnecessary multi-radio link probing and out-of-order fragment delivery between 15.4 and TREL interfaces, leading to kErrorDuplicated drops on valid ICMPv6 Echo Reply fragments during integration tests.

Before calling OnTrelServiceInstanceRemoved, check if the peer entry already exists with identical socket address and TXT data. If unchanged, update mDiscoverTime and exit without triggering peer removal or re-addition in OpenThread.

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.69%. Comparing base (2b41187) to head (488cbb1).
⚠️ Report is 1558 commits behind head on main.

Files with missing lines Patch % Lines
src/trel_dnssd/trel_dnssd.cpp 0.00% 12 Missing ⚠️
src/trel_dnssd/trel_dnssd.hpp 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3461       +/-   ##
===========================================
- Coverage   55.77%   33.69%   -22.09%     
===========================================
  Files          87      143       +56     
  Lines        6890    17286    +10396     
  Branches        0     1417     +1417     
===========================================
+ Hits         3843     5824     +1981     
- Misses       3047    11155     +8108     
- Partials        0      307      +307     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

gemini-code-assist[bot]

This comment was marked as outdated.

When OTBR_MDNS=mDNSResponder is enabled, redundant service browse and
resolve callbacks can occur for already discovered TREL peers. Because
TrelDnssd::OnTrelServiceInstanceAdded unconditionally called
OnTrelServiceInstanceRemoved right at the start of the function, each
duplicate mDNS update triggered peer removal (kDnssdRemoved) followed
by peer re-addition (kReAdded).

This continuous state cycling in OpenThread's TrelPeerTable caused
unnecessary multi-radio link probing and out-of-order fragment delivery
between 15.4 and TREL interfaces, leading to kErrorDuplicated drops on
valid ICMPv6 Echo Reply fragments during integration tests.

Before calling OnTrelServiceInstanceRemoved, check if the peer entry
already exists with identical socket address and TXT data. If unchanged,
update mDiscoverTime and exit without triggering peer removal or
re-addition in OpenThread.
@jwhui jwhui force-pushed the trel-dnssd-dedup-updates branch from cca8db0 to 488cbb1 Compare July 9, 2026 16:35
@jwhui jwhui closed this Jul 9, 2026
@jwhui jwhui reopened this Jul 9, 2026
@openthread openthread deleted a comment from gemini-code-assist Bot Jul 9, 2026
@jwhui

jwhui commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/gemini review

gemini-code-assist[bot]

This comment was marked as outdated.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request optimizes peer discovery and handling in the TREL DNSSD implementation. It introduces a Matches helper method in the Peer class to compare socket addresses and TXT data. In OnTrelServiceInstanceAdded, it replaces unconditional peer removal with a check to see if the peer already exists; if it matches, it updates the discovery time and exits early, and if the extended address differs, it removes the instance. Additionally, it ensures proper initialization of otPlatTrelPeerInfo structures using memset and refactors socket address comparisons to avoid direct struct comparison which could be affected by padding. There are no review comments, so I have no feedback to provide.

@jwhui jwhui marked this pull request as ready for review July 9, 2026 17:57
@jwhui jwhui requested a review from abtink July 9, 2026 17:57
@jwhui jwhui merged commit 6a3410f into openthread:main Jul 9, 2026
56 of 77 checks passed
@jwhui jwhui deleted the trel-dnssd-dedup-updates branch July 9, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants