[network-diag] introduce RouterNeighborTlv - #12827
Conversation
This commit updates `RouterNeighborTlv` to follow the `SimpleTlvInfo` pattern, separating the TLV value structure from its type/length header. Specifically, it defines `RouterNeighborTlvValue` to hold the data fields for a router neighbor's diagnostic information, while `RouterNeighborTlv` is redefined as a `SimpleTlvInfo` using the value structure and the `kRouterNeighbor` type. This allows the use of generic `Tlv::Append<RouterNeighborTlv>()` and `tlvInfo.Read<RouterNeighborTlv>()` methods, which are generally safer and allow value type reuse. The `NetworkDiagnostic` and `MeshDiag` module are updated to utilize these new methods.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the RouterNeighborTlv implementation to adopt the standard SimpleTlvInfo pattern used across the codebase. By decoupling the TLV value structure from the type/length header, the changes improve code safety and maintainability while allowing for more consistent use of generic TLV handling utilities throughout the network diagnostic and mesh diagnostic modules. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
Library files
|
There was a problem hiding this comment.
Code Review
This pull request refactors the RouterNeighborTlv implementation by introducing RouterNeighborTlvValue and utilizing the SimpleTlvInfo template. These changes simplify TLV appending and reading operations across the network diagnostic and mesh diagnostic modules. Feedback was provided regarding a potential regression in forward compatibility: the new implementation uses a strict length check when reading the TLV, whereas the previous code allowed for a minimum length, which is safer if the protocol is extended in the future.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12827 +/- ##
==========================================
- Coverage 75.56% 74.57% -1.00%
==========================================
Files 694 696 +2
Lines 95495 95483 -12
==========================================
- Hits 72165 71205 -960
- Misses 23330 24278 +948
🚀 New features to boost your workflow:
|
This commit updates
RouterNeighborTlvto follow theSimpleTlvInfopattern, separating the TLV value structure from its type/length header.Specifically, it defines
RouterNeighborTlvValueto hold the data fields for a router neighbor's diagnostic information, whileRouterNeighborTlvis redefined as aSimpleTlvInfousing the value structure and thekRouterNeighbortype.This allows the use of generic
Tlv::Append<RouterNeighborTlv>()andtlvInfo.Read<RouterNeighborTlv>()methods, which are generally safer and allow value type reuse.The
NetworkDiagnosticandMeshDiagmodule are updated to utilize these new methods.