[PATCH] gsupplicant: rely on wpa_supplicant retry mechanism

2013-12-12 Thread Philippe Coval
When connecting WiFi with a wrong passphrase,
connman is longer than it should to cancel the attempt.

The effect is this change, is to have a quicker feedback to the agent
in charge of passphrase input.

Since, Wpa_supplicant 2.0 and later
is already managing its own retry mechanism,
let's use it because it's overkill to have this also inside comman
and even more if it add an unnecessary delay.

Note, that for earlier versions of wpa_supplicant this change may be reverted,
while for later ones (2.0 to HEAD/2013-12-10),
it's resulting a 10 secs improvement
(observed the whole test is now 10s vs 20s between two user's attempts).

Let me credit Liu Guoqiang and Tomasz Bursztyka
for helping to solve this problem.

Fixes CM-655

Change-Id: I38877df1df4e074b86871628ae42376e95638539
---
 plugins/wifi.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index f7fbe86..09272eb 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -58,8 +58,7 @@
 
 #define CLEANUP_TIMEOUT   8/* in seconds */
 #define INACTIVE_TIMEOUT  12   /* in seconds */
-#define MAXIMUM_RETRIES   2
-#define FAVORITE_MAXIMUM_RETRIES 4
+#define FAVORITE_MAXIMUM_RETRIES 2
 
 #define BGSCAN_DEFAULT simple:30:-45:300
 #define AUTOSCAN_DEFAULT exponential:3:300
@@ -1615,8 +1614,7 @@ static bool 
handle_4way_handshake_failure(GSupplicantInterface *interface,
if (connman_service_get_favorite(service)) {
if (wifi-retries  FAVORITE_MAXIMUM_RETRIES)
return true;
-   } else if (wifi-retries  MAXIMUM_RETRIES)
-   return true;
+   }
 
wifi-retries = 0;
connman_network_set_error(network, CONNMAN_NETWORK_ERROR_INVALID_KEY);
-- 
1.8.1.2

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


Connman-1.20 services scan does not return hidden networks.

2013-12-12 Thread Sameer Naik
Hello,

I updated to connman-1.20 and found that hidden wifi networks are not
returned when scanning for services. Upon inspection I found that commit
#363393cfb1a5f95f8892f40662486c87b80d0091 is where the breakage occurs.

For reference, please find the commit message below:

commit 363393cfb1a5f95f8892f40662486c87b80d0091
Author: Daniel Wagner daniel.wag...@bmw-carit.de
Date:   Mon Dec 2 13:50:25 2013 +0100

gsupplicant: Fix empty string test

The address of an array is never NULL, so the comparison will
always evaluate the same way. Instead test for the length
of the SSID.

Reported by coverity.

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


[PATCH] gsupplicant: A network ssid of length 0 is valid, it's an hidden one

2013-12-12 Thread Tomasz Bursztyka
In case of an hidden AP around, its ssid has a length of 0, but it is
obviously a valid network anyway.

Fixes such regression from commit 363393cfb1a5f95f8892f40662486c87b80d0091

Reported by Sameer Naik
---
 gsupplicant/supplicant.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 23ea41a..559dfbc 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -853,7 +853,7 @@ const char 
*g_supplicant_network_get_security(GSupplicantNetwork *network)
 const void *g_supplicant_network_get_ssid(GSupplicantNetwork *network,
unsigned int *ssid_len)
 {
-   if (!network || network-ssid_len == 0) {
+   if (!network) {
*ssid_len = 0;
return NULL;
}
-- 
1.8.4.4

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


Re: [PATCH] gsupplicant: A network ssid of length 0 is valid, it's an hidden one

2013-12-12 Thread Daniel Wagner
Hi Thomas,

On 12/12/2013 02:57 PM, Tomasz Bursztyka wrote:
 In case of an hidden AP around, its ssid has a length of 0, but it is
 obviously a valid network anyway.
 
 Fixes such regression from commit 363393cfb1a5f95f8892f40662486c87b80d0091

Ooops, sorry about that.


 Reported by Sameer Naik
 ---
  gsupplicant/supplicant.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
 index 23ea41a..559dfbc 100644
 --- a/gsupplicant/supplicant.c
 +++ b/gsupplicant/supplicant.c
 @@ -853,7 +853,7 @@ const char 
 *g_supplicant_network_get_security(GSupplicantNetwork *network)
  const void *g_supplicant_network_get_ssid(GSupplicantNetwork *network,
   unsigned int *ssid_len)
  {
 - if (!network || network-ssid_len == 0) {
 + if (!network) {
   *ssid_len = 0;
   return NULL;
   }
 

Just out of curiosity, what is then the contents of network-ssid?

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


Re: [PATCH] gsupplicant: A network ssid of length 0 is valid, it's an hidden one

2013-12-12 Thread Daniel Wagner
Hi Tomasz,

On 12/12/2013 04:52 PM, Daniel Wagner wrote:
 On 12/12/2013 02:57 PM, Tomasz Bursztyka wrote:
 In case of an hidden AP around, its ssid has a length of 0, but it is
 obviously a valid network anyway.

 Fixes such regression from commit 363393cfb1a5f95f8892f40662486c87b80d0091
 
 Ooops, sorry about that.
 
 
 Reported by Sameer Naik
 ---
  gsupplicant/supplicant.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
 index 23ea41a..559dfbc 100644
 --- a/gsupplicant/supplicant.c
 +++ b/gsupplicant/supplicant.c
 @@ -853,7 +853,7 @@ const char 
 *g_supplicant_network_get_security(GSupplicantNetwork *network)
  const void *g_supplicant_network_get_ssid(GSupplicantNetwork *network,
  unsigned int *ssid_len)
  {
 -if (!network || network-ssid_len == 0) {
 +if (!network) {
  *ssid_len = 0;
  return NULL;
  }

 
 Just out of curiosity, what is then the contents of network-ssid?

I enabled my brain, got the answer :)

brainless greetigs,
daniel
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] gsupplicant: A network ssid of length 0 is valid, it's an hidden one

2013-12-12 Thread Tomasz Bursztyka

Hi Daniel,


I enabled my brain, got the answer:)

brainless greetigs,


And guess who reviewed your patch and thought it was totally fine ;)

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