From: zzhang0 <[email protected]>
In current connman implementation, when user connect a hidden wifi service
successfully, and then disconnect it, if connect to the hidden wifi service
again immediately, it will return fail. And the test steps are described below:
1. ./connect-service <ssid> [passphrase] [security]
2. ./test-connman disconnect <service>
3. ./connect-service <ssid> [passphrase] [security] or ./test-connman connect
<service>
It will return net.connman.Error.Failed and can't connect to the service
successfully.
The root cause is described below:
When to connect a hidden wifi service, it will create a network with identifier
hidden_xx,
and then in wifi plugin network_added(), when it searches the network with the
identifier
which format is ssid_mode_security, it can't find it and will create another
network with
this identifier, which is the same as network group(ssid_mode_security). We can
find that
it's wrong in wifi plugin to create another network when connecting to hidden
wifi service.
And then when disconnecting the service, in wifi plugin network_removed(), it
will unregister
the network with the identifier hidden_xx immediately, and set the
network->device to be NULL,
which leads to reconnecting to this hidden wifi service failed.
The solution is described below:
When connecting to hidden wifi service, in the function of
create_hidden_wifi(), we pass the
network group to it, with which to create network as the network identifier
instead of hidden_xx,
so that in wifi plugin network_added(), it can find the network and will never
create another one.
And when the service is disconnected, the network will not be unregisterred
immediately and user
can reconnect to it successfully.
---
src/service.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/service.c b/src/service.c
index 2249863..c17566a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4098,7 +4098,8 @@ static struct connman_service *lookup_by_identifier(const
char *identifier)
}
static struct connman_network *create_hidden_wifi(struct connman_device
*device,
- const char *ssid, const char *mode, const char *security)
+ const char *ssid, const char *mode, const char *security,
+ const char *group)
{
struct connman_network *network;
char *name;
@@ -4109,7 +4110,7 @@ static struct connman_network *create_hidden_wifi(struct
connman_device *device,
if (ssid_len < 1)
return NULL;
- network = connman_network_create(NULL, CONNMAN_NETWORK_TYPE_WIFI);
+ network = connman_network_create(group, CONNMAN_NETWORK_TYPE_WIFI);
if (network == NULL)
return NULL;
@@ -4244,7 +4245,7 @@ int __connman_service_create_and_connect(DBusMessage *msg)
if (service != NULL)
goto done;
- network = create_hidden_wifi(device, ssid, mode, security);
+ network = create_hidden_wifi(device, ssid, mode, security, group);
if (network != NULL)
connman_network_set_group(network, group);
--
1.6.3.3
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman