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.
This commit is contained in:
李通洲
2025-07-21 20:23:38 +08:00
parent d07fe997a9
commit ccbb9e90ea
+2
View File
@@ -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) ||