All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Trimarchi <michael@amarulasolutions.com>
To: connman@lists.linux.dev
Subject: [PATCH 1/2] iwd: Set the network index add_network
Date: Fri,  1 Oct 2021 12:26:06 +0000	[thread overview]
Message-ID: <20211001122607.34360-1-michael@amarulasolutions.com> (raw)

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


             reply	other threads:[~2021-10-01 12:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 12:26 Michael Trimarchi [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211001122607.34360-1-michael@amarulasolutions.com \
    --to=michael@amarulasolutions.com \
    --cc=connman@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.