Skip to content

fix(dns): DNS failover now applies changes to OS + Linux NM integration#1

Merged
louzt merged 1 commit into
mainfrom
fix/dns-failover-linux-nm
Jun 15, 2026
Merged

fix(dns): DNS failover now applies changes to OS + Linux NM integration#1
louzt merged 1 commit into
mainfrom
fix/dns-failover-linux-nm

Conversation

@louzt

@louzt louzt commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

DNS failover was detecting failures and updating internal state, but never actually calling set_dns() to apply the change to the operating system. This caused DNS probe errors to persist even when the app detected the issue.

Changes

  • dns_intelligence.rs (+50 lines): check_failover_static() now calls set_dns() to apply the failover to the OS after detecting consecutive_failures >= max_consecutive_failures.
  • dns.rs (+292 lines): Full Linux NetworkManager integration — nmcli-based adapter detection, connection reapply, resolvectl support, DNS provider list, latency measurement, and DNS resolution checks.
  • capabilities/migrated.json: Narrowed PowerShell validator from \\S+ (any string) to specific DNS cmdlets only.

Scope

  • Does NOT include: UI changes, Svelte components, other Tauri commands
  • Does include: DNS service layer, intelligence layer, Linux support

Testing

cargo check  # ✅ compiles

Security

PowerShell capability narrowed to: Set-DnsClientServerAddress, Clear-DnsClientCache, Test-Connection, Get-NetAdapter, Get-DnsClientServerAddress, Resolve-DnsName

Summary by CodeRabbit

  • New Features

    • Added full Linux support for network diagnostics, DNS management, and system optimization features previously available on Windows only.
    • Upgraded to Tauri v2 with improved plugin architecture and multi-platform capabilities.
  • Bug Fixes

    • Improved network monitoring and diagnostic accuracy with native implementations.
    • Enhanced cross-platform reliability for DNS, speed testing, and system tools.
  • Chores

    • Migrated desktop framework dependencies to latest versions.

- dns.rs: +292 líneas con soporte Linux (nmcli, resolvectl, NetworkManager)
- dns_intelligence.rs: +50 líneas para apply real del failover al SO
  (antes solo actualizaba memoria, nunca llamaba a set_dns())
- Add Tauri gen/schemas y capabilities

loust <davidmirelesll@outlook.com>
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e4117ad-5d38-481a-8752-03152011e179

📥 Commits

Reviewing files that changed from the base of the PR and between d3f33f0 and 2987e82.

⛔ Files ignored due to path filters (5)
  • platforms/tauri/src-tauri/gen/schemas/acl-manifests.json is excluded by !**/gen/**
  • platforms/tauri/src-tauri/gen/schemas/capabilities.json is excluded by !**/gen/**
  • platforms/tauri/src-tauri/gen/schemas/desktop-schema.json is excluded by !**/gen/**
  • platforms/tauri/src-tauri/gen/schemas/linux-schema.json is excluded by !**/gen/**
  • platforms/tauri/src-tauri/icons/icon.png is excluded by !**/*.png
📒 Files selected for processing (26)
  • platforms/tauri/package.json
  • platforms/tauri/src-tauri/Cargo.toml
  • platforms/tauri/src-tauri/capabilities/migrated.json
  • platforms/tauri/src-tauri/src/commands/devtools.rs
  • platforms/tauri/src-tauri/src/commands/diagnostics.rs
  • platforms/tauri/src-tauri/src/commands/monitoring.rs
  • platforms/tauri/src-tauri/src/commands/network.rs
  • platforms/tauri/src-tauri/src/commands/optimizer.rs
  • platforms/tauri/src-tauri/src/commands/speedtest.rs
  • platforms/tauri/src-tauri/src/commands/updater.rs
  • platforms/tauri/src-tauri/src/main.rs
  • platforms/tauri/src-tauri/src/services/diagnostics.rs
  • platforms/tauri/src-tauri/src/services/dns.rs
  • platforms/tauri/src-tauri/src/services/dns_intelligence.rs
  • platforms/tauri/src-tauri/src/services/mod.rs
  • platforms/tauri/src-tauri/src/services/notifications.rs
  • platforms/tauri/src-tauri/src/tray.rs
  • platforms/tauri/src-tauri/tauri.conf.json
  • platforms/tauri/src/lib/api.ts
  • platforms/tauri/src/lib/components/DiagnosticChain.svelte
  • platforms/tauri/src/lib/components/NetworkDiagnostics.svelte
  • platforms/tauri/src/lib/components/UpdaterTab.svelte
  • platforms/tauri/src/lib/components/tabs/DashboardTab.svelte
  • platforms/tauri/src/lib/stores/alertStore.ts
  • platforms/tauri/src/lib/tauri-bridge.ts
  • platforms/tauri/src/routes/+page.svelte

📝 Walkthrough

Walkthrough

This PR migrates the Tauri desktop application from v1 to v2 APIs (dependencies, configuration, capability file, tray/notification plugins) and simultaneously adds Linux-native implementations across all backend Rust commands and services (DNS via NetworkManager/nmcli, diagnostics via ip/ping/nslookup, optimizer via sysctl, monitoring via /sys/class/net, updater via AppImage/xdg-open) and updates all Svelte frontend components to detect the runtime platform and render platform-appropriate labels, handlers, and tool actions.

Changes

Tauri v2 + Linux Cross-Platform Migration

