From patchwork Mon Aug 12 15:46:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13760803 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 5F4328121B for ; Mon, 12 Aug 2024 15:46:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477582; cv=none; b=k+EMRkRpFNXzkAb/SB+fzCLGb77RL7yHvGcbT+q6bCWFhjezqga7pwk3IURn56E6JwoTuTbsmajjetUFYPLY4Kg6MRsJpjkQevYPh0luQfVXlEn78gvyfwr9qvre20JKjvKvISuDCmaRgFoD9GHvexmxaxyS5u4Kn1fhjw4hc4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477582; c=relaxed/simple; bh=N5ktHp55FAxev4Fe93AiflrA9E2h1tg4Y823bSvYpR4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Yb5/K7oU1yhl4TyV8+VxJLnoX/VPnE+IMX5wxoM1BgCn+dugHJiAh3R4m3PI7jNkHN7ZRX/gTDO2YA4c9eZjVyf3nCuHtVXKujdpNn/MzT6nQeDdaDvjbWLmTO8GuMB+SJVruEw2+1Oag4yWmfNTnMFokd/ZSr9fwi5HjZRSJio= 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=UT2rVbg5; arc=none smtp.client-ip=209.85.208.46 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="UT2rVbg5" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5a156557029so5116299a12.2 for ; Mon, 12 Aug 2024 08:46:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477579; x=1724082379; 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=aCM7mUQWtupCxt63H0cxJM+Qx+Ka5rFi9XYM48vSNfw=; b=UT2rVbg54191PDDcSzPxsPGSwCveF3d4xD5GgV5uQzaK4FwfSviMSGGrPvX2JAYHRV GzFvgVi004fGcaNHgqIoJzqEKw4bkj5/3Y398KfMP7Xqh+JldzUdfwYovpn/3I7hXbxn jFZRGHGB5VPPbC+oG7zcrCfR+2gqYNxG4KobYX3VIRa4MiNL24IZ8u0zerm1HQhcwUxp fAbQ5ifa28Kea78AgFifk0Y4LpZlSsMKhIwFUugQIdPpDTL2bxhgiMeup8o5VRwEGvmh B4WTYu1fugDDVmUURmjdsju46m4kCurNnl541PorYzFWL7FjJj14xBobWYFAMuP1U4k7 sCTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477579; x=1724082379; 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=aCM7mUQWtupCxt63H0cxJM+Qx+Ka5rFi9XYM48vSNfw=; b=gFCCtWZodJg96rn64quzNE3JteCX7isix8IE1Q/y8x4w/UxBg2Vyj/rLJpeOHK1s4M oxQob/AMCZMDLmcDc3WPIOuPtsLSPj0mVn7wdCz7AXC6oeeP8vSR4J+yRDc6xtKAPA14 8GfeIMnA49V2VXLyZbDXcfJfFYPFEe/X+MmfpQFcmuVucmXrIN7J9NKDJ1c1g0QOTkfU SMAMAlAB6gR6G8LoQfbCIbq1TyB4V2zD7zwIHWpHwV6Bf8ke+O/5z4cLsv9OmEvJ1fbY YPz+dTk8vPrtnIOWYPyteVNI7BOsyTMrFOtPU52Q6wvRszinpRLS4FQADvBE/S96JhF4 XBgg== X-Gm-Message-State: AOJu0Yx8oTARY1ZqoWnkury1v5ot432ptyTGdqUO39sTomZg8f809BjA bDJd3zk6fQp/KNQ/lCSXET+VpS0J2eNfqAm4hdvUqTezexhuitD+0Kijwg== X-Google-Smtp-Source: AGHT+IGxoYI72WfASQkCYd7kn/PpWzhTUMJVEhwB7PfoyE8UdkKhXh7ZvyrPKXgCIZLQjQvKz6otQA== X-Received: by 2002:a05:6402:35d6:b0:5af:51d6:d8e with SMTP id 4fb4d7f45d1cf-5bd44c44291mr639487a12.20.1723477579039; Mon, 12 Aug 2024 08:46:19 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:18 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 01/13] dbus: Add net.connman.iwd.BasicServiceSet interface Date: Mon, 12 Aug 2024 08:46:01 -0700 Message-Id: <20240812154613.126522-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 --- src/dbus.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbus.h b/src/dbus.h index b43412d7..14814b5d 100644 --- a/src/dbus.h +++ b/src/dbus.h @@ -48,6 +48,7 @@ #define IWD_NETCONFIG_AGENT_INTERFACE \ "net.connman.iwd.NetworkConfigurationAgent" #define IWD_SHARED_CODE_AGENT_INTERFACE "net.connman.iwd.SharedCodeAgent" +#define IWD_BSS_INTERFACE "net.connman.iwd.BasicServiceSet" #define IWD_BASE_PATH "/net/connman/iwd" #define IWD_AGENT_MANAGER_PATH IWD_BASE_PATH From patchwork Mon Aug 12 15:46:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13760804 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 DD39F4206B for ; Mon, 12 Aug 2024 15:46:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477585; cv=none; b=JOzu398WVghjGu9CQdtNIrlmKswUkVgZPWmR0VRAxH4pRvHMYRt/HXiLsw1sSUrHn82PWsBHbfMUTnFhA4ARjvjPXQtGER9JtpgFo+rkUnt67SeB/1qab10MmvlIBZDzOiJLADeQbSGyOuXlTmL4qcR2lSEaKmFP8Q+s91AdnNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477585; c=relaxed/simple; bh=pqdBjKO/n0yherFc3LdRMjLcAkwQUGBTlVcfYCI9kUg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fpolDtvAIhaPJZujQ7GF9Up/4HdX78toQgKgq0VjC1Xk00G4VGkuXW72fhvxjxK3qXSP0jcu0iwHVPxSmw3PxVaINFm/sDXOWxyB6suTFAWCvMzYplS8fpLmp0QwHUXRII9unfuUCltFPLfClJtalLKCw25OhqnOjTylPeDQHd8= 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=dv+aqfXh; arc=none smtp.client-ip=209.85.167.42 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="dv+aqfXh" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-52efa16aad9so5832848e87.0 for ; Mon, 12 Aug 2024 08:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477581; x=1724082381; 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=Rumi3IyiN5PbTLljvftiS4o5QJk04XrHqIyr253wL1o=; b=dv+aqfXhDWDyhyY7/lkIygr/9DLfx8pa07LaVTTpasJOV3GdUr20dm+hj9O8sQZWHY UhqnA9Fecs9sn1/4ECeWq3leMTfMcmFSajEJQunvu8uxcZ8Y02/9HvaixDlE96jYNbNO vTuH6o2FuMUw09By3ZLymk2yH418TJe7hSXFnEs8YtFY0VidL3k3cX/JFv5j9YN27pwZ BkFilMoyNulQEBqiQNQoZehkZEVEK5HQvZW81wh+RuLT70tfmF2jGNNJyP8DpAjsC89B okIN/BR8+P4cZyXA/4H9Ocnnarlx9LZdzT4DUCv7uzJ79jdUpM1m59bKCgIccRsalg5i VaLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477581; x=1724082381; 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=Rumi3IyiN5PbTLljvftiS4o5QJk04XrHqIyr253wL1o=; b=kyPONbKoORveS8U1j9CKarKnWP+HsqpouwIWg/5CZaqEv4LeAG6whrwRZD3NvcEfMO 76RiH7NmxSnvvlrjUoXfn3rNXOG3hcmz0K1x1R5bFCsnM1H1OTJmY+hFQ4+TstyOD6GH Srol6iRUX9PwsNKe+XbNePUt/tx+I/TOItfB8OwGCLdLRMlPxJxeAaPIsEwHEzcpmbA2 D0kiB9BEwzhoR0QnuM1ypGfSne9Ip+Xr2BB7MeNO6hD0RUyYglEWVkdAxaztUxbBVnec /Wgb44QRzWEfcFt0Jdfwvkbm/qX0Xd1QYC+rXvfGn1xrylB7vCF2lwQWZo2/ZIv4qLXK 8F1A== X-Gm-Message-State: AOJu0YxIF2UQBpGqsAx0efKbebdi9AvZMURcGtS9zWs9/Mj0jAxbB1el 6gjOWEwZk1iEb5lA4Qt/WyEtFmo0l6NK2ETHnVVXlsn1Mw1Nteexcf/LSA== X-Google-Smtp-Source: AGHT+IFjBqY94dAlECblHPEPDdk2ArC1V7Y0uONIfeZwcpmm/Rjhpq1xRXMwGMUZ3bcQh46u7erWQA== X-Received: by 2002:a05:6512:239e:b0:52b:c27c:ea1f with SMTP id 2adb3069b0e04-532136a47b2mr420337e87.55.1723477580876; Mon, 12 Aug 2024 08:46:20 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:20 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 02/13] network: Add BasicServiceSet object Date: Mon, 12 Aug 2024 08:46:02 -0700 Message-Id: <20240812154613.126522-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This adds a new DBus object/interface for tracking BSS's for a given network. Since scanning replaces scan_bss objects some new APIs were added to avoid tearing down the associated DBus object for each BSS. network_bss_start_update() should be called before any new BSS's are added to the network object. This will keep track of the old list and create a new network->bss_list where more entries can be added. This is effectively replacing network_bss_list_clear, except it keeps the old list around until... network_bss_stop_update() is called when all BSS's have been added to the network object. This will then iterate the old list and lookup if any BSS DBus objects need to be destroyed. Once completed the old list is destroyed. --- src/network.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++- src/network.h | 6 +++ 2 files changed, 137 insertions(+), 1 deletion(-) v3: * Pass the scan frequencies to stop_update() to avoid removing BSS's that weren't on the frequencies scanned. diff --git a/src/network.c b/src/network.c index 09099fac..8c16d9a6 100644 --- a/src/network.c +++ b/src/network.c @@ -75,6 +75,7 @@ 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 */ @@ -1129,12 +1130,107 @@ 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) +{ + static char path[256]; + + snprintf(path, sizeof(path), "%s/%02x%02x%02x%02x%02x%02x", + network->object_path, MAC_STR(bss->addr)); + + return path; +} + +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)); + + 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; + + return true; +} + +void network_bss_start_update(struct network *network) +{ + network->old_bss_list = network->bss_list; + 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); + /* Done if BSS is not HS20 or we already have network_info set */ if (!bss->hs20_capable) return true; @@ -1168,6 +1264,8 @@ 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); @@ -1190,7 +1288,12 @@ void network_bss_list_clear(struct network *network) struct scan_bss *network_bss_list_pop(struct network *network) { - return l_queue_pop_head(network->bss_list); + struct scan_bss *bss = l_queue_pop_head(network->bss_list); + + if (bss) + network_unregister_bss(bss, network); + + return bss; } struct scan_bss *network_bss_find_by_addr(struct network *network, @@ -1899,6 +2002,9 @@ 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); @@ -2155,6 +2261,24 @@ static void setup_network_interface(struct l_dbus_interface *interface) network_property_get_known_network, NULL); } +static bool network_bss_property_get_address(struct l_dbus *dbus, + struct l_dbus_message *message, + struct l_dbus_message_builder *builder, + void *user_data) +{ + struct scan_bss *bss = user_data; + + l_dbus_message_builder_append_basic(builder, 's', + util_address_to_string(bss->addr)); + return true; +} + +static void setup_bss_interface(struct l_dbus_interface *interface) +{ + l_dbus_interface_property(interface, "Address", 0, "s", + network_bss_property_get_address, NULL); +} + static int network_init(void) { if (!l_dbus_register_interface(dbus_get_bus(), IWD_NETWORK_INTERFACE, @@ -2162,6 +2286,11 @@ static int network_init(void) l_error("Unable to register %s interface", IWD_NETWORK_INTERFACE); + if (!l_dbus_register_interface(dbus_get_bus(), IWD_BSS_INTERFACE, + setup_bss_interface, NULL, false)) + l_error("Unable to register %s interface", + IWD_BSS_INTERFACE); + known_networks_watch = known_networks_watch_add(known_networks_changed, NULL, NULL); @@ -2179,6 +2308,7 @@ static void network_exit(void) event_watch = 0; l_dbus_unregister_interface(dbus_get_bus(), IWD_NETWORK_INTERFACE); + l_dbus_unregister_interface(dbus_get_bus(), IWD_BSS_INTERFACE); } IWD_MODULE(network, network_init, network_exit) diff --git a/src/network.h b/src/network.h index 17dfcca8..b27158ee 100644 --- a/src/network.h +++ b/src/network.h @@ -30,6 +30,7 @@ struct network; struct scan_bss; struct handshake_state; struct erp_cache_entry; +struct scan_freq_set; void network_connected(struct network *network); void network_disconnected(struct network *network); @@ -67,8 +68,13 @@ 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_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, + const struct scan_bss *bss); bool network_bss_list_isempty(struct network *network); void network_bss_list_clear(struct network *network); struct scan_bss *network_bss_list_pop(struct network *network); From patchwork Mon Aug 12 15:46:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13760805 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 6A9B4185E7B for ; Mon, 12 Aug 2024 15:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477587; cv=none; b=jLxxgzyyx7bVYEiAhhNkTbOLt7moQ6bZ1MDB4R18fvlZ4cbG1ku/cqok+M7LabLEy2deLIfO4FtQyUE+tGrkfHhH80SsoG3TEkpFbTM8pTwomg2z2yuDMTnODYQx7GYCXQy8CsOL+SY+pLOae0ihx5vUVAMah4CkN4aFW7pzvOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477587; c=relaxed/simple; bh=cO5JG5viEy5MUT80LQPDQWDW4F9qGzjr0mOtoK2xVSs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J31ALs5maBG3nN8zeyVmDnFgYOP9mm89IbsYt1y2lV2kQdY5+J/hS9XTM06bVT3UL4YH5XL6U3EUNGgzqBAOsXh1qzfdf8iHB/NQ5ynHhJo3CL4VHIGFjvFzRqsiYfYKGcoTke64qfwjhw/rTKAkp9cs5evJY2za0cjTs9v1xpA= 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=ZphFak+h; arc=none smtp.client-ip=209.85.208.46 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="ZphFak+h" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5a1337cfbb5so5957104a12.3 for ; Mon, 12 Aug 2024 08:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477583; x=1724082383; 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=GsgIYGinwHsZb7T3gEAavUfV/ewZDhdP5OQnNEu3J9g=; b=ZphFak+h3vfbtLlpklpowiq1RIkJZ+8epPjGu+9Mz3G93qWnPwKvu8jlybTW+lkctJ 9+nncesc4CKDz6S+2P7pXqNSkWwtMbzv7f9IB7Dbi/9Ty4wRpcmmxwL+bueUF6/Y8hl4 NhJ1xs5Pz6DUsfXohwhDJMWwawOsDimmP2LS5YNjQT0pmypp1rNkCx2tGatrHF3MoVSK YiTkjiIhF6yKEQ8EhiMSriYIQYtiRxXihdjSN0SFFBcz1p5WdYq70ImX7xm60memnz22 lb6dcLlL8G7lpEg9cxjVJXTN38cQP1KKZA2l3W93E5pU8LnTumBf6Lyy9L6+ILOwGYQp 8YTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477583; x=1724082383; 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=GsgIYGinwHsZb7T3gEAavUfV/ewZDhdP5OQnNEu3J9g=; b=TXdGCHaTMkpIG+EDATznv0ODPMXpSDyoBE6M7lBm6pk6PyBeOz2rVwMjwgC0oBOoHV 3D19nFldHIyrqQXQ+VApUc1EPgkAiwzkrmpXICJnu+x4RoggWaNbaGOIw3jJMya6O8H1 vQfxr2cy3x0t2tx99V9r0TjPmhRoaLePhaYZu/zYMZORXKFRNT85A6Io6IZH3xsP/58G YA8UkKp0u2kY15XQh5ioKfSmY9k3R1NkFiPZrhlOKyyXLy2+x43SlmaoO4I3hL1hf26p 728mdXFW4E9rcir7+74aLswB8LMlyVtbupLt8u3JqYic+WWJmCVrAmjhzDwka030Hy1u BV2g== X-Gm-Message-State: AOJu0YxPxEe+lncTzoI0zTcX+m4oSTg6FOWPVNPaO9FnNW1EkRSZWKFF TdA01OmEAQuMbIuXQVW3rOqr3CES8q5X0frEX42BXPFSpDe+4RhTdrN3Cg== X-Google-Smtp-Source: AGHT+IFtjzcxZCUnuBUi04eG2E9oA1PuU9zdIuJ3i8aRimx4Ymdyw0dR1ZwUcHxj6nv0Pz+l99SqyA== X-Received: by 2002:a05:6402:2109:b0:5a7:d986:6e4 with SMTP id 4fb4d7f45d1cf-5bd44c6d7efmr532022a12.28.1723477583009; Mon, 12 Aug 2024 08:46:23 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:22 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 03/13] station: use network_bss_{start,stop}_update Date: Mon, 12 Aug 2024 08:46:03 -0700 Message-Id: <20240812154613.126522-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This will tell network the BSS list is being updated and it can act accordingly as far as the BSS DBus registrations/unregistration. In addition any scan_bss object needing to be freed has to wait until after network_bss_stop_update() because network has to be able to iterate its old list and unregister any BSS's that were not seen in the scan results. This is done by pushing each BSS needing to be freed into a queue, then destroying them after the BSS's are all added. --- src/station.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) v3: * Update use of stop_update() to provide the scan_freq_set. This also required using a new struct to pass to process_network() diff --git a/src/station.c b/src/station.c index e373b03b..c45b849b 100644 --- a/src/station.c +++ b/src/station.c @@ -339,10 +339,18 @@ static void network_free(void *data) network_remove(network, -ESHUTDOWN); } +struct process_network_data { + struct station *station; + const struct scan_freq_set *freqs; +}; + static bool process_network(const void *key, void *data, void *user_data) { struct network *network = data; - struct station *station = 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; @@ -532,6 +540,7 @@ struct bss_expiration_data { struct scan_bss *connected_bss; uint64_t now; const struct scan_freq_set *freqs; + struct l_queue *free_list; }; #define SCAN_RESULT_BSS_RETENTION_TIME (30 * 1000000) @@ -553,18 +562,20 @@ static bool bss_free_if_expired(void *data, void *user_data) bss->time_stamp + SCAN_RESULT_BSS_RETENTION_TIME)) return false; - bss_free(bss); + l_queue_push_head(expiration_data->free_list, bss); return true; } static void station_bss_list_remove_expired_bsses(struct station *station, - const struct scan_freq_set *freqs) + const struct scan_freq_set *freqs, + struct l_queue *free_list) { struct bss_expiration_data data = { .now = l_time_now(), .connected_bss = station->connected_bss, .freqs = freqs, + .free_list = free_list, }; l_queue_foreach_remove(station->bss_list, bss_free_if_expired, &data); @@ -939,18 +950,20 @@ 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); while ((network = l_queue_pop_head(station->networks_sorted))) - network_bss_list_clear(network); + network_bss_start_update(network); l_queue_clear(station->hidden_bss_list_sorted, NULL); l_queue_destroy(station->autoconnect_list, NULL); station->autoconnect_list = NULL; - station_bss_list_remove_expired_bsses(station, freqs); + station_bss_list_remove_expired_bsses(station, freqs, free_list); for (bss_entry = l_queue_get_entries(station->bss_list); bss_entry; bss_entry = bss_entry->next) { @@ -962,7 +975,12 @@ void station_set_scan_results(struct station *station, if (old_bss == station->connected_bss) station->connected_bss = new_bss; - bss_free(old_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); continue; } @@ -994,7 +1012,12 @@ void station_set_scan_results(struct station *station, station->bss_list = new_bss_list; - l_hashmap_foreach_remove(station->networks, process_network, station); + data.station = station; + data.freqs = freqs; + + 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); From patchwork Mon Aug 12 15:46:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13760806 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 896FA185E7B for ; Mon, 12 Aug 2024 15:46:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477589; cv=none; b=jjeEE/n32E7tfGavvZuhUx8WQ+5e22FT/8palKBZWiGo2TKq5ftUOWKk1x1TRhqploG4iLKXkC8sYfl6AVMltSL+IpxZ5Xg4n6m36ITzkfhBAPTzAv25+/UJbKB4SDGNu17VU2Ta6ZgdQhxzjJZsjeXiY7pmKlg1RjWHrWzSX30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477589; c=relaxed/simple; bh=vd+0BqQGeL6d0wePw8NmZkbxGlTy6GR6pLjRff/+NPY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QMOgEIuDeg5mFuzP6grJpWkRfXburthVu+byOA9EyrUga8HDF8EyTXt5IKHnqhylEZxuBXHVzbBMstMdFW2xJxbLePXIUEkXIDTYpR+G+Hsj2zL3w5jDAmfEShu3losDkG5/oKiBKkcMlcvssNzYnUCpjft3s8yflSVLBwP9Fw8= 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=J/IlqC8H; arc=none smtp.client-ip=209.85.167.54 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="J/IlqC8H" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-52efe4c7c16so581662e87.0 for ; Mon, 12 Aug 2024 08:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477585; x=1724082385; 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=puoGti0I0USP52+eg3CGOIm4RrSQTQJscRkup9urEAE=; b=J/IlqC8HKAAtQVAUQ94kVPI0wQj6ObHwFTXzejEY/aIdagVGujiFELb5tA4QJnty6b XlyIc0wJIUUF18fM5YWhj5hlo1tYkQiekcUj48Qzt0ooMLOB+0Bpe864J9uUS5ay2K1J pPT1RHAQWHFDxoIR3deY+CsbunTVm9gmJU2NZeqGfJFGc+kKYlXF22ZD+YXoYWV3aBO9 0JEhCAMnZx71KMpAPdc08gF22QNu3dXmYjEfBEbUPoOsuiPh0zGyHR16vRsfP27IAPNH 2HFPjJcwauY6mGZOsVHeB8UT5T8kGwFuZm82QyqEgC2T/N+skP8uaQC5Nt+aieaZ/mVx MOtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477585; x=1724082385; 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=puoGti0I0USP52+eg3CGOIm4RrSQTQJscRkup9urEAE=; b=BmXAi3+FI5CKRXGLVI2gpKEV8PiZ5Boj4GmzVNd41FfXQLt+REmdJ79Az3n/IPDfRg p2wUROJYlHxQ0w3wVVeCMwLxnCPrh+0+6B4f8lSm5wuWs1SROp+wXJH60j7t+TpYE1aQ LHOpdrRRiMQAji6fMbPZq06Fg80g/nATVXWgxr0OslWZY7I3WdutzPtD435suZY0MYDV X8y2GzSCNjYsScMv3uEN/W2n0hcb1bXe6MDi3TYUUTVXPNSBv6s0Zb9csIErKjMR27m2 8pdDviBp/+ln199TWLzMXtNYDuOKqkwPAxeU7fIPYwuRczK13uUS6fynjlnJioM2IHg6 51zw== X-Gm-Message-State: AOJu0YzZpJotB8n/hzbuOlWbsRghBkuZltWWmGUyRXg4wGLpfdiTknZ6 HeRc4794uzrTLbNiE9+Hk6EbunfOLkQGT6t96E8UgFLlVO8kJYNGRxWIqw== X-Google-Smtp-Source: AGHT+IFg6KYFvKIhSLTuW00DeOCF0NRlL7OeD0W3ReaTYhJgrXefYCtQjPd8MBp54vITpKgcaintfQ== X-Received: by 2002:a05:6512:b22:b0:530:d088:2348 with SMTP id 2adb3069b0e04-5321369714emr371626e87.54.1723477584904; Mon, 12 Aug 2024 08:46:24 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:24 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 04/13] network: add ExtendedServiceSet DBus property Date: Mon, 12 Aug 2024 08:46:04 -0700 Message-Id: <20240812154613.126522-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This contains a list of all BasicServiceSet objects (paths) that exist for a network. --- src/network.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/network.c b/src/network.c index 8c16d9a6..76238e56 100644 --- a/src/network.c +++ b/src/network.c @@ -1149,6 +1149,9 @@ static bool network_unregister_bss(void *a, void *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; } @@ -1174,6 +1177,9 @@ static bool network_register_bss(struct network *network, struct scan_bss *bss) L_DBUS_INTERFACE_PROPERTIES, bss)) return false; + l_dbus_property_changed(dbus_get_bus(), network->object_path, + IWD_NETWORK_INTERFACE, "ExtendedServiceSet"); + return true; } @@ -1960,6 +1966,28 @@ static bool network_property_get_known_network(struct l_dbus *dbus, return true; } +static bool network_property_get_extended_service_set(struct l_dbus *dbus, + struct l_dbus_message *message, + struct l_dbus_message_builder *builder, + void *user_data) +{ + struct network *network = user_data; + const struct l_queue_entry *e; + + l_dbus_message_builder_enter_array(builder, "o"); + + for (e = l_queue_get_entries(network->bss_list); e; e = e->next) { + struct scan_bss *bss = e->data; + const char *path = network_bss_get_path(network, bss); + + l_dbus_message_builder_append_basic(builder, 'o', path); + } + + l_dbus_message_builder_leave_array(builder); + + return true; +} + bool network_register(struct network *network, const char *path) { if (!l_dbus_object_add_interface(dbus_get_bus(), path, @@ -2259,6 +2287,9 @@ static void setup_network_interface(struct l_dbus_interface *interface) l_dbus_interface_property(interface, "KnownNetwork", 0, "o", network_property_get_known_network, NULL); + + l_dbus_interface_property(interface, "ExtendedServiceSet", 0, "ao", + network_property_get_extended_service_set, NULL); } static bool network_bss_property_get_address(struct l_dbus *dbus, From patchwork Mon Aug 12 15:46:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13760807 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 02E5918453F for ; Mon, 12 Aug 2024 15:46:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477591; cv=none; b=rFfPL0BZlBA6hP0wc+0A6+gM1gA5NA1VCMwYZ/aLIB9vTUrgMcY3LdiCj/LsrtRD6LBZ/7pOGX3+Hlrkjpnb8BLYWKJTB1NCIeDRLXxTQ6MALySMDlWvKLo/d/VK+SYJMTUJASzFcUHnFop8YIjnR0SqXUr8QmWfG9OMXK87Cg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477591; c=relaxed/simple; bh=pPO1f1eW/mVhcTn0HPd8uGgycFi3Yd/9Qj+fseKwfHU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gxdkciTS76HDCEygiVDaokynKnhHLMCL3xHtPuqcsgu99wG/lDP9gNSUxcGNMg4RYI0tMhoLegbVfH6fOqqXKea0G0dMxKiCk9LYEWsEQF9rGnWT8GGChnBFJRe5pL3a0vh9VHWc5DRRgyMS1BX3+CUc2fC+vDf5t4x6VhL2RP4= 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=EsMOMZo/; arc=none smtp.client-ip=209.85.167.53 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="EsMOMZo/" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-52efa16aad9so5832993e87.0 for ; Mon, 12 Aug 2024 08:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477588; x=1724082388; 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=thWe1ydZOe4eEmuknFajVWF+FQWtQsVenIO3kVW6KAs=; b=EsMOMZo/YT0PDhODoyL1Op/1MtAisYpzb0NyqArAXIqcHNh/TD0tc/2maEBPnAqUvm FfwhIkprsd2V8U0MiF1B5aX2YeyXOPZiON2JqkD3JtSSDp5koejiKGlDKtNcAlhzAO8y g8UAS9cKZrY+5F24AeRNW1MRkvZAjf4O5Bdg7u74sHXj57wqbNcugySVkKJuJliSdU4P 0cMtmYuw2zGcdPFJQZa5re8VJ1GC8qorKjZF09b9RWq2YBVz9PpofXvn7cTqmYMsaD+C jaYfXEYZbDgfPNzme1W6uZMzR2bz+7C9Edz8CfsbQzK2z4MPc60CnKZRxwRSwhShow07 Jk3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477588; x=1724082388; 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=thWe1ydZOe4eEmuknFajVWF+FQWtQsVenIO3kVW6KAs=; b=dB1ifCsmMTOxnE85T9O3OgxgQvhjKoxkEQHb1DYvjUs57cQ7jTBvrtrKx4Oxk0rapL EFoBJmURar9yO54i2zEek0elXXO1YDSul47vihDWTuVRL/pz1+wQOGDkUsg6N122A5Sv ejz/icB3lHs60GaSkgF0bL8fONLxFV9+gGmfPI76KCq5+nLFmwLN3j9SUgotC7qMWM/J L5GKdn61fcZOmOb25MEzV27eAg1k+vaGnXxV2qTaBrbcJq5TLS9qAf91NsFYUXEE3DsH aC7ppNtLsYJgaulF4ztDDhtr1lb63XvNtXHbRYiKDtJBLsJzY4/Fp4eoYXN2vDJSQ1g8 NAdg== X-Gm-Message-State: AOJu0Yx7XcBkYn27+ak2w2nXqpkiZ5fiTcgaC3PeuxxoSK8y0FGdPMJv w0KOGE9mIT2dnWG8ajBM26FScEC/B5hAMP3l1EN+EDsQh0BSuIgpVIcM9A== X-Google-Smtp-Source: AGHT+IEFDmkjvRzmRyPSCEJTW+4rJYXgm0xWIDS4f+/vWgcequFvb9sBqSZS6TliLIfA+V0y0VX3OA== X-Received: by 2002:a05:6512:108a:b0:52f:cd03:a847 with SMTP id 2adb3069b0e04-532136b3804mr344506e87.61.1723477587395; Mon, 12 Aug 2024 08:46:27 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:26 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 05/13] network: remove network_bss_list_clear Date: Mon, 12 Aug 2024 08:46:05 -0700 Message-Id: <20240812154613.126522-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- src/network.c | 6 ------ src/network.h | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/network.c b/src/network.c index 76238e56..85d2a983 100644 --- a/src/network.c +++ b/src/network.c @@ -1286,12 +1286,6 @@ bool network_bss_list_isempty(struct network *network) return l_queue_isempty(network->bss_list); } -void network_bss_list_clear(struct network *network) -{ - l_queue_destroy(network->bss_list, NULL); - network->bss_list = l_queue_new(); -} - struct scan_bss *network_bss_list_pop(struct network *network) { struct scan_bss *bss = l_queue_pop_head(network->bss_list); diff --git a/src/network.h b/src/network.h index b27158ee..78ced99d 100644 --- a/src/network.h +++ b/src/network.h @@ -76,7 +76,7 @@ bool network_bss_update(struct network *network, struct scan_bss *bss); const char *network_bss_get_path(const struct network *network, const struct scan_bss *bss); bool network_bss_list_isempty(struct network *network); -void network_bss_list_clear(struct network *network); + 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 12 15:46:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13760808 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 1BACB4206B for ; Mon, 12 Aug 2024 15:46:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477592; cv=none; b=p3Rb0ttNszYLXMJ3EJyowufhUsu2Trln2datOZBb+14/bXeeHq4elS4JV2CADEk5IRxClZBpWs5hbiJRWolwE1kQlZuQGiP4TXnDkjRFRSWMrQGalOiy7CdkBl7r3H45/TWoaKpW6Y9rPEaXb+IyUu0Ki3eN7YDo6RbzxNi9iIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477592; c=relaxed/simple; bh=GKYQ9EqFStMLgsfyNKnMJ7yGfIXZKKI9kKuDUmwTmDk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EvQFKXY42Wj2H7c8izWB+bMBFyyVcOaIhsw2ii8ewq40Z/DbvCRsxTPLjswQ46jFW5siFPsddmamx9vXixP0Y+61k4EpN6h4VHFjQDPFArEk9+YX7koPlttPeroVgo0zprqX/akWEahgR/rmPVq6HQYeK4L8gtPN64UvzR1Eces= 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=HExdLHe1; arc=none smtp.client-ip=209.85.208.46 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="HExdLHe1" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5a10bb7bcd0so5596099a12.3 for ; Mon, 12 Aug 2024 08:46:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477589; x=1724082389; 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=ObQQmZXcl83AVXC3czdCofeHGePflsvYQ8Cdvz2hw4c=; b=HExdLHe1VgD3WuqBSCaDUz1S/7lVEPSNFGVxKQaWqTAmqkl7MBjuyJYnVRm4tlkO9q 8C7BpVGZDgY4aX6fZDIvvZCRY2mdSj30DVx/HjU8fjIrKck0cN8q+rpSpkAcMoEl15fa sO9/9wTQLkRo8uSqPmXcLBdHlAL1ytyWBR79JcdkouQendiqpjKTNRdmuOc3nYrrPbX4 STk1nvSH6gH1ShGMazJgXWvs804B4SVDXFJ4SrrZ1AfSS0MQPuf2tKiNnE7uLarea+Ja oJw0YL1kzjmvjh2nozzJp43T3V6+AVjXIJzT/SWdQaBQyM+JQz7riWuNc8QIegyhTG3T lVpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477589; x=1724082389; 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=ObQQmZXcl83AVXC3czdCofeHGePflsvYQ8Cdvz2hw4c=; b=YMpAASumLmqlRdBI0+AMkRVjsseCt4O45gMqTO+2xtEc0eHFy2PAMasr7B1uyUjK4O UWfulGi3kTzwAwO2saY28eLCAWm1j/fE+8DJlWdDAGYifQEkFvdgn/xESRQE+ybFkEka noOifBvjiSCwtPsHE2ZBFV1fi6BSfwHebxRYZTbD9MqtWTGlBw+1DzO9l54Id5D/a4X1 dI0tLgOXc6tZg0WE9Am2+Qh5XMo6tkLKhtIfkcX593vPPlUSU70simEop93C63ggxZoh oVhtynM9/NBf/I656nkr21nwYzJhHB3oV27cpz3xhzKbhL3BywOcxgoJuTothcDrOJxy tmJQ== X-Gm-Message-State: AOJu0Yz5zNWrXANrrqe4x0YeFkBYkNTAjH1pcCGEtg0h7o4QTBI1oDut a5uDEWp4sJs9p1yppTggHiDC2AWBwitywA86+grd4JCdh5Qzk+s2rsnvPg== X-Google-Smtp-Source: AGHT+IErVElMDDXUB2zjQb6gs71PlwgjXOkQ1hUuUQ3UIoXs1gFVFxVljsszMCh0RalIvMfNxf5jow== X-Received: by 2002:a50:cb8d:0:b0:5a1:c43:82bd with SMTP id 4fb4d7f45d1cf-5bd44c405ecmr403469a12.19.1723477589160; Mon, 12 Aug 2024 08:46:29 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:28 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 06/13] station: add ConnectedAccessPoint property Date: Mon, 12 Aug 2024 08:46:06 -0700 Message-Id: <20240812154613.126522-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This property is a path that corresponds to a BasicServiceSet object, the one the station is currently connected to. --- src/station.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/station.c b/src/station.c index c45b849b..06b19db3 100644 --- a/src/station.c +++ b/src/station.c @@ -4386,6 +4386,23 @@ static bool station_property_get_connected_network(struct l_dbus *dbus, return true; } +static bool station_property_get_connected_ap(struct l_dbus *dbus, + struct l_dbus_message *message, + struct l_dbus_message_builder *builder, + void *user_data) +{ + struct station *station = user_data; + + if (!station->connected_network) + return false; + + l_dbus_message_builder_append_basic(builder, 'o', + network_bss_get_path(station->connected_network, + station->connected_bss)); + + return true; +} + static bool station_property_get_scanning(struct l_dbus *dbus, struct l_dbus_message *message, struct l_dbus_message_builder *builder, @@ -4793,6 +4810,9 @@ static void station_setup_interface(struct l_dbus_interface *interface) l_dbus_interface_property(interface, "ConnectedNetwork", 0, "o", station_property_get_connected_network, NULL); + l_dbus_interface_property(interface, "ConnectedAccessPoint", 0, "o", + station_property_get_connected_ap, + NULL); l_dbus_interface_property(interface, "Scanning", 0, "b", station_property_get_scanning, NULL); l_dbus_interface_property(interface, "State", 0, "s", From patchwork Mon Aug 12 15:46:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13760809 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 10D381862B8 for ; Mon, 12 Aug 2024 15:46:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477594; cv=none; b=ItvwlpAFYntqtWymqjZMawsBnbk1wDGCcgrsA33mSI6RBMSTg+KoKhSCkF2LUesr4dGdIwCQDtj2TMH18wxJJuSFZpDEQMZY0VJRkJq4z5BzNwdHMrU+/TxKhVJ4iTgBf/NNf8hu95R97B/+JTG5BHjt/lF+4Efb6BHpNLjt+3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477594; c=relaxed/simple; bh=L4W3PB+g4jBEte+Do1+h9fxmKOADzWcA8/fRrBNtNx4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=V5gSPdJFkAjhr5CWyK88Oslmd5fTUzLes7iOWFCNOU6iBEjpQm3ggZ5vdhmsyWbz+bJWtKpeO5REok4Y8yBR3z0tHw2XubQh9tNwTjjlU7U6agWGOMYWR6Kh9IIOQtwfSFRgjUCXLw+7/uAra9RPPW1IK58gg+C+fRfQJc3W1SE= 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=KQwSPNP5; arc=none smtp.client-ip=209.85.208.48 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="KQwSPNP5" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5b3fff87e6bso5037806a12.0 for ; Mon, 12 Aug 2024 08:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477591; x=1724082391; 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=iMD1SmJ3yUMRnAU5EICc73uBS+J/IxStg9QYcmtUZIQ=; b=KQwSPNP5HYNDifuC60+jfHSbPzjeRTMPdOF6HRFJRJd3W23BP3VWvNjrmRK0k1cbpw L3drNBXKtnj5LMQSLh1G03IV/STKilq8rMcMZq1PUcka5eNqdjROf5Kb88WHVbWbhFK0 BbCjLrXY9OL40ETfReKmmv4dXLQP5YCv+M7jc9gp/Gy055LtHadvUT/Qq3tqXDXDdQQc VkVhvzyQmWT/j8PQVzcfLoP/V/qJtRgZUhDBpUc1Ey7Y/Af1mWu9dMMxrdX7SLEqlWKD QDVYi/sxmkcCokJM45XtsfsssoycxmecYQmV14aEwWQQbcLDvciAAxzzezh+Vg+D1hHD NJhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477591; x=1724082391; 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=iMD1SmJ3yUMRnAU5EICc73uBS+J/IxStg9QYcmtUZIQ=; b=ZJe+Idx1EDb/9WRkV7ai49yoceu42QGdmUlVaOzghvIh5XDx1cZf2BEYmFSZw080j9 WuPoMwJOsETCb5TWbqioKyPA54UqnPTsFglZOSgxnMEjexCV86ltDXXLdSwRB3vh/UkL lZ+oB0p8KTT6n1rI+Qtvi8IgRFrhcERiLGnx2BVdb1w0O3qtJ3wydOD122e5JaAxn3GW jHEBRmQfIWgXlh4oDmh8/j5Bsfafln0FfDXz/gp0dkDzVwA/OlYbgHlRh7l2YoGY018n 4xkYYRl0InoGPi2383DbfirHjmxKJeCbgohYKPPIWO+zOiTLA1shyzJ2k1usfnKYqJer DpKA== X-Gm-Message-State: AOJu0YwngStLkElT6w39GIMAK0eZvn6YF49lXDeSZQCECdhjvzNoeOe9 fAwab/6tWQ5gKnuP7BsmtF8IF6fl5BBKHJIu1nzyVIUFsoXDb97IiTe4BA== X-Google-Smtp-Source: AGHT+IHCpSu+GbLejFUVInp0St/YOm/L7L2zmlfuDHhjMBe81N+cOvXB/VLl2+NoCWEbnzGl14QRDA== X-Received: by 2002:a05:6402:90b:b0:5b9:1009:f42d with SMTP id 4fb4d7f45d1cf-5bd44c78caemr447963a12.32.1723477590876; Mon, 12 Aug 2024 08:46:30 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:30 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 07/13] doc: document BasicServiceSet API Date: Mon, 12 Aug 2024 08:46:07 -0700 Message-Id: <20240812154613.126522-7-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- doc/basic-service-set.txt | 10 ++++++++++ doc/network-api.txt | 5 +++++ doc/station-api.txt | 6 ++++++ 3 files changed, 21 insertions(+) create mode 100644 doc/basic-service-set.txt diff --git a/doc/basic-service-set.txt b/doc/basic-service-set.txt new file mode 100644 index 00000000..f827ca02 --- /dev/null +++ b/doc/basic-service-set.txt @@ -0,0 +1,10 @@ +Basic service set hierarchy +================= + +Service net.connman.iwd +Interface net.connman.iwd.BasicServiceSet +Object path /net/connman/iwd/{phy0,phy1,...}/{1,2,...}/Xxx + +Properties string Address [readonly] + + MAC address of BSS diff --git a/doc/network-api.txt b/doc/network-api.txt index e4a34411..8bc6eea6 100644 --- a/doc/network-api.txt +++ b/doc/network-api.txt @@ -50,3 +50,8 @@ Properties string Name [readonly] corresponding to this Network. If the network is not provisioned or has not been connected to before, the property is omitted. + + array(object) ExtendedServiceSet [readonly] + + Contains a list of paths of each individual + BasicServiceSet object. diff --git a/doc/station-api.txt b/doc/station-api.txt index 05dd137e..84f1b7bf 100644 --- a/doc/station-api.txt +++ b/doc/station-api.txt @@ -164,6 +164,12 @@ Properties string State [readonly] for networks. net.connman.iwd.Network objects are updated when this property goes from true to false. + object ConnectedAccessPoint [readonly, optional] + + net.connman.iwd.BasicServiceSet object represeting the + BSS the device is currently connected to or to which + a connection is in progress. + SignalLevelAgent hierarchy ========================== From patchwork Mon Aug 12 15:46:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13760810 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 9B9A8184541 for ; Mon, 12 Aug 2024 15:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477596; cv=none; b=HWBl4z5eU6VdjMl1sgKzJHUW/VNq2iqi/kQbdPJb6p5NrNzet3csJfu9wTJvlu0yCRCJs3UmwHMyUdGGTuAQWTl7dNhUl+YIONFh1bnmc7hEWJ0LN4hQ80sZInYYAA4M/uO7DeBPNbELrKY64kjRvtnljfyAHkuFFowgqpIDaJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477596; c=relaxed/simple; bh=0JXQUsU+CeZbduEPiJJveo0hTbm5nD6K/zdc+wnogXU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UtwS/wvVQD7b/a3Vc7Q9u85ZujLOOu2S1ILQfBeUJomU6zmauKeT9UnnBidb8RFUMerPE84zqGYnXv6o4LMc7ZenL+cMMC9puHbaHwl/8iiZ9CHrQSRkAmJYTan08rjw0oA0Cb3QDnpNwmkebIGtllhGbrnv4Yc0WyftAko/r7E= 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=G4siSNkd; arc=none smtp.client-ip=209.85.208.41 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="G4siSNkd" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-5b3fff87e6bso5037852a12.0 for ; Mon, 12 Aug 2024 08:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477593; x=1724082393; 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=bkZzKtxYPZkT6hUlkqBEznSewHrv3kJaBT71xggLwjM=; b=G4siSNkdglJDUsNVI/Bageq+D0BzJRySsrdY6ic/ZVF282aGrqZvmzvv1o+pWSGU4r 8jAs56dA5468+GC5d1p4URJZUFriJBjrjpIGb2ffSJjhmyTjJSQTg6Y0Hz4OxJ1xSzWH gSCywh7TKfsNUAIUCZY+pCOXHcRsVflaj+an4S4UppOeimY9tD53EZDJa0pxbri8Jvuj NKHT1XWN5lxmqCw2F3xmniHGtpgZsmJCPfi6shlOfiHeZmxXtljgfO0h+UpPn0bL3UJz ggTg/XGnMj/K64e1vhcR1DL/7m7OfTBb7Uf8hkEM554+qCniG5doOHWzA6V2G5VBdx88 1J/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477593; x=1724082393; 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=bkZzKtxYPZkT6hUlkqBEznSewHrv3kJaBT71xggLwjM=; b=wkW5ovrcjdMEQ6YgTwavnpPTDCJXkrsEffr5cbJCLWQGk44E1BcPC0LurDyKCYCTsf +7S4ARjxoPYkwdy1OSY+hkLhKm6SSJVJVRM1q/wysqhIDaWLBVoFm0Z4yHSO8EbhFdMw owEOeqa1iB997A7+Uag37CocaJnQaVm5h4cEBHaCdUnYK74ckoxiu7QXVevBty+/deai zhu0d9jYRbBzkXJraKVmQPDKV9yJUhDknaXnohzv0gBq2h03MRJ6qzEHW2PYhtEzwlt3 AiTQsmne3GmaxIfdNGDi+BPKugl87X0dUtac98Zo9Jp79rfcC5NLftnTIVcw+8SknFDf LQ8g== X-Gm-Message-State: AOJu0YxO6cNos8BMKp3t4aDCDBwrkaIVxkE8y3NxQjF3s908B1yIkCO3 vE43xJV1Rwu8hRS4b5js0g9dHP96f8AdeB3I2C96F7+I5c82voBqoKovwQ== X-Google-Smtp-Source: AGHT+IH7pm/e2t2AYSgkE1qKEmWLINxY8lF1+uRkH4vKlhOIqmQS1QB4BVd11/e62RlXHoNpvyCKtA== X-Received: by 2002:a05:6402:40cc:b0:5a2:ff64:1218 with SMTP id 4fb4d7f45d1cf-5bd44bc45c9mr636279a12.0.1723477592637; Mon, 12 Aug 2024 08:46:32 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:32 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 08/13] client: separate property header and values into two functions Date: Mon, 12 Aug 2024 08:46:08 -0700 Message-Id: <20240812154613.126522-8-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are certain cases where we may not want to display the entire header for a given set of properties. For example displaying a list of proxy interfaces. Add finer control by separating out the header and the prop/value display into two functions. --- client/dbus-proxy.c | 38 +++++++++++++++++++++++++++++--------- client/dbus-proxy.h | 7 +++++++ 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c index 42b8427f..1e50d902 100644 --- a/client/dbus-proxy.c +++ b/client/dbus-proxy.c @@ -47,10 +47,10 @@ static struct l_dbus *dbus; static struct l_queue *proxy_interfaces; static struct l_queue *proxy_interface_types; -void proxy_properties_display(const struct proxy_interface *proxy, - const char *caption, const char *margin, - unsigned int name_column_width, - unsigned int value_column_width) +void proxy_properties_display_inline(const struct proxy_interface *proxy, + const char *margin, + unsigned int name_column_width, + unsigned int value_column_width) { const void *data; const struct proxy_interface_property *properties; @@ -59,11 +59,6 @@ void proxy_properties_display(const struct proxy_interface *proxy, if (!proxy->type->properties) return; - display_table_header(caption, "%s%-*s %-*s %-*s", margin, - 8, "Settable", - name_column_width, "Property", - value_column_width, "Value"); - data = proxy_interface_get_data(proxy); properties = proxy->type->properties; @@ -82,6 +77,31 @@ void proxy_properties_display(const struct proxy_interface *proxy, } } +void proxy_properties_display_header(const char *caption, const char *margin, + unsigned int name_column_width, + unsigned int value_column_width) +{ + display_table_header(caption, "%s%-*s %-*s %-*s", margin, + 8, "Settable", + name_column_width, "Property", + value_column_width, "Value"); +} + +void proxy_properties_display(const struct proxy_interface *proxy, + const char *caption, const char *margin, + unsigned int name_column_width, + unsigned int value_column_width) +{ + if (!proxy->type->properties) + return; + + proxy_properties_display_header(caption, margin, name_column_width, + value_column_width); + + proxy_properties_display_inline(proxy, margin, name_column_width, + value_column_width); +} + static const void *proxy_interface_property_tostr( const struct proxy_interface *proxy, const char *name) diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h index 98b0a2a4..f0a5d38a 100644 --- a/client/dbus-proxy.h +++ b/client/dbus-proxy.h @@ -95,6 +95,13 @@ void proxy_properties_display(const struct proxy_interface *proxy, const char *caption, const char *margin, unsigned int name_column_width, unsigned int value_column_width); +void proxy_properties_display_inline(const struct proxy_interface *proxy, + const char *margin, + unsigned int name_column_width, + unsigned int value_column_width); +void proxy_properties_display_header(const char *caption, const char *margin, + unsigned int name_column_width, + unsigned int value_column_width); char *proxy_property_str_completion(const struct proxy_interface_type *type, proxy_property_match_func_t function, From patchwork Mon Aug 12 15:46: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: 13760811 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 814514206B for ; Mon, 12 Aug 2024 15:46:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477598; cv=none; b=kodZH0sBKENyvWjeJNc1rpw3FxHRSa5RSyy7TJaV1Ejdq7EXHufWj93nDUqHlUl1UmkAU976b809ae+vX9MPj5U3Wgg9GL8bygDJatQua/Co+uLj5SgFz0XbpxImggm3eTIg1JFPIpAA4qdc30yDmmHc59bBforq5ui9X+iIJ90= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477598; c=relaxed/simple; bh=Y0FM6IdMTdYxT6n/KJsgMsZ/chZmNYalxNdE7CK3QLk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KCj9Dy4uj8dubogZ9oHptyelQ6Ra+pWW1HTz/jq9Gt1zk9cpCOMUXH/a/vYcbLRnd9uUoQOlC3Lml6BCOKD/uBauydMOOiLjfgNMrp4aU8uSSTOy8m76OC+xJd1afuqdTXAaPIeqE05zCQUY546RKuxoSCip4Ox/EI1daPl/gBs= 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=BqIhPm0s; arc=none smtp.client-ip=209.85.208.48 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="BqIhPm0s" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5a156557029so5116647a12.2 for ; Mon, 12 Aug 2024 08:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477594; x=1724082394; 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=P7GqKrME9tW1V+rFm/dnRiB8ulNgvrCAADhugetOY0Q=; b=BqIhPm0sn/3sVGdipmji0pyEa+lrsCZEuj2nmVQdrRQBHoOzp86bMl+KmPRXdVnR4G SrTXtx1UkvDbiYVsnV77e0QMxG1n2ewHjHmGNjmqPwiDyfxQ16ADJGxXhWGVCsasMKRJ UgZ26ENOSUvymgK3WGmkVeTmSCG5TDbI+04nu9sLTWFo+CXnan4BnN7zyxbsEK7DoCO2 oSjb6xfrrZ5WBWOcj7N0UpRRI3KSG+vwtLq7Dg/V7Aoh3+MWjJgYGbr6qWdRQj4i1oqC cqFpHOGTxo/TgfdGkLHriG0aWpVQmx4rMrxqdKTjx5Nx1u0I1jQmqOe4f55W1xKQTKlG NqZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477594; x=1724082394; 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=P7GqKrME9tW1V+rFm/dnRiB8ulNgvrCAADhugetOY0Q=; b=intEgIKaE+PqYR9lNdtG3iV5d74aIXLDbftITBl0rLG4jZ4XBWqZd3LCblZyVQFeyH Z2IGm74BR1YRthl9t2LjgcECms6Ti/R69qm4UjsCkMF3SgVO4ciKaIuw0y8rbYNDZYGs q4tnGcb1HZmniDwa5Lz3pTRDjQdCK12+qNytysxRhNGRpIeBi2QhTtAKKblZOzEX4iG8 vjq0t+NOe+3nYarYlsqPIqxcSo7aKVW/sgO9IrrRcAVeP+73lgwGhUUjIfqhlbOkulqs lQzDt5zWReRt6n04mO52yl505/LjZl5ghnG0PA3P99KQSbJ7oXQrCinYR933AexFESQ7 EB9g== X-Gm-Message-State: AOJu0Yxd51N1v4CO8iU7DcdNLuJ/eBi/mkXl+kXck75XoF1kkfH/xANk NRlR5F6fBMWKT/GKe9CqZ0NhZ0PFDivBpWa3Z5AocLzWtnGTX4KIp17frg== X-Google-Smtp-Source: AGHT+IHDIm7Z3RcNnCqvMaj/Oms+vtKimJU8Mpgs+GWEVuEU+YQAGdqZnUCfXIrtuGFyfNlYPJZtDw== X-Received: by 2002:a05:6402:2187:b0:5b9:3846:8bb8 with SMTP id 4fb4d7f45d1cf-5bd44c2da65mr521312a12.12.1723477594388; Mon, 12 Aug 2024 08:46:34 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:33 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 09/13] client: add net.connman.iwd.BasicServiceSet definition Date: Mon, 12 Aug 2024 08:46:09 -0700 Message-Id: <20240812154613.126522-9-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- client/dbus-proxy.h | 1 + 1 file changed, 1 insertion(+) diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h index f0a5d38a..32300f41 100644 --- a/client/dbus-proxy.h +++ b/client/dbus-proxy.h @@ -41,6 +41,7 @@ struct proxy_interface; #define IWD_DPP_INTERFACE "net.connman.iwd.DeviceProvisioning" #define IWD_DPP_PKEX_INTERFACE \ "net.connman.iwd.SharedCodeDeviceProvisioning" +#define IWD_BSS_INTERFACE "net.connman.iwd.BasicServiceSet" typedef bool (*proxy_property_match_func_t) (const void *a, const void *b); From patchwork Mon Aug 12 15:46: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: 13760812 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 6E6F5186E35 for ; Mon, 12 Aug 2024 15:46:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477600; cv=none; b=t8Sjl7zg7+hsrz29I43kKkbxqKX30kby8Lui5OV+K+5KXepb2LYtED087asxTYMWshANJXH/oKRpM7PZkhz8/JWXEfUfbcJqilGR98obbaPpPvzLoR6vWPtqkbTkEGkSLtVbxh0I5DtTH21XtvFMTPFXrrvG48mVvcmRrwxlkhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477600; c=relaxed/simple; bh=vAb58u/XqBNtRFv1ckkIBuj3cRcHiM1+Zb6zKxs1xXk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NCf1/3fLISdFCq94c/DI823GNaRELdBHEUxrq/9AW/ghL/fCz7GXqBJ6CygnY+BAUPglgHLl8V3lFOwg+tzpb2LXngbPb0UwfB3STwPZLQty2hjHRjA5vczLsZHyKCyZ1/UENeC7ubMUHTKjYh2Oyp5jlUNYRpW0hKWO2gcppOA= 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=EgsJ2xp4; arc=none smtp.client-ip=209.85.167.49 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="EgsJ2xp4" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52efd855adbso5680824e87.2 for ; Mon, 12 Aug 2024 08:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477596; x=1724082396; 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=62JcGrbGI1cE9yKn+mCLTkRUEfkkg/yYCyCeCW/MocQ=; b=EgsJ2xp4XT4YYTBYOLWmXZrvBs+K2ehAwcuGLiMudv7bZGB7of3Wnut5/Q5qkALJ7T yNOmoMW3cq7hxH4WNEQMIrfNw+aRwqqwi+90NtIh8vp1p4jVIcds4wsxopXBxkTOPF8S c1Fw5BAUGNZg9i5izYWsJcbN8fGEqCFg89CVDXhGpd024xc4ZrTFfuG0klxZkOVTxRZH 9aPQM+6GrsH9KvlEzXb8mRCexzCqNCQyf20lUE2QnpP6nvfkm+OfJ46JbJ7ao4trmTZu xXiXgkl5GSBm8Jp6LmsmBeEbpt4Imb+ds9DpIh2B0MIsUboklIy5BAJiZ0JwJcrrpQIZ SGUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477596; x=1724082396; 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=62JcGrbGI1cE9yKn+mCLTkRUEfkkg/yYCyCeCW/MocQ=; b=H7V0QwpVkMuFlSLaMbRg24e932ztJQoOixL5c841BFRUoKWdMAm5JF5JIk93zKvq5P 5pxIJkjEnbAmVPSTZVlBlkNuSXRTr/YXmneOiQmV73tF/JXaZCa8blmZjuITPuCn3nmw r6W5skaXbKCW0Upg5pTerRP5YPz4TyGPtktBqrDAre/OSQsOH7aCfBN0yCGSGGl0Tqaf qnsGFbbI3+NIsa5PR6lb+OWtF3CLdI9Yuo1IfOnVe5WDlALAbRnRI+pTVx7n4kP3zvsx n09qfYC7GxQp87RZAEK/NKpV+538SI9cpLc99SCDOv37rgpj41nVjT8jTwmxdV/hAlJB QIMg== X-Gm-Message-State: AOJu0YxIizGqJAUkkKoNDs7/KkJU4hCC6CJGZFxpBmFVh0Q+8zmWwZHY clBuPXSJM4by/TwfndVATz/2oYGtrioXSqiSO9UOOUxoQnzuB9jxZp9AXA== X-Google-Smtp-Source: AGHT+IE8HHcCKzjnI0zxwThS9E213JYTvY7x9VFAM2eEQBekKuWHw7W/TiMkI6F1C8ZtRx19I7smGg== X-Received: by 2002:a05:6512:e92:b0:52e:7125:c70a with SMTP id 2adb3069b0e04-532136841b4mr331126e87.47.1723477596120; Mon, 12 Aug 2024 08:46:36 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:35 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 10/13] client: Add BasicServiceSets property to network Date: Mon, 12 Aug 2024 08:46:10 -0700 Message-Id: <20240812154613.126522-10-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The property itself is an array of paths, but this is difficult to fit nicely within a terminal. Instead just display the count of BSS's. Displaying a detailed list of BSS's will be done via a separate command. --- client/network.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ client/network.h | 2 ++ 2 files changed, 51 insertions(+) diff --git a/client/network.c b/client/network.c index 6b79bcd1..7431183b 100644 --- a/client/network.c +++ b/client/network.c @@ -35,6 +35,7 @@ struct network { char *identity; char *name; char *type; + struct l_queue *bss_list; const struct proxy_interface *device; }; @@ -146,11 +147,58 @@ static void update_type(void *data, struct l_dbus_message_iter *variant) network->type = l_strdup(value); } +static bool match_path(const void *a, const void *user_data) +{ + const char *path1 = a; + const char *path2 = user_data; + + return !strcmp(path1, path2); +} + +static void update_ess(void *data, struct l_dbus_message_iter *variant) +{ + struct network *network = data; + struct l_dbus_message_iter array; + const char *path; + + if (!network->bss_list) + network->bss_list = l_queue_new(); + + if (!l_dbus_message_iter_get_variant(variant, "ao", &array)) + return; + + while (l_dbus_message_iter_next_entry(&array, &path)) { + l_free(l_queue_remove_if(network->bss_list, match_path, path)); + l_queue_push_head(network->bss_list, l_strdup(path)); + } +} + +static const char *get_ess(const void *data) +{ + const struct network *network = data; + static char count[10]; + + snprintf(count, 10, "Count %u", l_queue_length(network->bss_list)); + + return count; +} + +struct l_queue *network_get_bss_list( + const struct proxy_interface *network_proxy) +{ + const struct network *network = proxy_interface_get_data(network_proxy); + if (!network) + return NULL; + + return network->bss_list; +} + static const struct proxy_interface_property network_properties[] = { { "Name", "s", update_name, get_name }, { "Connected", "b", update_connected}, { "Device", "o", update_device}, { "Type", "s", update_type}, + { "ExtendedServiceSet", "ao", update_ess, get_ess }, { } }; @@ -186,6 +234,7 @@ static void network_destroy(void *data) l_free(network->name); l_free(network->type); l_free(network->identity); + l_queue_destroy(network->bss_list, l_free); network->device = NULL; diff --git a/client/network.h b/client/network.h index 41624749..56d74e3f 100644 --- a/client/network.h +++ b/client/network.h @@ -37,3 +37,5 @@ char *network_name_completion(const struct proxy_interface *device, struct l_queue *network_match_by_device_and_args( const struct proxy_interface *device, const struct network_args *args); +struct l_queue *network_get_bss_list( + const struct proxy_interface *network_proxy); From patchwork Mon Aug 12 15:46: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: 13760813 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.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 1C097186E3B for ; Mon, 12 Aug 2024 15:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477601; cv=none; b=cP/god/F/jV7Aohij5kk7z4D7AIr6ljhRpcJ13PcZAcAW44AVq7t2OPSmKQPnTFShA9b+bAC1gcYATgW2DTDH3fCzYeWOeA6sugSfZVntSpM16d8TxNn+fMA91HulszDm8gG0C4vMrrK//2YJbT1mRl4371ypF831x8YlxPWyAk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477601; c=relaxed/simple; bh=uogCmoUQVgnF0uaW38LuJljWcL/2D2EDL+jnqvpBV1Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r5myxruI5SLfs1uke5WAWYeQiaR3xwfEpNMMMY6IQOQhp+ZxE1ZaFr/yVFn0xijB9C1J5XtEPkkLO9bZOjbcXP2LOibqK4HUm07sakAuK2jypXC+vkrvfI5FIl8xd2/kNrZq4FDp9Ae33W5v5leQHc0H1x0LiRjmCxmRjSg5yvU= 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=Pd+UG4Ow; arc=none smtp.client-ip=209.85.208.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="Pd+UG4Ow" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5b8c2a6135dso5191670a12.1 for ; Mon, 12 Aug 2024 08:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477598; x=1724082398; 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=2Qky0MQJeJF3LCCWOtjL0pplPriz27AORg7Oa63Y+U0=; b=Pd+UG4OwpVcURM5ktAsIXq+28ZqgpdPJf9i/rQq1wu5Oir95+8mlUc/tJP3rQ3/cnd NPR42Xlicx+HY5dE5ZwjVBMMNHv2j/NNgoCSGmGQwrvZu+K5Ip7oJqY/Qsn0KVAtiL2p kAYiS9tbSP7e+YjWBdaHBwOaZYDGl6z5gEX+wlz+KjwuUpCyxpylVCYZkXY/r8ohfOMv w0WbNyrzKNJ21D+lc6uEmYzDNz5KFB9OCMC63JxUhhXwZIf4zNI2kUAmeg5xgokwRmhY VDcFBfeBG4Xjdq2npLhOU2DRo61fQ3VjkJlZg1gahUkaoyzMk+E9nW4IUz8yhwfIFJro Ol8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477598; x=1724082398; 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=2Qky0MQJeJF3LCCWOtjL0pplPriz27AORg7Oa63Y+U0=; b=LyZuiI6wgkiLZQ/TM/YEmQuicB4xsqtllBEMw147TqO5+DbaI5VFtEFbQcXquZnePw JDiXiNjTeSfD9KOvckO99Mkc7Hfq3VKlcPiACsijRAmGKVUgiayiPeczawuLxrTms0VX CqYvyNx+SC8E4hAFkY0/oHjeqO7dkXnx9HQ4EDoiSi8OdZ95gUvjQByGvhSR7xlbwAu2 bIFtxMXQYGvKL2+zHfkBYreF4Wnv/0x83f1fZ/Vq+UZBUEvo3j9oW9lqeu2RGEHc87Oj eOc652BViI/7nk19f4A3WNohj8QGL3KRrVUOQiqo1keQFTnjafN9ZFgPmLrRMKHezT2E 4hcQ== X-Gm-Message-State: AOJu0YzT7i9WeJ1w3LqGc+6pKRrED6VCutMGbgGKrtFEAZq2gejrUkKS jSMFNOhbu6fMxvUZSZusT1CLAmWVEld65yDaSy3UXjUAjo4+u3pybz4k3g== X-Google-Smtp-Source: AGHT+IEUJmvQHYOLqKqUBFx4P6C9a8islU2TGrN/DtmMMNw2LhF6ggqjwxyDpdp0CN6Dbe+NzH2mRQ== X-Received: by 2002:a05:6402:34c6:b0:5a2:d970:114c with SMTP id 4fb4d7f45d1cf-5bd44c15055mr537663a12.4.1723477597922; Mon, 12 Aug 2024 08:46:37 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:37 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 11/13] client: add BasicServiceSet interface Date: Mon, 12 Aug 2024 08:46:11 -0700 Message-Id: <20240812154613.126522-11-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- Makefile.am | 1 + client/bss.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 client/bss.c diff --git a/Makefile.am b/Makefile.am index 0c152216..d438a5ba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -319,6 +319,7 @@ client_iwctl_SOURCES = client/main.c \ client/daemon.c client/daemon.h \ client/dpp.c client/dpp-pkex.c \ client/station-debug.c \ + client/bss.c \ src/util.c src/util.h \ src/band.c src/band.h diff --git a/client/bss.c b/client/bss.c new file mode 100644 index 00000000..def4de7f --- /dev/null +++ b/client/bss.c @@ -0,0 +1,109 @@ +/* + * + * Wireless daemon for Linux + * + * Copyright (C) 2024, Locus Robotics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include "ell/useful.h" + +#include "client/dbus-proxy.h" +#include "client/display.h" + +struct bss { + char *address; +}; + +static const char *get_address(const void *data) +{ + const struct bss *bss = data; + + return bss->address; +} + +static void update_address(void *data, struct l_dbus_message_iter *variant) +{ + struct bss *bss = data; + const char *value; + + l_free(bss->address); + + if (!l_dbus_message_iter_get_variant(variant, "s", &value)) { + bss->address = NULL; + + return; + } + + bss->address = l_strdup(value); +} + +static const struct proxy_interface_property bss_properties[] = { + { "Address", "s", update_address, get_address }, + { } +}; + +static void *bss_create(void) +{ + return l_new(struct bss, 1); +} + +static void bss_destroy(void *data) +{ + struct bss *bss = data; + + l_free(bss->address); + l_free(bss); +} + +static void bss_display_inline(const char *margin, const void *data) +{ + const struct bss *bss = data; + + display("%s%s\n", margin, bss->address); +} + +static const struct proxy_interface_type_ops ops = { + .create = bss_create, + .destroy = bss_destroy, + .display = bss_display_inline, +}; + +static struct proxy_interface_type bss_interface_type = { + .interface = IWD_BSS_INTERFACE, + .properties = bss_properties, + .ops = &ops, +}; + +static int bss_interface_init(void) +{ + proxy_interface_type_register(&bss_interface_type); + + return 0; +} + +static void bss_interface_exit(void) +{ + proxy_interface_type_unregister(&bss_interface_type); +} + +INTERFACE_TYPE(bss_interface_type, bss_interface_init, bss_interface_exit) From patchwork Mon Aug 12 15:46: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: 13760814 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 AF3B3183CD9 for ; Mon, 12 Aug 2024 15:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477603; cv=none; b=GZZe+RWVLjUMtDeLGWRrC9yzOf8za85AJ4HVGKVqNQ5KNcVeNiLdQYDdrkqoBti7zIw3UCVNmN3Ns1feHvCQkQAqeAAaIQ5+qHVF3M4aNhJlAEZFnr8pZT6HynSt693ehA7utMyGxNCmEPri2rBTZMmdv0KnVpeLiW16j1V9WDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477603; c=relaxed/simple; bh=gCdwM5boUrxXJykMfnN7bEjV0cAfhvzuqH+rcGbJXMI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=N7I3uX/76tpPcVUQNeZmx1mrhqxNIM/99wcbZ1vT41KBC6WKbYZWYuzDsA+GcuWYiiGSiPXuNshUXzLokqwshqAsrJEOx33iuL8nCSn5gMx2KWlX9NZOtG9MVB9lBPrVeYRzQ8i+xnsb/46wc6p4sGyeXu9/JjQs4GT2kRS7rwg= 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=AuKC0GXu; arc=none smtp.client-ip=209.85.208.43 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="AuKC0GXu" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-58ef19aa69dso4404657a12.3 for ; Mon, 12 Aug 2024 08:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477600; x=1724082400; 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=+PuzQJECGUFs6HRFSL9Henz0/P8ilvHbUqfcGwqXeJg=; b=AuKC0GXueVjduHpPbsHygXTHyUjJSEJ+eZOYldLrtLGGPuKmEOJL8R9Rta+DeG+rjB JpfTqpOYVk7iLrkIzmpREIfCt7S1Ct6FN5pjULg1lU4GCpnJHnh3NOYQ+HmEsaQOCz90 Us8MvKUKkfZOt5rndpKxXfmAzNp9vl3Y26Bo+bFV8qk6FG/9zQPWtxwOq9OAPY08gy65 WjyjuEjVfqWAfbr2WnjdthiyW6r7OiMztYYW98XPrWvBy0NnLV+o8iYwMlBu20mg9Mxq KASUR4Q7NkhhnUQBwVOErqRlqgvYVCfrF4PULsR+Ys6YtD62yi0iYdMV2h9zY+Dz42mF 1WGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477600; x=1724082400; 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=+PuzQJECGUFs6HRFSL9Henz0/P8ilvHbUqfcGwqXeJg=; b=U2LQTZ6whrrE8Og4f7muLO1h7MgTrvwVFrkzuxGTbOFs45O6g5j6dDsbJJ3TRomYhf q74h6LVJw48g6SQM8Te8GQfSbbjZYYQea9GDDKmgsuJpkTwc23bVWYezoZeNscJ1rFwZ kNfviVI+8glXL2TvOj52sUoZjF/wz/Yr86pI4zl2eUk5B07c26DFjUQoGXyswPuKYNYM h5u3P03sVG2OYWo0P8Ki0tiQfgMLCddY3CiPc3Qv1zFlYSvxeGAyigfcjkBo+cz9xtdV yKD2w8h2jQGrvnJZzUNUfWLebPScic8VUcScQc7nWX7FThVSIf5V1NAnbjFAVELBoyda 1kJQ== X-Gm-Message-State: AOJu0Yx4/im5SP+YHqkpad99HgtVYeMu/iVAYidPo1/Mwz/V37U5778c 8FIiCGA2ndZjscELVECmuqjBcia6XG2MzsDU2iVjqNkcmmv711fRqEMcCA== X-Google-Smtp-Source: AGHT+IFLLWOqdDMX8srVFCYMKQ94O8V2kaelxTG+jM3XL1U2KkOeQiUi2GYrl7r76PGaIoYzRS0ISA== X-Received: by 2002:a05:6402:3813:b0:58d:81ac:ea90 with SMTP id 4fb4d7f45d1cf-5bd44c7cc25mr494401a12.38.1723477599666; Mon, 12 Aug 2024 08:46:39 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:39 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 12/13] client: refactor cmd_connect() and add find_network() Date: Mon, 12 Aug 2024 08:46:12 -0700 Message-Id: <20240812154613.126522-12-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This will do all the lookup/searching needed to find a network proxy object. --- client/station.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/client/station.c b/client/station.c index affb7f15..58aac29e 100644 --- a/client/station.c +++ b/client/station.c @@ -283,28 +283,26 @@ static char *connect_cmd_arg_completion(const char *text, int state, return network_name_completion(device, text, state); } -static enum cmd_status cmd_connect(const char *device_name, - char **argv, int argc) +static const struct proxy_interface *find_network(const char *device_name, + const char *name, + const char *type) { struct network_args network_args; struct l_queue *match; const struct proxy_interface *network_proxy; const struct proxy_interface *device_proxy; - if (argc < 1) - return CMD_STATUS_INVALID_ARGS; - device_proxy = device_proxy_find_by_name(device_name); if (!device_proxy) - return CMD_STATUS_INVALID_VALUE; + return NULL; - network_args.name = argv[0]; - network_args.type = argc >= 2 ? argv[1] : NULL; + network_args.name = name; + network_args.type = type; match = network_match_by_device_and_args(device_proxy, &network_args); if (!match) { display("Invalid network name '%s'\n", network_args.name); - return CMD_STATUS_INVALID_VALUE; + return NULL; } if (l_queue_length(match) > 1) { @@ -315,11 +313,28 @@ static enum cmd_status cmd_connect(const char *device_name, l_queue_destroy(match, NULL); - return CMD_STATUS_INVALID_VALUE; + return NULL; } network_proxy = l_queue_pop_head(match); l_queue_destroy(match, NULL); + + return network_proxy; +} + +static enum cmd_status cmd_connect(const char *device_name, + char **argv, int argc) +{ + const struct proxy_interface *network_proxy; + + if (argc < 1) + return CMD_STATUS_INVALID_ARGS; + + network_proxy = find_network(device_name, argv[0], + argc >= 2 ? argv[1] : NULL); + if (!network_proxy) + return CMD_STATUS_INVALID_VALUE; + network_connect(network_proxy); return CMD_STATUS_TRIGGERED; From patchwork Mon Aug 12 15:46: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: 13760815 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 80062186E47 for ; Mon, 12 Aug 2024 15:46:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477605; cv=none; b=KjwIQTM0bqoUeLbSe67b2Ud26uNBGJ8VvLvCD7yWOtv+CFyNCp58fdWLeq2y2fQQjc0q1jJnzW0OrHyLYjusTzjRYurl00q7K/LdMV+2NEpTIQjlOxXCXNxCTQzrzpZPrM+pfCZCHtWgdP1QmwUGd8ScWUz1pNnznwK2tAzUlzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723477605; c=relaxed/simple; bh=cgLZfJReiqyoHO2vj5i33u/5uHkuCEpQxKVkzMASb7Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lnO5wdPyoga98ykenrjtgzJJZ45hRKfJXxSHB0oOtFSgRYL1EpZlM8GshT0MhsBFxK7/P/Kv8yBBtwMd4HLSpwCMfyfS+PBxcUKpMFbkjjXuezpaReyQb2/VkRbjVRYubViBjX016wOaMad/jrFvC0YhaPxkRdyCYzgbuj+qNBs= 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=R2kt88+C; arc=none smtp.client-ip=209.85.208.52 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="R2kt88+C" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5b391c8abd7so5263401a12.2 for ; Mon, 12 Aug 2024 08:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723477601; x=1724082401; 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=QkSDlpminQGhbEfKy7XbbczaPNShZF8GbJOpidG1zbs=; b=R2kt88+COLtbXsiFDquZyyPGMFZ3GZLcZ7l0L187ROBO37DSeCckNNJAv4MmzfAtvX Mq4Caj9fmoqOo1YiQ6YeXJ+2LNafJJlIVtj3zUzt/IGHdx4wGWdjWtlCUH/XWljnWmct OyuHlDTJ6RYhQE6f4Q7Ngf7pe/NLOvUI+nqPufQxaovKbhvsr9nS7sVObW9POTZ7oTSE hPwo8paqP9xBrqQxo+MC8NInxm130zYcOhumpctkBafdLtCWgAStEe7xf5uvbI5UywTi rp6mQFoL8QgDJ4HsagBUjMVG3jKu5ajLtEGmdNP4OSeBZIAHgR6USHh2rL0ShRuPheq8 MiGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477601; x=1724082401; 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=QkSDlpminQGhbEfKy7XbbczaPNShZF8GbJOpidG1zbs=; b=g9Zy/1Om8obmuI6vXufHDkqMDoffoJNr9a3qJYeERH0fFZTovIiSQJVlQYNTZgFAyN Zm5cFJZy6lOBIlEAH9LCha9oz1mFtObveqqbdB438cRiaKMLgqdw7d+EYQsP2r3dj4df DsyJKpb0ELsl/hIzXdSEzVyC0x9D39D6OKLoDzZqyDHXzJB6oTr7nmntBUKAYWbSYCfM HeHUnYms8toez0ZKtVwZjqYF4gFRSp1A6xmoEK+IQTnjqqp641vGtlA2emaSroCnXoPA Ay8Aq1dlj+CWWU4Tx72Y2QqZnz3cFex0TcrDYLY1D38O4+6Wb0qPRltxuQwwtnyTL4Or seMg== X-Gm-Message-State: AOJu0YyFIz0vpDSVTo5KoL3OpAbe/B3aouXe+IENcvZKjBH2BdTLpn4I vPshA14DJc0RoPvuqXkUsC81MzXz+mjDeKaYvCiX2SZ3EJvGBHd5rAW4vg== X-Google-Smtp-Source: AGHT+IGLXxZr1ClbK0evJI43K0p2taPKbdun2AwZxFWDy7nyfAo21angcOIapdJ5kMvovhEZK7aL1w== X-Received: by 2002:a05:6402:430b:b0:5a1:1740:33cc with SMTP id 4fb4d7f45d1cf-5bd44c0e074mr619439a12.3.1723477601434; Mon, 12 Aug 2024 08:46:41 -0700 (PDT) Received: from LOCLAP699.vf-sint-niklaas.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd190adb45sm2224931a12.32.2024.08.12.08.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 08:46:41 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 13/13] client: add station command "get-bsses" Date: Mon, 12 Aug 2024 08:46:13 -0700 Message-Id: <20240812154613.126522-13-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812154613.126522-1-prestwoj@gmail.com> References: <20240812154613.126522-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This command will get the BasicServiceSet list for a given network. If no network is supplied, its assumed to be the current network. --- client/station.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/client/station.c b/client/station.c index 58aac29e..5066a9f1 100644 --- a/client/station.c +++ b/client/station.c @@ -723,6 +723,55 @@ static enum cmd_status cmd_show(const char *device_name, return CMD_STATUS_TRIGGERED; } + +static enum cmd_status cmd_get_bsses(const char *device_name, + char **argv, int argc) +{ + const struct proxy_interface *station_i = + device_proxy_find(device_name, IWD_STATION_INTERFACE); + const struct station *station = proxy_interface_get_data(station_i); + struct l_queue *bss_list; + const struct l_queue_entry *e; + const struct proxy_interface *network_proxy; + char header[256]; + + if (argc > 0) + network_proxy = find_network(device_name, argv[0], + argc >= 2 ? argv[1] : NULL); + else + network_proxy = station->connected_network; + + if (!network_proxy) { + display_error("Can't find network"); + return CMD_STATUS_INVALID_ARGS; + } + + bss_list = network_get_bss_list(network_proxy); + if (!bss_list) { + display_error("No BSS list for network"); + return CMD_STATUS_FAILED; + } + + sprintf(header, "%s BasicServiceSets", network_get_name(network_proxy)); + + proxy_properties_display_header(header, MARGIN, 10, 18); + + for (e = l_queue_get_entries(bss_list); e; e = e->next) { + const char *path = e->data; + const struct proxy_interface *bss_i = proxy_interface_find( + IWD_BSS_INTERFACE, path); + + if (!bss_i) + continue; + + display_table_row(MARGIN, 1, strlen(path), path); + proxy_properties_display_inline(bss_i, MARGIN, 10, 18); + display_table_row(MARGIN, 1, 1, ""); + } + + return CMD_STATUS_DONE; +} + static const struct command station_commands[] = { { NULL, "list", NULL, cmd_list, "List devices in Station mode", true }, { "", "connect", @@ -747,6 +796,8 @@ static const struct command station_commands[] = { "Get hidden APs", true }, { "", "scan", NULL, cmd_scan, "Scan for networks" }, { "", "show", NULL, cmd_show, "Show station info", true }, + { "", "get-bsses", "[network] [security]", cmd_get_bsses, + "Get BSS's for a network", true }, { } };