public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] station: reload settings in 'netconfig_after_roam' case
@ 2023-10-20 13:55 James Prestwood
  2023-10-20 15:35 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: James Prestwood @ 2023-10-20 13:55 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

If netconfig is canceled before completion (when roaming) the
settings are freed and never loaded again once netconfig is started
post-roam. Now after a roam make sure to re-load the settings and
start netconfig.
---
 src/station.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/station.c b/src/station.c
index e18847bc..9b224e5a 100644
--- a/src/station.c
+++ b/src/station.c
@@ -2055,6 +2055,20 @@ static void station_netconfig_event_handler(enum netconfig_event event,
 	}
 }
 
+static bool netconfig_after_roam(struct station *station)
+{
+	const struct network *network = station_get_connected_network(station);
+
+	/* Netconfig was reset which frees all settings, reload now */
+	if (!netconfig_load_settings(station->netconfig,
+					network_get_settings(network)))
+		return false;
+
+	return netconfig_configure(station->netconfig,
+					station_netconfig_event_handler,
+					station);
+}
+
 static void station_roamed(struct station *station)
 {
 	station->roam_scan_full = false;
@@ -2086,9 +2100,7 @@ static void station_roamed(struct station *station)
 	/* Re-enable netconfig if it never finished on the last BSS */
 	if (station->netconfig_after_roam) {
 		station->netconfig_after_roam = false;
-		L_WARN_ON(!netconfig_configure(station->netconfig,
-						station_netconfig_event_handler,
-						station));
+		L_WARN_ON(!netconfig_after_roam(station));
 	} else
 		station_enter_state(station, STATION_STATE_CONNECTED);
 }
@@ -2126,9 +2138,7 @@ static void station_roam_failed(struct station *station)
 	/* Re-enable netconfig if needed, even on a failed roam */
 	if (station->netconfig_after_roam) {
 		station->netconfig_after_roam = false;
-		L_WARN_ON(!netconfig_configure(station->netconfig,
-						station_netconfig_event_handler,
-						station));
+		L_WARN_ON(!netconfig_after_roam(station));
 	}
 
 	/*
-- 
2.25.1


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

* Re: [PATCH] station: reload settings in 'netconfig_after_roam' case
  2023-10-20 13:55 [PATCH] station: reload settings in 'netconfig_after_roam' case James Prestwood
@ 2023-10-20 15:35 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2023-10-20 15:35 UTC (permalink / raw)
  To: James Prestwood, iwd

Hi James,

On 10/20/23 08:55, James Prestwood wrote:
> If netconfig is canceled before completion (when roaming) the
> settings are freed and never loaded again once netconfig is started
> post-roam. Now after a roam make sure to re-load the settings and
> start netconfig.
> ---
>   src/station.c | 22 ++++++++++++++++------
>   1 file changed, 16 insertions(+), 6 deletions(-)

Applied, thanks.

Regards,
-Denis


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

end of thread, other threads:[~2023-10-20 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20 13:55 [PATCH] station: reload settings in 'netconfig_after_roam' case James Prestwood
2023-10-20 15:35 ` Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox