Skip to content

Commit ab264f7

Browse files
committed
ipc: windows: don't display disabled adapters
Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 01dcad9 commit ab264f7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ipc-windows.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static int kernel_get_wireguard_interfaces(struct string_list *list)
3737
SP_DEVINFO_DATA dev_info_data = { .cbSize = sizeof(SP_DEVINFO_DATA) };
3838
HKEY key;
3939
GUID instance_id;
40+
ULONG status, problem_code;
4041
char *interface_name;
4142
struct hashtable_entry *entry;
4243

@@ -110,7 +111,9 @@ static int kernel_get_wireguard_interfaces(struct string_list *list)
110111
goto cleanup_buf;
111112
}
112113

113-
string_list_add(list, interface_name);
114+
if (CM_Get_DevNode_Status(&status, &problem_code, dev_info_data.DevInst, 0) == CR_SUCCESS &&
115+
(status & (DN_DRIVER_LOADED | DN_STARTED)) == (DN_DRIVER_LOADED | DN_STARTED))
116+
string_list_add(list, interface_name);
114117

115118
entry = hashtable_find_or_insert_entry(&cached_kernel_interfaces, interface_name);
116119
free(interface_name);

0 commit comments

Comments
 (0)