ipc: windows: don't display disabled adapters

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2021-06-30 01:56:24 +02:00
parent c70bea7a31
commit fabe24df3a
1 changed files with 4 additions and 1 deletions

View File

@ -37,6 +37,7 @@ static int kernel_get_wireguard_interfaces(struct string_list *list)
SP_DEVINFO_DATA dev_info_data = { .cbSize = sizeof(SP_DEVINFO_DATA) };
HKEY key;
GUID instance_id;
ULONG status, problem_code;
char *interface_name;
struct hashtable_entry *entry;
@ -110,7 +111,9 @@ static int kernel_get_wireguard_interfaces(struct string_list *list)
goto cleanup_buf;
}
string_list_add(list, interface_name);
if (CM_Get_DevNode_Status(&status, &problem_code, dev_info_data.DevInst, 0) == CR_SUCCESS &&
(status & (DN_DRIVER_LOADED | DN_STARTED)) == (DN_DRIVER_LOADED | DN_STARTED))
string_list_add(list, interface_name);
entry = hashtable_find_or_insert_entry(&cached_kernel_interfaces, interface_name);
free(interface_name);