[PATCH v2] wifi: disconnect if wpa_s state changes from completed to scanning

2015-05-06 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

It's possible from wpa_s to change the state from completed to scanning
without going through disconnected state if interface signals that the carrier
went off and on (IFF_LOWER_UP flag).

This will cause dead lock similar in c810464828d6764bea304de3e9b6b151aa05e313
if the wifi gets into associating state as the network-connected is still true
but wifi-connected is not.
---
 plugins/wifi.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index d0d7917..046373c 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2341,6 +2341,9 @@ static void interface_state(GSupplicantInterface 
*interface)
 
switch (state) {
case G_SUPPLICANT_STATE_SCANNING:
+   if (wifi-connected)
+   connman_network_set_connected(network, false);
+
break;
 
case G_SUPPLICANT_STATE_AUTHENTICATING:
@@ -2435,6 +2438,14 @@ static void interface_state(GSupplicantInterface 
*interface)
else
wifi-connected = false;
break;
+   case G_SUPPLICANT_STATE_SCANNING:
+   if (wifi-connected) {
+   wifi-connected = false;
+   start_autoscan(device);
+   } else {
+   wifi-connected = false;
+   }
+   break;
case G_SUPPLICANT_STATE_COMPLETED:
wifi-connected = true;
break;
-- 
2.1.4

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Re: [PATCH v2] wifi: disconnect if wpa_s state changes from completed to scanning

2015-05-06 Thread Pasi Sjöholm
Hi Tomasz,

On 06.05.2015 13:46, Tomasz Bursztyka wrote:
 +case G_SUPPLICANT_STATE_SCANNING: +if
 (wifi-connected) { +wifi-connected = false; +
 start_autoscan(device); +} else { +
 wifi-connected = false; +}
 You could remove the else { } (but keep the inner statement)

Done.

 With a unique wifi device, once connected, it is still possible to
 do a scan (and it stays connected of course). Can you check if your
 patch does not break this?

Yes, scanning still works (nothing gets disconnected) and wpa_s does
not change the interface state from completed to anything else while
doing extra scans while being connected.

Br,
Pasi
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH v2] wifi: disconnect if wpa_s state changes from completed to scanning

2015-05-06 Thread Tomasz Bursztyka

Hi Pasi,


+   case G_SUPPLICANT_STATE_SCANNING:
+   if (wifi-connected) {
+   wifi-connected = false;
+   start_autoscan(device);
+   } else {
+   wifi-connected = false;
+   }


You could remove the else { } (but keep the inner statement)

With a unique wifi device, once connected, it is still possible to do a 
scan (and it stays connected of course).

Can you check if your patch does not break this?

Tomasz
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman