WPS: Make testing operations configurable at runtime
Instead of build time options (CONFIG_WPS_TESTING_EXTRA_CRED and CONFIG_WPS_EXTENSIBILITY_TESTING), use a single build option (CONFIG_WPS_TESTING) and runtime configuration of which testing operations are enabled. This allows a single binary to be used for various tests. The runtime configuration can be done through control interface with wpa_cli/hostapd_cli commands: Enable extensibility tests: set wps_version_number 0x57 Disable extensibility tests (WPS2 build): set wps_version_number 0x20 Enable extra credential tests: set wps_testing_dummy_cred 1 Disable extra credential tests: set wps_testing_dummy_cred 0
This commit is contained in:
parent
ab98525399
commit
b4e34f2fdf
9 changed files with 124 additions and 14 deletions
|
@ -559,6 +559,10 @@ CFLAGS += -DCONFIG_WPS_STRICT
|
|||
OBJS += ../src/wps/wps_validate.o
|
||||
endif
|
||||
|
||||
ifdef CONFIG_WPS_TESTING
|
||||
CFLAGS += -DCONFIG_WPS_TESTING
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifdef CONFIG_EAP_IKEV2
|
||||
|
|
|
@ -84,6 +84,26 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
|
|||
ret = -1;
|
||||
} else if (os_strcasecmp(cmd, "wps_fragment_size") == 0) {
|
||||
wpa_s->wps_fragment_size = atoi(value);
|
||||
#ifdef CONFIG_WPS_TESTING
|
||||
} else if (os_strcasecmp(cmd, "wps_version_number") == 0) {
|
||||
long int val;
|
||||
val = strtol(value, NULL, 0);
|
||||
if (val < 0 || val > 0xff) {
|
||||
ret = -1;
|
||||
wpa_printf(MSG_DEBUG, "WPS: Invalid "
|
||||
"wps_version_number %ld", val);
|
||||
} else {
|
||||
wps_version_number = val;
|
||||
wpa_printf(MSG_DEBUG, "WPS: Testing - force WPS "
|
||||
"version %u.%u",
|
||||
(wps_version_number & 0xf0) >> 4,
|
||||
wps_version_number & 0x0f);
|
||||
}
|
||||
} else if (os_strcasecmp(cmd, "wps_testing_dummy_cred") == 0) {
|
||||
wps_testing_dummy_cred = atoi(value);
|
||||
wpa_printf(MSG_DEBUG, "WPS: Testing - dummy_cred=%d",
|
||||
wps_testing_dummy_cred);
|
||||
#endif /* CONFIG_WPS_TESTING */
|
||||
} else if (os_strcasecmp(cmd, "ampdu") == 0) {
|
||||
if (wpa_drv_ampdu(wpa_s, atoi(value)) < 0)
|
||||
ret = -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue