From patchwork Thu Aug 8 17:42:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758018 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 4B8FF13D8A3 for ; Thu, 8 Aug 2024 17:42:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138961; cv=none; b=ks3AqJFdLj10pCr1GBBik8Yr7n4Eit4FhtYw+M5a306ALMqjvevpf59roglC7vzBxSATpS+EIBEKyN9Z+Y97cu7FjFH2cLeW/GbwUb8Rp950y3XZOMjr0ifaXLwK0zhJQtRcdMEHfmFXK70X+NrrlS+Snv6fe1yTVsB+8xPVRPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138961; c=relaxed/simple; bh=N5ktHp55FAxev4Fe93AiflrA9E2h1tg4Y823bSvYpR4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=fdglYvQ2549Q3xDdSTis842WRRUFvhZ+pULAoNEHwpMYQjS+iW5oqgt2HeqswCGERXE42vx0vbkgYF9tAIzq0xPOYs2dZ4T6hzuWjj6rOvdELC1SuTmIEzCSqJVDhhezz4ZEF7z5Y/UBXyWRsOenyewpbWHrku0NAkNjanTvLjE= 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=ShMmAW4V; arc=none smtp.client-ip=209.85.214.174 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="ShMmAW4V" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1fd9e70b592so10727335ad.3 for ; Thu, 08 Aug 2024 10:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138959; x=1723743759; 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=ShMmAW4VEQxWuiW8LSfhVhe2Og7lMETp2XpPdx388rOotHUm70MnEAzzeVSIK4W+Y3 wImAJxTJZ1tadWnQYRSQUWN5f45deHe3HmBF8fGMsp1WbZWR8A9mHEVD8ShG49SmI9CA PVNbow7HGKhLJzsLu6vJ1+E8tFHnNPIlp9ydZuQNa423ixKslaXsX7XAlhVC3q5BF3y2 q0FOCWx4HbMBw2/YXoqRrqlPZeC96bKwt8a9Vp84T28b6EPq+Hr79qwDOf3R8zZf7jEc uc6tbjLlRE5qT4hANYaCClc9xWHcRcH8IxUbW/BCTimI5bp5xC9n3hJggMtOfT1VmCcc QzFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138959; x=1723743759; 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=BB7Zs1tJ8LADp1Nc45MxMj4TWC/pr0IBGgRtAbeD+LOwlGTyCo5O0jhpLYPsEv8lgG holj8J1Eq9LvtPlVVgFbakkS8dxZsKQbTXoD4/w9tbP1cZWF8DKFeWRwSwkf/LSwQFQ+ eWEdYE7mBaqG6U/lBru/H9Stl3mzJLUh5st0zipGQpDdVdWKKOrN0HRMTmOk7Z2HBbzc YHpeD9tO2TyYuNR1T+Oxgfm2ddHJSTVdiWeARw9cIUZV/M+PBp/SEGh/LQ/jhHCEkOQd 8pienPnCsbmdJPaOv7mO8H/o6ylYpt1aQvEEXA1cGIQckYlL+MtMXytjBKvbyc1De1cT DmXA== X-Gm-Message-State: AOJu0YzgOUB+VTks6bRUYLIEhINHxFGZJDoB2hTOxVEIEVECf5CWQNZz icvjz9jxVa/wXYWWCMTPTClmol4CrYqWrwrptP2kaZ1QMAGWzUcSXFGaAA== X-Google-Smtp-Source: AGHT+IHy3FZXNWvKGpdVl7d+UV7r6YPMCyRCJ8GMFND0OOdpE15168BwD3aJXhrMuq+QhPNVLen4zA== X-Received: by 2002:a17:902:d4c1:b0:1fd:9e88:e4d1 with SMTP id d9443c01a7336-20095391c14mr30425095ad.51.1723138958979; Thu, 08 Aug 2024 10:42:38 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:38 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 01/13] dbus: Add net.connman.iwd.BasicServiceSet interface Date: Thu, 8 Aug 2024 10:42:24 -0700 Message-Id: <20240808174236.218750-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 Thu Aug 8 17:42:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758019 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 1315E19006A for ; Thu, 8 Aug 2024 17:42:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138962; cv=none; b=oHfx0Xu8sp97upy+z0rqHA7IDHKJozN46+XzuZL8Tovk/mCQO/2NaBDtLQGiyvz2R/XPdt6fqlJn31xdchdJKVBj/wMUwmmvMmn0d3FRIMOKGD4YlwSJc1sb7/R5M2+tvvgUwf+zwvtVL5zXtDvk98Yk8qRa1KRGE5YUKxV3wDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138962; c=relaxed/simple; bh=gL9/hIUNpJ2gfMcRa9bEN2H3UC2GFGEkTGsnaA/OVZk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jhc43vttsV+ioJZjYb5w2IGTsSsxqcJvE9zvCMVpqNGjtfo68FJp+vkyqQCbglpvN+KvXq2l+a1XNg0/lyYRsWIVor/Y7EM8apRzJGJWweraRUgs3a016uqPBIGPk9F36AQsrHuLy0YB3Aa3DtxhowUmpM15Cv6/R3WoJs1esTs= 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=WFBqB/Er; arc=none smtp.client-ip=209.85.214.175 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="WFBqB/Er" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1ff1cd07f56so10963945ad.2 for ; Thu, 08 Aug 2024 10:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138960; x=1723743760; 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=SB9jcrzhXsSqkcbekdX4625JgVZH0PgLdblAKSVBN44=; b=WFBqB/ErlMX+8WuPw79HW4k4GWhlWpVutc65h1qizgsuM9jvKTic6tbem2LCI7JYpW 3MjEWb3fzPX4EMbzNFj+lnKeXe4vqYWhghThwTSiFIN8ftl3IbG0ghYXpkyWu2Fos/Gk QCCED18ro2l0prCw6XQx6UOHS+/2QN7WdsiOwJMNm49kIbEmc+f09mp2i1ga1Jdwpm3x iDY1iYQCNU6+72apq5N1OWE9GMbxYJEIWliS6SmXrcxzpnBi9oac4Nc4in2y4+OTsDc0 XdE35Eydg/BvMLF4BL4gXjdYGhl4DReg6r8CpIAM48DBgMRFT3twdze3dDs4IXHxH8ll smlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138960; x=1723743760; 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=SB9jcrzhXsSqkcbekdX4625JgVZH0PgLdblAKSVBN44=; b=LZVd6C+upg9Pf/GZWN7u40CeNSs+AV42T6oKNHawb3JEUF9K86Hvm4hrt7mIJGo+JR 86+GNEfL/Php+2Jb9GWF82vtCQKWz4nCYrE/urfnJRkprNBVTr2Q9BovP/h/73bhSJJS ahUgTgcxEMypmBcDpDV8HsI0EGJixxpgqwPBXIgAg4rwN6HKhK3WBZD6NJ1vzOaa1X8A Uo7orZAcljNZqS0hZQfB8LCj99SLdkU2643viK97SDMGUMx0y+D32GdQJy8md2aD4hMC 91U9yahyrN3W8GmbuSXDDe96Bf95Vr4lpJULeklqgZ5TJnXYOnVvo3PEwM1uTVaWJDMj bEeg== X-Gm-Message-State: AOJu0YxXQ0AvbuVFMjbMZ5SUT+oZXvVea+MO+PgmUJ4NeLIP8jeI7fXr 8W4unh1K5czVf+xQQ2ayfsl+1DKoNxzCOm5VzxYa/wqx91Njs/ee1f16VQ== X-Google-Smtp-Source: AGHT+IEyp+tdtzEb13mFdrrDwpRpDCjKe7haXFtWPqU4RNyFXjJU3+VLrGcsWGft7l0Q2JEQbHIOxw== X-Received: by 2002:a17:902:cecd:b0:1fc:2e36:511a with SMTP id d9443c01a7336-20095244225mr34269625ad.14.1723138959693; Thu, 08 Aug 2024 10:42:39 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:39 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 02/13] network: Add BasicServiceSet object Date: Thu, 8 Aug 2024 10:42:25 -0700 Message-Id: <20240808174236.218750-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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 | 122 +++++++++++++++++++++++++++++++++++++++++++++++++- src/network.h | 4 ++ 2 files changed, 125 insertions(+), 1 deletion(-) v2: * Reworked to use network_bss_{start,stop}_update diff --git a/src/network.c b/src/network.c index 09099fac..9c197731 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,97 @@ 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; + + /* + * Due to station issuing multiple scan requests we may already have + * this BSS data registered. Remove it from the old_bss_list + */ + old = l_dbus_object_get_data(dbus_get_bus(), path, IWD_BSS_INTERFACE); + if (old == bss) + return l_queue_remove(network->old_bss_list, bss); + else 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 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); + /* + * 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 +1254,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 +1278,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 +1992,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 +2251,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 +2276,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 +2298,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..f27329a9 100644 --- a/src/network.h +++ b/src/network.h @@ -67,8 +67,12 @@ 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); 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 Thu Aug 8 17:42:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758020 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FEEB190072 for ; Thu, 8 Aug 2024 17:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138962; cv=none; b=CPWjZSjEkhqwKTnIrn1Ni96zISPNDFntLffdDgQ8+WVWWfuBVhNa5Zr03yQLd3i9iwbE/fjaLRRaml61O2LzTisqOUEwQicJLT5zcLwIeRVUJhSe/0x/BVXCtii031ujupSaHlVHZr0aGOxMnwY1VVAZPBXF2o8CTR3vYdmDCiI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138962; c=relaxed/simple; bh=py7vwZab5zeIRybpiYD2KXK0nrES6lgvE7s3LcLAJxM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mjx9qp0WTRzv0mWEXVMvZQZLPRyPk3TyixojDo0bvbNNVN94jkNnIp2tCWsle4d/x476JG5L/axGXAEAfZoNOdBUYQ96d4JsqGldgCRN5JfoxYp28WYZUKK548jEZ8macJOH7SA8S8gVuGdF7RCDQIhcaLo934Pmj+ogeoUUmwM= 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=AELiI9sW; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AELiI9sW" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1fd9e70b592so10727535ad.3 for ; Thu, 08 Aug 2024 10:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138960; x=1723743760; 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=bZPCgnGXF4BrQ9vo5hXu2653vC5Ulqpydb1rMi3BJUo=; b=AELiI9sW20mUX8arRAa/Ue2MlNENLTsVyuG3/uxbk0CMUC6jvSIBsjTV8GVagwoR5m RNeZV29c+HI8eEL0IgB6tGPGuMHDxtn/6VhmAyOFhY5owefgFenIkR6BJKENIbdaREkZ qCc1E27OTipzAs+5pIwLu1xHsGRFUnKFPNZqGcORhjiDKinEufk3h9gYlYAw1CI4w+Ed upVTflamegVrNzP72t+dDLD4ywa6PyQMG1QZpWQfjQx3vd+SSTjuEtohJ99211+3KcVK aHtAYYkGrSk637FyRF9Yq4ZR7pVbwNP7rp3J2rRIbVlQVOimIiDNFfil5FgHa7KO/1fq w4CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138960; x=1723743760; 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=bZPCgnGXF4BrQ9vo5hXu2653vC5Ulqpydb1rMi3BJUo=; b=Ex663u/qu5KJS4UiWtZ3dqH57V8ura7eZMQ8AgBZFlRe5pCRSC8RGrkFpqLms9TBc5 TkkJAX5Tch9ZtKYDWBUUQOJjmbhGeQ/3884bkySFtZhIe8BVGV5851I1pUwYLS3cH78b fV3ooWfXDo18dbgQTfZM2768KDswbc8YB0V0S5eDZqUFIsWUqmz/ju7nOZz2kKpclVS6 MRSnJtJBUN8UzlRRY3LlBKYe6N2BpzQc7fiCefYu0nrgcM2hRGRp4WXdZNJdi6zwLuJl Qwr7PBkB3K6hnHOfNm1de/1rwZAnJk/XVCsw46ilpzTVj3yjaH29IdGlb3Zdb8+AtmeX B5dg== X-Gm-Message-State: AOJu0YxZf9O59uoMqewGovpgKAcXJC2Wr6p6kZdwfIcpGnRN8maubrHI g0Xu1tLDKUlXV2RbaoktQQbgrZu6IsNC+NaOZhW+VtugIyuQdDxPVWt09A== X-Google-Smtp-Source: AGHT+IHjUhUxRk4zLzwTIyJve9RC+YflhmQSehdgx/kXX6bHMyoutoIjAFCuEFQCa0aQ1u/PDSNcag== X-Received: by 2002:a17:903:41d2:b0:1fd:63d7:5d21 with SMTP id d9443c01a7336-20095395179mr29108455ad.47.1723138960469; Thu, 08 Aug 2024 10:42:40 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:40 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 03/13] station: use network_bss_{start,stop}_update Date: Thu, 8 Aug 2024 10:42:26 -0700 Message-Id: <20240808174236.218750-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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 | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) v2: * Updated to use network_bss_{start,stop} update * Added the free list to fix invalid reads due to freeing the scan_bss early diff --git a/src/station.c b/src/station.c index e373b03b..8a76339c 100644 --- a/src/station.c +++ b/src/station.c @@ -344,6 +344,8 @@ static bool process_network(const void *key, void *data, void *user_data) struct network *network = data; struct station *station = user_data; + network_bss_stop_update(network); + if (!network_bss_list_isempty(network)) { bool connected = network == station->connected_network; @@ -532,6 +534,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 +556,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 +944,19 @@ void station_set_scan_results(struct station *station, { const struct l_queue_entry *bss_entry; struct network *network; + 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 +968,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; } @@ -996,6 +1007,8 @@ void station_set_scan_results(struct station *station, l_hashmap_foreach_remove(station->networks, process_network, station); + l_queue_destroy(free_list, bss_free); + station->autoconnect_can_start = trigger_autoconnect; station_autoconnect_start(station); } From patchwork Thu Aug 8 17:42:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758021 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.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 96B0B13D8A3 for ; Thu, 8 Aug 2024 17:42:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138964; cv=none; b=X3YPqBlGNoGx5wrjLJDBeSxJENL7RYytuNDMff5ZBspc38wnL6FalQ9MN5WM+TVwH/EIRZ4NgXtY8El3HIctP1/lZ4DvKuw0aPdg0w4vgNB/zHcr3yVMrI8IQRb4+apY3VT4i6nY2PgS7JVEAuq8l4CnKbEu64M9ie4ik4duZO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138964; c=relaxed/simple; bh=sxzA+Nn8SPaD0oyBawBuAc/3DvERKrGuBuR6LXQXaic=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hvV9wdnLouoJA38qeUil90fLWrY+8zQRcLnBItQBj+BsJ8e1BaG57rjXLjNzdttUsZD5eAext1qqqiu0c8NTr/COSxA3lAZhZLT+u0htNNPXRAImm9yOtK1h+pypd0xkGak5KbSSNAj3xmdrVW4XT4UyjqilYlGcLkcq1/dl1js= 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=ci422hLQ; arc=none smtp.client-ip=209.85.214.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="ci422hLQ" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1fc56fd4de1so8636235ad.0 for ; Thu, 08 Aug 2024 10:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138962; x=1723743762; 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=zstXg2qUq099OLrjj87QlBwGeHGsG3dbckKiWwSxEbc=; b=ci422hLQiLWGHip0x2vU2ojvJW4tR60ifcsLtSLSKj+Cw9boJSP5O8QN8oaaWDXn8t H0mA2pa+2eONcZFbAnOxlDD8RvPctk5z2n5+/dlltdKBoVDADHs2AeTqJI+vhufk7lva eUgVZk8JcwUab/3jTeYbqrIXwGKr36oC6JOEcGrirneInpGTvlTaP+Ob1V3RDvrSOkX4 +0kp9cB7gyFVJnE9OVxkC+msDEYEskCGINtnwIpd/5iOl1Yuz1e3HKzEbpSNX2eFuXJc dLVA6YfQ7ps9pNm3VlTmHFWTcrTzPo1dOmP23dDGATaY8s9peJgoA1cc83Utw15nqKjX bs1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138962; x=1723743762; 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=zstXg2qUq099OLrjj87QlBwGeHGsG3dbckKiWwSxEbc=; b=EG1T/LFmEyPvSvy/omB7x5jglU4lmH1OS3bNgCVxEW40CcCkHEgYSS1UPtNo3VyLSd NKwUiZq/6J6wcIC2xQCzCgnPCGbKKnMH+5wGnLewucEyUbNHulXNC6WQymcD2HY5YfHo 2Y4XsNxpqU4OnKza64fGGfCkMhAmJPA/rz3uh/ekW2Ao9t6K3nbrPwJwcPATCUk7JVgp 6DMIQUZDXFfzwhAgLI1Jx5mRUC2ApLL9U6bQpOYVpeG+Jq9hFNUgBqSFpH16vGouJDmv NvIBg0p/1yp+O5iVk91bSfkumPW35RqsbFb8FRZmVKmO8knE3cDcvtJ+IgqpARimaJpC kV7Q== X-Gm-Message-State: AOJu0YwpAQS/LScRJOh3vTlPdutieBzwF/4og/6vIzxiWO0xqdaWiHRJ C9C28Tyf/hKAui0WAk3JFXfDXw0QtB8TtgaCSKZ9jErI+TOzz6XHyYbASQ== X-Google-Smtp-Source: AGHT+IGqwE1wRRm2eTSD6jotEq/wzvvPlu/kusf5zHGJp6ew5EmsuSH43J/+na45l5wwsKbARGiwcw== X-Received: by 2002:a17:902:e5c2:b0:1fd:8f7b:1e88 with SMTP id d9443c01a7336-2009681bff6mr46350775ad.12.1723138961592; Thu, 08 Aug 2024 10:42:41 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:40 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 04/13] network: add ExtendedServiceSet DBus property Date: Thu, 8 Aug 2024 10:42:27 -0700 Message-Id: <20240808174236.218750-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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(+) v2: * Renamed BasicServiceSets to ExtendedServiceSet diff --git a/src/network.c b/src/network.c index 9c197731..35e7ba4a 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; } @@ -1176,6 +1179,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; } @@ -1950,6 +1956,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, @@ -2249,6 +2277,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 Thu Aug 8 17:42:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758022 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.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 C1CA1190072 for ; Thu, 8 Aug 2024 17:42:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138965; cv=none; b=aw21oqHwVfvMCs7gNJSJr+E4gvDJif+FNHHfeeiHZvbM2H5ROgJzDKbyFD2kW0Ma6YOZxnh3APXQLE0YriuMYd6nucmoZKJ0qCVIagUoU2fgRZFE69JechrccMNHxIE4Zi2kelKFoybgnQMPNScoDyeh0BrsZwNX60Pd2IZUVFY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138965; c=relaxed/simple; bh=R4aAhncRrSkyQxsQU2XAHhX+tZrBlWjUxlrvPLYVHLE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gBmubWeHpUgRJvh7L29LPeMHRjYB3PSa54tTpTL3s1YFfGP+kmNYPE6zIW72qc/4h2yXXwFy48PNJPB93xC1zXnjMC//Wjk1dqNrccT1kdcYeMf2YLrx75JzfEdxFIksih/zV0GmBN7Dfx8MDWJjCBkCOaUMR5QeV0SuKzCbf9k= 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=Ozp496SX; arc=none smtp.client-ip=209.85.215.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="Ozp496SX" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-76cb5b6b3e4so926051a12.1 for ; Thu, 08 Aug 2024 10:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138963; x=1723743763; 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=VJyEjmxTPA1YiN3VAH9YSjeEhOFyYL1J/hgxQhYQn7k=; b=Ozp496SXTIIkFvLwY4UtsLYQS5IyomBb4mVpNDMSqSss5zy2i9xiNUbDdpvOYUXw0z 7ydkdAwlRIzjloiZNUyVFikfgBZjh2GxkNyE25mYLe+OnUFjaaNTxsimTomsrMZDIwv0 6t9sog30l1eBXZQGTbsZvXEJTi9xUfZX7O5yALbnngCnPztDVqloC3qaVi/0mBxfY8VA 8kQ50GLaFIwH3PmDhOHJvmT5jExMSNN4wYE6kF6mT+rovpSIUkaVzzAlB47vfGeSze4b dKLY1gweJYCZxRprQXAFLo3uWiO0SXzmMi0P+t/J9UdHNr6OROsZLZqjDokHmt0LM6Ja 0ovQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138963; x=1723743763; 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=VJyEjmxTPA1YiN3VAH9YSjeEhOFyYL1J/hgxQhYQn7k=; b=Y+T3SQ7KCjEliusSwtKz77e/hjEjhPyiezqSu1LqrPujkXaVSdz8tX2VRK7XnNAmoO GI9pvxgXrxoCo3vIstwrtQtRu4nXz1KL5OYMd7hUSh0O8/tIU+cES5Fk8t1jb4DgEzIg hWhqjgdwZ7/yqf0MfJ/QuuT6ILh16tFH7ZUrcbmF2NAOtMatt7AaAaNcdyjhnU7PqvT+ Gz0+1Dym6cdrTvUAxhZnPmp0X7IE8+7TX12yOPEJzWxa8ByyvYUcFth2/8xMnjN1eA/2 dvq3UgWYs0quhtLPz+lpPQw+fAnKXGDldJSvx0EzKpcUk02wk7aXaZmFPv3s/ZEunkdX RCeA== X-Gm-Message-State: AOJu0Yx+u3kbPXztvYHE+/X7qEUVC6gXm1HXnQ9BVsHrgMCR1ygT75oC 9X5dPcOKyrtVs1pZ5EZs1LeTtgnfDbFxGflNi68w1fssXLBgrF5TNJQv/A== X-Google-Smtp-Source: AGHT+IHjtOz/tewa/0UgyykCqFYmTqC2iwvCxOK4qqgebNpdFMtLmQwUf4zqJ6p1VyghfX6DUz7D8A== X-Received: by 2002:a17:903:32ce:b0:1fd:a412:5e05 with SMTP id d9443c01a7336-200952cdeabmr30301645ad.52.1723138962700; Thu, 08 Aug 2024 10:42:42 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:41 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 05/13] network: remove network_bss_list_clear Date: Thu, 8 Aug 2024 10:42:28 -0700 Message-Id: <20240808174236.218750-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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 35e7ba4a..eff4117a 100644 --- a/src/network.c +++ b/src/network.c @@ -1276,12 +1276,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 f27329a9..121404ef 100644 --- a/src/network.h +++ b/src/network.h @@ -74,7 +74,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 Thu Aug 8 17:42:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758023 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8305513D8A3 for ; Thu, 8 Aug 2024 17:42:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138965; cv=none; b=LFxUXysKGUp+gtKwPWOQ9O/ypXmrYwvYqCSj+ExlQ8zsH9C/aZu3g7JSthQ4huylNswjr6HfOd7eHPm8vcf+c3Gf5tjLqj+v/k/l+16JUk1iGThT0PdDGYMOtWoQRFGQeXktux+jKDsGPoBsPC35D7/p2IfbB1n7SG3xcVV+hp4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138965; c=relaxed/simple; bh=zcfmygZEedhUPgLFVHLHlW3UnxphsOK8lGiRwrln21M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VV04n6CbGScA808cC6WPhaE4/qrA0rZbwHGLTZmWj7ROwrUjNaKCantuZZXWJmR0VF3qSpzogUbxXOm0pCzrA66paJr4pxOlHgAhaXx0cVjE6mW518HxlzYPFLOOoUXpxE0LCWpDqJLAKKuwAccrk9YLCest/ejbUNaGPLMY0eI= 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=fp19hPy7; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fp19hPy7" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1fc566ac769so11114765ad.1 for ; Thu, 08 Aug 2024 10:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138964; x=1723743764; 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=4+7LVb5lYo1Qa0arYhAPcN+vLl04SkUC6WEfVoKbenM=; b=fp19hPy736xZ7Nvt+sdSqFRRuirs/xNP0MBjVvfp980uOKrHpSf2D9Mwjy4nob2mdi rDql3WkCjeTv/zCrWA2GjHAIH9LjquPxAlDR8biyXJ3IqAWpgS7RAUpIYdEN7MqMtZgz FAeWt3GwsesREKwYe8btU4e1JZukLyHAxk8fNLTyp6O+W/DTTTHnwMkRSAAjXK+5QUpQ gacW8eRFE8vGtMaHnQC9Od39XfdPhaAiu7vEFiOWp23ZEXB0jin38oih10tQrRi2d6Bt Iy4Y2lzQt42o5KeOlxIhbeM2gN2NLii43WX+iAbi9gxNyMPW4632ggHCvws6Il45iWqy Ts6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138964; x=1723743764; 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=4+7LVb5lYo1Qa0arYhAPcN+vLl04SkUC6WEfVoKbenM=; b=d1EXHpgIJOT4rgCGEcEn39AgMaL2r9YyjEwvTveOE2diqvNGxFRPR7Fnog75rDxY5X ojPIS+I0jITF7vwHpcLs2XFHzd5kDcRHKoCseP1cx9Mpq6JaJ5zHw1F7z4M7YJXE92m3 SxiRB6kSgaoJyzlNQl3tuP3rHb2hVYAMkZdMYcj49Y8LDk280RanfBftlNzW+KY8T2qQ kzYHSDrEVSQ1RorhZ9UrtnIArmpDOdkKTjSUBXX95PUlm0DyUfEyUpuvgsOwyQ/LXMqC SR6/99t8S8xZvtE8YMwCuvRAlZjxWtItuiPkkWouhLbStxATxCo9sFnzH2UF0M/Sg95e kaWQ== X-Gm-Message-State: AOJu0YyvtEbkIV6jyshEpE1ewcLmPheINeTfnFvUvYx/6TjUmVsMfUFt lHBH4Q1yFXdvaBiucK05rhYIchrBdRSLT9RfexDt2XPK26StJmCoAZOzPw== X-Google-Smtp-Source: AGHT+IFhmdjFoblJ9ZEC/ypXfde725zNxVXaoOAn3lkCvf5nysJGlym1hoCbRkeMxE9J5gi3YNIygA== X-Received: by 2002:a17:903:2310:b0:1fc:62e5:76da with SMTP id d9443c01a7336-200952b71a9mr32982585ad.21.1723138963345; Thu, 08 Aug 2024 10:42:43 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:43 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 06/13] station: add ConnectedAccessPoint property Date: Thu, 8 Aug 2024 10:42:29 -0700 Message-Id: <20240808174236.218750-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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(+) v2: * Renamed ConnectedBss to ConnectedAccessPoint diff --git a/src/station.c b/src/station.c index 8a76339c..5524943b 100644 --- a/src/station.c +++ b/src/station.c @@ -4376,6 +4376,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, @@ -4783,6 +4800,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 Thu Aug 8 17:42:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758024 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.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 9D38013D8A3 for ; Thu, 8 Aug 2024 17:42:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138968; cv=none; b=cXYI+bWUpLBGnp2gpOBf4l8Z/f993mJ945toMIISSkSAEO0yHUSvoRLzJOqwpO3dlBz9T/AMTfCMXzDzlUOdjjpwTQzpkyfpJXVZSUSmLbxHX/as6AawycXkvFRq5fbmkX0U4NYmLJBrOSSGI+jXRZoclwygfa4UTJIDs6OM2z8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138968; c=relaxed/simple; bh=je2lKnZk7kH3dmAL7I38N/hHJqcA5JaTsiG8voPPEK8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QcvevyBVLauPpIT/L2H0hPJ3Aj40PGkEVXeSRk+sIxUjo/7P6R9ysG9MwPMNejgQa/9hrx2DDPsY+WKju5i8Y5w03SFzF4YnLEuxT56arIKFTEoKylJeuBlV9e04WWsB5PG5yW+0nvMqDaRGCyKhyWQafAmN78+wmZsPj2FmpqU= 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=g7zvRfkZ; arc=none smtp.client-ip=209.85.214.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="g7zvRfkZ" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1fc52394c92so12100015ad.1 for ; Thu, 08 Aug 2024 10:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138965; x=1723743765; 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=iMW23mZ6oxjsUd082UMfzQK+uh7dCMibsbp6keuPKJ4=; b=g7zvRfkZJrD1UjLOzmNJ0qRbjQqIxy3cPo+68wiI3US1YQcITPwRK9tEYwbEvkqVgb 4csPSju6Jlop0nN3T+VEspICCSuZFv8hsIKyT9kYSHpEjmGZmHedluSxN/gsJIWu6Z+c L9TUTLaGGTdDCyvFj0+mlKeIPLgUTW7BE0XHqDw4DiMUBzbGm9bfVmvniNrE4LzDyxhU gUHYReslJsMQKCHGL0maLM2R8FfsGngmFEzxOJ/Wgab5zk/gk+IkjPBElH3EURhBT94S Mot+Aw2kHOeO1/LrUsQHcEbE/E9R3cOHy4letCdvCMHbI4g5kE0C8QqzRHQJqYN5Clyd Up4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138965; x=1723743765; 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=iMW23mZ6oxjsUd082UMfzQK+uh7dCMibsbp6keuPKJ4=; b=A7XCW21GKBdNQQbZdyqvub9GjTInpsUXr3KgLaMg3Me7yBy4VgUi8EwFK0e7qgm8VQ SpCG6CrGdokn3zOkkVXnJn+6/od276ODFly0mAzpV5LlFOal4uBqkj5JJaGNqPNKiVl3 hOHcK961zddbrUluO6sfDFGRNCPRRHG4y0PavWLNBgqdGIaevmfq+t6P5RBCtFEX7syZ C1/B3JzqY42ARAYdwQyDPPTyDRq5/xlWDV/tGvxITeurIZ6Mi4Ne4W5l6CiPvfFjXVrN GSVRoH4Y3Jh4PMf2T6Ig9sPzIFMl6csyv7/k5SxlPnxUVR6Y7lm9pBOPG2IbYvQYgqHC rRyw== X-Gm-Message-State: AOJu0YylB6lQPoIY+sBRA+tjHr9EG9T0wHmdP4xFRkuYodVXPhQ/qLFm YzvnbjQ2dMXaFhvnuLS1X5wqUXpurkyPFk5rE7j7f5W4ZqvFuyTO+ZJK1A== X-Google-Smtp-Source: AGHT+IH6an9OKiMWOE7M0SPFadr8K2/KUwp1W++jeH18uuka9PN7xT3LDdGq1mxTtqiQacl5ee08sg== X-Received: by 2002:a17:903:120b:b0:1fc:6c23:8a3b with SMTP id d9443c01a7336-2009526b4c4mr28087345ad.17.1723138964724; Thu, 08 Aug 2024 10:42:44 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:43 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 07/13] doc: document BasicServiceSet API Date: Thu, 8 Aug 2024 10:42:30 -0700 Message-Id: <20240808174236.218750-7-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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 v2: * Renamed properties after review 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 Thu Aug 8 17:42:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.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 9D048191466 for ; Thu, 8 Aug 2024 17:42:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138969; cv=none; b=Thue+cx138b58+ESI57wPaHuCATKkvaSrRAjkRz7NAO9Cexzx2QZZr1H3BsvztOQfNj1giWrXjDQfWD53abihBss3HyWdH5wtMLbptJvbV4+JpNkfgf4EZD9VOl5CpRE6ndJXBBc+3049PNUJXuTDQ1LV+pamqAr3n8B/j1jqk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138969; c=relaxed/simple; bh=0JXQUsU+CeZbduEPiJJveo0hTbm5nD6K/zdc+wnogXU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Wm0/PPEo6jtstW29Fb4YmnETlRYJ79ZNF/TvFFBbZhUR+wPLcOm8A9swDEFxpDOvyeXM0gYZcPl4ML7hpD/pTOiSZgbSGUwQ01QY2XRJkI6fVSuUy5Wx58/ThnU9sp+Ik9G5JNTf/xNCh44pmKJyPsJYGl3+GLb4awr5U+hyRrs= 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=dGycy4Of; arc=none smtp.client-ip=209.85.214.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="dGycy4Of" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1fc491f9b55so10965945ad.3 for ; Thu, 08 Aug 2024 10:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138965; x=1723743765; 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=dGycy4Ofgp+/prkd31e1ZsIhpNOd0M6zGP8Xs//RX/42FDIfSXXjq0defwHpaRE4zs h5/N1Qj0RhG0oibtqdovrnbWU7KHieo7ptRquwwrrtUUoaPl8o68//QbfwCtDbxNlO6N tPjOLxvIrdGYIsFWm7XgkShBdIZ71YgkJKkAcLebojzdKm1M0Aap3VMmV2SCgF/mAARm wcMPquhNBdBZ7FSC3MegV1xg+yO1Fk12CEY3wzSHkiSWJlvpE9dImUGZafnQK/ak9IP6 o/tR3qT0LnuNoptK9+eJ4hjvpBxqa53uqBvIANpRbp0J6slhIgzu0WAW5Ax8Wz/92yxM ZgLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138965; x=1723743765; 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=GK/7zvH7qZUhrYSjEJ6gdiS9fREC8rhtfkmsSp+V30lnVktYRfxBPvErE+Jbg3bXzy 2bks6yNjoxQvUVdqcAv8EZ9NCltNZCVJZagne+lz7dvae9xFGufwstg7iH8MQnyDZOlz cssgAF/REOAq81hbkNp8cNYeMC3N6AJKfXALt40OO9o6t7AMmQTXtI4T3+5W8JmIZ5XE juW1d/QD0Z1prvlCAnTspex5UXxO0rm4ejNfcSGQlinWvcK/LjianK84NzqIb+f5O2Os RsglC6oXcJ72FfK4WxO9cb2Wxwa5p72ORTFwhPgn5loartyLyfvRA3HjN7yYDLD+mYBW 0o1w== X-Gm-Message-State: AOJu0Yy5qmDNn24/5LLF71F7yTNrlGlNMuj30DQC35l3mtA8U92XuxTM R/qwhjXWar8WqEWg0jbphRNpRYHlYCrxHm78/SyV0605eneJAu5BjskjFg== X-Google-Smtp-Source: AGHT+IG/WngtTdSo/w0GVl9CoItR5NGFwR43xj0WgpHmV4JxgTNRYnvR+CxnJscbNyXqYXByHmPQOw== X-Received: by 2002:a17:902:d4c2:b0:1ff:1bd:7e61 with SMTP id d9443c01a7336-20095252872mr28918305ad.14.1723138965431; Thu, 08 Aug 2024 10:42:45 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:45 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 08/13] client: separate property header and values into two functions Date: Thu, 8 Aug 2024 10:42:31 -0700 Message-Id: <20240808174236.218750-8-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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 Thu Aug 8 17:42:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758025 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.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 0AC74191460 for ; Thu, 8 Aug 2024 17:42:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138968; cv=none; b=BUJBSNFyGvv769amtlWT+UQ/MjZt2f7Rl7jN+GgTj4RyTjHWVUhAgRIsbSyICRlU76bKyd0GLzmALuFkwIfYS5sxUznhwJZiGOUxNtSZfQtxLi/DgdBzi4R0ij7BY6cv3BcLJaTds9DvbHv6zDqeRvlsxXLZGBnZEmgGLUFWtuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138968; c=relaxed/simple; bh=Y0FM6IdMTdYxT6n/KJsgMsZ/chZmNYalxNdE7CK3QLk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=k3X3y1a+Gz4PosaBYclBMXVWE0iZVXd5yE3X1wEB6myzpFfUNfYmHu+j363CF10nnuHSZgHxknYZD3CQSNtoidxksdWjfFvF2MW4Jl42u1mvBzJ6AMfk+Li0lxMuliDqGtGpqCBUp3V98RFgSmzqjdY4nxQ06ByYVkuX+OHFmtw= 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=knMx3FpQ; arc=none smtp.client-ip=209.85.214.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="knMx3FpQ" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1ff3d5c6e9eso11001765ad.1 for ; Thu, 08 Aug 2024 10:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138966; x=1723743766; 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=knMx3FpQ2DF8egPYoYR6YJqLxXQIIgr3PY2cecILnMPgRBz37pR/CGBbDPo4VQt3qt LWf1GadyUrenOI93uV6jUaGZkMcWM02724tlvXwk3lsCxJMv9IXJoAVTBQDqJ+RidYQg Ed6Z92z5TQKOlt0LCLa69Q1GMgMl9fs5RMzKBOSmJW3mXSxFNC5D6s9STmYbrUjal/Tr usKU0KH6DI6l+79vX7HK97/gfNkMU2NYYBc3nnnqh7coHVqBkD0sLFF4qc3PU1GJpUaR VXVGoUMsCIwn6ba2iodqF8p/ETaF049LhZBcHCiKZqmPFSYFhiVlIDGsYsYLO97RVxSh 4TdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138966; x=1723743766; 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=cJ7GsiHBT8rCZpMMsp0pTrEklyITvXsvP6ywf8/iEeM5+Jfxq80acLOWMkv1rnBcKZ 52ji5rwjzsJdgTVYInjMqr0YygjDnUcojjCoSoNf/RsrQA1XCKPtUn5MNiRZW7kMNOYR UJ5NMsD8LfOgseNJ/JZ5v0Xo8Nzpp/+qCNBRkojjYzqpWu18NyYlLhkYVE1UbWsvwoIN 0pNaEqP+v6jySqT6G0GbN5uggbG0mXPYYkjWHCBgsQ9m1yFPjdleH2sDmy31h9XjZZh/ TN0jrceLZNOHqTSh+axt3hNtonQbg/j2as3xEieQT2cLqC/veq7kV1uVPtKbOiJ9yWS6 fY0g== X-Gm-Message-State: AOJu0Yw7E97FN99WSt6YRoSVtlEIgzkOY2+I5jdj9K1CWjnD9b9Ukoh9 KllOHs7E6zYh00RwIIXuVQG93CRHimmPQ0IXGoB+e/BPK585j3Ly+NtZNA== X-Google-Smtp-Source: AGHT+IEGLLXVPwgV0XEQSYTABpMgqGELgQT763SookvC8db/Lbofc9cW2aykV/cjNG8UXff0ljVVFw== X-Received: by 2002:a17:903:1d0:b0:1fd:a5a2:5817 with SMTP id d9443c01a7336-2009525fca9mr30710725ad.31.1723138966088; Thu, 08 Aug 2024 10:42:46 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:45 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 09/13] client: add net.connman.iwd.BasicServiceSet definition Date: Thu, 8 Aug 2024 10:42:32 -0700 Message-Id: <20240808174236.218750-9-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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 Thu Aug 8 17:42:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758027 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 5368213D8A3 for ; Thu, 8 Aug 2024 17:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138969; cv=none; b=j1m+9SgbTaFMrMrLblJo64YdBts1EdjkrjMBHVRSLgg6u2a5wupDB7/y+pCVMlrMb6BoW3gGEIKubrOSrcwVBY5kKC+fOnFKAX8uOv0s7fjSq3I/6PQOE6N+jyZoHp3CKu5BhgYCNklX3gFoEWZ8ngtxF3OOol4MQtmlEi5e1ko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138969; c=relaxed/simple; bh=vAb58u/XqBNtRFv1ckkIBuj3cRcHiM1+Zb6zKxs1xXk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oclIsGFR1KZsCMWSd8R7KecvmYn8eRELvN1SkN6WSZTjTnlMg6ivlcTwjK3qk0ABlvQ1YW/rYpTwyLS1x5/NxQudn6m76X294mE7OeW14EIqpD0Pd5AtZx627zlcOOf9AM1DBRzU2bPr+TG70DCvMBFiE2P+Tyl774dqQw9+f7s= 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=TeNX1UiI; arc=none smtp.client-ip=209.85.214.177 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="TeNX1UiI" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1fc566ac769so11115415ad.1 for ; Thu, 08 Aug 2024 10:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138967; x=1723743767; 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=TeNX1UiIF4dFqAY8I1luurJivS7EwsH1exkx22Z2Fu8F6VJTNXZWHadfOvpA/scXJh CNDITyHVnVkArvX5jIHo/w7E1FjCe3wc6MuBELtTajEJdi8V7rHj7IFIHeG8eybZli1W IuvUbCotEEYqcuZTpr4rBZenwT3ko4Vr/cXGNXKJfMyEvGeesidw+d+ub8lFUSdqf0Ar 5sPLHo5oVwsqdVGOG7hgWTGqajJy+KAaL2TQwiVLTESig15L6YvrpxKKG1xYIMD1vdfB sDlZ2JjkX98lBWOfm/catIKUK3ACTUT778L+PJzLWnW53W3WMfZgKSFUDHKWylO6nBXx VSeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138967; x=1723743767; 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=NFJz6mxUCWQhxocoZPSHn4xIrvprjpeAPVrwnGW7Y73iODGZIRWPHgCFda86WJ367s LPSCKeKVsvKHtHVO/lGBKbouxb9K+S99VxoFFGMDhhRMZveqjUdQPCTTR83k5g2AFOmE SggdOl19xS/Bu8vVvaPDhngHZo3sOk6+9eRAX42a7T3hf6BlFyj85w+jjsjVY/0JzgvH ea9qQTIKLXlCeLhqOuVNDvvQ9sR705nUWLwH+ZW2+E6kM4sLZ3SH1MG9vAEFkIzNmrBS lCqZpaIBBZrz8Z+vvVlKVDiYM5Sx07YdE72fdVASw2uqm0aUfCN/aCSVx6l7zOQ9fW0I 00KQ== X-Gm-Message-State: AOJu0Yw4D8Q0cB35xH1xhcwpIL2qaS+wgHjn84423VE2omqZLGlf8Ct4 LqM2R9qEDFhkxhr1j8GfxoyxLTgLLrhHiv93FpzpMSVBEDK9/QKoZ2PIsQ== X-Google-Smtp-Source: AGHT+IHBrsoI6+Jp48I//vi7kTFg6KktViKPhmJyOo+zY33r5mcuIb+uTIQVtXny8djh6wBPZHQU8A== X-Received: by 2002:a17:902:d490:b0:1fd:9c2d:2ef1 with SMTP id d9443c01a7336-200953c1d7emr32581855ad.53.1723138967238; Thu, 08 Aug 2024 10:42:47 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:46 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 10/13] client: Add BasicServiceSets property to network Date: Thu, 8 Aug 2024 10:42:33 -0700 Message-Id: <20240808174236.218750-10-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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 Thu Aug 8 17:42:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758028 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDB25190661 for ; Thu, 8 Aug 2024 17:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138970; cv=none; b=SjsUWL0llpBP8EKtjzB283NBNPnMRDZqQnN2kmn4PoxxEuGXP7HFpYx1FWOpuFLQjlzMd/he3tFvVQDvF0DvwoX4gCxKdpITHwdHWC0RmQYcrzeWFYMwn5tSmrcbzTAP0hhYYmZhNlNZgJc0mQvNGiRU6tt1kg3mMUj0wxCXIcQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138970; c=relaxed/simple; bh=uogCmoUQVgnF0uaW38LuJljWcL/2D2EDL+jnqvpBV1Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OTJJtfYjtJfXYSLA7zH4XdfSHSgNPHPSUsPwWhYfoCaHXp/jR+/Mzx82opz899D7bI7Ix5XkNpORe1nfTHRlsId5c5Vdl4S4+PxaB9Puxb6hwFcxfzgafZw1u7jFyzD9HSti5Y2oK3wqYzyYa7Wiqv46+Ucy4+W9Eu/QfZx1rGQ= 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=J2KnSDP5; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J2KnSDP5" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1ff3d5c6e9eso11002055ad.1 for ; Thu, 08 Aug 2024 10:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138968; x=1723743768; 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=J2KnSDP5lm72OVan0gFmv7OkCX+UESQlUGX2VxLiL7VrZUUkzMXWqnqE2h8XBAdjFE VMh7F3T2aO6lLz+Emazyr/JrD5KVYlw0YHUqeloPx/ND/0XFSLrWyzA0ifcayZFEtlSs N6RyGZAZBzqsx0kqTOd6axMfHFiyzGd7/2vemXQ0iYN64KjqZhHR6EXPvq3IT6WQPsh0 SanAbB7OepA3RLJ1XSdfsyl7lIMA5GcWJAaYcnQ6od2JPQrVx55NNmeIqn6Uia/o7CP5 LfgNPQiRXxXZ+DX34kudPuK0sjPCG0WtP3+6x8avsYpFS4Qt3d2UQIPAa+I8LdfQpmVU 5zfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138968; x=1723743768; 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=lUGmwPKQ6agRtTHS5ZrSmxtkJQDY/cg0NV/t/Yd5oi2O+wLmZnBam7VpnMDDU3/PlZ GxbV4ohQXGgBmbKWwBCVESz0ZKia81fLKV7pqrUaW+gGyUKSEa9xnM9QSZjX+dCKHHmw HxdqwlvbGKwE1NRk/amSPEL4+8+XLJhDyp+imn2BuNkjHgVGWGZ6pZ5XKMrRZDx5FC0d vD9KkOf42CP3eSMLk7IcJjLoC/AUPm2Rc+t6QzMatMuZm38v4KqkexTK6SbnTvveRI49 NqQ00f6rsz0vNMn96kyIYjrhoI9ldOzkF1n7zr/+9/JepNAyNnNCYrr6PMgKzKI1GLwg 7Exw== X-Gm-Message-State: AOJu0YwS9AlGxdBmdDxdA68hZ6iiCjMvPom9nR05iDZCiJlxnC/pHTGq wgoVTR8aBefAtouW4CB2E80CoBmS9SH2HIpJd+gyvTU7CNxa0ODU/jZyxw== X-Google-Smtp-Source: AGHT+IGpLhNkFvEeGQq7+EEEPBJXsBfhEuticx/YoP8I7NJQVmAZCoBTIaK7DSr6sWITnUixVZPYnA== X-Received: by 2002:a17:902:e745:b0:1fd:6c5b:afcc with SMTP id d9443c01a7336-2009522047cmr33244435ad.8.1723138967926; Thu, 08 Aug 2024 10:42:47 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:47 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 11/13] client: add BasicServiceSet interface Date: Thu, 8 Aug 2024 10:42:34 -0700 Message-Id: <20240808174236.218750-11-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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 Thu Aug 8 17:42:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758029 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 017AB1917C6 for ; Thu, 8 Aug 2024 17:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138971; cv=none; b=m2Z1QRBbB4yBdbdptC1sf5q/cs4EbOoeVVKLKLUn/d8kjCIYX9VLfYN3UOYq0yCITOjCJbEdk3q+34TzTK3yO9gmzGrtUrMr4he3ZbI0Pwnr4OSh0kSuOSXGMJe9DtOyeiXtCkSj0w6gD6EZa5rUNwMojMGIIZQVnXBh4EL60V0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138971; c=relaxed/simple; bh=gCdwM5boUrxXJykMfnN7bEjV0cAfhvzuqH+rcGbJXMI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oIWJqRjyJ87Crcu/NEh3NVZYOhXyX4CmxqSiBh4TGv9/nI72r/kk0eJkyouQGY3C1M2YyrBK9kerfv9gtE3t6AL3qN2fQ0mK4bGZWHTRqGOmryiKeR8F7amFxIX8hJqf+1yWtkdHXUe0xgc24XVJPbxxKrtSkiixv/ag/K7RWsw= 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=CEEgaFWr; arc=none smtp.client-ip=209.85.214.175 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="CEEgaFWr" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1fc65329979so12285405ad.0 for ; Thu, 08 Aug 2024 10:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138969; x=1723743769; 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=CEEgaFWrtCjWj10jLIEryBk26qRGtcj1Kj97eMjdRQR6ZjBo7HD8QyfPt739ycvFTc C9oiKLFpVcYNOCgAPX1wdQIPGG49cEMrbJ/Ig8EBe5cZHs8uBEG9dL9I6HEbzcgqOo61 vHzHmvqNSb5j8VwpWyyIS/4AxpYeAjFtsEvXwMNY4UHClX3+apH8uuVo4yPKEFWduB7b Uoe4WuqMXpTyd/kso1375y+O8wqaP44YkDG/TDKlEeuHx7taEoDUOB7vqFGTjgYWSdvG 08FpeE2DbTFOWtNoVkSGmSOAod1r+Zi/mtmKcJYy0TRYxi/VE9opcA+6BvE39f4Eegf+ yCnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138969; x=1723743769; 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=cJn3t2h15UbQiTJHIDcxXD/YRQt2uoE5EtpUaL2g40lalbdikkAEpXDE1Kg7tExUUL s9DHIn+cOzBMYGVmJQd5u6XH9os4UAh4Q05bdI5iEXz/jJaMRsbWNHlxy4WQJh8A+Zdt 27Qc4WnoiTPkKYrZeFwBD35eQ39Ym4+A7V/9yj1owbjZpzKkpNliLvzDz/nSQPirxpqN dHxbbjz3mNx4AA8ACrq0d6yHVl0/XqhzZ/YYsXVmdBKuiAGjlAIma21uXcXzO5JaadVa c8pglEbUBslhwJKJCd3HxCg6Ivvxn/D3wrhaYupdLQvpZKqXADbRQT5Gp1j8OkJQ+Y10 MGtg== X-Gm-Message-State: AOJu0YyiZPU6mqbNccBcBhXHwqNu3cvG+JrE6R3WqohBb+Wme8l5hHdb VU9IcA6bYe3AqlNtuxuBwwJjFl9xUpjemcUHMs/CpYqAMrFAR0cAt13+Jw== X-Google-Smtp-Source: AGHT+IExikKOzJezC0/KL1XT41O/iKxXUElSEW71g+fTJgM00gxxZp6FpLQ4uPdSQMNVQlSjkKclkw== X-Received: by 2002:a17:902:f68a:b0:1fd:a043:e3de with SMTP id d9443c01a7336-200952bef5emr30471455ad.40.1723138969006; Thu, 08 Aug 2024 10:42:49 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:48 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 12/13] client: refactor cmd_connect() and add find_network() Date: Thu, 8 Aug 2024 10:42:35 -0700 Message-Id: <20240808174236.218750-12-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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 Thu Aug 8 17:42:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13758030 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A637D1917D0 for ; Thu, 8 Aug 2024 17:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138973; cv=none; b=U1KaTxmVEJnqlP1lSQ/qTnIxdKUURJTwl3q+OnYoB7iaPkhbY2hh1XMaZ2si/imWe0H9S6OInlzADbEksGqkPUHo9iVeTqiujmAm2yVAvI8HSkWqmJRVL4w55Z+YhBEM/bXr144vMMUtjdpGo5b+kiaParx+Oi7x17vlI8+58VU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723138973; c=relaxed/simple; bh=cgLZfJReiqyoHO2vj5i33u/5uHkuCEpQxKVkzMASb7Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hXJ7lvM+AZ3Qdc4HntbFX6xsjS5rGIQhxhOJLAbf1JBM0F9RGdt2WEdLYfpNVeSU5B7E9ZQz3T32gkDFcPEJNdIzdA+6e4Vmfl00wxg739btI0rIujKX73LojNS77hrGTvfwUa3RWiLy8GKBuoucP4G1n/GARFnL6iFEorTPYv4= 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=gisISUHk; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gisISUHk" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1fd90c2fc68so11504185ad.1 for ; Thu, 08 Aug 2024 10:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723138971; x=1723743771; 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=gisISUHkDGaT9PxDTNCcCJ2+OlanQ6TCD69Lk1tIyDsOAb2M+BlwSBGCnPn1z3fPri VzPEV+NfInrsxHdXDhsJncIUXc7FmdXj7CbAsUtzfL+mB5b9mHiXSdpggdEoESP8Lwus qTfXzYKVXAiNoAQgFIehG9oUkq7HQgsLzSQKluNsFRubveVsezT1cwTn3svWv6iD+ELp U0U15aqnBZMtVYNFeTc1gPL0IZSY8G8sP447OY7NgXeVzKZ9c4I3M2ay90Pc/CFj6DDg VMu0+sV2WdISry2z0ZnwrLQInT9l4Kw4zK2YanpFTlxFKyQj/1YEo+uk5DNuvo2T0Tqe q48w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723138971; x=1723743771; 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=F3T8vY8zxtx/ZrG218bbkn63lt7MmswJGV2NePHi0SZ93CJ/aKnwS4bxfSj/tt3qqd LV1ZEPhlan23z9nw+C7lx0yh/bFXoOGM/orBgKR8ursGJjjIbWQc9VVw37DF3dIa52Ot QKoB6PckZp2+G3dnWBOjx2WfDd32Z3aOA9h8tFrI8Sn/H72bl/tKFu8WyLL+pJfxjlEL QoxbFeOdc6tsTe3e4+INdquwG45W3LJz26DEP8JJ6nuCied+5WrviMarsWeYNU8T6ZnK rCx1Ybc/vaR9T93Qqadtrf+sB50sfgIdavxqwzZBVUg7Sj/oauG2VFWDE9IngCe2hiV8 rCAg== X-Gm-Message-State: AOJu0YxOIuDoNcpl+yrn1s5uSMmfAz9Ox6w1xFQlZOHxr0khL3fDSPsM bKYnqlk4e5AqU9YEu8XisWOtz1UrBzSD7vYxWuNUkpa1V9n29jBwQegicQ== X-Google-Smtp-Source: AGHT+IFwg2lb6t/pS4oAWJXZdUWI3+zyS23oPWov7kZSTNxRuT7piMCbOx4qK0XeTF4Ibqyx6akJ/Q== X-Received: by 2002:a17:902:cf03:b0:1fd:9a23:90cc with SMTP id d9443c01a7336-2009524a0b6mr27797585ad.26.1723138970787; Thu, 08 Aug 2024 10:42:50 -0700 (PDT) Received: from LOCLAP699.localdomain (h69-130-12-20.bendor.broadband.dynamic.tds.net. [69.130.12.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff58f53435sm127478355ad.64.2024.08.08.10.42.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 10:42:49 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 13/13] client: add station command "get-bsses" Date: Thu, 8 Aug 2024 10:42:36 -0700 Message-Id: <20240808174236.218750-13-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com> References: <20240808174236.218750-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 }, { } };