diff mbox series

[v2,3/6] network: remove BasicServiceSet DBus registration code

Message ID 20240819155734.1276476-3-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [v2,1/6] network: add __network_path_append_bss | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Aug. 19, 2024, 3:57 p.m. UTC
This was moved into station.
---
 src/network.c | 100 ++------------------------------------------------
 src/network.h |   2 -
 2 files changed, 4 insertions(+), 98 deletions(-)
diff mbox series

Patch

diff --git a/src/network.c b/src/network.c
index a8e61d48..b9194b3c 100644
--- a/src/network.c
+++ b/src/network.c
@@ -75,7 +75,6 @@  struct network {
 	struct l_ecc_point *sae_pt_20; /* SAE PT for Group 20 */
 	unsigned int agent_request;
 	struct l_queue *bss_list;
-	struct l_queue *old_bss_list;
 	struct l_settings *settings;
 	struct l_queue *secrets;
 	struct l_queue *blacklist; /* temporary blacklist for BSS's */
@@ -1147,101 +1146,20 @@  const char *network_bss_get_path(const struct network *network,
 	return __network_path_append_bss(network->object_path, bss);
 }
 
-static bool network_unregister_bss(void *a, void *user_data)
-{
-	struct scan_bss *bss = a;
-	struct network *network = user_data;
-
-	l_dbus_unregister_object(dbus_get_bus(),
-					network_bss_get_path(network, bss));
-
-	l_dbus_property_changed(dbus_get_bus(), network->object_path,
-				IWD_NETWORK_INTERFACE, "ExtendedServiceSet");
-
-	return true;
-}
-
-static bool network_register_bss(struct network *network, struct scan_bss *bss)
-{
-	const char *path = network_bss_get_path(network, bss);
-	struct scan_bss *old;
-
-	/*
-	 * If we find this path in the object tree update the data to the new
-	 * scan_bss pointer, as this one will be freed soon.
-	 */
-	old = l_dbus_object_get_data(dbus_get_bus(), path, IWD_BSS_INTERFACE);
-	if (old)
-		return l_dbus_object_set_data(dbus_get_bus(), path,
-						IWD_BSS_INTERFACE, bss);
-
-	if (!l_dbus_object_add_interface(dbus_get_bus(), path,
-						IWD_BSS_INTERFACE, bss))
-		return false;
-
-	if (!l_dbus_object_add_interface(dbus_get_bus(), path,
-					L_DBUS_INTERFACE_PROPERTIES, bss))
-		return false;
-
-	l_dbus_property_changed(dbus_get_bus(), network->object_path,
-				IWD_NETWORK_INTERFACE, "ExtendedServiceSet");
-
-	return true;
-}
-
 void network_bss_start_update(struct network *network)
 {
-	network->old_bss_list = network->bss_list;
+	l_queue_destroy(network->bss_list, NULL);
 	network->bss_list = l_queue_new();
 }
 
-void network_bss_stop_update(struct network *network,
-				const struct scan_freq_set *limit_freqs)
-{
-	const struct l_queue_entry *e;
-
-	/*
-	 * Update has finished, clean up any BSS's from the old list that have
-	 * been registered on DBus.
-	 */
-	for (e = l_queue_get_entries(network->old_bss_list); e; e = e->next) {
-		const struct scan_bss *old = e->data;
-		const struct scan_bss *bss;
-		const char *path = network_bss_get_path(network, old);
-
-		bss = l_dbus_object_get_data(dbus_get_bus(), path,
-						IWD_BSS_INTERFACE);
-
-		/*
-		 * Don't remove BSS's who's frequencies were not in the set.
-		 * This happens due to scan subsets (i.e. from station) so some
-		 * BSS's won't be seen since the frequency is not being scanned.
-		 * These BSS's will get cleared out eventually if they have
-		 * actually disappeared.
-		 */
-		if (!scan_freq_set_contains(limit_freqs, bss->frequency))
-			continue;
-
-		/*
-		 * The lookup matched the user data of an old BSS. This should
-		 * be unregistered from DBus
-		 */
-		if (bss && bss == old)
-			l_dbus_object_remove_interface(dbus_get_bus(), path,
-							IWD_BSS_INTERFACE);
-	}
-
-	l_queue_destroy(network->old_bss_list, NULL);
-	network->old_bss_list = NULL;
-}
-
 bool network_bss_add(struct network *network, struct scan_bss *bss)
 {
 	if (!l_queue_insert(network->bss_list, bss, scan_bss_rank_compare,
 									NULL))
 		return false;
 
-	network_register_bss(network, bss);
+	l_dbus_property_changed(dbus_get_bus(), network->object_path,
+				IWD_NETWORK_INTERFACE, "ExtendedServiceSet");
 
 	/* Done if BSS is not HS20 or we already have network_info set */
 	if (!bss->hs20_capable)
@@ -1276,8 +1194,6 @@  bool network_bss_update(struct network *network, struct scan_bss *bss)
 
 	l_queue_insert(network->bss_list, bss, scan_bss_rank_compare, NULL);
 
-	network_register_bss(network, bss);
-
 	/* Sync frequency for already known networks */
 	if (network->info) {
 		known_network_add_frequency(network->info, bss->frequency);
@@ -1294,12 +1210,7 @@  bool network_bss_list_isempty(struct network *network)
 
 struct scan_bss *network_bss_list_pop(struct network *network)
 {
-	struct scan_bss *bss = l_queue_pop_head(network->bss_list);
-
-	if (bss)
-		network_unregister_bss(bss, network);
-
-	return bss;
+	return l_queue_pop_head(network->bss_list);
 }
 
 struct scan_bss *network_bss_find_by_addr(struct network *network,
@@ -2030,9 +1941,6 @@  static void network_unregister(struct network *network, int reason)
 
 void network_remove(struct network *network, int reason)
 {
-	l_queue_foreach_remove(network->bss_list,
-				network_unregister_bss, network);
-
 	if (network->object_path)
 		network_unregister(network, reason);
 
diff --git a/src/network.h b/src/network.h
index c9f73200..73d2ddb0 100644
--- a/src/network.h
+++ b/src/network.h
@@ -69,8 +69,6 @@  int network_can_connect_bss(struct network *network,
 int network_autoconnect(struct network *network, struct scan_bss *bss);
 void network_connect_failed(struct network *network, bool in_handshake);
 void network_bss_start_update(struct network *network);
-void network_bss_stop_update(struct network *network,
-				const struct scan_freq_set *freqs);
 bool network_bss_add(struct network *network, struct scan_bss *bss);
 bool network_bss_update(struct network *network, struct scan_bss *bss);
 const char *network_bss_get_path(const struct network *network,