aboutsummaryrefslogtreecommitdiff
path: root/src/ncp
diff options
context:
space:
mode:
authorLi Cao <irvingcl@google.com>2021-12-01 10:02:39 +0800
committerGitHub <noreply@github.com>2021-11-30 18:02:39 -0800
commit4cda3157c1c9fc803ecd46bf6807e140d418d333 (patch)
tree156ff76dacee3539ecc859c5bd87d7eea44a9fab /src/ncp
parent2257ce97b84be02c063f0b05115279db6f9305d3 (diff)
downloadot-br-posix-4cda3157c1c9fc803ecd46bf6807e140d418d333.tar.gz
[agent] set dry-run option in Thread config if printRadioVersion is true (#1028)
`otbr-agent` will exit directly if `--radio-version` is passed in parameters. This PR sets the DryRun option in PosixConfig when `radio-version` is set. In this way, the posix instance will only initialize very few things to avoid permission issues.
Diffstat (limited to 'src/ncp')
-rw-r--r--src/ncp/ncp_openthread.cpp5
-rw-r--r--src/ncp/ncp_openthread.hpp10
2 files changed, 10 insertions, 5 deletions
diff --git a/src/ncp/ncp_openthread.cpp b/src/ncp/ncp_openthread.cpp
index e98e774e..29fb2b43 100644
--- a/src/ncp/ncp_openthread.cpp
+++ b/src/ncp/ncp_openthread.cpp
@@ -62,7 +62,8 @@ static const uint16_t kThreadVersion12 = 3; ///< Thread Version 1.2
ControllerOpenThread::ControllerOpenThread(const char * aInterfaceName,
const std::vector<const char *> &aRadioUrls,
- const char * aBackboneInterfaceName)
+ const char * aBackboneInterfaceName,
+ bool aDryRun)
: mInstance(nullptr)
{
VerifyOrDie(aRadioUrls.size() <= OT_PLATFORM_CONFIG_MAX_RADIO_URLS, "Too many Radio URLs!");
@@ -71,6 +72,8 @@ ControllerOpenThread::ControllerOpenThread(const char * aInt
mConfig.mInterfaceName = aInterfaceName;
mConfig.mBackboneInterfaceName = aBackboneInterfaceName;
+ mConfig.mDryRun = aDryRun;
+
for (const char *url : aRadioUrls)
{
mConfig.mRadioUrls[mConfig.mRadioUrlNum++] = url;
diff --git a/src/ncp/ncp_openthread.hpp b/src/ncp/ncp_openthread.hpp
index 79227c53..210cd650 100644
--- a/src/ncp/ncp_openthread.hpp
+++ b/src/ncp/ncp_openthread.hpp
@@ -62,14 +62,16 @@ public:
/**
* This constructor initializes this object.
*
- * @param[in] aInterfaceName A string of the NCP interface name.
- * @param[in] aRadioUrls The radio URLs (can be IEEE802.15.4 or TREL radio).
- * @param[in] aBackboneInterfaceName The Backbone network interface name.
+ * @param[in] aInterfaceName A string of the NCP interface name.
+ * @param[in] aRadioUrls The radio URLs (can be IEEE802.15.4 or TREL radio).
+ * @param[in] aBackboneInterfaceName The Backbone network interface name.
+ * @param[in] aDryRun TRUE to indicate dry-run mode. FALSE otherwise.
*
*/
ControllerOpenThread(const char * aInterfaceName,
const std::vector<const char *> &aRadioUrls,
- const char * aBackboneInterfaceName);
+ const char * aBackboneInterfaceName,
+ bool aDryRun);
/**
* This method initalize the NCP controller.