Layer / File(s) Summary
Tauri v2 manifests and capability config
platforms/tauri/package.json, platforms/tauri/src-tauri/Cargo.toml, platforms/tauri/src-tauri/tauri.conf.json, platforms/tauri/src-tauri/capabilities/migrated.json, platforms/tauri/src/lib/tauri-bridge.ts
Bumps @tauri-apps/cli, @tauri-apps/api, and Tauri plugin npm packages to ^2; bumps tauri-build and tauri Cargo crates to 2 and adds four plugin crates; restructures tauri.conf.json with frontendDist/devUrl, useHttpsScheme, and security; adds migrated.json capability file with permissions for filesystem, shell, dialog, and notification; updates isTauriAvailable() to check __TAURI_INTERNALS__ and invoke import to @tauri-apps/api/core.
Tray and notification API migration to v2
platforms/tauri/src-tauri/src/tray.rs, platforms/tauri/src-tauri/src/services/notifications.rs
Replaces SystemTray/SystemTrayEvent with TrayIconBuilder/MenuBuilder/TrayIconEvent/MenuEvent; removes handle_system_tray_event, adds handle_tray_icon_event and handle_menu_event; replaces tauri::api::notification::Notification with tauri_plugin_notification::NotificationExt; changes all emit_all calls to emit.
DNS service: Linux NetworkManager support
platforms/tauri/src-tauri/src/services/dns.rs, platforms/tauri/src-tauri/src/services/dns_intelligence.rs, platforms/tauri/src-tauri/src/services/mod.rs
Adds non-Windows helpers (run_command_capture, virtual-interface detection, NM connection reapply, boolean normalization, DNS list parsing); gates run_powershell behind cfg(windows); makes get_primary_adapter, set_dns, reset_dns_to_dhcp, flush_dns_cache, ping_dns, and check_dns_resolution fully OS-conditional with nmcli/resolvectl on Linux. Adds consecutive_failures tracking to DnsMetrics, removes in-loop failover call from start(), and extends check_failover_static to call set_dns on the OS when failover triggers.
App entry point wiring
platforms/tauri/src-tauri/src/main.rs
Registers Tauri v2 plugins, replaces old tray builder with create_system_tray, adds CloseRequested → hide behavior, expands generate_handler! list, adds Linux helpers for locating programs and opening a terminal, changes non-Windows is_admin to run id -u, and adds Linux open_cli_manager path.
Diagnostics commands: Linux helpers and cross-platform tool actions
platforms/tauri/src-tauri/src/commands/diagnostics.rs, platforms/tauri/src-tauri/src/services/diagnostics.rs
Adds large cfg(not(windows)) Linux block for program discovery, network command helpers, adapter/gateway detection, Linux UI openers (network/system/terminal), and network snapshot file writer; makes run_windows_network_troubleshooter open Linux settings on non-Windows; adds Linux reset_network_stack via resolvectl/nmcli; rewires adapter/ping/DNS internals to linux_command wrappers; reformats diagnostic scoring and recommendation strings.
Network, optimizer, and monitoring commands: Linux cross-platform
platforms/tauri/src-tauri/src/commands/network.rs, platforms/tauri/src-tauri/src/commands/optimizer.rs, platforms/tauri/src-tauri/src/commands/monitoring.rs
Adds Linux sysfs/nmcli adapter discovery and DNS mutation helpers in network.rs; adds sysctl read/write helpers and Linux apply_profile_internal/reset_to_defaults_internal branches in optimizer.rs; splits get_adapter_metrics and measure_latency into cfg(not(windows)) sysfs/ip-route paths vs. PowerShell paths in monitoring.rs.
DevTools, speed test, and updater: reqwest and Linux support
platforms/tauri/src-tauri/src/commands/devtools.rs, platforms/tauri/src-tauri/src/commands/speedtest.rs, platforms/tauri/src-tauri/src/commands/updater.rs
Replaces PowerShell HTTP/ping/traceroute/port-scan/headers implementations with reqwest and native system commands in devtools.rs; changes emit_all to emit and updates ping median/jitter statistics in speedtest.rs; adds Linux AppImage executable-bit + spawn and xdg-open installer paths, changes download_update and get_downloads_path to take AppHandle for path resolution in updater.rs.
Frontend: platform detection and platform-aware UI
platforms/tauri/src/lib/components/DiagnosticChain.svelte, platforms/tauri/src/lib/components/NetworkDiagnostics.svelte, platforms/tauri/src/lib/components/UpdaterTab.svelte, platforms/tauri/src/lib/components/tabs/DashboardTab.svelte, platforms/tauri/src/lib/stores/alertStore.ts, platforms/tauri/src/lib/api.ts, platforms/tauri/src/routes/+page.svelte
Adds navigator.userAgent-based platform detection on mount in four Svelte components; replaces Windows-only troubleshooter/tool/download handlers with generic cross-platform invoke calls; adds reactive platform-dependent labels for buttons/titles; updates alertStore Tauri detection to __TAURI_INTERNALS__ and notification import to @tauri-apps/plugin-notification; adds Linux asset icons in UpdaterTab.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Poem

🐰 Hop, hop! The tray is new, the plugins aligned,
From v1 to v2, all packages resigned.
On Linux now, sysctl and nmcli play,
The rabbit rewired the DNS today!
emit replaced emit_all, the scopes now are right —
Cross-platform at last, oh what a delight! 🌟

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dns-failover-linux-nm

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@louzt louzt merged commit 8e4f3b1 into main Jun 15, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant