From 0fb531e4bc8227eaac7ca6d9c9dca34a89b8f531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Tue, 23 Jun 2026 01:20:46 +0200 Subject: [PATCH] [client] Treat missing default route per protocol in next-hop check A failed GetNextHop lookup is now treated as an absent route (zero Nexthop) and compared per protocol, instead of forcing a restart. In a single-stack network the missing IPv6 default route no longer counts as a change on every debounce, which previously defeated the unchanged-route check. --- client/internal/networkmonitor/monitor.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/client/internal/networkmonitor/monitor.go b/client/internal/networkmonitor/monitor.go index b80bf9b69..b3fa82e52 100644 --- a/client/internal/networkmonitor/monitor.go +++ b/client/internal/networkmonitor/monitor.go @@ -141,14 +141,12 @@ func (nw *NetworkMonitor) checkChanges(ctx context.Context, event chan struct{}, } // nexthopChanged reports whether the current default next hop differs from the -// given baseline. A lookup error is treated as a change so we fail safe and -// restart rather than miss a real network change. +// given baseline, per protocol. A failed lookup is treated as an absent route +// (zero Nexthop), so a protocol that had no default route to begin with (e.g. +// IPv6 in a single-stack network) does not by itself count as a change. func nexthopChanged(oldv4, oldv6 systemops.Nexthop) bool { - newv4, errv4 := systemops.GetNextHop(netip.IPv4Unspecified()) - newv6, errv6 := systemops.GetNextHop(netip.IPv6Unspecified()) - if errv4 != nil || errv6 != nil { - return true - } + newv4, _ := systemops.GetNextHop(netip.IPv4Unspecified()) + newv6, _ := systemops.GetNextHop(netip.IPv6Unspecified()) return !sameNexthop(oldv4, newv4) || !sameNexthop(oldv6, newv6) }