[PATCH v2 1/6] network: make clearing network blacklist a separate operation

James Prestwood <[email protected]> Wed, 28 May 2025 13:10:21 -0700
Newsgroups dev.linux.lists.iwd
Message-ID <[email protected]>
This adds a new API network_clear_blacklist() and removes this
functionality from network_connected(). This is done to support BSS
iteration when netconfig is enabled. Since a call to
network_connected() will happen prior to netconfig completing we
cannot clear the blacklist until netconfig has either passed or
failed.
---
 src/network.c | 9 ++++++---
 src/network.h | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/network.c b/src/network.c
index 4602a110..588ea5ae 100644
--- a/src/network.c
+++ b/src/network.c
@@ -168,6 +168,11 @@ static bool network_secret_check_cacheable(void *data, void *user_data)
 	return false;
 }
 
+void network_clear_blacklist(struct network *network)
+{
+	l_queue_clear(network->blacklist, NULL);
+}
+
 void network_connected(struct network *network)
 {
 	enum security security = network_get_security(network);
@@ -198,8 +203,6 @@ void network_connected(struct network *network)
 	l_queue_foreach_remove(network->secrets,
 				network_secret_check_cacheable, network);
 
-	l_queue_clear(network->blacklist, NULL);
-
 	network->provisioning_hidden = false;
 }
 
@@ -207,7 +210,7 @@ void network_disconnected(struct network *network)
 {
 	network_settings_close(network);
 
-	l_queue_clear(network->blacklist, NULL);
+	network_clear_blacklist(network);
 
 	if (network->provisioning_hidden)
 		station_hide_network(network->station, network);
diff --git a/src/network.h b/src/network.h
index 849051dd..061f47ca 100644
--- a/src/network.h
+++ b/src/network.h
@@ -74,6 +74,7 @@ bool network_bss_update(struct network *network, struct scan_bss *bss);
 const char *network_bss_get_path(const struct network *network,
 						const struct scan_bss *bss);
 bool network_bss_list_isempty(struct network *network);
+void network_clear_blacklist(struct network *network);
 
 const char *__network_path_append_bss(const char *network_path,
 					const struct scan_bss *bss);
-- 
2.34.1