-
Notifications
You must be signed in to change notification settings - Fork 237
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
8c9966c
to
2e22cb9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/border_agent/border_agent.cpp
Outdated
@@ -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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
@@ -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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
57b7266
to
d5602d8
Compare
368aa32
to
93b3426
Compare
93b3426
to
b7ea789
Compare
src/border_agent/border_agent.cpp
Outdated
@@ -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) |
There was a problem hiding this comment.
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
?
, mIsEphemeralKeyEnabled(OTBR_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ON_INIT) | |
, mIsEphemeralKeyEnabled(otThreadGetVersion() >= OT_THREAD_VERSION_1_4) |
There was a problem hiding this comment.
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
b7ea789
to
d16d856
Compare
d47d09a
to
3c40915
Compare
d58b711
to
b39b38e
Compare
31de4aa
to
16d79d8
Compare
Depends-On: openthread/openthread#10596