Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. [PATCH 4/5] gsupplicant: Add callback to notify the
associated network ([email protected])
2. [PATCH 5/5] wifi: Set current network in case of reconnection
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Fri, 17 Feb 2017 14:03:33 +0000
From: [email protected]
To: [email protected]
Cc: [email protected], [email protected],
[email protected], Jose Blanquicet
<[email protected]>
Subject: [PATCH 4/5] gsupplicant: Add callback to notify the
associated network
Message-ID:
<1487340214-5410-5-git-send-email-jose.blanquicet-melen...@magnetimarelli.com>
From: Jose Blanquicet <[email protected]>
Notify WiFi plugin about the network with which we got associated in
order to allow it to get aligned with what is happening in wpa_s.
---
gsupplicant/gsupplicant.h | 1 +
gsupplicant/supplicant.c | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 678cf8b..db61595 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -351,6 +351,7 @@ struct _GSupplicantCallbacks {
void (*network_removed) (GSupplicantNetwork *network);
void (*network_changed) (GSupplicantNetwork *network,
const char *property);
+ void (*network_associated) (GSupplicantNetwork *network);
void (*peer_found) (GSupplicantPeer *peer);
void (*peer_lost) (GSupplicantPeer *peer);
void (*peer_changed) (GSupplicantPeer *peer,
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 36c4dd5..6cfd190 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -602,6 +602,17 @@ static void callback_network_changed(GSupplicantNetwork
*network,
callbacks_pointer->network_changed(network, property);
}
+static void callback_network_associated(GSupplicantNetwork *network)
+{
+ if (!callbacks_pointer)
+ return;
+
+ if (!callbacks_pointer->network_associated)
+ return;
+
+ callbacks_pointer->network_associated(network);
+}
+
static void callback_peer_found(GSupplicantPeer *peer)
{
if (!callbacks_pointer)
@@ -2234,7 +2245,21 @@ static void interface_property(const char *key,
DBusMessageIter *iter,
g_strdup(interface->ifname), g_strdup(str));
}
} else if (g_strcmp0(key, "CurrentBSS") == 0) {
+ GSupplicantNetwork *network;
+ const char *path = NULL;
+
+ dbus_message_iter_get_basic(iter, &path);
+ if (g_strcmp0(path, "/") == 0)
+ return;
+
interface_bss_added_without_keys(iter, interface);
+
+ network = g_hash_table_lookup(interface->bss_mapping, path);
+ if (!network)
+ return;
+
+ if (interface->state == G_SUPPLICANT_STATE_ASSOCIATED)
+ callback_network_associated(network);
} else if (g_strcmp0(key, "CurrentNetwork") == 0) {
interface_network_added(iter, interface);
} else if (g_strcmp0(key, "BSSs") == 0) {
--
1.9.1
------------------------------
Message: 2
Date: Fri, 17 Feb 2017 14:03:34 +0000
From: [email protected]
To: [email protected]
Cc: [email protected], [email protected],
[email protected], Jose Blanquicet
<[email protected]>
Subject: [PATCH 5/5] wifi: Set current network in case of reconnection
Message-ID:
<1487340214-5410-6-git-send-email-jose.blanquicet-melen...@magnetimarelli.com>
From: Jose Blanquicet <[email protected]>
Use associated notification from gsuplicant to ensure ConnMan is
prepared when wpa_s triggers a connection because it got associated
with the last AP we were connected to which previously deauthenticated
us. Otherwise, WiFi plugin may receive a notification it does not expect
which indicates interface state is "COMPLETED" and state machines would
not move, resulting in a L2 connection and no IP address.
This should no happen because wpa_s should always notify there is a
new BSS through a "BSSAdded" signal before notifing we got connected to
it. If so, ConnMan would create the corresponding service and
auto-connect would start and everything would be in its place when wpa_s
notifies we got connected.
In any case, this patch makes ConnMan prepared for such situation.
---
plugins/wifi.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index a721101..fe43c47 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2800,6 +2800,56 @@ static void network_changed(GSupplicantNetwork *network,
const char *property)
}
}
+static void network_associated(GSupplicantNetwork *network)
+{
+ GSupplicantInterface *interface;
+ struct wifi_data *wifi;
+ struct connman_network *connman_network;
+ const char *identifier;
+
+ DBG("");
+
+ interface = g_supplicant_network_get_interface(network);
+ if (!interface)
+ return;
+
+ wifi = g_supplicant_interface_get_data(interface);
+ if (!wifi)
+ return;
+
+ identifier = g_supplicant_network_get_identifier(network);
+
+ connman_network = connman_device_get_network(wifi->device, identifier);
+ if (!connman_network)
+ return;
+
+ if (wifi->network) {
+ if (wifi->network == connman_network)
+ return;
+
+ /*
+ * This should never happen, we got associated with
+ * a network different than the one we were expecting.
+ */
+ DBG("Associated to %p while expecting %p",
+ connman_network, wifi->network);
+
+ connman_network_set_associating(wifi->network, false);
+ }
+
+ DBG("Reconnecting to previous network %p from wpa_s", connman_network);
+
+ wifi->network = connman_network_ref(connman_network);
+ wifi->retries = 0;
+
+ /*
+ * Set network/service in association state is the only step we could
+ * missed if wifi->network was not set in previous interface's states.
+ */
+ if (!wifi->connected)
+ connman_network_set_associating(wifi->network, true);
+}
+
static void apply_peer_services(GSupplicantPeer *peer,
struct connman_peer *connman_peer)
{
@@ -3011,6 +3061,7 @@ static const GSupplicantCallbacks callbacks = {
.network_added = network_added,
.network_removed = network_removed,
.network_changed = network_changed,
+ .network_associated = network_associated,
.peer_found = peer_found,
.peer_lost = peer_lost,
.peer_changed = peer_changed,
--
1.9.1
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 16, Issue 20
***************************************