This fixes the issue when given psk is incorrect as a value, not in its
format. Agent API will then handle it as it should to request a retry or not.
---
 plugins/wifi.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index a9d7871..d8c2019 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -935,6 +935,20 @@ static void interface_state(GSupplicantInterface 
*interface)
 
                if (is_idle(wifi))
                        break;
+
+               /* If previous state was 4way-handshake, then
+                * it most probably means psk was incorrect */
+               if (wifi->state == G_SUPPLICANT_STATE_4WAY_HANDSHAKE) {
+                       /* We disable the selected network, if not then
+                        * wpa_supplicant will loop retrying */
+                       if (g_supplicant_interface_disable_selected_network(
+                                                       interface) != 0)
+                               DBG("Could not disables selected network");
+
+                       connman_network_set_error(network,
+                                       CONNMAN_NETWORK_ERROR_INVALID_KEY);
+               }
+
                connman_network_set_associating(network, FALSE);
                connman_network_set_connected(network, FALSE);
                break;
-- 
1.7.3.4

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to