From ba8c61fe9a69e87aa6c2b75b42636f9bd217afa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georg=20M=C3=BCller?= Date: Fri, 19 Feb 2021 14:34:19 +0100 Subject: [PATCH] supplicant: disable wps in wpa supplicant if disabled in config Before this commit, in AP mode, WPS is started by default and there is no possibility to disable it. The methods provided as WPS sources seem to differ from device to device. With some Wifi USB sticks running in AP mode, the WPS config methods contain "Keypad". Then, I get a pin entry dialog on Windows machines, even if no pin is configured. This merge request wires the existing 802-11-wireless-security.wps-method with wpa_supplicant's configuration to allow disabling WPS. --- src/core/supplicant/nm-supplicant-config.c | 9 ++++++++- src/core/supplicant/nm-supplicant-settings-verify.c | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/supplicant/nm-supplicant-config.c b/src/core/supplicant/nm-supplicant-config.c index 1f27ab80dd..9a77d03e6f 100644 --- a/src/core/supplicant/nm-supplicant-config.c +++ b/src/core/supplicant/nm-supplicant-config.c @@ -815,7 +815,7 @@ nm_supplicant_config_add_setting_wireless_security(NMSupplicantConfig * nm_auto_free_gstring GString *key_mgmt_conf = NULL; const char * key_mgmt, *auth_alg; const char * psk; - gboolean set_pmf; + gboolean set_pmf, wps_disabled; g_return_val_if_fail(NM_IS_SUPPLICANT_CONFIG(self), FALSE); g_return_val_if_fail(setting != NULL, FALSE); @@ -1102,6 +1102,13 @@ nm_supplicant_config_add_setting_wireless_security(NMSupplicantConfig * } } + wps_disabled = (nm_setting_wireless_security_get_wps_method(setting) + == NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED); + if (wps_disabled) { + if (!nm_supplicant_config_add_option(self, "wps_disabled", "1", 1, NULL, error)) + return FALSE; + } + return TRUE; } diff --git a/src/core/supplicant/nm-supplicant-settings-verify.c b/src/core/supplicant/nm-supplicant-settings-verify.c index 3f0a33e0af..5e77b2076c 100644 --- a/src/core/supplicant/nm-supplicant-settings-verify.c +++ b/src/core/supplicant/nm-supplicant-settings-verify.c @@ -144,6 +144,7 @@ static const struct Opt opt_table[] = { OPT_BYTES("wep_key2", 0), OPT_BYTES("wep_key3", 0), OPT_INT("wep_tx_keyidx", 0, 3), + OPT_INT("wps_disabled", 0, 1), }; static gboolean