From patchwork Mon Aug 19 15:57:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13768520 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50A6716D4E1 for ; Mon, 19 Aug 2024 15:57:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083063; cv=none; b=CoaM5var1fzLuXyLrCB0vJsW4RBpZh9XS900jRjQikmD5RbNGoUh3tFqtAyJa0g9Cdz5TkNHhfsTeJIbD5HuLqZGjR+8wFe2bQNKL5lrYKo3+cB5MbzFKevRbwXNYmP5oaAncQg6PY+P+htitiiVawemXt6vVdWfu9YjDSSGcMk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083063; c=relaxed/simple; bh=Xo0jQKN0L3cPu7vcQ9s1yXgfKSMGdhZqcDWEIRz2Tbk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=D7ToyjHd5pWgooG9Hfo6nq2JcGZaECT4r5ze+I9DZsu1FxEXvzBdGMwXDafgUv4WYAqZE5JpHZ0gCmKqZRtsAUrz8UPg2N2P33ZIugEUD5Byhj/yVQwaD27o7S+ytMRnEScJdjXgxaJTwvtl4zg6B4+xgqyjWA50NZOy8e7xUyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BVLTxSuA; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BVLTxSuA" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-713e460f920so1191959b3a.1 for ; Mon, 19 Aug 2024 08:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724083061; x=1724687861; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qBTWjnhGFVMdytmi/xL+pxTD5kCqfJksEi160IRlQa0=; b=BVLTxSuAWA3uO0GegNCtjAKykv+Bd7dTGNq7Dkr+wDzM0OqRvq2LVP7AnV2Mlu6L/o 4FaZZ/sUUnRzwMkCqq/5WccpChaijWlrxtJ2VxZoghkoAGpsob0G7ffCVzE0cpGxrU9Y DRPtVeV2rng5zlF3atjN43md6VT/MjZVB+NwGYpesUoU4Nn93R5nfBtQFO5hsNjkVmRV RpsSkeLg9Ngp8AeDRhWrlOsgBajPBqgN6s9zI0ZoVeE0I3eknQ7XVnSRRnSox8/MJ/FV oNkVViNa76KWiU3TkDXBLtALFy4x17kxirozefwPUetHwmUfxH7TSM2a4vjrSWV4TYJT 37FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724083061; x=1724687861; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qBTWjnhGFVMdytmi/xL+pxTD5kCqfJksEi160IRlQa0=; b=Lsdb8Hs4AoSM6vZJATR45XocHeXpuRaLcUGgUtz2G7bC3xiXXeAzbwPcSlS6sDtEPO 0wemLfq1nCdm+bmROIq/Z0jcMzwihwAihmGV0OYligTmeZwB1g/xB3MMRFyQkDj2HxMi doPTurvIRmMWji7dSq6F2iUmyucpQum7YqUhJopRbkny2XZoWWMHHCRe9W39QkaxWz4d JdSNoj/+XAHwx9KwNB/rZngT3BA2iQGgw3P+y3+RSZmR5MsBNSoPl/bHofTKUAjajWyj vAVNceFa0gdBeIj5KGrl+pVdfF8m2a4t4/tAyinRlRko2LU70WIzee5zcGeH4yc1+HG+ D14g== X-Gm-Message-State: AOJu0YyPmkRwGoQWyNIU/oi7h/rcDmkqdAD6xR/aCa0McT/XMtkjYZdr JK3zGZmvzU2rZQYbKsRIxGYxx2GAUdr0hPrIHPJy10h4IaRNKaBNqSPtnA== X-Google-Smtp-Source: AGHT+IEU/oobZL4/n/C4nv7c92gx4AA5jIZ9sli7ZgxbN9s2BuU4dURUiZprlM9t4M/oQ8QSjLjm4Q== X-Received: by 2002:a05:6a00:1ad1:b0:706:284f:6a68 with SMTP id d2e1a72fcca58-713c4efc813mr11240759b3a.23.1724083061110; Mon, 19 Aug 2024 08:57:41 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7127ae0cb5asm6752277b3a.69.2024.08.19.08.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 08:57:40 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 1/6] network: add __network_path_append_bss Date: Mon, 19 Aug 2024 08:57:29 -0700 Message-Id: <20240819155734.1276476-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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); From patchwork Mon Aug 19 15:57:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13768521 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D50A813698F for ; Mon, 19 Aug 2024 15:57:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083065; cv=none; b=k0e+q9QwEXEptepNzcb9UYAxFZpAX0WGibdW+CAW34dl7Wt+8riNhSnV2gZKWycXVuwZ2IjCAaehIAyHlmKj9Nlhb4GcENAynpUsR1acbfTzReOF7PyiTtMBSM9pWiZh0JzAovYrkk6nRf1Eija3fKiPJsIHlAK2mMAeT8+Ff9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083065; c=relaxed/simple; bh=qVS0WEusawa8e9zmO93xAlJSemRdRXWTa9cFK8H5yjk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Hq5IvP2m8/mmOO57OwyPARod1O3dKfRrepBmpLMAYHyEaJ8iwlDeHiSUvS1EOZB3o+aLa4msXyTfqP/dL1UIlqLGR1bQr8JT3bQ0BWIQyZ6EjEmUflVn6Jel6HtbjhdaY9AMxDlCxhiXU/7E89wu91EmAr6Ckk8WSpfFvmbUUhQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IZ/PcFeb; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IZ/PcFeb" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-70d162eef54so2811460b3a.3 for ; Mon, 19 Aug 2024 08:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724083063; x=1724687863; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=68ags4Z/fglRocc1Zec5AK6s5R+ogqTtMIGOd/mlYiI=; b=IZ/PcFebVKZkLy2BWJC6j7E4iRbEUZX0KFLAs8ykrxVGjUa9+Q7oqm7cMmBmaaLD29 zCUX4xIAIVj4s42eaF8WRAMp+z0Yg50ornbGe00JmtewMDI9jZ6kx/PfTb/Jp0eyYIPv YGRIAtbQp13nmG09UPMZQBb0LOw+jmCp0hxESVcbOlp1WoVFMJKyu6H1whRUqtNSthRH UfxbNSd/+cluB1O9dZadaIWN5HzX0ESwFhHpjlJpuU5xpbHgLRXM04IzUD6PBfpOVuCm ycs0XU3UR7STBeX6RvAy6UcS7hU/4UlEv4P6uWtTX+1K0jJjfTCgZM4g/pLskAYwObYB a1Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724083063; x=1724687863; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=68ags4Z/fglRocc1Zec5AK6s5R+ogqTtMIGOd/mlYiI=; b=DYBGWWuXKQwir2B+V8GKlgLc8OaxPcIzn9AhpSjaMaHrcmi7VulFl/o3Qusa349CfW uVP9SneP5Sobr4qfwZhehn6bpddMnfHyFzrNgdkbyKVq4NmI3H4YVgbmgttiR9iSRFm8 Eclv21vnBPz8nF7PI4XqaCGTOZaCd3mBX7LyPNy8m5zkrCiwWO95hqIVXHxeCJhaWSwR XUiK93DERzSPDypQA2wVi3Nn0+HNYEGOxp+2B5LelvR4y2aoofGuAkNFHzz1dNXFMtRi BljfWfoROXLkeoU75lAaJJzr4VDY5RjGJw0laZu8+9DVTTJPQ12v3GMVUeiDSjQWOls/ 8CoQ== X-Gm-Message-State: AOJu0Ywpfu/JrhRyxbAN0FbZbfWOR5blP4xX9uyNOJyilzPDCSeCT1N+ dkKbJWzSmxNwiCvqwjcLRMMRkY46RwMBHKkiPGl8MXwREBgFWkEPfuaS+w== X-Google-Smtp-Source: AGHT+IH3Dj+qyA0AHumL/H2aQOO3aDwHsErjv2IRNHSZHFCfm1tJZM4tn8b+nyVl21N2YzwRY7KwMQ== X-Received: by 2002:a05:6a21:3998:b0:1c0:f5be:a3ca with SMTP id adf61e73a8af0-1c904fc0f42mr10770208637.30.1724083062630; Mon, 19 Aug 2024 08:57:42 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7127ae0cb5asm6752277b3a.69.2024.08.19.08.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 08:57:42 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 2/6] station: move BasicServiceSet DBus management into station Date: Mon, 19 Aug 2024 08:57:30 -0700 Message-Id: <20240819155734.1276476-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819155734.1276476-1-prestwoj@gmail.com> References: <20240819155734.1276476-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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); From patchwork Mon Aug 19 15:57:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13768522 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50A4B13A3F4 for ; Mon, 19 Aug 2024 15:57:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083066; cv=none; b=KKBzHUsyUWjxup65zYNnL+XME5RZSrTuEd3rDXATlmyBX4Dspe30Haq8Cgh41na2hX6uqXog8WnI0ckHNxLIAVFs6LtE5iNULtIeFODChtRop+0yNhi1xugLUiT6f/9e2QjFaTiQhSlS00Gcri109dWF23B9pKtjt386XpEtZIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083066; c=relaxed/simple; bh=2HqIBExNRmwUHO+XHHwxK4p1f6S0ypn3Q0S/iPGc28k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r76HAfAS5XwoeCKjQXuFOV0BG782+dYeYyoSrH9DoGODLEvgRmHhjvRkmThAvGFoHQYEyAXfCQE/mRb5Y+O3Rk2f53CWQ1KajIk3giFyZM8IL2grttF90IcSZmwExRJo9ID8ZXQRwTp5rPqkdzHUvDXSVBZa+MacV5KanvZkArA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M82SMlzQ; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M82SMlzQ" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-6c5bcb8e8edso3337680a12.2 for ; Mon, 19 Aug 2024 08:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724083064; x=1724687864; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FkdPtJF6Yfs9+V2+uZ5QEN9qO8E9CKv0LgQx8qXBJyU=; b=M82SMlzQ0/H2TbJtUJeVlrZW8z5/HcpzishEX+mrAQVt+ny53j1kYekADw7pZht7lQ u0cI8AzCxr8v668c4yR9/U5hmuYo5a5lmWLel8JvDYgUODOLEU14owyuj/kJrHF/7tKk jRMk2oyMtMv/gGLtsr2mPDydrRT9XFc6KFSzTQ/mwCVyWsqFS/WJnEXHJeWbbkawgoXd EdNKZvbGjwwN5WFD5Yi4oWVWfWvIvUCxPZbYBVE3X402LpSIVt4KQEn68Y9Zg8KiResW DEcxgiqG2vcp6GUbUBLucbXPCr5LckfoJ/k8XglVRfNbv3I10kn5eCDRc6/d6nDkNFsv t+tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724083064; x=1724687864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FkdPtJF6Yfs9+V2+uZ5QEN9qO8E9CKv0LgQx8qXBJyU=; b=fY5Ai8aKcYpWzpkicJ/cNPgXa2N7Z18s0U+58Qr0du/WVkw6RgPtYr+bhpFXPqADZn qBDgomAKBHr6SKZ0Y2NWNZ/nIvEp2ow7y3fo+Q+0SxtfaMms3T83cyio0/Yn4h3Ku34v Lh2/wexAYGlcbuyuU1pHgPq9p/SCpM7Z0HPO0Snxy3xhg3/4w4GoUfGLox98aoVfsxGf QJCOhjROzuibcHg8kLfQKg6SaQFbyahcp+jW0J9EoxmIvSLuiQw/zJBfnjzcp/XJbst2 /qbGbuSQmL/O9xn3J3YxB48+0va/XtRabG0KPZaUcnudNYXZh6fV57MluilEMG/f8rUF JFbQ== X-Gm-Message-State: AOJu0YzFrCI0xV11kgG7RTnCCUZTWe8DORFCfN407BmDHz15axLrx1vz NPshbBqSrwQfW6zrXBrd2r5zd+tGQ9Ppbu8yO0OMfsUHgkgaVzYFSMs0cQ== X-Google-Smtp-Source: AGHT+IFkVeS9t71cA08lZ8xMg/m9pRP9Lp5Gdjb393i5rUmWXbTOrgzOaVZfNDRCf7BYYioFgoG4gA== X-Received: by 2002:a05:6a20:6f05:b0:1c4:ba7c:741c with SMTP id adf61e73a8af0-1c904f91357mr14768318637.21.1724083064243; Mon, 19 Aug 2024 08:57:44 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7127ae0cb5asm6752277b3a.69.2024.08.19.08.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 08:57:43 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 3/6] network: remove BasicServiceSet DBus registration code Date: Mon, 19 Aug 2024 08:57:31 -0700 Message-Id: <20240819155734.1276476-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819155734.1276476-1-prestwoj@gmail.com> References: <20240819155734.1276476-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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, From patchwork Mon Aug 19 15:57:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13768523 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F305613698B for ; Mon, 19 Aug 2024 15:57:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083068; cv=none; b=RGwm+A5A8QJWxmMr8YkeiMqEhZCFRYp/6+Z3k8vYm4/dee0BS2HbuwaxoDor/mv0QwXBbmDMJcIngi/PtpKmtJMydpDLHEBooitq1GXvJ/x7Gd+mPMSK0QogahvNjLsgRiDVG8bkh6TnGAPgm4WXOUObd2oZ+x4R8qGTV74cJDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083068; c=relaxed/simple; bh=RC1rsY0tGCRivMAspeEl23nEHI5GpA0HFim2qN46O1Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QA1WYacJNhRAY9+IvyLhKSuXbTOBBd11AlkqdDZCsbIj3QKOSkVidlOqIoJkF481Jwq9ufPtKif3bw4WDTr0XifX9RUMHHQHFXfF8tqWj5w9adohPrs4PpDoJtqxyHW19UHOep/ItEYTmyLjssLP/DSwKgDiHUTRxwxo2u5WyvY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RYdF0WaS; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RYdF0WaS" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-7a115c427f1so2699317a12.0 for ; Mon, 19 Aug 2024 08:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724083066; x=1724687866; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GOtO/WMTZo4GLFRZfbqnYPS7ONYYi4bw8wetTO1+J64=; b=RYdF0WaS9HBGSGWIJBPpV7M+0//HEN9WjAG7nou+C4ugGJFVfvll2YNKL83XkYaX39 zMQt+TnAG59sEAHc0UjOqQmrCy4OZbEzp/frKCiWhZb/xswqdCjRkULm684n434+qvBm IwIBZbOhBl+M2TBUL4HLN3rm6kBipSlPzEnOAy9OnKIxe9tnhcL+mE4sZbbuanCYLjMz 82rwgBierZuFyQozn+KEIqYMEcbmQPVdEc4Azr7mvySPvIQrRVPnF0WR7rv4rv/sMXf4 FvD2Pk4fyOdobfZybY6N9fwRtcpIkxE58tg35WcLt7jYT2yO8Nd2BL9DUc9z/To4FrD2 pC/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724083066; x=1724687866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GOtO/WMTZo4GLFRZfbqnYPS7ONYYi4bw8wetTO1+J64=; b=rnvMLfmo8fumKywP5AnJthJjiWW5LiMlGW1gQA63kjmXiRdl5b9HpJDH8VLULacj21 xfp9Ko7hDvPtQbEMYM57Yf4YL7+Uq7FqARcXjCW43/m3Nz6k671lZu2CxVOoAKE74X97 w6FPKeaw75kwOO5CG9Cz0+4ZbeWRfzR/SaONCRbzg7PJIqTuGXwerjbFc/UHvCucq+CS nbF8DFQLvGatKg9e3WjISapAxdHovhvB4O+WWoVnZKanis2HqFh1mV/IU4HSwFAGtDGJ acrewdmVOJtClWKR4fAi0I0anx1avwhGfOtPuy4quHJrOu6lj9gAHYGEvYaGsbQF0UxS 4OgQ== X-Gm-Message-State: AOJu0YxE7wnOSkXno8gp5lCmqwLv2i00W8ey1Pd2F8uMlXjY2ntAB+4G mWrNQEgTXTj/SxHuvhSDMrTj05QL9fyONZayihKDoaI5Kj3j4Z9+y+1Xmw== X-Google-Smtp-Source: AGHT+IGc+KwtYW733TUBIqSq6VTb4DrJsVWvhE7Hxz878dOW7bXHBckZRKR8Ac6E52lsHA8PKh2XKw== X-Received: by 2002:a05:6a20:6f8a:b0:1c0:eba5:e192 with SMTP id adf61e73a8af0-1c904fb8e21mr11291845637.27.1724083065803; Mon, 19 Aug 2024 08:57:45 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7127ae0cb5asm6752277b3a.69.2024.08.19.08.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 08:57:45 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 4/6] network: add back network_bss_list_clear Date: Mon, 19 Aug 2024 08:57:32 -0700 Message-Id: <20240819155734.1276476-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819155734.1276476-1-prestwoj@gmail.com> References: <20240819155734.1276476-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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); From patchwork Mon Aug 19 15:57:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13768524 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AE0B13B2A5 for ; Mon, 19 Aug 2024 15:57:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083069; cv=none; b=mDj84jlQmD1nxU69guwl+NHR1SO2fvbA/lx8nNm2gL48w7e7VMLwaRi6SSiCIJuiC+gYYCKjGie6FcWQ7JraVam9oj3BFr1H4sETjh4/GGKeQfUZKDJlHK7awv0lSZaOoxpNpWS9ZfkmRxl/xMPeWK8tXO7HOr7gIfAIY+s8e7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083069; c=relaxed/simple; bh=dGvS93TLppkCHT7FkE+RNSg4owaFpHKRYvuTu3q412U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=azS10LWHSVl7sJGYqFUFTJa41/RWSOzuBpyaK5Rpd34w+6YpNDGHjp1Y6Gdo0Z/VqTEX11kr7v3nVdGaN3v4wXbiZvx/I+137kPtkZ6e9lShIK5f8RuQTuqsp+DhUVM2MU5iY6+vm8Fb0G2Ki1ywgyAuVFGM18c9taUj43V89Kw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IDd7tWHZ; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IDd7tWHZ" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-6c5bcb8e8edso3337708a12.2 for ; Mon, 19 Aug 2024 08:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724083067; x=1724687867; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5avM1BXirhrk1+l4IoOpkNGQh9n3oULhwodONX2WEJs=; b=IDd7tWHZ/XE1ZhtjEYZ1i8VEpHpS4doVg/NIAHzfN+NrlFti9Jon04VAdKA+o//hUm tobOC92CcCbzUtK97nycLgUM/CupJ0BEHJDAo8Bt6f85z2WQLn6K0C2oc6ZPsoaxZvys 9Z3NGlROrMJxZjoDT9/iSryU8Xh110++HRjdWJP9kDUKzpzrMz7MLqmmgxevFZ5iHd3m SYsSWNYqjyTRNANxVjMWsxX4VL6AePoMN9Yd2IfPdYwlf6TxZ4yHhdj5swaaPreTEh3g 8WAIR0MDDIH+lEsVIk6MIGDYaNxvR1iX1I9C/SHplYKWAiHWJF4qY9nhGOt+bJ0N+E2S hMKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724083067; x=1724687867; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5avM1BXirhrk1+l4IoOpkNGQh9n3oULhwodONX2WEJs=; b=f5ZID97Hvl+TKaXwI3m3J3wbYIc5oMKRyeOORQB4BvopDmKDi71uIBKh5V9odni2mk pAV+3gg712UMAyxn1Wlobn+P+RJBf8u4iq63ijvUVO+uRB6V7fwSE8p3bdElfRXMbCjB avD1VnWQkvFKIRe9TC91k2XHKGXhap++72fnbvNLt1oeB0stcNJs829zeoNNWy6/FOKj nWkqodGmbVJWDi1A6CUmLRZz2rfr7hq2vThuG0DSbQ/cRmqXPj1TzamyFEPaMBUFr9Gd un8Ho9AmYRmtBU+eKXeeUaBg7tYD/WdH4ZVPKawPWNleFfiV/wCZqBOY5vsEL1gM3/e5 Ualg== X-Gm-Message-State: AOJu0YxV0Zm+pdQTiv9CEnw7BPiBqlRJF6O5ybCDEM6ydulVY7TfVvB1 N0R1POsPZJ//al5aWc+VI3pn0UWy/nXzZvIqh0cA34zQ9jMYnt+4ir447Q== X-Google-Smtp-Source: AGHT+IEc6PF2STYdr/PtFT1Zo5wX5KSu5JqrZlG/NVkKYQ2Ao3DqNR4xFOnFpCq9jnP0FYIcIoZ+lA== X-Received: by 2002:a05:6a21:318b:b0:1c4:2469:f893 with SMTP id adf61e73a8af0-1c9050528c7mr15347985637.46.1724083067374; Mon, 19 Aug 2024 08:57:47 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7127ae0cb5asm6752277b3a.69.2024.08.19.08.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 08:57:47 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 5/6] auto-t: Add ExtendedServiceSet property Date: Mon, 19 Aug 2024 08:57:33 -0700 Message-Id: <20240819155734.1276476-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819155734.1276476-1-prestwoj@gmail.com> References: <20240819155734.1276476-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- 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 From patchwork Mon Aug 19 15:57:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13768525 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F18F813B2A5 for ; Mon, 19 Aug 2024 15:57:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083071; cv=none; b=VTrg3RWuQIg+Z9WlJuRPEgr6XlB1D2T/hlCd3M3OOv1BOKrd1r2U4tu1HTJW37DW+Aq+F1l4CZAe8FYAY3l8QhEsAveRwbc7+1rwMHLqydB2DA/JaQDMa8xh4DguUp818OrNy1QlgGy5VZosvfqCX5vBJiYb07q3em5ilATYzYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724083071; c=relaxed/simple; bh=wQ1sYgy+XyfmWW2VsSjGNopZ+AQqSPwYV8AF/Tc8QkI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=c3TneyMR2ei9cARycj/vXmV1YYUKvUvuY+vLrJm/Snmqq2E5m/4bbyChI0G60rnBBnWP+6LkF1+Hjvwq3aRY0wDEyuwk09T+PIvkTgPDx1940WoA7wTxMP73uCG/SvrJF9aCLTjrwz6QIQyHSCUg1hWuXq+EIoULgxmcUNNQ910= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WzMgw+FB; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WzMgw+FB" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-713e460f920so1192036b3a.1 for ; Mon, 19 Aug 2024 08:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724083069; x=1724687869; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UDoJeKkVNCXIIp7EFX/aAAGL6EGIL4UURmjJXhZ9qyk=; b=WzMgw+FBTWJrImmDIcWHggL443/dEAOJ2ylE04mMjyOJIssNatQiWZNpr13SLWStH7 BBwoyv26I+qsgcUwJTylWstTOR/SD5HiJ3KT6A4Zal/qqW7GC1bwl6JlHDZiK+KX8NHD UFTuHkoN+JdI3IqylNl2FKGgO09PuvpGV8dll6x8TpDY2AWwfeZWkLzmOOaYFkmtwvq4 fwvZj6TwiGNU1PfB1ZyAygqcjyVTteKja/4V7QYtdLxBjNS42CK9ADdvev5V1TQjwxLk uQmUtBOFDq8jpePrja+BUbnKXuLfPRkro9M1peyecsxJYUMRM7ByJqcCsXx0wFFDtRcD T98A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724083069; x=1724687869; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UDoJeKkVNCXIIp7EFX/aAAGL6EGIL4UURmjJXhZ9qyk=; b=SbfFMZlIQ8qr8gkMPpAc1H8HzxERNf8JDCJKPMfbNtw80Rp8UOmUhTV/WgsJrAv7Er RIAEpKIa6N1gekxO1NNesE70IAoEXAj3LUqn3HyrACkqUxmO3cPw2JhbSpivZ2/dfgCS b04sD6p38h+Z1R1tN5AP9e7GLVRBlW7e32FAOeyL1YC3MMW0FIYlstar5bxS3vFrIHQ4 Mz6HOmHL1SsKBql2+E03tbpqos5ruHD5inzpg1ZEyaErqNiOzu25h/uofZ5HLtYKmfoP hYZb3G4c8a/Mu0mQY8/jjp59logdZ6mmiGXlT96GAkouZxPDIwjsgwfY0/fh/4Ek93EB iI6g== X-Gm-Message-State: AOJu0YyVrJnc9/8IeYz+MQR+qOTri4P4pZwrNZ8d0V32plAXGC4rGp8k 3vIJfu3PzEKE5qqrt0BgLymAAQjXTHMA+EVIdJwvNhJBBSyBqJ5ZAsFbzg== X-Google-Smtp-Source: AGHT+IFz/5bc2pjuW3lRi8GbA0JQIM6n2AX/xEp6JhW4LIIgTfUb0nwPMXJGz7lNk+EpR0NSk9a3fg== X-Received: by 2002:a05:6a00:915a:b0:70d:2b23:a714 with SMTP id d2e1a72fcca58-713c4dbec9dmr10233175b3a.4.1724083068895; Mon, 19 Aug 2024 08:57:48 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7127ae0cb5asm6752277b3a.69.2024.08.19.08.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 08:57:48 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 6/6] auto-t: Add test for BasicServiceSets Date: Mon, 19 Aug 2024 08:57:34 -0700 Message-Id: <20240819155734.1276476-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240819155734.1276476-1-prestwoj@gmail.com> References: <20240819155734.1276476-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- .../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