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

[udp-proxy] track Mesh-Local prefix in UDP Proxy client #188

Merged
merged 1 commit into from
Apr 21, 2021

Conversation

wgtdkp
Copy link
Member

@wgtdkp wgtdkp commented Apr 11, 2021

Previous implementation requires the caller of the Commissioner library to set Mesh-Local prefix before
initiating MGMT commands. it is error-prone and breaks backward compatibility: we need to first fetch
the Active Operational Dataset and set the Mesh-Local Prefix to the commissioner library before sending
other MGMT_* commands:

BbrDataset bbrDataset;
SuccessOrExit(error = mCommissioner->GetActiveDataset(activeDataset, 0xFFFF));
SuccessOrExit(error = mCommissioner->SetMeshLocalPrefix(activeDataset.mMeshLocalPrefix));
SuccessOrExit(error = mCommissioner->GetPendingDataset(pendingDataset, 0xFFFF));

This PR refactors the UDP Proxy to have it manage the Mesh-Local prefix inside the ProxyClient class.

  1. The Mesh-Local prefix is lazily requested from the Border Agent before sending the first MGMT command (if no Mesh-Local prefix is cached).
  2. The cached Mesh-Local prefix is cleared when the commissioner receives MGMT_DATASET_CHANGED.ntf so that the latest Mesh-Local prefix will be fetched before next MGMT command.
  3. The cached Mesh-Local prefix is cleared when the commissioner is disconnected.

In this way, the user doesn't need to be aware of the Mesh-Local prefix and no changes are required.

@google-cla google-cla bot added the cla: yes label Apr 11, 2021
@wgtdkp wgtdkp added enhancement New feature or request IOP labels Apr 11, 2021
@wgtdkp wgtdkp changed the title [UDP-Proxy] track Mesh-Local prefix in UdpProxyClient [UDP-Proxy] track Mesh-Local prefix in UDP Proxy client Apr 11, 2021
@wgtdkp wgtdkp force-pushed the refactor-udp-proxy branch from d578508 to de34d98 Compare April 11, 2021 11:24
@codecov-io
Copy link

Codecov Report

Merging #188 (c8efa67) into main (f41edbd) will increase coverage by 0.00%.
The diff coverage is 93.33%.

❗ Current head c8efa67 differs from pull request most recent head de34d98. Consider uploading reports for the commit de34d98 to get more accurate results

@@           Coverage Diff           @@
##             main     #188   +/-   ##
=======================================
  Coverage   70.35%   70.36%           
=======================================
  Files          52       52           
  Lines        4780     4778    -2     
=======================================
- Hits         3363     3362    -1     
+ Misses       1417     1416    -1     
Impacted Files Coverage Δ
include/commissioner/commissioner.hpp 43.75% <ø> (ø)
src/app/commissioner_app.cpp 39.65% <ø> (-0.10%) ⬇️
src/library/commissioner_impl.hpp 96.29% <ø> (ø)
src/library/commissioner_safe.cpp 79.92% <ø> (-0.31%) ⬇️
src/library/commissioner_safe.hpp 100.00% <ø> (ø)
src/library/commissioner_impl.cpp 75.91% <71.42%> (-0.66%) ⬇️
src/library/udp_proxy.cpp 91.13% <97.29%> (+5.42%) ⬆️
src/library/udp_proxy.hpp 91.66% <100.00%> (-1.20%) ⬇️

@wgtdkp wgtdkp requested review from simonlingoogle and jwhui April 13, 2021 03:32
@wgtdkp wgtdkp removed the request for review from simonlingoogle April 18, 2021 02:10
@wgtdkp wgtdkp linked an issue Apr 18, 2021 that may be closed by this pull request
@wgtdkp wgtdkp force-pushed the refactor-udp-proxy branch from de34d98 to 9205751 Compare April 18, 2021 11:12
@wgtdkp wgtdkp changed the title [UDP-Proxy] track Mesh-Local prefix in UDP Proxy client [udp-proxy] track Mesh-Local prefix in UDP Proxy client Apr 18, 2021
@wgtdkp wgtdkp force-pushed the refactor-udp-proxy branch from 9205751 to d06e7c3 Compare April 20, 2021 05:02
@codecov-commenter
Copy link

Codecov Report

Merging #188 (257d980) into main (1b5dd47) will increase coverage by 0.97%.
The diff coverage is 93.87%.

❗ Current head 257d980 differs from pull request most recent head d06e7c3. Consider uploading reports for the commit d06e7c3 to get more accurate results

@@            Coverage Diff             @@
##             main     #188      +/-   ##
==========================================
+ Coverage   69.40%   70.38%   +0.97%     
==========================================
  Files          52       52              
  Lines        4874     4782      -92     
==========================================
- Hits         3383     3366      -17     
+ Misses       1491     1416      -75     
Impacted Files Coverage Δ
include/commissioner/commissioner.hpp 43.75% <ø> (ø)
src/app/commissioner_app.cpp 39.65% <ø> (-0.10%) ⬇️
src/library/commissioner_impl.hpp 96.29% <ø> (ø)
src/library/commissioner_safe.cpp 79.92% <ø> (-0.31%) ⬇️
src/library/commissioner_safe.hpp 100.00% <ø> (ø)
src/library/commissioner_impl.cpp 75.91% <71.42%> (-1.09%) ⬇️
src/library/udp_proxy.cpp 91.56% <97.56%> (+5.85%) ⬆️
src/library/udp_proxy.hpp 91.66% <100.00%> (-1.20%) ⬇️
src/library/coap.hpp 95.29% <0.00%> (-1.18%) ⬇️
... and 4 more

@wgtdkp wgtdkp requested a review from jwhui April 20, 2021 05:28
src/library/udp_proxy.cpp Outdated Show resolved Hide resolved
@wgtdkp wgtdkp force-pushed the refactor-udp-proxy branch from d06e7c3 to da5f8ea Compare April 20, 2021 05:36
@wgtdkp wgtdkp requested a review from jwhui April 20, 2021 05:55
@jwhui jwhui merged commit 2a81ae0 into openthread:main Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes enhancement New feature or request IOP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom commissioner assertion
4 participants