[PATCH v2 2/6] station: fix DBus reply for Connect() with netconfig

James Prestwood <[email protected]> Wed, 28 May 2025 13:10:22 -0700
Newsgroups dev.linux.lists.iwd
Message-ID <[email protected]>
When netconfig is enabled the DBus reply was being sent in
station_connect_ok(), before netconfig had even started. This would
result in a call to Connect() succeeding from a DBus perspective but
really netconfig still needed to complete before IWD transitioned
to a connected state.

Fixes: 72e7d3ceb83d ("station: Handle NETCONFIG_EVENT_FAILED")
---
 src/station.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

v2:
 * Broke this out into its own commit. I believe this is how the original
   change was supposed to operate i.e. send the reply only once fully
   connected.

diff --git a/src/station.c b/src/station.c
index 2b6a18f8..4180b7a4 100644
--- a/src/station.c
+++ b/src/station.c
@@ -1795,6 +1795,13 @@ static void station_enter_state(struct station *station,
 		periodic_scan_stop(station);
 		break;
 	case STATION_STATE_CONNECTED:
+		if (station->connect_pending) {
+			struct l_dbus_message *reply =
+				l_dbus_message_new_method_return(
+						station->connect_pending);
+			dbus_pending_reply(&station->connect_pending, reply);
+		}
+
 		l_dbus_object_add_interface(dbus,
 					netdev_get_path(station->netdev),
 					IWD_STATION_DIAGNOSTIC_INTERFACE,
@@ -3581,13 +3588,6 @@ static void station_connect_ok(struct station *station)
 
 	l_debug("");
 
-	if (station->connect_pending) {
-		struct l_dbus_message *reply =
-			l_dbus_message_new_method_return(
-						station->connect_pending);
-		dbus_pending_reply(&station->connect_pending, reply);
-	}
-
 	/*
 	 * Get a neighbor report now so future roams can avoid waiting for
 	 * a report at that time
-- 
2.34.1