From patchwork Fri Aug 16 12:52:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13766131 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.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 88D69156F34 for ; Fri, 16 Aug 2024 12:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812741; cv=none; b=GKamqYOs5Vv2XBwBGptZtLP4lUp0UxurW8XP+dsJIJBYV+lciVvu4N28Y6+lJBu+lxddZGtHQ0FvhWIOXOLfBvePORFhOCvQ7DTxwoLPGAAC+Llo9Zj16UoYOx8SYB7M+GwclWtb+wfIqqao2jIaEx4mg18X8Kwr2ROwj0TWQAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812741; c=relaxed/simple; bh=Xo0jQKN0L3cPu7vcQ9s1yXgfKSMGdhZqcDWEIRz2Tbk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=SptjNe+TXNhxV/hH2nDTnMFxnHjaawaG0p//PmBGyAsftFBxqu8NRb9EZ52jDkZevo6BDMyLHjWtz15hcpPoKnzCJSLPyrbpTWIf3pFOZ4CPGEI8LYmVz3DFOKdoAEbLAKf94fiz+oPLVmCNxUS/6YvgIbROHYmm8R5h1QX/FQk= 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=Jzn6V455; arc=none smtp.client-ip=209.85.160.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="Jzn6V455" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-44fdcd7a622so11337281cf.0 for ; Fri, 16 Aug 2024 05:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723812738; x=1724417538; 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=Jzn6V45569mQ0MLUTlMsrOhGvnAf1khuCtQK4CzU2D/6uArYScZqtUi1wuUchrpgxk zikRiuRJ1/b2Q1uDUZAwnyiASfcZ3jRDrxkvH1Rp6On5GIiSnRwdlbKvUH25Dl78KwAy 3atcn/7teYH+sjxZ2xFM63829BV6/mtDSjePQTUGPZtPA7yn9i5lPFV9NU1wLPGKniAA onjPgMZ+AAniDjwDLSv3ZsLUQeu24dlGjgRWGrre7sof0CN3ADVzwpqF5mRC/Lg1gLHe W0jxzZPo1U4kAyKe1g4JZKmAoQ+JJKyUp5j+P0r9oOPDloCN7vXM4+kgjlCLUjD9VKHJ H4FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723812738; x=1724417538; 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=qZQPf4V4vFxGKqiW6tcD+vD628SS2nS9+624AJR0BK33VmVV4fD6LEDaAqd2UqAcB+ FL3JkAdOwzCGmoQ4gaY5ytgFkcujSbMi6omAWxCxd4OKmI2a1iZ89ZjoiciUn7dJssbD saUH1ItVO0VGzmRGQzpH64VVD23Tf3aLDHKhphr9X+5cwTF9oBcC4LaR6HU5GjEWEnfn t9kPlzXUuDgCImBugRXtVm96CZXyFU9K/wY3/EniQg9k4LV4uq5I2u/e6I6K1KHB9Ooi 4hSuoCxD5uXWVaa7Nrii7iJPVw4+2TKzjw7qJdtYdL9TmI/sJ5QuPuRdICZA2ItGTli5 xfaw== X-Gm-Message-State: AOJu0YyFqCaDC8vi8kkTKkl+/mB1HNgiihuT7ygNYlQEezqHJ5CN+JmN o33TRz/RSshxkqz/1Rw5QTaAzahXqC+hFQdaO98tVr8krCB5zwSXD0qlLA== X-Google-Smtp-Source: AGHT+IHtd0kYQnbp67gMm6YoHkQD5JDQzUMogS+NxLtPIdAYN/NMwSNrBiERdfX7TurgmV/uX3vGNg== X-Received: by 2002:ac8:7418:0:b0:453:74a5:3a3f with SMTP id d75a77b69052e-45374a53ad2mr22504801cf.0.1723812738064; Fri, 16 Aug 2024 05:52:18 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45369ff54ffsm15921931cf.36.2024.08.16.05.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:52:17 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/6] network: add __network_path_append_bss Date: Fri, 16 Aug 2024 05:52:09 -0700 Message-Id: <20240816125214.1162415-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 Fri Aug 16 12:52:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13766132 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.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 91E781741D2 for ; Fri, 16 Aug 2024 12:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812742; cv=none; b=hApvjGJbwCS3+ZIsMVPbUBPk6L6rNQalxIIdLZxdQh/oZufEiKraJ2y0jPlMyT5xCNU1WBrrmOZ0SqZpU9Gi3n0YBvFtvJ3ougWp/JlbsFE6h1y+NOQGALXcPnY6c8CycKtzJ6zqKNnud66jds0BDKDW9gOup5U3X4HvEJwcvkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812742; c=relaxed/simple; bh=rz2zxxgcFIenkrSykQF/Xglw0PTg/msxDuJvSXRirEk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Swjgs7ncMZeaolWhLNf2r4h25kRlBmdAjTjzR6R/R2K7DmVj/Y/NG7/4w8cGou5gMkU/mmpV/kiC+nL2cz/YUX79q1FoJD+ox9wBpjaozXwXAVhyILjp1e559MAwZXUS2kr9TnrIruyo5UEb/APW8NIq2Q6hhBn+lrdZD2pYDQM= 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=KsiEFb7S; arc=none smtp.client-ip=209.85.160.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="KsiEFb7S" Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-44fea44f725so15700231cf.1 for ; Fri, 16 Aug 2024 05:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723812739; x=1724417539; 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=fuofz8v0KMzDxQBkLp5djOAqsITua8Ho2HF+XRC4t1A=; b=KsiEFb7SVAAt7OudFDu6+r9bCAkQNPMhh9mD/Xvhf4u+MCcvCVbM+xemcRsVY/Guu5 76uaYjxQdnxUIPOlVQUrcWPM7UM7+LyPMFYWdTq0vcAs0ClPxxE5418i5CQagGQXZZU/ dsljkr5O/NkkH0VgcqxCD4Adxyz9/EkDrVDDnAbbp5q1TXpE/6aMMPFdi5IsdscfT775 h+PZ5Q2p22G84WNdrs4xftD1AQmxjPR+gB7J6szY2kpY+TR45/pK6+YRnoQcOsGiu1Ot 0pfpx8D3rQaT70eOWORmgcLYuUvF9r27GT+zERMt7DumGGMSfEzI5nIHcJPwhNGZKa0D Y0+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723812739; x=1724417539; 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=fuofz8v0KMzDxQBkLp5djOAqsITua8Ho2HF+XRC4t1A=; b=NIy2LiI9nh0Ku2RRNYpvdSPPyhH+/6Sp2p1crGMSSAiizWZ9FcIZ9nvLwrqeeswrCb j5cBO0AsnDCww0iU8MDrNIuLXWVGQiAnSmpGNGQJD6q8GpG03MhJYU+iEC+oR2U8ooJD k3Dchzv+en9XDdQO5MR8IXhNzkm0sMqyiJFuo6EZTDv7hWPJwMYd6ItEdPRllu4OsYVX xgXpqnze+JCAXbLHcduHBET8oL7jPf8pIla/P4IPG4abHWAOaQjNdiaqHRJ35+ghTO85 vu7Fhpcy3ZD+cj6RANICSSsF8LupQex0cXavVGR5HsA/9uTvnAfyCINNRMHtRN/AqOTQ fwVg== X-Gm-Message-State: AOJu0Yy4Z0xSzi8R5Qemkj7VQb1ngxNCWJePPfLbbpBYX5BMRo3F77eq 1r7H1zb+4TCFjEn/CClEyN8wZyK4rg0+inxDB5pa69uyR5rBjRFY8Z0lnQ== X-Google-Smtp-Source: AGHT+IFJRfCAKqqBEPTG0i40QcHFjqN+gQfFSScvd4A0wUVQP2tjjvPGe4d7PQEwkeyAfyIKxwPU3g== X-Received: by 2002:ac8:1005:0:b0:453:761d:7dab with SMTP id d75a77b69052e-453761d90b5mr33187091cf.2.1723812739158; Fri, 16 Aug 2024 05:52:19 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45369ff54ffsm15921931cf.36.2024.08.16.05.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:52:18 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/6] station: move BasicServiceSet DBus management into station Date: Fri, 16 Aug 2024 05:52:10 -0700 Message-Id: <20240816125214.1162415-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240816125214.1162415-1-prestwoj@gmail.com> References: <20240816125214.1162415-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 | 89 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 72 insertions(+), 17 deletions(-) diff --git a/src/station.c b/src/station.c index 06b19db3..25ddce43 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,65 @@ 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 station *station, struct scan_bss *bss) +{ + struct scan_bss *old; + const char *path = station_get_bss_path(station, 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 +575,7 @@ static struct network *station_add_seen_bss(struct station *station, } network_bss_add(network, bss); + station_register_bss(station, bss); return network; } @@ -540,7 +598,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 +620,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 +882,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(station, bss); continue; @@ -951,7 +1011,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 +1022,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 +1034,8 @@ 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); + station_register_bss(station, new_bss); + scan_bss_free(old_bss); continue; } @@ -1017,8 +1072,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 +2705,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(station, bss); l_queue_push_tail(station->bss_list, bss); if (old) @@ -3160,6 +3214,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, new); /* Remove new BSS if it exists in past scan results */ stale = l_queue_remove_if(station->bss_list, bss_match, new); From patchwork Fri Aug 16 12:52:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13766133 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (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 AE7C2156F34 for ; Fri, 16 Aug 2024 12:52:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812743; cv=none; b=DwecPlaETdITh3I4K1zaFHivzaDVGcn5fe/j+wg/bPCIzBzAfkjB7bXCZxwnAZA4dFSK6SR8fqNHIVOK0i81V+4zFHiJUdbnVGwbgZUCt1IMbmIKT5MwdRIjKPsBtXdhk1UA2mcY62i/0UFOesOzS7DnAcAdrSt6hsdD+IPQLDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812743; c=relaxed/simple; bh=2HqIBExNRmwUHO+XHHwxK4p1f6S0ypn3Q0S/iPGc28k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VbjXyCyJCALdPr+lsBDznUxA4gocau2S/ms8r9n2lDRixu5dxngn7gpCfrOT/Lxt0xiREOj5qigVtixgUvCBMtMOwiHmOWfQ8JAtpvkrUS08/eho8lSkwtRX/mTXgirKavolZwUXARcxQJ70sk98bMJ9vp+x1uWDfquU0w6hK/M= 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=OGzT9vQw; arc=none smtp.client-ip=209.85.160.170 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="OGzT9vQw" Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-45006bcb482so10418031cf.3 for ; Fri, 16 Aug 2024 05:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723812740; x=1724417540; 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=OGzT9vQwWvgv8OySPUPc+FWT3vgwPX7FdDEQAQxMfJZt0Resc5H0DebkGM+pu92v0T kfJKzc6NluVNeL4EBSik1ECAkvENXYSQsRUKYmROOU0tn8g3Mqel7lPO/qlWnY/XJ5uC uhc86uovyKEnlIzh1hTBXBsgGR1fkxg/DUxkbWaW6XfhwXZfkNlQILVZG7xvaZTe0VlC D6K84dVDMi1JdV0ZjrVIKIDzstZlMck3EV0KST91qjr2WDxpWnm9U246im6I051wUXqZ zS/5vaa8qRV0fAjSFcZXcOT31n5VdQJKyUUEFQvg+yJX/eqTGStlkjB8yI8BVgX8T2bR KgVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723812740; x=1724417540; 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=WtrRPL8kFi2V45qsUWX7dzDVqrfGpAiyGCVmZhb/QX6psktj0jOrz2ntV+siv+qTyJ Ky9lSaVC3Z6MaY40bjSyOOBxD6+T9x3ulGvwGrs8KhR5WNa8FPdCjdOjPGTnC07MAf+5 af/2wuqc3WwMk+qrm8fquiDtKxEJEN/zj+VSd/kajHOelS4PzcXf1oiyPKLGAMmbscjg xU+JXvvqaR9h46xEKQe1JrxXd2toHwrweQMCrDpTZE0voM3eVfVsucXGXa3HLh1Ni5/i hHB/Py0POPC5xeeqGRmn69T+smGLDcfrpwX06nvp4dY/dcUoJOYV8bcz78ZkzBBQFmWm GcAg== X-Gm-Message-State: AOJu0YzoRslYnZG6Rw2YCeoDwdW6JjGd1uhGUXYnsg4nTGKdO2sMDFhP a3S5B+Gg3oUTssAWeued+ogzNdxKBSHXqdm6tx0TAejj6ANd2MHMDvCAMw== X-Google-Smtp-Source: AGHT+IG6np22Dn4nCUK7UFqZ27vMsGYh3PefeKezo2LTrgu0/EMIkgpMigt2+sb8ZQ+3odEZ6f4/pA== X-Received: by 2002:a05:622a:5e83:b0:451:d557:22ed with SMTP id d75a77b69052e-453741bf460mr24814531cf.11.1723812740227; Fri, 16 Aug 2024 05:52:20 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45369ff54ffsm15921931cf.36.2024.08.16.05.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:52:19 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/6] network: remove BasicServiceSet DBus registration code Date: Fri, 16 Aug 2024 05:52:11 -0700 Message-Id: <20240816125214.1162415-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240816125214.1162415-1-prestwoj@gmail.com> References: <20240816125214.1162415-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 Fri Aug 16 12:52:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13766134 Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (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 3FC351741D2 for ; Fri, 16 Aug 2024 12:52:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812744; cv=none; b=XKkYGmEhOfEhyTI0lKR1/0wuYiECl2FAD+GoRDoE6XgJm3gFwaEYlrXkyYVVCjlc7Qu6q0NV5gbMcZcE/lWIiXwshhWBPnbWSQlKk6C5VAANHZ4cU4alk+HXldGOZUa5UoBRIsNyZ85UcBuF1UFBzNlK6oy5/5wCCNy2RH28gdU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812744; c=relaxed/simple; bh=q7gotcoxEPZUezvxhZwIN1x/NWzLW6u93O+HoQ6zcEg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CEFoR7kwSakOx9WcABm5LF8A/Q63PbQ13A25G0RpVb+nxxwoSJ4/0YLywO88kxu6/Orngb8EDHw9xBVgYVCx0KiJiA088uhVDUSmbzbYC+fMvZs6+nVz56fFio2Qjfehy8dR00NvOtd6LLBguTAHilKak4YZnma8J+yydbO1iIw= 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=k481TFCn; arc=none smtp.client-ip=209.85.222.171 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="k481TFCn" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-7a1e31bc1efso122913285a.3 for ; Fri, 16 Aug 2024 05:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723812742; x=1724417542; 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=CngE5AZvTqb1OkmdQOJlNjvA6hGBVA2aS90ZfU/54X8=; b=k481TFCnNrDVbRw4szKisKNb5Sqk8G6Wgmodd3Bonp4wEQJwDmP9peplYcsmDBh7yy Dqg6aHCx1rkMyEb4YyCvSHZ+Kz7FYbxSCwzmGv1/OR3EEcQDMZTSGNz8kyohq3hn6ovf zYzOOmQsaTPmlEwuTtIF2OC7NZY5F90c5Wb+KkdiyH/MROizBmutHzZg+dkINyb0mOGk GrvK/bhrl8u+MAbzVYTlSjmAKjCNr6b8ztXtmvhk3unPw9VYAGlAlNA/ZaHowZg+RHyN tEO4G6Qk8Mgvoy33fB5y7OD12nLT7d/ud+kGo5LkAno1Caj8JX7oAN8lQcLQtEsiXtZZ gnhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723812742; x=1724417542; 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=CngE5AZvTqb1OkmdQOJlNjvA6hGBVA2aS90ZfU/54X8=; b=ZgR4i3hA2i1iP01M/OivTj7m2sr/d1wwytT87oCx7pPmH7WTyTRlMQmx7llQbq0K5Z RRcwqsV772KkFEuflfO0Sh1rPjpEXghYhgGyN08+oLqUGYpZRFETVUZdt8N1sn1Ayclf SkdLe5ymT2ciHZP1YdiwDHbMYLPubfBe1DAkSI7Jb71KYQGJmKNsv1TkdvILT/NaC3sb 0IAKhgd9BUq2P7/uEaekxIHi764FCpLueLRTO8gK6I5RwL39Em8RemUmJVCwz2Al/gh3 1+w42Th+79pASITWRpHl2lcraaAiJmvYaZYzZrxmOd7gugSU3tF/76XWAJbgV8I7EAkj kkzA== X-Gm-Message-State: AOJu0YyJ5+mRCgAyt1VMU4tT8IcKBqtWIbpqs8+RvHQC5NpPlyh4B6H8 AgpeY+j53WXTnsQnkxAG+rpCq4K26g554uYNBcfC+gupGi2M5qHUwDSewg== X-Google-Smtp-Source: AGHT+IH504mnSj0WfLYkQAefjIrDmsEIp3mXHrhPTg2R30T5sniwUxMO5iYyBDbleDSFT9sA+IspyQ== X-Received: by 2002:a05:6214:5f10:b0:6bf:6a7a:c653 with SMTP id 6a1803df08f44-6bf7ce6f148mr38588696d6.31.1723812741945; Fri, 16 Aug 2024 05:52:21 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45369ff54ffsm15921931cf.36.2024.08.16.05.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:52:21 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 4/6] network: add back network_bss_list_clear Date: Fri, 16 Aug 2024 05:52:12 -0700 Message-Id: <20240816125214.1162415-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240816125214.1162415-1-prestwoj@gmail.com> References: <20240816125214.1162415-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 25ddce43..e1352041 100644 --- a/src/station.c +++ b/src/station.c @@ -1015,7 +1015,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 Fri Aug 16 12:52:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13766135 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (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 8E6F1156F34 for ; Fri, 16 Aug 2024 12:52:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812746; cv=none; b=NH2E0QNKCr9WQd5Qe/43rP0Q85H3zi6+LW4yjKHdNMizxLQQhVsSAUxHK9Ee8Sl7SCPH5qZ3+yGy6PNcy1gmnPdbMszL0g9xbUaR2ZAsjMVlcdXElfys+/VtC1Lg467r8Gy0gJsE929tnGH+c6o2840g6Ztl/09gjU22K69pzjM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812746; c=relaxed/simple; bh=dGvS93TLppkCHT7FkE+RNSg4owaFpHKRYvuTu3q412U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L3RNAZoTfC+nL46A4NJ8/xg8Hcwlf0r63E/AaRFbv+e0U1mUAMzF6FnTfZYM12YhJXFApi1xGYzUd2mmYlnPM0HysBZd6HmhZ/b66WlItsuJWTFGMro7UI9fOzOITnORPe+CF1SHidyo2aiAGLFVaF/zbCvhxYyopvar1M719vc= 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=hvtq7fEv; arc=none smtp.client-ip=209.85.160.170 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="hvtq7fEv" Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-450059a25b9so18401371cf.0 for ; Fri, 16 Aug 2024 05:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723812743; x=1724417543; 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=hvtq7fEv1pznQ6xkN5QQotgLO4Epwbl519DlIXMNmkj1KpM4SMwUeiFCZ52Wi3ousf /9Z2+80SC1wTK9nRtRQbG5xtCtPL1jXsZ8z4wdzMZmHMbeOmeuvqmvyZK1zN49pKfXgj gKUvasr1SH68hfkeMPCjltZ6pGf0MNNEj6wb13kDJMhUxi7/o3HAzfV3OhwUzC5N0Rri 5XkZ6L7yTi20rt6sVWbxNNb8As0ThidzAqoV9DH1f4/DmfCKJdrfwuakN9ZmT2NuaCYM 1epEwBrvKKE/i9kqgSutzfKVyD6W+Tx4l8XQMbB114WJKRtZqnkTq/29/hXikGAAc5WN JTGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723812743; x=1724417543; 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=ojnoKPNJ+WVZZajTogXlV/UGCCqHZPFYqPBuiqVtOK64UgH5BUI0cUnIPwCT18HNaa KLkRmIMPW+nNQPnvJGKBCiTBtfAQ7oNmqfmsBPNXJ9/SoGwXvN62eitzP8HGpbMZTyYj awqwsJ6r3XOeXLdkgTEe1P6Y0+j74U+Iy5Tj7sXeIliq7w5QI3wfljkdaZtE7bWD7dD8 i8TtmjaPmSZQAkO7dYjx48WC2UHJE1BeDhc3CRYi4X6ggJ29OgpjvrpeKhk2hvv1lN0n LcJfh15+VWTf/QG/hJ5vEPceSrHg8AYJZOcpuwewjeS2bVdLzN6/OYZG3nxRT6liAmur l16w== X-Gm-Message-State: AOJu0YyjiBWudYeDiEhp6wWPyU6hYNB98OVsMTd2zqlR/AH5S6/QUHvg EoLWInNIBhC4GqkwZBSes4XUcwGgfioORzpHLbSJhi6RHpYKQSjr2y35jA== X-Google-Smtp-Source: AGHT+IHr4FmCmxLEuLZuiD5qvEavPzrgoUCjN1/gDCfUCfmITz2+t4XIkQFbdz/EynGOdaGjQd0dVg== X-Received: by 2002:a05:622a:518f:b0:44f:ea31:cdbd with SMTP id d75a77b69052e-45375268e21mr45903541cf.24.1723812743032; Fri, 16 Aug 2024 05:52:23 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45369ff54ffsm15921931cf.36.2024.08.16.05.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:52:22 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 5/6] auto-t: Add ExtendedServiceSet property Date: Fri, 16 Aug 2024 05:52:13 -0700 Message-Id: <20240816125214.1162415-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240816125214.1162415-1-prestwoj@gmail.com> References: <20240816125214.1162415-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 Fri Aug 16 12:52:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13766136 Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (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 4C84B1741D2 for ; Fri, 16 Aug 2024 12:52:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812746; cv=none; b=oGvoOIB1HJwEwBpbUCje1e/4oP9zxaAZ6PaEYzNp0sHSqcJx1x+KzM4U1Yqv/SnMTt4dVT77AkjIH0cYyibbSq9OqVOSc3+QTesBmZYMIhf86ylfrNf0bD11V5MEEDtGGnFpeHCdUJfNs/cSHPbjl02M28qX6g8KxIllce91eIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723812746; c=relaxed/simple; bh=8eNGP5xOxlNPfHibAF8pSEIVZ1lGWsy8Ru/702n2+jM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qcr9/N5ko0Jn99aXzFujZYlU4yfCeXiSZ/NOA5cYPqP+a7Q9j3Hn0FTkIoyVANQ+adv5TiMEAMMc61xCv/OVpSLvBM81gQ3W7+3qwB5VKgv4X0shFcsrSD+5aCAsLe16IDfYgI3k0KSfTvTfpoy7WXnvb9e2X33kAdO3mm0VMrg= 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=LrYu13lK; arc=none smtp.client-ip=209.85.210.47 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="LrYu13lK" Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-70940c9657dso956232a34.1 for ; Fri, 16 Aug 2024 05:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723812744; x=1724417544; 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=kmKr4wShoxfc/Ar3yqI0w/yD7Vp7QvgQQW1F8edHasQ=; b=LrYu13lKBGLlMobW/3LJfA78ZNPSwuED25E1+scc4OLazNxlvW0YlfgszuWWDvdXa0 qfDd8xqsVH6RVzt39PlPLkMpLR0s435+GLR981IBIhEDBoj8nY9XI0yQquHBDCctwTcm jz2AkwUDTvuBdvpb+n/CwzY5UbF6ITrIXMCYTiYqQMAvWhHbnm1hsC+w/Z0XSAUlXGPh CfNkxUlmqbSX3TzElUV4ox/dTx1bZM2iixCnuvJ2xU1TImpmXySmu7hErmmWHgH+2vy/ qn7Kp0cOlAIVB019MWQnYAF03iXYqEkLhQpS/YjMaxqJ9NjtUc9apownMlR9ZVQWs5EV /DbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723812744; x=1724417544; 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=kmKr4wShoxfc/Ar3yqI0w/yD7Vp7QvgQQW1F8edHasQ=; b=mYXolwFUINvHUXPACmYpXacV1sGH9Pro4quNvyo3UFWD7jbhq/EMkY6nhOxqur0A+0 TbY6vWuPY2QNWoGhF/8xvH+WUz5EEjIFDu291ltg1eLSFSUJXec3GXlZM/TjGSNjO9p1 ecnFPz7Pu52isGHuhvIu9QgzeH/jVDlX+oe6T5H5S3a/lSogCzbPPwhXzVz6WLTOAq8/ plxwFpWnt/+ayna1lPHvfLtHZDeDkxPsieJzHNUknGUxIjGs8BiiuGJK0jygvvTsbhiL /NvfnYKSA5HjBU0wAcxLLioX8VimXjfKJdJ4ESNdh4+kp4ImQSMQfWTofHhs8ueHmnoM sTyQ== X-Gm-Message-State: AOJu0YyNSr0GxLenYEjTpJaUYPeAd6Ni7ijIP6VHgVtmPRsele/tzd/Y vSeWLvWJarfZxQHtRAjOk+zRRGkJAYI1G9lg1dv98qFw9OzlzZKFua8ekA== X-Google-Smtp-Source: AGHT+IEwuJ7jwdzHunkvLvu3/9A7Y1vBi6Bi/dWATVytAvvu5tk0SOlg1aGrl04ldI5YDfR56PzU0g== X-Received: by 2002:a05:6830:6208:b0:709:4552:1f70 with SMTP id 46e09a7af769-70cac89c417mr3295328a34.24.1723812744189; Fri, 16 Aug 2024 05:52:24 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45369ff54ffsm15921931cf.36.2024.08.16.05.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 05:52:23 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 6/6] auto-t: Add test for BasicServiceSets Date: Fri, 16 Aug 2024 05:52:14 -0700 Message-Id: <20240816125214.1162415-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240816125214.1162415-1-prestwoj@gmail.com> References: <20240816125214.1162415-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 | 100 ++++++++++++++++++ autotests/testBasicServiceSet/hw.conf | 7 ++ autotests/testBasicServiceSet/ssidTKIP-1.conf | 7 ++ autotests/testBasicServiceSet/ssidTKIP-2.conf | 7 ++ autotests/testBasicServiceSet/ssidTKIP.psk | 5 + 5 files changed, 126 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..c99f1901 --- /dev/null +++ b/autotests/testBasicServiceSet/basic_service_set_test.py @@ -0,0 +1,100 @@ +#! /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..ff1075fa --- /dev/null +++ b/autotests/testBasicServiceSet/hw.conf @@ -0,0 +1,7 @@ +[SETUP] +num_radios=3 +hwsim_medium=yes + +[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