1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-06 09:40:41 +03:00

Exclude inactive routes in Windows routing management

This commit is contained in:
Yihong Wu 2022-09-16 17:25:11 +09:00
parent ac04c469c7
commit 05fa675d5a
2 changed files with 11 additions and 1 deletions

View File

@ -9414,8 +9414,16 @@ RETRY:
{ {
e = ZeroMallocFast(sizeof(ROUTE_ENTRY)); e = ZeroMallocFast(sizeof(ROUTE_ENTRY));
Win32IpForwardRow2ToRouteEntry(e, &p->Table[i]); Win32IpForwardRow2ToRouteEntry(e, &p->Table[i]);
if (e->Active)
{
Add(o, e); Add(o, e);
} }
else
{
FreeRouteEntry(e);
}
}
FreeMibTable(p); FreeMibTable(p);
// Sort by metric // Sort by metric
@ -9573,6 +9581,7 @@ void Win32IpForwardRow2ToRouteEntry(ROUTE_ENTRY *entry, void *ip_forward_row)
{ {
entry->IfMetric = p->Metric; entry->IfMetric = p->Metric;
entry->Metric = r->Metric + p->Metric; entry->Metric = r->Metric + p->Metric;
entry->Active = p->Connected;
} }
else else
{ {

View File

@ -293,6 +293,7 @@ struct ROUTE_ENTRY
UINT IfMetric; UINT IfMetric;
UINT InterfaceID; UINT InterfaceID;
UINT64 InnerScore; UINT64 InnerScore;
bool Active;
}; };
// Routing table // Routing table