[client] Add IPv6 dual-stack support#148
[client] Add IPv6 dual-stack support#148
Conversation
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds IPv6 support across UI and tooling: new disable‑IPv6 preference and UI entry, Peer model and adapter show/copy IPv6, TUN/VPN tooling accepts and persists IPv6 address, NetworkChangeNotifier gains an IPv6 setter, and the netbird submodule pointer is bumped. ChangesAdvanced Settings UI
Peer Model & List UI
Resource Detection
VPN / TUN Interface Logic
EngineRunner / Misc
Dependencies
Sequence Diagram(s)sequenceDiagram
participant User as "User (UI)"
participant Advanced as "AdvancedFragment"
participant Prefs as "goPreferences"
participant VM as "PeersFragmentViewModel"
participant Adapter as "PeersAdapter"
participant Clipboard as "Clipboard"
participant VPN as "VPNService"
participant IFace as "IFace / TUN builder"
User->>Advanced: Toggle Disable IPv6 / click container
Advanced->>Prefs: setDisableIPv6(isChecked) + commit
Prefs-->>Advanced: ack
VM->>Adapter: bind Peer(status, ip, ipv6, fqdn)
Adapter->>User: display IPv4 and IPv6 (if present)
User->>Adapter: long-press -> select "copy IPv6"
Adapter->>Clipboard: copy "IPv6 Address"
VPN->>IFace: configureInterface(address, addressV6, mtu, dns, routes)
IFace->>IFace: parse addressV6, add IPv6 addr or add IPv6 default route
IFace-->>VPN: tunFd / success
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fa435ce to
3f573e8
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/src/main/java/io/netbird/client/ui/home/Resource.java`:
- Around line 38-40: The isExitNode method in class Resource can NPE and misses
IPv6 when multiple addresses are present; update Resource.isExitNode to be
null-safe and use the same containment logic for both IPv4 and IPv6 (e.g., check
address != null and then address.contains("0.0.0.0/0") ||
address.contains("::/0")) so both "0.0.0.0/0,::/0" and "::/0,10.0.0.0/8" are
detected consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 07976be7-06ad-4c85-aeb7-69281ce165ee
📒 Files selected for processing (13)
app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.javaapp/src/main/java/io/netbird/client/ui/home/Peer.javaapp/src/main/java/io/netbird/client/ui/home/PeersAdapter.javaapp/src/main/java/io/netbird/client/ui/home/PeersFragmentViewModel.javaapp/src/main/java/io/netbird/client/ui/home/Resource.javaapp/src/main/res/layout/fragment_advanced.xmlapp/src/main/res/menu/peer_clipboard_menu.xmlapp/src/main/res/values/strings.xmlnetbirdtool/src/main/java/io/netbird/client/tool/IFace.javatool/src/main/java/io/netbird/client/tool/NetworkChangeNotifier.javatool/src/main/java/io/netbird/client/tool/TUNParameters.javatool/src/main/java/io/netbird/client/tool/VPNService.java
Use contains() for IPv6 check to match IPv4 logic, so multi-address strings like "0.0.0.0/0,::/0" are handled correctly. Add null guard for address field.
# Conflicts: # app/src/main/java/io/netbird/client/ui/home/PeersFragmentViewModel.java # netbird
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tool/src/main/java/io/netbird/client/tool/IFace.java`:
- Around line 80-82: The current logic only adds a blackhole ::/0 when addrV6 ==
null and hasIPv4DefaultRoute(routes) is true, but the presence of an IPv6
address is not the right signal — we must add the ::/0 blackhole whenever there
is an IPv4 default route and there is no IPv6 default route. Change the
condition in IFace where routes are built: replace the addrV6 == null check with
a check for absence of an IPv6 default route (e.g., !hasIPv6DefaultRoute(routes)
or !routes.stream().anyMatch(r -> r.prefix.equals("::/0"))), so that if
hasIPv4DefaultRoute(routes) && no IPv6 /0 route then routes.add(new
Route("::/0")). Use or add a helper like hasIPv6DefaultRoute(routes) to mirror
hasIPv4DefaultRoute for clarity; keep Route and routes usage unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 08479a13-3a8b-4b3b-b88c-f6846203f348
📒 Files selected for processing (2)
netbirdtool/src/main/java/io/netbird/client/tool/IFace.java
🚧 Files skipped from review as they are similar to previous changes (1)
- netbird
New PlatformFiles.CacheDir() method in the netbird submodule. Pass context.getCacheDir() through from EngineRunner.
# Conflicts: # netbird # tool/src/main/java/io/netbird/client/tool/EngineRunner.java
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tool/src/main/java/io/netbird/client/tool/EngineRunner.java (1)
23-239:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winRestore
EngineRunner.debugBundle(boolean)to avoid a hard API break.
EngineRunnerno longer exposesdebugBundle, butVPNServicestill callsengineRunner.debugBundle(anonymize)(tool/src/main/java/io/netbird/client/tool/VPNService.java, Line 242). This is a compile-time break and also disrupts the app-layer troubleshooting chain (ServiceAccessor→MainActivity→TroubleshootFragment).Suggested fix
class EngineRunner { @@ + public String debugBundle(boolean anonymize) throws Exception { + return goClient.debugBundle(anonymize); + } + public PeerInfoArray peersInfo() { return goClient.peersList(); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tool/src/main/java/io/netbird/client/tool/EngineRunner.java` around lines 23 - 239, EngineRunner no longer provides debugBundle(boolean) causing a compile-time break where VPNService calls engineRunner.debugBundle(anonymize); restore compatibility by adding a public synchronized debugBundle(boolean anonymize) method on EngineRunner that delegates to the appropriate goClient or internal logic to produce the debug bundle (or returns the same data structure VPNService expects), ensuring the signature matches VPNService's call; reference EngineRunner.debugBundle(boolean), VPNService's call to engineRunner.debugBundle(anonymize), and preserve behavior used by ServiceAccessor/MainActivity/TroubleshootFragment so callers continue to work without changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@tool/src/main/java/io/netbird/client/tool/EngineRunner.java`:
- Around line 23-239: EngineRunner no longer provides debugBundle(boolean)
causing a compile-time break where VPNService calls
engineRunner.debugBundle(anonymize); restore compatibility by adding a public
synchronized debugBundle(boolean anonymize) method on EngineRunner that
delegates to the appropriate goClient or internal logic to produce the debug
bundle (or returns the same data structure VPNService expects), ensuring the
signature matches VPNService's call; reference
EngineRunner.debugBundle(boolean), VPNService's call to
engineRunner.debugBundle(anonymize), and preserve behavior used by
ServiceAccessor/MainActivity/TroubleshootFragment so callers continue to work
without changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0a9ea66e-4cf7-4735-aab4-45ff7b8e04c3
📒 Files selected for processing (6)
app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.javaapp/src/main/res/layout/fragment_advanced.xmlapp/src/main/res/values/strings.xmlnetbirdtool/src/main/java/io/netbird/client/tool/EngineRunner.javatool/src/main/java/io/netbird/client/tool/VPNService.java
✅ Files skipped from review due to trivial changes (3)
- netbird
- app/src/main/res/layout/fragment_advanced.xml
- app/src/main/res/values/strings.xml
🚧 Files skipped from review as they are similar to previous changes (2)
- app/src/main/java/io/netbird/client/ui/advanced/AdvancedFragment.java
- tool/src/main/java/io/netbird/client/tool/VPNService.java
Add IPv6 dual-stack support to the Android client.
Summary by CodeRabbit
New Features
Bug Fixes / Enhancements