Skip to contentSkip to conversation

iwd: Set the network index add_network

PATCH In review Michael Trimarchi 2 participants 6 messages Oct 1, 2021 – Oct 4, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 iwd: Set the network index add_network

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

---
 plugins/iwd.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
plugins/iwd.c +7 -13
index 14a442a7..48097a1f 100644
@@ -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);
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 manager: Add TetheringClientsChanged GBUS_SIGNAL

Add TetheringClientsChanged as dbus signal. This can be seen using d-feet or other tool

---
 src/manager.c | 3 +++
 1 file changed, 3 insertions(+)
src/manager.c +3 -0
index 3bf8f4e4..892d3a42 100644
@@ -600,6 +600,9 @@ static const GDBusSignalTable manager_signals[] = {
 	{ GDBUS_SIGNAL("PeersChanged",
 			GDBUS_ARGS({ "changed", "a(oa{sv})" },
 					{ "removed", "ao" })) },
+	{ GDBUS_SIGNAL("TetheringClientsChanged",
+			GDBUS_ARGS({ "registered", "as" },
+					{ "removed", "as" })) },
 	{ },
 };
 
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 2/2] manager: Add TetheringClientsChanged GBUS_SIGNAL

Quoted 2 lines · Michael Trimarchi

Add TetheringClientsChanged as dbus signal. This can be seen using d-feet or other tool

Patch applied.

Thanks,
Daniel

#3 lore raw
In reply to Michael Trimarchi

Hi Michael,

Quoted 5 lines · Michael Trimarchi

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

I've applied the version from Emmanuel. Hope that is okay.

Thanks,
Daniel

#4 lore raw

Hi

Quoted 11 lines · Daniel Wagner

Hi Michael,

Quoted 5 lines · Michael Trimarchi

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

I've applied the version from Emmanuel. Hope that is okay.

Better commit message (aka better english) and 6 minutes before :)

Michael

Quoted 3 lines

Thanks,
Daniel

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
#5 lore raw
Quoted 3 lines · Michael Nazzareno Trimarchi
Quoted 1 line

I've applied the version from Emmanuel. Hope that is okay.

Better commit message (aka better english) and 6 minutes before :)

The 6 minutes did win the race :)