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

[epskc] enable by default for Thread 1.4 #2429

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

mia1yang
Copy link
Contributor

@mia1yang mia1yang commented Aug 9, 2024

@mia1yang mia1yang marked this pull request as ready for review August 9, 2024 12:11
Copy link

codecov bot commented Aug 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.35%. Comparing base (2b41187) to head (16d79d8).
Report is 766 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2429       +/-   ##
===========================================
- Coverage   55.77%   45.35%   -10.42%     
===========================================
  Files          87      100       +13     
  Lines        6890    11345     +4455     
  Branches        0      821      +821     
===========================================
+ Hits         3843     5146     +1303     
- Misses       3047     5943     +2896     
- Partials        0      256      +256     

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

@mia1yang mia1yang requested a review from bukepo August 9, 2024 12:55
@mia1yang mia1yang force-pushed the epskc_version branch 2 times, most recently from 8c9966c to 2e22cb9 Compare August 9, 2024 13:09
@mia1yang mia1yang requested a review from bukepo August 9, 2024 13:09
src/border_agent/border_agent.cpp Outdated Show resolved Hide resolved
@librasungirl librasungirl changed the title [epskc] set ePSKc init status according to otversion [epskc] enable by default for Thread 1.4 Aug 9, 2024
@mia1yang mia1yang requested a review from abtink August 9, 2024 13:26
Copy link
Member

@abtink abtink left a comment

Choose a reason for hiding this comment

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

👍

@@ -163,6 +165,9 @@ BorderAgent::BorderAgent(otbr::Ncp::RcpHost &aHost, Mdns::Publisher &aPublisher)
, mBaseServiceInstanceName(OTBR_MESHCOP_SERVICE_INSTANCE_NAME)
{
mHost.AddThreadStateChangedCallback([this](otChangedFlags aFlags) { HandleThreadStateChanged(aFlags); });
mIsEphemeralKeyEnabled = (otThreadGetVersion() >= kThreadVersion14);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think in a previous discussion our consensus was to provide a macro to configure whether to enable ePSKc on init and define the default value according to the version.

Could you explain why your prefer to implement this by directly checking the version? I think it's less configurable in this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another review concern is too many macro; I suppose the target of macro is easy to config, so in the new commit, add a kEphemeralKeyEnableOnInit for config; Let me know your concerns. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Another review concern is too many macro

IMHO the suggested macro is not that harmful because it doesn't guard code blocks. Instead, it's just used as a configurable boolean value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have modified to Macro accordingly; Thanks for re-reviewing

src/border_agent/border_agent.cpp Outdated Show resolved Hide resolved
src/border_agent/border_agent.cpp Outdated Show resolved Hide resolved
@@ -77,6 +77,8 @@ static const char kBorderAgentServiceType[] = "_meshcop._udp"; ///< Bo
static const char kBorderAgentEpskcServiceType[] = "_meshcop-e._udp"; ///< Border agent ePSKc service
static constexpr int kBorderAgentServiceDummyPort = 49152;

static constexpr uint16_t kThreadVersion14 = 5; ///< Thread Version 1.4
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you can just use OT_THREAD_VERSION_1_4?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This definition is in core and could not be used directly? Open an issue to track refactor of thread version in OTBR b/358571361

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I didn't pay attention to where the macro was defined.

IMHO we should expose the OT_THREAD_VERSION_* macros as part of Openthread API. Currently otThreadGetVersion doesn't tell what the returned integer means.

@abtink @jwhui what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@superwhd Just FYI, there is a dbus API GetThreadVersion can tell the version mapping (slightly differences of version1.3.1);

Temperately add version definition in BA in this PR and try to refactor OT version in OTBR, tracking here: b/358571361. Appreciate to leave comments for the refactor.

Copy link
Member

Choose a reason for hiding this comment

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

IMHO we should expose the OT_THREAD_VERSION_* macros as part of Openthread API. Currently otThreadGetVersion doesn't tell what the returned integer means.

I 100% agree. I was expecting OT_THREAD_VERSION_* to be defined in thread.h header, but for some reason they are defined in openthread-core-config.h (which is not a public header). I will submit a PR on this.

@mia1yang mia1yang force-pushed the epskc_version branch 2 times, most recently from 57b7266 to d5602d8 Compare August 12, 2024 07:38
@mia1yang mia1yang requested a review from superwhd August 12, 2024 07:55
@mia1yang mia1yang force-pushed the epskc_version branch 2 times, most recently from 368aa32 to 93b3426 Compare August 12, 2024 09:40
@@ -157,12 +163,13 @@ BorderAgent::BorderAgent(otbr::Ncp::RcpHost &aHost, Mdns::Publisher &aPublisher)
: mHost(aHost)
, mPublisher(aPublisher)
, mIsEnabled(false)
, mIsEphemeralKeyEnabled(false)
, mIsEphemeralKeyEnabled(OTBR_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ON_INIT)
Copy link
Member

Choose a reason for hiding this comment

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

do we need the macro OTBR_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ON_INIT?

Suggested change
, mIsEphemeralKeyEnabled(OTBR_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ON_INIT)
, mIsEphemeralKeyEnabled(otThreadGetVersion() >= OT_THREAD_VERSION_1_4)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use this simple way for this PR; Link detailed discussion for ref

@mia1yang mia1yang force-pushed the epskc_version branch 2 times, most recently from d47d09a to 3c40915 Compare August 19, 2024 08:52
@mia1yang mia1yang force-pushed the epskc_version branch 2 times, most recently from d58b711 to b39b38e Compare August 19, 2024 09:35
@mia1yang mia1yang requested a review from bukepo August 19, 2024 09:37
@librasungirl librasungirl requested a review from jwhui August 20, 2024 05:48
@jwhui jwhui merged commit 791828c into openthread:main Aug 20, 2024
32 checks passed
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.

7 participants