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

[border agent] add UDP Proxy module for Thread commissioning #2717

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Irving-cl
Copy link
Contributor

@Irving-cl Irving-cl commented Feb 14, 2025

This PR adds a UDP Proxy module to do Thread commissioning under NCP architecture.

This PR is one of sub-task to support Border Agent under NCP mode. The UDP Proxy will also be used to do Thread commisssioning under RCP architecture and replace OT_PLATFORM_UDP.

Based on the OT border agent state changes (HandleBorderAgentStateChange), the module simply starts/stops listening on an UDP ephemeral port and if starts, sets a mapping between OT border agent UDP port and the port on host. And then it does bidrectional UDP forwarding:

  • Dependencies::UdpForward will be implemented as OT UDP forwarding to OT core.
  • SendToPeer will send a UDP packet to the remote peer using the local host port (that maps to OT border agent port) as the source port.

The module hasn't been integrated with the application and put in use. This PR adds a unit test for the module.

This module can also be used for other cases.

Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 74.57627% with 45 lines in your changes missing coverage. Please review.

Project coverage is 43.82%. Comparing base (2b41187) to head (8ddb9a9).
Report is 975 commits behind head on main.

Files with missing lines Patch % Lines
src/host/posix/udp_proxy.cpp 77.14% 20 Missing and 4 partials ⚠️
tests/gtest/test_udp_proxy.cpp 68.65% 16 Missing and 5 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2717       +/-   ##
===========================================
- Coverage   55.77%   43.82%   -11.95%     
===========================================
  Files          87      113       +26     
  Lines        6890    13569     +6679     
  Branches        0      965      +965     
===========================================
+ Hits         3843     5947     +2104     
- Misses       3047     7303     +4256     
- Partials        0      319      +319     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Irving-cl Irving-cl force-pushed the border_agent_udp_proxy branch from d513312 to ab1e9e1 Compare February 14, 2025 10:26
@Irving-cl Irving-cl force-pushed the border_agent_udp_proxy branch 3 times, most recently from 7c3cbee to b4e24ee Compare March 3, 2025 08:53
@Irving-cl
Copy link
Contributor Author

@bukepo @abtink

Could you help take a look at this PR when you have a chance? This one is a little bit long so maybe first let's align on the interfaces of the module UdpProxy.

For now I didn't add a general UDP platform module because the border agent is the only user. We can refactor it into a general UDP platform module when there are more users.

@Irving-cl Irving-cl force-pushed the border_agent_udp_proxy branch from b4e24ee to 685cf48 Compare March 5, 2025 02:38
@Irving-cl Irving-cl requested a review from bukepo March 5, 2025 02:41
@Irving-cl Irving-cl force-pushed the border_agent_udp_proxy branch from 685cf48 to 9e88a24 Compare March 5, 2025 02:51
Copy link
Member

@bukepo bukepo left a comment

Choose a reason for hiding this comment

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

Great to see we are on the way to deprecate platform UDP.

@Irving-cl Irving-cl force-pushed the border_agent_udp_proxy branch 5 times, most recently from f345da8 to 87c7d35 Compare March 7, 2025 06:00
@Irving-cl
Copy link
Contributor Author

@bukepo As discussed, updated the module to be generic so that it can also work for other cases (not only for Border Agent).

@bukepo bukepo self-requested a review March 7, 2025 09:33
@Irving-cl Irving-cl force-pushed the border_agent_udp_proxy branch from 87c7d35 to 612d4bd Compare March 10, 2025 03:57
@Irving-cl Irving-cl force-pushed the border_agent_udp_proxy branch 2 times, most recently from f5fc67b to 90a9808 Compare March 10, 2025 05:49
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.

LGTM.

@Irving-cl Irving-cl force-pushed the border_agent_udp_proxy branch from 90a9808 to 55066e0 Compare March 11, 2025 00:52
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.

3 participants