wpasvc: Add skip_on_error registry value to skip interfaces on error
This can be used to include binding information for multiple interfaces in Windows registry and only use the ones that match with an available network interface.
This commit is contained in:
parent
4b4a8ae547
commit
f44b6b8c04
2 changed files with 16 additions and 3 deletions
|
@ -70,9 +70,10 @@ static int read_interface(struct wpa_global *global, HKEY _hk,
|
||||||
HKEY hk;
|
HKEY hk;
|
||||||
#define TBUFLEN 255
|
#define TBUFLEN 255
|
||||||
TCHAR adapter[TBUFLEN], config[TBUFLEN], ctrl_interface[TBUFLEN];
|
TCHAR adapter[TBUFLEN], config[TBUFLEN], ctrl_interface[TBUFLEN];
|
||||||
DWORD buflen;
|
DWORD buflen, val;
|
||||||
LONG ret;
|
LONG ret;
|
||||||
struct wpa_interface iface;
|
struct wpa_interface iface;
|
||||||
|
int skip_on_error = 0;
|
||||||
|
|
||||||
ret = RegOpenKeyEx(_hk, name, 0, KEY_QUERY_VALUE, &hk);
|
ret = RegOpenKeyEx(_hk, name, 0, KEY_QUERY_VALUE, &hk);
|
||||||
if (ret != ERROR_SUCCESS) {
|
if (ret != ERROR_SUCCESS) {
|
||||||
|
@ -116,10 +117,21 @@ static int read_interface(struct wpa_global *global, HKEY _hk,
|
||||||
iface.confname = (char *) config;
|
iface.confname = (char *) config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buflen = sizeof(val);
|
||||||
|
ret = RegQueryValueEx(hk, TEXT("skip_on_error"), NULL, NULL,
|
||||||
|
(LPBYTE) &val, &buflen);
|
||||||
|
if (ret == ERROR_SUCCESS && buflen == sizeof(val))
|
||||||
|
skip_on_error = val;
|
||||||
|
|
||||||
RegCloseKey(hk);
|
RegCloseKey(hk);
|
||||||
|
|
||||||
if (wpa_supplicant_add_iface(global, &iface) == NULL)
|
if (wpa_supplicant_add_iface(global, &iface) == NULL) {
|
||||||
|
if (skip_on_error)
|
||||||
|
wpa_printf(MSG_DEBUG, "Skipped interface '%s' due to "
|
||||||
|
"initialization failure", iface.ifname);
|
||||||
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,5 @@ REGEDIT4
|
||||||
"adapter"="{A7627643-C310-49E5-BD89-7E77709C04AB}"
|
"adapter"="{A7627643-C310-49E5-BD89-7E77709C04AB}"
|
||||||
"config"="test"
|
"config"="test"
|
||||||
"ctrl_interface"=""
|
"ctrl_interface"=""
|
||||||
|
"skip_on_error"=dword:00000000
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue