connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] iwd: Set the network index add_network
@ 2021-10-01 12:26 Michael Trimarchi
  2021-10-01 12:26 ` [PATCH 2/2] manager: Add TetheringClientsChanged GBUS_SIGNAL Michael Trimarchi
  2021-10-04  6:32 ` [PATCH 1/2] iwd: Set the network index add_network Daniel Wagner
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Trimarchi @ 2021-10-01 12:26 UTC (permalink / raw)
  To: connman

In order to have compatibility with wpa_supplicant
configuration and fill the dictionary as was before
we need to set index not when the wireless is connected
but when it's registered. This allow to understand
what wireless card is using each services

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 plugins/iwd.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/plugins/iwd.c b/plugins/iwd.c
index 14a442a7..48097a1f 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -208,19 +208,6 @@ static int cm_network_probe(struct connman_network *network)
 
 static void update_network_connected(struct iwd_network *iwdn)
 {
-	struct iwd_device *iwdd;
-	int index;
-
-	iwdd = g_hash_table_lookup(devices, iwdn->device);
-	if (!iwdd)
-		return;
-
-	index = connman_inet_ifindex(iwdd->name);
-	if (index < 0)
-		return;
-
-	DBG("interface name %s index %d", iwdd->name, index);
-	connman_network_set_index(iwdn->network, index);
 	connman_network_set_connected(iwdn->network, true);
 }
 
@@ -911,6 +898,7 @@ static char *create_identifier(const char *path, const char *security)
 static void add_network(const char *path, struct iwd_network *iwdn)
 {
 	struct iwd_device *iwdd;
+	int index;
 	char *identifier;
 
 	iwdd = g_hash_table_lookup(devices, iwdn->device);
@@ -920,6 +908,12 @@ static void add_network(const char *path, struct iwd_network *iwdn)
 	identifier = create_identifier(path, iwdn->type);
 	iwdn->network = connman_network_create(identifier,
 					CONNMAN_NETWORK_TYPE_WIFI);
+
+	index = connman_inet_ifindex(iwdd->name);
+	if (index < 0)
+		return;
+
+	connman_network_set_index(iwdn->network, index);
 	connman_network_set_data(iwdn->network, iwdn);
 
 	connman_network_set_name(iwdn->network, iwdn->name);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-04  6:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 12:26 [PATCH 1/2] iwd: Set the network index add_network Michael Trimarchi
2021-10-01 12:26 ` [PATCH 2/2] manager: Add TetheringClientsChanged GBUS_SIGNAL Michael Trimarchi
2021-10-04  6:34   ` Daniel Wagner
2021-10-04  6:32 ` [PATCH 1/2] iwd: Set the network index add_network Daniel Wagner
2021-10-04  6:35   ` Michael Nazzareno Trimarchi
2021-10-04  6:38     ` Daniel Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).