diff --git a/src/common/netif/netif_linux.c b/src/common/netif/netif_linux.c index 49976b695..7867d1a1e 100644 --- a/src/common/netif/netif_linux.c +++ b/src/common/netif/netif_linux.c @@ -151,6 +151,12 @@ bool ffNetifGetDefaultRouteImplV4(FFNetifDefaultRouteResult* result) continue; } + // Skip local/loopback routes + if (rtm->rtm_scope == RT_SCOPE_HOST || rtm->rtm_type == RTN_LOCAL) { + FF_DEBUG("Skipping local route #%d (scope=%d, type=%d)", routeCount, rtm->rtm_scope, rtm->rtm_type); + continue; + } + FF_DEBUG("Processing IPv4 default route candidate #%d", routeCount); entry = (__typeof__(entry)) { }; // Default to zero metric (no RTA_PRIORITY found) @@ -360,6 +366,12 @@ bool ffNetifGetDefaultRouteImplV6(FFNetifDefaultRouteResult* result) continue; } + // Skip local/loopback routes + if (rtm->rtm_scope == RT_SCOPE_HOST || rtm->rtm_type == RTN_LOCAL) { + FF_DEBUG("Skipping local route #%d (scope=%d, type=%d)", routeCount, rtm->rtm_scope, rtm->rtm_type); + continue; + } + FF_DEBUG("Processing IPv6 default route candidate #%d", routeCount); entry = (__typeof__(entry)) { }; // Default to zero metric (no RTA_PRIORITY found)