public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v2 1/6] network: add __network_path_append_bss
@ 2024-08-19 15:57 James Prestwood
  2024-08-19 15:57 ` [PATCH v2 2/6] station: move BasicServiceSet DBus management into station James Prestwood
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: James Prestwood @ 2024-08-19 15:57 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

To reduce code duplication and prepare for moving the BSS interface
to station, add a new API so station can create a BSS path without
a network object directly.
---
 src/network.c | 12 +++++++++---
 src/network.h |  3 +++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/network.c b/src/network.c
index 85d2a983..a8e61d48 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1130,17 +1130,23 @@ bool network_update_known_frequencies(struct network *network)
 	return true;
 }
 
-const char *network_bss_get_path(const struct network *network,
-						const struct scan_bss *bss)
+const char *__network_path_append_bss(const char *network_path,
+					const struct scan_bss *bss)
 {
 	static char path[256];
 
 	snprintf(path, sizeof(path), "%s/%02x%02x%02x%02x%02x%02x",
-			network->object_path, MAC_STR(bss->addr));
+			network_path, MAC_STR(bss->addr));
 
 	return path;
 }
 
+const char *network_bss_get_path(const struct network *network,
+						const struct scan_bss *bss)
+{
+	return __network_path_append_bss(network->object_path, bss);
+}
+
 static bool network_unregister_bss(void *a, void *user_data)
 {
 	struct scan_bss *bss = a;
diff --git a/src/network.h b/src/network.h
index 78ced99d..c9f73200 100644
--- a/src/network.h
+++ b/src/network.h
@@ -77,6 +77,9 @@ const char *network_bss_get_path(const struct network *network,
 						const struct scan_bss *bss);
 bool network_bss_list_isempty(struct network *network);
 
+const char *__network_path_append_bss(const char *network_path,
+					const struct scan_bss *bss);
+
 struct scan_bss *network_bss_list_pop(struct network *network);
 struct scan_bss *network_bss_find_by_addr(struct network *network,
 							const uint8_t *addr);
-- 
2.34.1


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

* [PATCH v2 2/6] station: move BasicServiceSet DBus management into station
  2024-08-19 15:57 [PATCH v2 1/6] network: add __network_path_append_bss James Prestwood
@ 2024-08-19 15:57 ` James Prestwood
  2024-08-19 15:57 ` [PATCH v2 3/6] network: remove BasicServiceSet DBus registration code James Prestwood
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: James Prestwood @ 2024-08-19 15:57 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Due to an unnoticed bug after adding the BasicServiceSet object into
network, it became clear that since station already owns the scan_bss
objects it makes sense for it to manage the associated DBus objects
as well. This way network doesn't have to jump through hoops to
determine if the scan_bss object was remove, added, or updated. It
can just manage its list as it did prior.

From the station side this makes things very easy. When scan results
come in we either update or add a new DBus object. And any time a
scan_bss is freed we remove the DBus object.
---
 src/station.c | 91 +++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 74 insertions(+), 17 deletions(-)

v2:
 * For station_register_bss() the caller always has access to the network
   object so pass that and use network_get_path() instead of deriving the
   entire path manually. For unregistration we still have to derive it
   because we don't have a network object handy.
 
diff --git a/src/station.c b/src/station.c
index 06b19db3..2a58c69a 100644
--- a/src/station.c
+++ b/src/station.c
@@ -350,8 +350,6 @@ static bool process_network(const void *key, void *data, void *user_data)
 	struct process_network_data *process_data = user_data;
 	struct station *station = process_data->station;
 
-	network_bss_stop_update(network, process_data->freqs);
-
 	if (!network_bss_list_isempty(network)) {
 		bool connected = network == station->connected_network;
 
@@ -431,6 +429,66 @@ static void station_print_scan_bss(const struct scan_bss *bss)
 			optional);
 }
 
+static const char *station_get_bss_path(struct station *station,
+						struct scan_bss *bss)
+{
+	enum security security;
+	char ssid[33];
+	const char *network_path;
+
+	memcpy(ssid, bss->ssid, bss->ssid_len);
+	ssid[bss->ssid_len] = '\0';
+
+	if (scan_bss_get_security(bss, &security) < 0)
+		return NULL;
+
+	network_path = iwd_network_get_path(station, ssid, security);
+	if (!network_path)
+		return NULL;
+
+	return __network_path_append_bss(network_path, bss);
+}
+
+static bool station_unregister_bss(struct station *station,
+					struct scan_bss *bss)
+{
+	const char *path = station_get_bss_path(station, bss);
+
+	if (L_WARN_ON(!path))
+		return false;
+
+	return l_dbus_unregister_object(dbus_get_bus(), path);
+}
+
+static bool station_register_bss(struct network *network, struct scan_bss *bss)
+{
+	struct scan_bss *old;
+	const char *path = __network_path_append_bss(network_get_path(network),
+							bss);
+
+	if (L_WARN_ON(!path))
+		return false;
+
+	/*
+	 * 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;
+
+	return true;
+}
+
 /*
  * Returns the network object the BSS was added to or NULL if ignored.
  */
@@ -518,6 +576,7 @@ static struct network *station_add_seen_bss(struct station *station,
 	}
 
 	network_bss_add(network, bss);
+	station_register_bss(network, bss);
 
 	return network;
 }
@@ -540,7 +599,7 @@ struct bss_expiration_data {
 	struct scan_bss *connected_bss;
 	uint64_t now;
 	const struct scan_freq_set *freqs;
-	struct l_queue *free_list;
+	struct station *station;
 };
 
 #define SCAN_RESULT_BSS_RETENTION_TIME (30 * 1000000)
@@ -562,20 +621,21 @@ static bool bss_free_if_expired(void *data, void *user_data)
 			bss->time_stamp + SCAN_RESULT_BSS_RETENTION_TIME))
 		return false;
 
-	l_queue_push_head(expiration_data->free_list, bss);
+	station_unregister_bss(expiration_data->station, bss);
+
+	scan_bss_free(bss);
 
 	return true;
 }
 
 static void station_bss_list_remove_expired_bsses(struct station *station,
-					const struct scan_freq_set *freqs,
-					struct l_queue *free_list)
+					const struct scan_freq_set *freqs)
 {
 	struct bss_expiration_data data = {
 		.now = l_time_now(),
 		.connected_bss = station->connected_bss,
 		.freqs = freqs,
-		.free_list = free_list,
+		.station = station,
 	};
 
 	l_queue_foreach_remove(station->bss_list, bss_free_if_expired, &data);
@@ -823,6 +883,7 @@ static bool station_owe_transition_results(int err, struct l_queue *bss_list,
 
 		l_queue_push_tail(station->bss_list, bss);
 		network_bss_add(network, bss);
+		station_register_bss(network, bss);
 
 		continue;
 
@@ -951,7 +1012,6 @@ void station_set_scan_results(struct station *station,
 	const struct l_queue_entry *bss_entry;
 	struct network *network;
 	struct process_network_data data;
-	struct l_queue *free_list = l_queue_new();
 
 	l_queue_foreach_remove(new_bss_list, bss_free_if_ssid_not_utf8, NULL);
 
@@ -963,7 +1023,7 @@ void station_set_scan_results(struct station *station,
 	l_queue_destroy(station->autoconnect_list, NULL);
 	station->autoconnect_list = NULL;
 
-	station_bss_list_remove_expired_bsses(station, freqs, free_list);
+	station_bss_list_remove_expired_bsses(station, freqs);
 
 	for (bss_entry = l_queue_get_entries(station->bss_list); bss_entry;
 						bss_entry = bss_entry->next) {
@@ -975,12 +1035,7 @@ void station_set_scan_results(struct station *station,
 			if (old_bss == station->connected_bss)
 				station->connected_bss = new_bss;
 
-			/*
-			 * The network object is still holding a reference to
-			 * the BSS. Until we tell network to replace the BSS
-			 * with a new object, don't free it.
-			 */
-			l_queue_push_head(free_list, old_bss);
+			scan_bss_free(old_bss);
 
 			continue;
 		}
@@ -1007,6 +1062,8 @@ void station_set_scan_results(struct station *station,
 		if (!scan_freq_set_contains(freqs, bss->frequency))
 			continue;
 
+		station_register_bss(network, bss);
+
 		station_start_anqp(station, network, bss);
 	}
 
@@ -1017,8 +1074,6 @@ void station_set_scan_results(struct station *station,
 
 	l_hashmap_foreach_remove(station->networks, process_network, &data);
 
-	l_queue_destroy(free_list, bss_free);
-
 	station->autoconnect_can_start = trigger_autoconnect;
 	station_autoconnect_start(station);
 }
@@ -2652,6 +2707,7 @@ static void station_update_roam_bss(struct station *station,
 		l_queue_remove_if(station->bss_list, bss_match, bss);
 
 	network_bss_update(network, bss);
+	station_register_bss(network, bss);
 	l_queue_push_tail(station->bss_list, bss);
 
 	if (old)
@@ -3160,6 +3216,7 @@ static void station_event_roamed(struct station *station, struct scan_bss *new)
 	struct scan_bss *stale;
 
 	network_bss_update(station->connected_network, new);
+	station_register_bss(station->connected_network, new);
 
 	/* Remove new BSS if it exists in past scan results */
 	stale = l_queue_remove_if(station->bss_list, bss_match, new);
-- 
2.34.1


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

* [PATCH v2 3/6] network: remove BasicServiceSet DBus registration code
  2024-08-19 15:57 [PATCH v2 1/6] network: add __network_path_append_bss James Prestwood
  2024-08-19 15:57 ` [PATCH v2 2/6] station: move BasicServiceSet DBus management into station James Prestwood
