# Config Methods
# List of the supported configuration methods
+# Available methods: usba ethernet label display ext_nfc_token int_nfc_token
+# nfc_interface push_button keypad
#config_methods=label display push_button keypad
# Access point PIN for initial configuration and adding Registrars
os_strdup(hapd->conf->model_number) : NULL;
wps->dev.serial_number = hapd->conf->serial_number ?
os_strdup(hapd->conf->serial_number) : NULL;
- if (hapd->conf->config_methods) {
- char *m = hapd->conf->config_methods;
- if (os_strstr(m, "label"))
- wps->config_methods |= WPS_CONFIG_LABEL;
- if (os_strstr(m, "display"))
- wps->config_methods |= WPS_CONFIG_DISPLAY;
- if (os_strstr(m, "push_button"))
- wps->config_methods |= WPS_CONFIG_PUSHBUTTON;
- if (os_strstr(m, "keypad"))
- wps->config_methods |= WPS_CONFIG_KEYPAD;
- }
+ wps->config_methods =
+ wps_config_methods_str2bin(hapd->conf->config_methods);
if (hapd->conf->device_type &&
wps_dev_type_str2bin(hapd->conf->device_type,
wps->dev.pri_dev_type) < 0) {
char * wps_dev_type_bin2str(const u8 dev_type[WPS_DEV_TYPE_LEN], char *buf,
size_t buf_len);
void uuid_gen_mac_addr(const u8 *mac_addr, u8 *uuid);
+u16 wps_config_methods_str2bin(const char *str);
#endif /* WPS_H */
/* Variant specified in RFC 4122 */
uuid[8] = 0x80 | (uuid[8] & 0x3f);
}
+
+
+u16 wps_config_methods_str2bin(const char *str)
+{
+ u16 methods = 0;
+
+ if (str == NULL) {
+ /* Default to enabling methods based on build configuration */
+ methods |= WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY |
+ WPS_CONFIG_KEYPAD;
+#ifdef CONFIG_WPS_UFD
+ methods |= WPS_CONFIG_USBA;
+#endif /* CONFIG_WPS_UFD */
+#ifdef CONFIG_WPS_NFC
+ methods |= WPS_CONFIG_NFC_INTERFACE;
+#endif /* CONFIG_WPS_NFC */
+ } else {
+ if (os_strstr(str, "usba"))
+ methods |= WPS_CONFIG_USBA;
+ if (os_strstr(str, "ethernet"))
+ methods |= WPS_CONFIG_ETHERNET;
+ if (os_strstr(str, "label"))
+ methods |= WPS_CONFIG_LABEL;
+ if (os_strstr(str, "display"))
+ methods |= WPS_CONFIG_DISPLAY;
+ if (os_strstr(str, "ext_nfc_token"))
+ methods |= WPS_CONFIG_EXT_NFC_TOKEN;
+ if (os_strstr(str, "int_nfc_token"))
+ methods |= WPS_CONFIG_INT_NFC_TOKEN;
+ if (os_strstr(str, "nfc_interface"))
+ methods |= WPS_CONFIG_NFC_INTERFACE;
+ if (os_strstr(str, "push_button"))
+ methods |= WPS_CONFIG_PUSHBUTTON;
+ if (os_strstr(str, "keypad"))
+ methods |= WPS_CONFIG_KEYPAD;
+ }
+
+ return methods;
+}
static struct wpabuf * wps_build_m1(struct wps_data *wps)
{
struct wpabuf *msg;
- u16 methods;
if (os_get_random(wps->nonce_e, WPS_NONCE_LEN) < 0)
return NULL;
if (msg == NULL)
return NULL;
- methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD;
-#ifdef CONFIG_WPS_UFD
- methods |= WPS_CONFIG_USBA;
-#endif /* CONFIG_WPS_UFD */
-#ifdef CONFIG_WPS_NFC
- methods |= WPS_CONFIG_NFC_INTERFACE;
-#endif /* CONFIG_WPS_NFC */
- if (wps->pbc)
- methods |= WPS_CONFIG_PUSHBUTTON;
-
if (wps_build_version(msg) ||
wps_build_msg_type(msg, WPS_M1) ||
wps_build_uuid_e(msg, wps->uuid_e) ||
wps_build_auth_type_flags(wps, msg) ||
wps_build_encr_type_flags(wps, msg) ||
wps_build_conn_type_flags(wps, msg) ||
- wps_build_config_methods(msg, methods) ||
+ wps_build_config_methods(msg, wps->wps->config_methods) ||
wps_build_wps_state(wps, msg) ||
wps_build_device_attrs(&wps->wps->dev, msg) ||
wps_build_rf_bands(&wps->wps->dev, msg) ||
os_free(config->model_number);
os_free(config->serial_number);
os_free(config->device_type);
+ os_free(config->config_methods);
os_free(config->pssid);
os_free(config);
}
char *device_type;
/**
+ * config_methods - Config Methods
+ *
+ * This is a space-separated list of supported WPS configuration
+ * methods. For example, "label display push_button keypad".
+ * Available methods: usba ethernet label display ext_nfc_token
+ * int_nfc_token nfc_interface push_button keypad.
+ */
+ char *config_methods;
+
+ /**
* os_version - OS Version (WPS)
* 4-octet operating system version number
*/
{ STR_RANGE(serial_number, 0, 32) },
{ STR(device_type) },
{ FUNC(os_version) },
+ { STR(config_methods) },
{ INT_RANGE(wps_cred_processing, 0, 2) },
#endif /* CONFIG_WPS */
{ FUNC(country) }
if (WPA_GET_BE32(config->os_version))
fprintf(f, "os_version=%08x\n",
WPA_GET_BE32(config->os_version));
+ if (config->config_methods)
+ fprintf(f, "config_methods=%s\n", config->config_methods);
if (config->wps_cred_processing)
fprintf(f, "wps_cred_processing=%d\n",
config->wps_cred_processing);
hk, TEXT("serial_number"));
config->device_type = wpa_config_read_reg_string(
hk, TEXT("device_type"));
+ config->config_methods = wpa_config_read_reg_string(
+ hk, TEXT("config_methods"));
if (wpa_config_read_global_os_version(config, hk))
errors++;
wpa_config_read_reg_dword(hk, TEXT("wps_cred_processing"),
wpa_config_write_reg_string(hk, "serial_number",
config->serial_number);
wpa_config_write_reg_string(hk, "device_type", config->device_type);
+ wpa_config_write_reg_string(hk, "config_methods",
+ config->config_methods);
if (WPA_GET_BE32(config->os_version)) {
char vbuf[10];
os_snprintf(vbuf, sizeof(vbuf), "%08x",
# 4-octet operating system version number (hex string)
#os_version=01020300
+# Config Methods
+# List of the supported configuration methods
+# Available methods: usba ethernet label display ext_nfc_token int_nfc_token
+# nfc_interface push_button keypad
+#config_methods=label display push_button keypad
+
# Credential processing
# 0 = process received credentials internally (default)
# 1 = do not process received credentials; just pass them over ctrl_iface to
wps->dev.model_name = wpa_s->conf->model_name;
wps->dev.model_number = wpa_s->conf->model_number;
wps->dev.serial_number = wpa_s->conf->serial_number;
+ wps->config_methods =
+ wps_config_methods_str2bin(wpa_s->conf->config_methods);
if (wpa_s->conf->device_type &&
wps_dev_type_str2bin(wpa_s->conf->device_type,
wps->dev.pri_dev_type) < 0) {
wps_er_refresh(wpa_s->wps_er);
return 0;
}
- wpa_s->wps->config_methods |= WPS_CONFIG_DISPLAY;
- wpa_s->wps->config_methods |= WPS_CONFIG_KEYPAD;
wpa_s->wps_er = wps_er_init(wpa_s->wps, wpa_s->ifname);
if (wpa_s->wps_er == NULL)
return -1;