tun: Add openvpn componentid prefix

Some drivers use root prefix. See https://patchwork.openvpn.net/patch/555/

Hopefully helping with bugs #46 and #73.
This commit is contained in:
Erik Ekman 2022-07-18 23:23:34 +02:00
parent 1df7d235f5
commit 17169e3444

View File

@ -61,6 +61,7 @@ static void get_name(char *ifname, int namelen, char *dev_name);
#define TAP_DEVICE_SPACE "\\\\.\\Global\\"
#define TAP_VERSION_ID_0801 "tap0801"
#define TAP_VERSION_ID_0901 "tap0901"
#define TAP_VERSION_ID_0901_ROOT "root\\tap0901"
#define KEY_COMPONENT_ID "ComponentId"
#define NET_CFG_INST_ID "NetCfgInstanceId"
#else
@ -193,7 +194,8 @@ get_device(char *device, int device_len, const char *wanted_dev)
goto next;
}
if (strncmp(TAP_VERSION_ID_0801, component, strlen(TAP_VERSION_ID_0801)) == 0 ||
strncmp(TAP_VERSION_ID_0901, component, strlen(TAP_VERSION_ID_0901)) == 0) {
strncmp(TAP_VERSION_ID_0901, component, strlen(TAP_VERSION_ID_0901)) == 0 ||
strncmp(TAP_VERSION_ID_0901_ROOT, component, strlen(TAP_VERSION_ID_0901_ROOT)) == 0) {
/* We found a TAP32 device, get its NetCfgInstanceId */
char iid_string[256] = NET_CFG_INST_ID;