@ 2024-08-19 15:57 ` James Prestwood
  2024-08-19 15:57 ` [PATCH v2 4/6] network: add back network_bss_list_clear James Prestwood
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: James Prestwood @ 2024-08-19 15:57 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

This was moved into station.
---
 src/network.c | 100 ++------------------------------------------------
 src/network.h |   2 -
 2 files changed, 4 insertions(+), 98 deletions(-)

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,
-- 
2.34.1


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

* [PATCH v2 4/6] network: add back network_bss_list_clear
  2024-08-19 15:57 [PATCH v2 1/6] network: add __network_path_append_bss James Prestwood
  2024-08-19 15:57 ` [PATCH v2 2/6] station: move BasicServiceSet DBus management into station James Prestwood
  2024-08-19 15:57 ` [PATCH v2 3/6] network: remove BasicServiceSet DBus registration code James Prestwood
@ 2024-08-19 15:57 ` James Prestwood
  2024-08-19 15:57 ` [PATCH v2 5/6] auto-t: Add ExtendedServiceSet property James Prestwood
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: James Prestwood @ 2024-08-19 15:57 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Rename network_bss_update_start back to network_bss_list_clear, since
this is what its now doing again.
---
 src/network.c | 2 +-
 src/network.h | 2 +-
 src/station.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/network.c b/src/network.c
