[netif] verify unicast netlink ACKs and gate cache updates#3245
[netif] verify unicast netlink ACKs and gate cache updates#3245binarylogic wants to merge 4 commits intoopenthread:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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 resolves a critical issue where the OpenThread Border Router (OTBR) cache could diverge from the Linux kernel's network interface state. Previously, unicast IPv6 address updates were optimistically applied to the local cache without confirming the kernel's acceptance via netlink responses. This change hardens the netif handling by introducing a robust mechanism to verify netlink ACKs for unicast address additions and removals, ensuring that the local cache accurately reflects the kernel's state and preventing inconsistencies. 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. Changelog
Activity
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly improves the robustness of unicast address management on Linux by verifying netlink acknowledgements before mutating the internal address cache. This prevents state divergence between the border router and the kernel. The implementation is well-done, with careful handling of timeouts, transient errors, and idempotent operations. I have one suggestion to improve the efficiency of the address removal logic in netif.cpp.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3245 +/- ##
===========================================
- Coverage 55.77% 34.95% -20.83%
===========================================
Files 87 145 +58
Lines 6890 17859 +10969
Branches 0 1483 +1483
===========================================
+ Hits 3843 6242 +2399
- Misses 3047 11286 +8239
- Partials 0 331 +331 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
This PR hardens Linux unicast netif handling by tying cache mutation to verified netlink outcomes.
Problem
UpdateIp6UnicastAddresses()previously updatedmIp6UnicastAddressesoptimistically, without confirming whether the kernel accepted each unicast add/remove request.When RTNETLINK rejected a request, OTBR cache could diverge from kernel state.
Changes
nlmsgerrpayload length before dereference.recv()interruptions (EINTR,EAGAIN,EWOULDBLOCK) are retried while waiting.EEXISTENOENT,EADDRNOTAVAILUpdateIp6UnicastAddresses()now mutates local cache only for operations that succeeded.Why this is safe
Validation
clang-formatcheck (LLVM 19) on modified files.git diff --checkclean.Fixes #3244