1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-26 11:29:53 +03:00

Fix 'RemoveDefGwOnDhcpForLocalhost' function: Change to exclude unplugged device from MAC address list.

This commit is contained in:
hiura 2024-03-31 23:07:16 +09:00
parent e8c14cba68
commit 97203568e7
3 changed files with 9 additions and 0 deletions

View File

@ -2568,6 +2568,7 @@ MS_ADAPTER_LIST *MsCreateAdapterListInnerExVista(bool no_info)
UniStrCpy(a->TitleW, sizeof(a->TitleW), title); UniStrCpy(a->TitleW, sizeof(a->TitleW), title);
UniToStr(a->Title, sizeof(a->Title), title); UniToStr(a->Title, sizeof(a->Title), title);
a->Index = r->InterfaceIndex; a->Index = r->InterfaceIndex;
a->MediaConnectState = r->MediaConnectState;
a->Type = r->Type; a->Type = r->Type;
a->Status = ConvertMidStatusVistaToXp(r->OperStatus); a->Status = ConvertMidStatusVistaToXp(r->OperStatus);
a->Mtu = r->Mtu; a->Mtu = r->Mtu;

View File

@ -281,6 +281,7 @@ typedef struct MS_ADAPTER
char Title[MAX_PATH]; // Display name char Title[MAX_PATH]; // Display name
wchar_t TitleW[MAX_PATH]; // Display Name (Unicode) wchar_t TitleW[MAX_PATH]; // Display Name (Unicode)
UINT Index; // Index UINT Index; // Index
UINT MediaConnectState; // Media Connect State
UINT Type; // Type UINT Type; // Type
UINT Status; // Status UINT Status; // Status
UINT Mtu; // MTU UINT Mtu; // MTU

View File

@ -540,6 +540,13 @@ LIST *Win32GetNicList()
if (a->Type == 6 && a->AddressSize == 6) if (a->Type == 6 && a->AddressSize == 6)
{ {
// If the connection state of the interface is unknown, then exclude it.
// Unknown means that the device is not plugged into the local host.
if (a->MediaConnectState == MediaConnectStateUnknown)
{
continue;
}
NIC_ENTRY *e = ZeroMalloc(sizeof(NIC_ENTRY)); NIC_ENTRY *e = ZeroMalloc(sizeof(NIC_ENTRY));
StrCpy(e->IfName, sizeof(e->IfName), a->Title); StrCpy(e->IfName, sizeof(e->IfName), a->Title);