index b9194b3c..300e8090 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1146,7 +1146,7 @@ const char *network_bss_get_path(const struct network *network,
 	return __network_path_append_bss(network->object_path, bss);
 }
 
-void network_bss_start_update(struct network *network)
+void network_bss_list_clear(struct network *network)
 {
 	l_queue_destroy(network->bss_list, NULL);
 	network->bss_list = l_queue_new();
diff --git a/src/network.h b/src/network.h
index 73d2ddb0..849051dd 100644
--- a/src/network.h
+++ b/src/network.h
@@ -68,7 +68,7 @@ int network_can_connect_bss(struct network *network,
 						const struct scan_bss *bss);
 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_list_clear(struct network *network);
 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,
diff --git a/src/station.c b/src/station.c
index 2a58c69a..6a28254b 100644
--- a/src/station.c
+++ b/src/station.c
@@ -1016,7 +1016,7 @@ void station_set_scan_results(struct station *station,
 	l_queue_foreach_remove(new_bss_list, bss_free_if_ssid_not_utf8, NULL);
 
 	while ((network = l_queue_pop_head(station->networks_sorted)))
-		network_bss_start_update(network);
+		network_bss_list_clear(network);
 
 	l_queue_clear(station->hidden_bss_list_sorted, NULL);
 
-- 
2.34.1


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

* [PATCH v2 5/6] auto-t: Add ExtendedServiceSet property
  2024-08-19 15:57 [PATCH v2 1/6] network: add __network_path_append_bss James Prestwood
                   ` (2 preceding siblings ...)
  2024-08-19 15:57 ` [PATCH v2 4/6] network: add back network_bss_list_clear James Prestwood
@ 2024-08-19 15:57 ` James Prestwood
  2024-08-19 15:57 ` [PATCH v2 6/6] auto-t: Add test for BasicServiceSets James Prestwood
  2024-08-19 16:53 ` [PATCH v2 1/6] network: add __network_path_append_bss Denis Kenzior
  5 siblings, 0 replies; 7+ messages in thread
From: James Prestwood @ 2024-08-19 15:57 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

---
 autotests/util/iwd.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 1d4a5472..74bb25c0 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -975,6 +975,10 @@ class Network(IWDDBusAbstract):
         '''
         return bool(self._properties['Connected'])
 
+    @property
+    def extended_service_set(self):
+        return self._properties['ExtendedServiceSet']
+
     def connect(self, wait=True):
         '''
             Connect to the network. Request the device implied by the object
-- 
2.34.1


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

* [PATCH v2 6/6] auto-t: Add test for BasicServiceSets
  2024-08-19 15:57 [PATCH v2 1/6] network: add __network_path_append_bss James Prestwood
                   ` (3 preceding siblings ...)
  2024-08-19 15:57 ` [PATCH v2 5/6] auto-t: Add ExtendedServiceSet property James Prestwood
@ 2024-08-19 15:57 ` James Prestwood
  2024-08-19 16:53 ` [PATCH v2 1/6] network: add __network_path_append_bss Denis Kenzior
  5 siblings, 0 replies; 7+ messages in thread
From: James Prestwood @ 2024-08-19 15:57 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

---
 .../basic_service_set_test.py                 | 98 +++++++++++++++++++
 autotests/testBasicServiceSet/hw.conf         |  8 ++
 autotests/testBasicServiceSet/ssidTKIP-1.conf |  7 ++
 autotests/testBasicServiceSet/ssidTKIP-2.conf |  7 ++
 autotests/testBasicServiceSet/ssidTKIP.psk    |  5 +
 5 files changed, 125 insertions(+)
 create mode 100644 autotests/testBasicServiceSet/basic_service_set_test.py
 create mode 100644 autotests/testBasicServiceSet/hw.conf
 create mode 100644 autotests/testBasicServiceSet/ssidTKIP-1.conf
 create mode 100644 autotests/testBasicServiceSet/ssidTKIP-2.conf
 create mode 100644 autotests/testBasicServiceSet/ssidTKIP.psk

diff --git a/autotests/testBasicServiceSet/basic_service_set_test.py b/autotests/testBasicServiceSet/basic_service_set_test.py
new file mode 100644
index 00000000..58b21ac0
--- /dev/null
+++ b/autotests/testBasicServiceSet/basic_service_set_test.py
@@ -0,0 +1,98 @@
+#! /usr/bin/python3
+
+import unittest
+import sys, os
+
+sys.path.append('../util')
+import iwd
+from iwd import IWD
+from iwd import PSKAgent
+from iwd import NetworkType
+from hwsim import Hwsim
+from hostapd import HostapdCLI
+import testutil
+
+class Test(unittest.TestCase):
+    def test_bss_unregister(self):
+        device = self.wd.list_devices(1)[0]
+
+        ordered_network = device.get_ordered_network('ssidTKIP', full_scan=True)
+        network = ordered_network.network_object
+
+        self.assertEqual(len(network.extended_service_set), 2)
+
+        ends = [parts.split('/')[-1] for parts in network.extended_service_set]
+
+        self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends)
+        self.assertIn(self.bss_hostapd[1].bssid.replace(':', ''), ends)
+
+        self.rule_bss1.enabled = True
+
+        # Even with flushing, the kernel still seems to return the scan
+        # results
+        self.wd.wait(40)
+        ordered_network = device.get_ordered_network('ssidTKIP', full_scan=True)
+        network = ordered_network.network_object
+
+        ends = [parts.split('/')[-1] for parts in network.extended_service_set]
+
+        self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends)
+        self.assertNotIn(self.bss_hostapd[1].bssid.replace(':', ''), ends)
+
+        self.rule_bss0.enabled = True
+
+        self.wd.wait(40)
+        ordered_networks = device.get_ordered_networks('ssidTKIP', full_scan=True)
+        self.assertIsNone(ordered_networks)
+
+        self.rule_bss0.enabled = False
+
+        ordered_networks = device.get_ordered_networks('ssidTKIP', full_scan=True)
+        ends = [parts.split('/')[-1] for parts in network.extended_service_set]
+
+        self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends)
+        self.assertNotIn(self.bss_hostapd[1].bssid.replace(':', ''), ends)
+
+    def tearDown(self):
+        self.rule_bss0.enabled = False
+        self.rule_bss1.enabled = False
+
+        self.wd.stop()
+        self.wd.wait(10)
+        self.wd = None
+
+    def setUp(self):
+        self.wd = IWD(True)
+
+    @classmethod
+    def setUpClass(cls):
+        hwsim = Hwsim()
+
+        IWD.copy_to_storage('ssidTKIP.psk')
+
+        cls.bss_hostapd = [ HostapdCLI(config='ssidTKIP-1.conf'),
+                            HostapdCLI(config='ssidTKIP-2.conf') ]
+
+
+        rad0 = hwsim.get_radio('rad0')
+        rad1 = hwsim.get_radio('rad1')
+
+        cls.rule_bss0 = hwsim.rules.create()
+        cls.rule_bss0.source = rad0.addresses[0]
+        cls.rule_bss0.bidirectional = True
+        cls.rule_bss0.drop = True
+
+        cls.rule_bss1 = hwsim.rules.create()
+        cls.rule_bss1.source = rad1.addresses[0]
+        cls.rule_bss1.bidirectional = True
+        cls.rule_bss1.drop = True
+
+    @classmethod
+    def tearDownClass(cls):
+        IWD.clear_storage()
+        cls.bss_hostapd = None
+        cls.rule_bss0.remove()
+        cls.rule_bss1.remove()
+
+if __name__ == '__main__':
+    unittest.main(exit=True)
diff --git a/autotests/testBasicServiceSet/hw.conf b/autotests/testBasicServiceSet/hw.conf
new file mode 100644
index 00000000..60dd64b8
--- /dev/null
+++ b/autotests/testBasicServiceSet/hw.conf
@@ -0,0 +1,8 @@
+[SETUP]
+num_radios=3
+hwsim_medium=yes
+start_iwd=no
+
+[HOSTAPD]
+rad0=ssidTKIP-1.conf
+rad1=ssidTKIP-2.conf
diff --git a/autotests/testBasicServiceSet/ssidTKIP-1.conf b/autotests/testBasicServiceSet/ssidTKIP-1.conf
new file mode 100644
index 00000000..11ef15f0
--- /dev/null
+++ b/autotests/testBasicServiceSet/ssidTKIP-1.conf
@@ -0,0 +1,7 @@
+hw_mode=g
+channel=1
+ssid=ssidTKIP
+
+wpa=1
+wpa_pairwise=TKIP
+wpa_passphrase=secret123
diff --git a/autotests/testBasicServiceSet/ssidTKIP-2.conf b/autotests/testBasicServiceSet/ssidTKIP-2.conf
new file mode 100644
index 00000000..0ed132c1
--- /dev/null
+++ b/autotests/testBasicServiceSet/ssidTKIP-2.conf
@@ -0,0 +1,7 @@
+hw_mode=g
+channel=2
+ssid=ssidTKIP
+
+wpa=1
+wpa_pairwise=TKIP
+wpa_passphrase=secret123
diff --git a/autotests/testBasicServiceSet/ssidTKIP.psk b/autotests/testBasicServiceSet/ssidTKIP.psk
new file mode 100644
index 00000000..85d25d8d
--- /dev/null
+++ b/autotests/testBasicServiceSet/ssidTKIP.psk
@@ -0,0 +1,5 @@
+[Security]
+Passphrase=secret123
+
+[Settings]
+AutoConnect=False
-- 
2.34.1


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

* Re: [PATCH v2 1/6] network: add __network_path_append_bss
  2024-08-19 15:57 [PATCH v2 1/6] network: add __network_path_append_bss James Prestwood
                   ` (4 preceding siblings ...)
  2024-08-19 15:57 ` [PATCH v2 6/6] auto-t: Add test for BasicServiceSets James Prestwood
@ 2024-08-19 16:53 ` Denis Kenzior
  5 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2024-08-19 16:53 UTC (permalink / raw)
  To: James Prestwood, iwd

Hi James,

On 8/19/24 10:57 AM, James Prestwood wrote:
> To reduce code duplication and prepare for moving the BSS interface
> to station, add a new API so station can create a BSS path without
> a network object directly.
> ---
>   src/network.c | 12 +++++++++---
>   src/network.h |  3 +++
>   2 files changed, 12 insertions(+), 3 deletions(-)

All applied, thanks.

Regards,
-Denis


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

end of thread, other threads:[~2024-08-19 16:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19 15:57 [PATCH v2 1/6] network: add __network_path_append_bss James Prestwood
2024-08-19 15:57 ` [PATCH v2 2/6] station: move BasicServiceSet DBus management into station James Prestwood
2024-08-19 15:57 ` [PATCH v2 3/6] network: remove BasicServiceSet DBus registration code James Prestwood
2024-08-19 15:57 ` [PATCH v2 4/6] network: add back network_bss_list_clear James Prestwood
2024-08-19 15:57 ` [PATCH v2 5/6] auto-t: Add ExtendedServiceSet property James Prestwood
2024-08-19 15:57 ` [PATCH v2 6/6] auto-t: Add test for BasicServiceSets James Prestwood
2024-08-19 16:53 ` [PATCH v2 1/6] network: add __network_path_append_bss Denis Kenzior

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