From ccbb9e90ea6d33c41ce4e9883970ad8db30ab284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 21 Jul 2025 20:23:38 +0800 Subject: [PATCH] Netif (Windows): fix default route detection when the default adapter is disabled This commit addresses an issue where the default route detection on Windows incorrectly identified a disabled adapter as the default route. Previously, when a user disabled the adapter configured as the default route, the system still reported it as active due to stale routing table entries. --- src/common/netif/netif_windows.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/netif/netif_windows.c b/src/common/netif/netif_windows.c index 6042dd8d6..54526864b 100644 --- a/src/common/netif/netif_windows.c +++ b/src/common/netif/netif_windows.c @@ -18,6 +18,8 @@ bool ffNetifGetDefaultRouteImpl(FF_MAYBE_UNUSED char iface[IF_NAMESIZE + 1], uin { MIB_IPFORWARD_ROW2* row = &pIpForwardTable->Table[i]; + if (row->Age > row->ValidLifetime) continue; + if ((row->DestinationPrefix.PrefixLength == 0) && ((row->DestinationPrefix.Prefix.Ipv4.sin_family == AF_INET && row->DestinationPrefix.Prefix.Ipv4.sin_addr.S_un.S_addr == 0) ||