ot-br-posix
ot-br-posix copied to clipboard
[meshcop] support runtime custom vendor and product name
Existing implementation will publish the _meshcop._udp service immediately when the program is started, even when there is no provisioned Thread network. This works as expected as the Thread spec defines.
The problem is that for non-Android linux platforms, the vendor, product name are customized via build time flags but customization needs to be runtime for Android because all Android device shares the same Thread stack in the mainline module.
To support Android, we make updates to allow delaying the advertisement of _meshcop._udp service after the customized vendor/product name has been provided via the new "BorderAgent::SetMeshcopServiceValues()" method. This is done by introducing the :ThreadStateEnabled" even from Android to otbr-posix and letting Application to enable Thread-dependent components when Android system notifies that Thread is enabled.
Check https://android-review.git.corp.google.com/c/platform/packages/modules/Connectivity/+/2993930 for how this is done from Android system server.
Codecov Report
Attention: Patch coverage is 33.33333%
with 16 lines
in your changes are missing coverage. Please review.
Project coverage is 39.58%. Comparing base (
2b41187
) to head (ef7abff
). Report is 612 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
src/border_agent/border_agent.cpp | 33.33% | 13 Missing and 3 partials :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #2200 +/- ##
===========================================
- Coverage 55.77% 39.58% -16.19%
===========================================
Files 87 88 +1
Lines 6890 9740 +2850
Branches 0 718 +718
===========================================
+ Hits 3843 3856 +13
- Misses 3047 5686 +2639
- Partials 0 198 +198
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
The problem is that for non-Android linux platforms, the vendor, product name are customized via build time flags but customization needs to be runtime for Android because all Android device shares the same Thread stack in the mainline module.
An idea for a possibly simpler way.
- We can change
BorderAgent
so that it waits untilSetMeshcopServiceValues()
is called before it will publish the "meshcop" service (i.e. add checks inPublishMeshCopService()
for this). - We can have this behavior be defined under a build config flag (so we can enable it for Andriod but not other platform)
- This way we don't need to add a new method in
Application
to delay the call toBorderAgent::SetEnabled()
. TheSetMeshcopServiceValues()
call itself can act as the trigger.
Thoughts?
The problem is that for non-Android linux platforms, the vendor, product name are customized via build time flags but customization needs to be runtime for Android because all Android device shares the same Thread stack in the mainline module.
An idea for a possibly simpler way.
- We can change
BorderAgent
so that it waits untilSetMeshcopServiceValues()
is called before it will publish the "meshcop" service (i.e. add checks inPublishMeshCopService()
for this).- We can have this behavior be defined under a build config flag (so we can enable it for Andriod but not other platform)
- This way we don't need to add a new method in
Application
to delay the call toBorderAgent::SetEnabled()
. TheSetMeshcopServiceValues()
call itself can act as the trigger.Thoughts?
@abtink Thanks for thoughtful review! Though my initial intention is for supporting runtime enablement of more components, I changed this CL to focus on BorderAgent for simplicity (I added a build flag OTBR_STOP_BORDER_AGENT_WHEN_INIT). PTAL