From patchwork Wed Aug 7 18:14:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13756578 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CFD18286A for ; Wed, 7 Aug 2024 18:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054477; cv=none; b=AoCXZKqx5ExN7QtAzWqu4nSx/xtB6V+SQ3e8zmZWqYVJa0AWZ6wFWpmPdp4fv0jOQ8upKZBygc9OqtfOK5prg43lyBVRiuujbXTyZE0/ia/wQm9PG4baAVvS40ORD2CxYvMmzHMQiXMYSGjo7I764R8V/djB9pTFcA8NHzw40/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054477; c=relaxed/simple; bh=FMJZ4MVV3MeRyAGLLPl3fbhEdU3KPFl4ckpiqCNdzjo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=tlhkojgHHe7WnqBlkpepZT2x3NbBi0iVcInqbfJsSHb9qD3djvy/DmRQEr+tIhBtvHAE2F6TlyFvde2tlSmA6QPYcvJxyBwZaqrrT/uA6wY5C14pkeSg6tZIpyRhKOVYL0wCfO8qdFn0gnonO0S5kww70Jf8cZtDTNj8kP0ukwM= 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=aPJdxoAf; arc=none smtp.client-ip=209.85.222.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aPJdxoAf" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-7a1d6f4714bso11753385a.1 for ; Wed, 07 Aug 2024 11:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054474; x=1723659274; 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=5WfHtyfFvWdBzXQxfvCPRPK4dSsTpYb/cz+sdUWNRlM=; b=aPJdxoAf245YqMynXmdlSxxo2npYaP/3NDI9KKs89uRhaRDfn+f10jSZYNXM34V+5P c+Egm6GvpSU2O+2J4QIZlae40fQ08l8IckK3bQmziD2olkri9Q3c0ukLUf3JZkvdqxex xMD9KVcdX56qh8v2vsvs4nC6BZSloeyR8nnBPvqlpjkfDaBQ9n+dxvcOYH0kcVX+rrsD q3vWWs3Liz4KpbzEJhPottSL9f9VZ/MbRxQ1wcsrbg8fZ9BwBSPmLEGiR3+03EX8z1s9 BNwOJ6exHORrxZ5HpUXh9wsuG+hNBfi8SzciKaQ0mwYhaJcVrfTb4SDd/bqaiyOtHiPw h19Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054474; x=1723659274; 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=5WfHtyfFvWdBzXQxfvCPRPK4dSsTpYb/cz+sdUWNRlM=; b=Ykc4ZPKkmAi+XaNHwUWnQ27K/+lOtlFqH4t+UY3csXYk34rymPHzUgEZNpnGDYOu0C 1FGdgd20GpMayNmyMyeOdtCpZrKshjVwVdxyEu9hu8d8BUGnFSRpmDIqrGJ5lWFNrTkx 01eow/wreiHpkhnBarQ2fLq3q2s6yNukqHON/J5kdgylG+dtZ/n8s9kzrGunNIy1acTZ s9qJ+THdas/Pg3uegYOqVWkop19j7CgrmfPQpmJBhlqI9T9Dt90dpD67PxSkH+3+RQPO 0uaR7GqrlAVEE2ocD8p9fDiuXebw/Qo1UwUqQgGRS5B655N89GwRgFrSIcREX5dad/w+ HNJQ== X-Gm-Message-State: AOJu0YyDi8zOH74ljZyMd0RgFC7Y8uA5HUl3B/hARE7Z5mujoHbNaB/F L07mxbb/Cx1zWns2gdRtpKQIZ3G2iZl+iAp22ksP6xjXUWsCohdiSSvFrg== X-Google-Smtp-Source: AGHT+IEhIHTsRp0Q4R+o5ZhYAl0Fg3JQYEU6sJYJZlTSWc2RjTgptO2m9/iax4r48EDDMO0aI9egdQ== X-Received: by 2002:a05:620a:410e:b0:79f:e0d:e052 with SMTP id af79cd13be357-7a377ba35b6mr627661385a.9.1723054474025; Wed, 07 Aug 2024 11:14:34 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:33 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 01/14] network: add network_bss_list_prune Date: Wed, 7 Aug 2024 11:14:14 -0700 Message-Id: <20240807181427.170515-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 This adds a new API meant to replace network_bss_list_clear. Instead of clearing the entirely network->bss_list on each scan we can instead just prune out entries that didn't show up in the scan. The network_bss_add API was also updated to prepare for network_bss_list_prune by removing existing entries, as now even "new" entries may exist in the list still and need to be removed. --- src/network.c | 43 ++++++++++++++++++++++++++++++++++++------- src/network.h | 2 ++ 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/network.c b/src/network.c index 09099fac..6d7e5ec4 100644 --- a/src/network.c +++ b/src/network.c @@ -1129,8 +1129,17 @@ bool network_update_known_frequencies(struct network *network) return true; } +static bool match_addr(const void *a, const void *b) +{ + const struct scan_bss *bss = a; + + return memcmp(bss->addr, b, 6) == 0; +} + bool network_bss_add(struct network *network, struct scan_bss *bss) { + l_queue_remove_if(network->bss_list, match_addr, bss->addr); + if (!l_queue_insert(network->bss_list, bss, scan_bss_rank_compare, NULL)) return false; @@ -1150,13 +1159,6 @@ bool network_bss_add(struct network *network, struct scan_bss *bss) return true; } -static bool match_addr(const void *a, const void *b) -{ - const struct scan_bss *bss = a; - - return memcmp(bss->addr, b, 6) == 0; -} - /* * Replaces an old scan_bss (if exists) in the bss list with a new bss object. * Note this BSS is *not* freed and must be by the caller. scan_bss objects are @@ -1188,6 +1190,33 @@ void network_bss_list_clear(struct network *network) network->bss_list = l_queue_new(); } +struct network_prune_data { + struct network *network; + struct l_queue *new_list; +}; + +static bool scan_bss_prune_missing(void *a, void *user_data) +{ + struct scan_bss *bss = a; + struct network_prune_data *data = user_data; + + if (!l_queue_find(data->new_list, match_addr, bss->addr)) + return true; + + return false; +} + +void network_bss_list_prune(struct network *network, struct l_queue *new_list) +{ + struct network_prune_data data; + + data.network = network; + data.new_list = new_list; + + l_queue_foreach_remove(network->bss_list, + scan_bss_prune_missing, &data); +} + struct scan_bss *network_bss_list_pop(struct network *network) { return l_queue_pop_head(network->bss_list); diff --git a/src/network.h b/src/network.h index 17dfcca8..be81c150 100644 --- a/src/network.h +++ b/src/network.h @@ -71,6 +71,8 @@ bool network_bss_add(struct network *network, struct scan_bss *bss); bool network_bss_update(struct network *network, struct scan_bss *bss); bool network_bss_list_isempty(struct network *network); void network_bss_list_clear(struct network *network); +void network_bss_list_prune(struct network *network, struct l_queue *new_list); + 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 Wed Aug 7 18:14:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13756579 Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92E9B13E02E for ; Wed, 7 Aug 2024 18:14:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054477; cv=none; b=nlKhnUWvCdZhcklBojiLV1hl0Z08C60FHfb+3EvKM1uXyu6QDXLqXvZ0fn1cl9EOdHbbZUIwA++0LFUpfTVCx2VF9yQLqb9VEzFBokOdKRM/M4tu70wfuaTWo5DmBSVAUbI6qLoUObya0+sfwn3bDMrwbFEA8MfW3EEks6LHlCk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054477; c=relaxed/simple; bh=SSw2Nq7zPTb84jAOJ0zQy+P5NSu+fpk1vgOFdPo2GOs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IpPhLTQ/jzZyTxZaHdVOFsWMkiE9Rd4KOEfEIqdbiwT6M3TQ7mIxfuqB4gK2j9/TOQXlgzDoKVBsxK4d8uIfFfPliHnfXHgq6B8o8wz3gWxT2Xbz60mNhQG/JmhcQKtK8hYAdYYuxoyTS3rgBZ7yHl2An2k/T3AHn0qqJWll+4w= 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=cLwowjP/; arc=none smtp.client-ip=209.85.210.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cLwowjP/" Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-70930972e19so45958a34.3 for ; Wed, 07 Aug 2024 11:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054475; x=1723659275; 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=UC6n6rinu7qAtnF7Q2mNVXJosOPkR7krcnvMsA4Cqn8=; b=cLwowjP/zTvonpMleKaXivaWJUIgwniISNu8NASSSUh0opqOfche6I6A0hwAQDHrY0 OHxOWi/kP2VLJCJig5Ozi70sVPAuPTAZEjteUONHLXRZ9X7XQeoa4HcBFHzfF1LNbjY4 oaIwMsIdHTWFkoLw2KhEIaEpQgMqB2bCl+MNwvlFj8L6xSTgX3PV/cBqv80tnIT3hqZS YlZig3GzQvdrmNKNbvwM6o+N03NgW1WyorGCU3qSeEdRbsHcVK2nvXwNncmj1rSgYsBx oyNt04jMw2g9I3sFXOgCiZbMJyYXj/4TX+mzmG9FEYSZrQxouDp1SRj7CU6QiSBdbDPP O8DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054475; x=1723659275; 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=UC6n6rinu7qAtnF7Q2mNVXJosOPkR7krcnvMsA4Cqn8=; b=Y9bOJwMo1Cn5QX24IzTgT7ehBmOzq3STG2JUQiyNgSEPMpbxHDXYLV0x1UWp1NryDC 8Asyt0phRkioEfsZgaubNSI33J1CcoTVWEum24ZxjsK80lIh5rUbL2iVOJA50/u2B5ye NcR4+M/YApsnxl0l1+Qnf355g1CwhJoQ4fe8GM6wdtKPffHv1IEEiex3GfD19CW6d8s6 83bggUQHVhPnIIHCAmHwSXo+Sx26SVVZ/KY9bskWGBfKma51E62x8/sgRFDYx/6dkqkg LQCBs1IsxJit761RdAVQHJEMFSZmh0i2CvoHvmqWpvhgwVFUL979wqvrGbKJN64qDgwz JnYA== X-Gm-Message-State: AOJu0Yy1IINOoClL1nu3OyvLfjRlv7fJVxCjOKpwj/kdiQFRri3p6UX2 4tCPwMjPkrJSgOdMLkAzVSB9VDPIrsHjMHstVUJluqXFInclcrj+up8Uvw== X-Google-Smtp-Source: AGHT+IFGrIAV3geiLRWdyBCN677nrkKiOTW0NJclPnEUxEiq+ho+dgWEqvSEYaYriuT8UwCnuGAC6A== X-Received: by 2002:a05:6830:638b:b0:70a:92e4:6736 with SMTP id 46e09a7af769-70a92e46bdbmr23951566a34.28.1723054475395; Wed, 07 Aug 2024 11:14:35 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:34 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 02/14] station: use network_bss_list_prune Date: Wed, 7 Aug 2024 11:14:15 -0700 Message-Id: <20240807181427.170515-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use this to clear only entires that were not found in the newest scan results. --- src/station.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/station.c b/src/station.c index e373b03b..2c4d686b 100644 --- a/src/station.c +++ b/src/station.c @@ -943,7 +943,7 @@ void station_set_scan_results(struct station *station, l_queue_foreach_remove(new_bss_list, bss_free_if_ssid_not_utf8, NULL); while ((network = l_queue_pop_head(station->networks_sorted))) - network_bss_list_clear(network); + network_bss_list_prune(network, new_bss_list); l_queue_clear(station->hidden_bss_list_sorted, NULL); From patchwork Wed Aug 7 18:14:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13756580 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.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 F0D458286A for ; Wed, 7 Aug 2024 18:14:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054479; cv=none; b=OMRtwqr1GBz8kfpOfTyJpWvnJZtwOViW2bHRdcO2dDTs0CeKwlNLc1rTerBdbXsmLfy+A3yFS0nlphEHgrN0lm2IKErWrrXXda6+qReEpfBGKxuchi0V7OUb2RPhDNc4bAgQME/hPKCYDVkulsAoI5xS/iF8OXrV8f5CRP/OxkQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054479; c=relaxed/simple; bh=jT2jOrG27/w/HrkUAbjILDUv6bAsEM1IJLK4FKAIhWA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Q+3AYP0g0v6+cvuHJ6N5tkBhObab5Ez3w+XhStLg9sQx7OJGjYr/y7/9Pf9Gzv25j4HM6+B6GFXxzw0Qit7SnbjJJtK8jyd8J98ZmfFWPT0FdU/UQ/rdJDJgd0f3hk4UVWZCPEPHRgiJppnZ9g6kcNb0jP6M823nrsQ9M7sbJ00= 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=IzO90Vbw; arc=none smtp.client-ip=209.85.222.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="IzO90Vbw" Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-7a1d42da3e9so12951185a.1 for ; Wed, 07 Aug 2024 11:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054476; x=1723659276; 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=KV2pDDJt19SgNsYn1dvCmgJMDADL+XSydLEn2aJzO8E=; b=IzO90VbwskZEXqWs272jRnMVX8rRST/JCwzSSySGvZmo1+37nhuSR3jrNQYKvC5PBt Ijf3a3xIkuhaL9/UHxvKU04KR4LhBkfLHlZlmvVeYaQ2Tm20lrMXhYKjHjOfzfg1aRAb 8MSrUqO3T25u57y+5bXongx3aRmMBI9zKVQph8CU1/LBuY6mRWe2B4fDYd9Ih9GUqs/s g7FwV4OgQ5CJSO+lEnjp0a4CB4SgBWFjL32tYPT8SPwC5qA+KcAoraMtz7Z6dmoMiaHH HjHxhKpw9H2k7UTE+qsKPUbiNi5jvudZvnkUKNKOo41aUdo8wOL3pew5NU9Rwwv4/5kt j6eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054476; x=1723659276; 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=KV2pDDJt19SgNsYn1dvCmgJMDADL+XSydLEn2aJzO8E=; b=sxqvUa97WHVJ5uSqjHIn/FoB9nJK/339kg05bcdgPcurtURBGltxGRu4qnOgKOVxhc +w9DbsEXMVAd2I4Qpm/75RUP8SSb6iOlEoQdQK3brisz71iVxMJT89O+ZVt79l43l9xg KsfbbLWZ/ffuWXOFMifr8OYqM4r343U6p0gwEDl4dVLAZL8Q03JlMP2RZLG0y+WUw/gk gWT5oyzsieX5ieTrCnaRuNCuyQPBuNE5e3Zmt48bGQ5/gSua00ShR95W++FYHc4qUBsp PWhJd3lNx6X1ILaqlIWcmo/j2zAIrc1M3KCbEvP4HcdO6fMCNwZduFUpCtXDKgyr0Jfl Bg/g== X-Gm-Message-State: AOJu0Yyla70lkHg4JGt/V0J2Eic8zp+XYhnJAAO3zbh/fmgWSVuW8HMX FgF4+3KvxX0IAmXsTSCB5PT0jg3dGDiJfTaW7Aw5/KhrSmrOzynKlzpbPA== X-Google-Smtp-Source: AGHT+IHliC8Nhan7r32glzsSPZiFWJ33Qyj1FUDGiwvjlTRoEmcQEl4Y2ZbPAOo3sLof4Jx5V85c1w== X-Received: by 2002:a05:620a:4056:b0:79f:17cb:7046 with SMTP id af79cd13be357-7a34efc0429mr2559010585a.69.1723054476536; Wed, 07 Aug 2024 11:14:36 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:36 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 03/14] network: remove network_bss_list_clear Date: Wed, 7 Aug 2024 11:14:16 -0700 Message-Id: <20240807181427.170515-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-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 | 1 - 2 files changed, 7 deletions(-) diff --git a/src/network.c b/src/network.c index 6d7e5ec4..c63d53b8 100644 --- a/src/network.c +++ b/src/network.c @@ -1184,12 +1184,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 network_prune_data { struct network *network; struct l_queue *new_list; diff --git a/src/network.h b/src/network.h index be81c150..29bc57ee 100644 --- a/src/network.h +++ b/src/network.h @@ -70,7 +70,6 @@ void network_connect_failed(struct network *network, bool in_handshake); bool network_bss_add(struct network *network, struct scan_bss *bss); bool network_bss_update(struct network *network, struct scan_bss *bss); bool network_bss_list_isempty(struct network *network); -void network_bss_list_clear(struct network *network); void network_bss_list_prune(struct network *network, struct l_queue *new_list); struct scan_bss *network_bss_list_pop(struct network *network); From patchwork Wed Aug 7 18:14:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13756581 Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (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 E92F413F428 for ; Wed, 7 Aug 2024 18:14:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054480; cv=none; b=MfCLH6eRv5Guju8SZ94udQal0imNU8ehbzJGxw7WmA0na3j/lD87i+qPuZE11mF1WC0Gvg6J2sy/iKcseT0VBwLRX6mrTTAUF7T+DzW6anTD222sjY68gsOOz0yLBhWMFQWnfA9z7PC2y/OR5ckH9JnHGbRVmmF23A53EKTqNFw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054480; c=relaxed/simple; bh=N5ktHp55FAxev4Fe93AiflrA9E2h1tg4Y823bSvYpR4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=K0Sr+xMf6+U6DpiCFXnHWaWNzRaX2DdDnbcvU2N1fAhI+3wK5FSQKKps1TxGu9lpN7NqtOh3a3iLejnOzH7JpXpWcPq6LjxQo/VluqYBjqGM4MBgBQLyUgzA66lEpetGDpsO6w9Y9Mx8QJwG/1ZpTKrecpMC72R8V7dg95o109I= 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=TUJDkpjd; arc=none smtp.client-ip=209.85.160.45 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="TUJDkpjd" Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-260f863109cso118587fac.1 for ; Wed, 07 Aug 2024 11:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054478; x=1723659278; 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=aCM7mUQWtupCxt63H0cxJM+Qx+Ka5rFi9XYM48vSNfw=; b=TUJDkpjd0LsPC0hEAIDtfv27mH1ySpzR2Nz/HRxzP/d/Pe5OBaMv/TD75rH8Uklq5o 1iFmLprPVwmlOetJFHPa9Dld9UayTD1yrditc13MacftkcCz15+r0QVQvHmxrgL8utB8 XoiaR8rzX/YHFHHArXljylcmvArIDa8h3JdK887zmwfzMXuCgTlaDPFqYcMU1U+QVSJX Xhbxb6Jg75HPLT+tpO6fPNGl8zZ0nzZEh94cX54ozXZ7nZaoAh4sUsehqylRrF94NGB8 z/y/pQF9vpRYJcD+NgRI4CZtxvkFBFb34adNvOY2AmaG8Vs4z3UNpPUSuEm/bDL+3woe Fzug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054478; x=1723659278; 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=aCM7mUQWtupCxt63H0cxJM+Qx+Ka5rFi9XYM48vSNfw=; b=a2PzGdqjGSBsJ83pfP4iom+W1iWLxB1Ow8/IkOfT2b4ci/J76dOkYbtJJiljd+l6X7 TVnhj8tjxN9re5Mn71K78tGTbcPaMSll2H90LseyKBo4jka9IQJkiW6CdZVyBuOfaUol N7sbMHLNkG/i4KjTys6CYfwUnehvHJr0uZNpo0qTpjHvGeJ+AuVyNoBIKeURnTvX9Jmn d1GCF7TYySl0hHHuhPV7+h1VWN7haAm6kXNUjmx0E7aoON/YRI8iscGUXvrnEwCzN6m6 UbXoXYDfTlEqd5FATg0wrtgp9oldDByMP6lureERylpoAbB9bsQs14IlvZ+gZRQWPYyc DGvg== X-Gm-Message-State: AOJu0YyOo6KdYYxakT6AoHO1dPlJtJL3RP75sfIVadvB7cePUQsLfoKw XeggsoJLknkCKaZCRHaHefL/to3dk8k6xPN70jdNWsTdE3pkVkFm1adzxg== X-Google-Smtp-Source: AGHT+IFQvl+co6/jODp+8J3LwVnKclw/wMnk8te5ZfIXF9WOatSkRW0NYx0ALL0AIbCqefFVHfEtRQ== X-Received: by 2002:a05:6870:b28b:b0:261:26be:2606 with SMTP id 586e51a60fabf-26891d705d1mr21846369fac.25.1723054477652; Wed, 07 Aug 2024 11:14:37 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:37 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 04/14] dbus: Add net.connman.iwd.BasicServiceSet interface Date: Wed, 7 Aug 2024 11:14:17 -0700 Message-Id: <20240807181427.170515-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-1-prestwoj@gmail.com> 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 Wed Aug 7 18:14:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13756582 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.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 6261514037F for ; Wed, 7 Aug 2024 18:14:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054482; cv=none; b=YXFQusdEM4sq/Vqh3NlLE2nlg9J53QyH/8pdWB23qX3B0zd95Ch2QrYgPe9wKNlcSZXpS1uNJOnjP0HNjKF55XLljuKzxArnq2OBPFBzA0qU3yHdBCM6WpeIkxXliWPXCqKS8fTeoFDm1jbgX7ksg41pD/fmMcsRugkfZlzWClY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054482; c=relaxed/simple; bh=+NeUWG4b3aw4f/0O8akwoFwPYs3u1BgWwH+wGzKNr70=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PErQdp0zq5ln7QdTFJVcrt2wcfSrfzSEah8n9KrHQNBlec+Pw6zsmD0JINGw8g8R0Xq8Jmud/D82pJgSSxZsW50KHv8biVICtko07EQAORBHpq01j0NiumxilA3XbbB6JBAlrgFuSSHwu2llDDq8JWR1HrDdVRAaqBxgO9wnsxo= 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=AuK9A416; arc=none smtp.client-ip=209.85.222.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="AuK9A416" Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7a1d5f6c56fso11382285a.0 for ; Wed, 07 Aug 2024 11:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054479; x=1723659279; 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=J8vlcHvkLRBlXCihbzDH6huS7z5YKVVoKdSUr3X8dXs=; b=AuK9A416x/xsz//SyMG7fHJMbZ8pRPkgSNrl6Hn4omqZM15jizFhuXHGs0/f5Uo6GI zTBDIaHr8cmLekYKsO8RR6VMstSuNCZqzeVxwYRqgJh3yB6UGpp1NiPblSYPBN17Ufwm EVVZYgfZuvp6uQeMrhhpXx9m9CMuv++tvYaGmG8QVQW3DdL58Jnw6BoNef8yaAUeuSu9 6AxGUcHVTO7j7Tc1CCeejUdfAiyHqPP7DeiiccxF5fKOYuwNxTrlP+/TYqwK1p8tIcBW A5aqXARm2fQQ8PkedoZjCKGNz46keuMLHx/VXKOVYmldtQrBNdQDtYKC4F2b3KJUZMN/ DBNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054479; x=1723659279; 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=J8vlcHvkLRBlXCihbzDH6huS7z5YKVVoKdSUr3X8dXs=; b=JyKsydnxcGVAJkrpVYQaRyy9tpKBh0sSn0ekV8GceuTf6KzTVTxTTb5mh+Di8m7srt sfZjXBIzDF18v3qJ0rITKQH/eQHdj1dQ3IqE3A/Y/RDUUOdeAHdgxyUtISaWYeaUh0X5 ms41tjCOxadp5cTxnc55aHxn1XhTE/s8WcyZLqBNlsSSJvg3gsdT+ZhlgWzcAWiG+Snx ILDw+6aHQE8KIUcmAbZJSUkVG1JGkcIO8/M10UeEhWNHHJmeLOpat7dNWXWpa1MGMwY/ JIxxCOy5FazZx4F2m8a0Sjf5/NhxftyLSrmFILrMuOE0iVcllkZ+uZhzchINznmGs4FS 0NoA== X-Gm-Message-State: AOJu0Yz+2wUu0QjMdezCCJK9k49DZVXia++kUI4qooQAmzj6zznjJeEH f2YiMgCf+BGzIsKiA09KKbQacg93wESNOO6oDce8nCLasG1LcXNvgE2Yow== X-Google-Smtp-Source: AGHT+IG5xAwBltASPoNIeDhizsFCOYwVmkZ1rAcaE46cXNZPcf+EIl0Io5RvW1iryg8tc7744Cr2MQ== X-Received: by 2002:a05:620a:1905:b0:7a1:d9a1:b9b with SMTP id af79cd13be357-7a34efc9a32mr2525544785a.60.1723054478938; Wed, 07 Aug 2024 11:14:38 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:38 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 05/14] network: implement net.connman.iwd.BasicServiceSet Date: Wed, 7 Aug 2024 11:14:18 -0700 Message-Id: <20240807181427.170515-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This ties the addition/removal of scan_bss objects from a network object to BasicServiceSet objects. If a "new" object is added when one with the same address already existed, no DBus object changes are made (only the user data is updated with the new scan_bss). Currently the only property on a BasicServiceSet object is the "Bssid". --- src/network.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++--- src/network.h | 2 ++ 2 files changed, 91 insertions(+), 5 deletions(-) diff --git a/src/network.c b/src/network.c index c63d53b8..e3f5bee8 100644 --- a/src/network.c +++ b/src/network.c @@ -1136,13 +1136,64 @@ static bool match_addr(const void *a, const void *b) return memcmp(bss->addr, b, 6) == 0; } +const char *network_bss_get_path(struct network *network, + 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, + bool update) +{ + const char *path = network_bss_get_path(network, bss); + + if (update) + return l_dbus_object_set_data(dbus_get_bus(), + network_bss_get_path(network, bss), + 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; +} + bool network_bss_add(struct network *network, struct scan_bss *bss) { - l_queue_remove_if(network->bss_list, match_addr, bss->addr); + bool removed = l_queue_remove_if(network->bss_list, + match_addr, bss->addr) != NULL; + + if (!l_queue_insert(network->bss_list, bss, + scan_bss_rank_compare, NULL)) { + /* This is essentially impossible... */ + if (L_WARN_ON(removed)) + network_unregister_bss(bss, network); - if (!l_queue_insert(network->bss_list, bss, scan_bss_rank_compare, - NULL)) return false; + } + + L_WARN_ON(!network_register_bss(network, bss, removed)); /* Done if BSS is not HS20 or we already have network_info set */ if (!bss->hs20_capable) @@ -1194,8 +1245,10 @@ static bool scan_bss_prune_missing(void *a, void *user_data) struct scan_bss *bss = a; struct network_prune_data *data = user_data; - if (!l_queue_find(data->new_list, match_addr, bss->addr)) + if (!l_queue_find(data->new_list, match_addr, bss->addr)) { + network_unregister_bss(bss, data->network); return true; + } return false; } @@ -1213,7 +1266,12 @@ void network_bss_list_prune(struct network *network, struct l_queue *new_list) 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, @@ -1931,6 +1989,8 @@ void network_remove(struct network *network, int reason) if (network->info) network->info->seen_count -= 1; + l_queue_foreach_remove(network->bss_list, + network_unregister_bss, network); l_queue_destroy(network->bss_list, NULL); l_queue_destroy(network->blacklist, NULL); @@ -2178,6 +2238,24 @@ static void setup_network_interface(struct l_dbus_interface *interface) network_property_get_known_network, NULL); } +static bool network_bss_property_get_bssid(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, "Bssid", 0, "s", + network_bss_property_get_bssid, NULL); +} + static int network_init(void) { if (!l_dbus_register_interface(dbus_get_bus(), IWD_NETWORK_INTERFACE, @@ -2185,6 +2263,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); @@ -2202,6 +2285,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 29bc57ee..62ed834b 100644 --- a/src/network.h +++ b/src/network.h @@ -69,6 +69,8 @@ int network_autoconnect(struct network *network, struct scan_bss *bss); void network_connect_failed(struct network *network, bool in_handshake); 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(struct network *network, + struct scan_bss *bss); bool network_bss_list_isempty(struct network *network); void network_bss_list_prune(struct network *network, struct l_queue *new_list); From patchwork Wed Aug 7 18:14:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13756583 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.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 64B581419B5 for ; Wed, 7 Aug 2024 18:14:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054482; cv=none; b=hpBFlWhiJATn/d/r+8ybFct6vrMMbPaB00julg4ywxlHjosmWUfFqYvTTs99O2NjsZyXi76Ik532siY7Dg93YzKN7xesgZl3vCgwgEpek9MRlbi4y47S/iMx1lcwn/+4Br79CkE2ZD4KwhWp8+NuCSc7uJgrIovH7TAiYPGK0OA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054482; c=relaxed/simple; bh=tUiwgvABs1PQlUMkgd+Br9XGUtlTxxMkDu2jdpRaoqk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eqnjv3HkqC5l/d1HL6KIW7z3l3sUIQNyw58u4LTGi4e54+p/2gqls5MBhAN7TAMkcN7/O45HSdg+AUZyGc9QtJLQICrUcc7B9P1amN7mVAfHQjOZPUnKMQjJrdOn1UQEpbu2u4vFR87puWQrwgpcSUR0MwNvr/9/k6OG5N3Ku/4= 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=Ivgt4V11; arc=none smtp.client-ip=209.85.222.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="Ivgt4V11" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-7a1d984ed52so11825985a.0 for ; Wed, 07 Aug 2024 11:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054480; x=1723659280; 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=73PjugG9a/l1hgYVyBZ+7l0sBvHgdOZi/iYNDy6S7Bg=; b=Ivgt4V11bZ93Dz0mxyLou+Ce3zDRtzTuSSl6XFgH8dTzMuhoC9iuuDR+/UBLiJvI4d Ud95FMxHLoNhlAs6KEOe/Iy6vZIOJCfIYDklRMoHTLGeulu8fAESdcF9uJ1BdypXPTjU 52Y8h53/KXgNpKOCQDF97F4hAPTq3O2Xe4z88hK51oDSJk6AYvkhLMq1URHIxbPXYJXf Z5gvuyUL9Os4nXVNH9rHM7QJyPqA2y/txjfecWtAcVkTvw9CDQhPJo1y4/KhLS4i0IJQ GIz0wCDWR64h5QOcedWafijghBWOjv4GxvCUiQZElAYB0x6fqkTLt3krYzGx1YXFJTyH DbAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054480; x=1723659280; 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=73PjugG9a/l1hgYVyBZ+7l0sBvHgdOZi/iYNDy6S7Bg=; b=hCrm3ore8HqCD7KwLTVx23zZ/hCedclhCEzRgoY7egbZGMt3VNhxm3NF22wMTXGH/f oPOq1BGUA/D/31ppSJPvXnTaa5UGQ/vPYGTBwMsJFFAhsJ2Od3Z/XFJr9Em5op7jmPwc nv/oYNT2uzf628L5LbAoS02aV6w2NrzH7fQ5/9aRyUgdK6ftJT+eDk8xgfI9lIr82djM /YHU9OAp5v0V2RMUco2IGGeTknVXQIXeKLweBMgo6j+V79PIjNWRuWigyGwap8Qxa6lu ILb3uqaDgKGH4G2sFKn21k3MRwkcPUmvywyym39C/TFUxQKdcw8G7figBHDgjGOTyovD cBPg== X-Gm-Message-State: AOJu0YxrtFvcSSP4TWaxaeXZwt4k17ZxI8LIXTfd7yPgLVeNnshrp0Va lumlgqi8LOQqs0G9bEPa4Wg1n7nEAeeK2RIrwyZl2allymQpCxr/0FdiKg== X-Google-Smtp-Source: AGHT+IEyXqWFyN7/Ob93QWhHwPx56X9fPO/seZvYEAOECkWCubKEtd47QTIPzY+vt1k5iau9K51Apw== X-Received: by 2002:a05:620a:40d3:b0:79d:7423:d040 with SMTP id af79cd13be357-7a34efac181mr2278006285a.54.1723054480092; Wed, 07 Aug 2024 11:14:40 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:39 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 06/14] network: add BasicServiceSets property on the network object Date: Wed, 7 Aug 2024 11:14:19 -0700 Message-Id: <20240807181427.170515-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-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 hold an array of object paths pointing to each BasicServiceSet object. --- src/network.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/network.c b/src/network.c index e3f5bee8..de56eaaf 100644 --- a/src/network.c +++ b/src/network.c @@ -1176,6 +1176,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, "BasicServiceSets"); + return true; } @@ -1938,6 +1941,28 @@ static bool network_property_get_known_network(struct l_dbus *dbus, return true; } +static bool network_property_get_basic_service_sets(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, @@ -2236,6 +2261,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, "BasicServiceSets", 0, "ao", + network_property_get_basic_service_sets, NULL); } static bool network_bss_property_get_bssid(struct l_dbus *dbus, From patchwork Wed Aug 7 18:14:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13756584 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7179F14037F for ; Wed, 7 Aug 2024 18:14:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054483; cv=none; b=RgPG+X86FdOHqIJnWcm49Vf8dGzD7pIaN8Z8IOfvyid1iI8RArhKPzpqzv/2tNjXYdEFWSjQhp4RAvZY9AUX2oKH4hpnDTZmm3JxwxhrO6LU/Idjx+aEzY6Y/OlpgIcZh7QPWnYL5CuLAyKRKETHaDa5CV/Uy/sqpBBlTz1eH84= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054483; c=relaxed/simple; bh=khDb1JzHSc71QI9zEf0s7g+88AyidS87t6JIleKMjgc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oGGdx3Y8l16VYtRuIa94SLBFXvDFP0JzThHSbq/cn3aQ2HGlgUFwh/KrcWXI8/0NlzcNzIBDJUUAjEdqowcYiLXknJisg7a0Gi1GtWZQf2xnqJpoGwu5xdR7MM4qdqvYIU8kTq4noT0yTSYyCdniJ460H5HUljwMrgNQxcHK0B8= 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=DqGGXRFo; arc=none smtp.client-ip=209.85.222.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DqGGXRFo" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-7a1dcc7bc05so13842285a.0 for ; Wed, 07 Aug 2024 11:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054481; x=1723659281; 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=qZBJoNkVUBgZ/+odBrbXlzFdMC8QOarTMTEXdnrZB4M=; b=DqGGXRFoBV72uXCSFS479USh7+/+kNTT6/ZyOpod0ZgVBfqWhkadmPQtM3ajvdaZdj fa9dPzQnWKdgXI7jeLxqRZWyR+G6P/vS9AP8D1ekkXWWZMznZrB2E1Urgd+LHEIFbkPQ Mt9d3LkFZbNjOV6ogSblhmijJOM2EYZzyXxtxWkm2Fo3PNm8jlhFvb7HEiorJNDrmw2q unJrd8CUM6Gtc2ezcLyqUZwZYhtiMX/Rt5buDF/ii3NxAvyn/03kwWjDfvVcKQiqH7bN yIcpuv01q6SeeePCwddY5ufTZnprUCkD7nYN0gu2Y4/JgDWS1m2PEH8lyITpSvcIBtpr QbMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054481; x=1723659281; 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=qZBJoNkVUBgZ/+odBrbXlzFdMC8QOarTMTEXdnrZB4M=; b=ceSn1akBtWktd6sW1wRqWYXkG0bjMQQGUyLJ6VYhNtm2FMauXfImpvxvv3ttaTEwt4 AHmeuIIDzvyxSq6r4yCptWRhJMM6EJAgTYVFNif5f7znQa1hB3FFBXtGMkishk1Nuaw8 BTJAUxpej6V3uiOLpkCMKm/DAe625400wTLGKFeOwariXNa5H7S0ZfiX75ao1Zzce5ye 7R1qgY2FBLxJPSMT+yvzQEU1AFOrqUj/ZGkGoEVnGicFFyK0IsufwIMq8tAus7/g7dwO vAgdR9SZw6/yB5dA0RlZlV2m+1hQi0LqHUtDjctmKmR1IWoP5M2pwOELRn7dS5JuVw1Y jQWg== X-Gm-Message-State: AOJu0YyhZcIdN72Blxqy4mX2vZmH1VzVRutT4zMI7cK/BB0b5K9Ssyjm AjeIw2LOgR4rTIVcu7KfnIWXnKEQJiFrYAWp1gl6DNWLrMrQf+bqXzKGWg== X-Google-Smtp-Source: AGHT+IF4O27QW1emjr10NG/Wv8surlCb/bIY1xvvIvESIoyqdSS5pmFj07w9APwqx7MFGcoWYZeUfw== X-Received: by 2002:a05:620a:2909:b0:79d:569a:6997 with SMTP id af79cd13be357-7a34f029668mr2177475285a.70.1723054481220; Wed, 07 Aug 2024 11:14:41 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:40 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 07/14] station: add ConnectedBss property Date: Wed, 7 Aug 2024 11:14:20 -0700 Message-Id: <20240807181427.170515-7-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-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 2c4d686b..5a6360de 100644 --- a/src/station.c +++ b/src/station.c @@ -4363,6 +4363,23 @@ static bool station_property_get_connected_network(struct l_dbus *dbus, return true; } +static bool station_property_get_connected_bss(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, @@ -4770,6 +4787,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, "ConnectedBss", 0, "o", + station_property_get_connected_bss, + NULL); l_dbus_interface_property(interface, "Scanning", 0, "b", station_property_get_scanning, NULL); l_dbus_interface_property(interface, "State", 0, "s", From patchwork Wed Aug 7 18:14:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13756585 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (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 AB08613E04B for ; Wed, 7 Aug 2024 18:14:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054485; cv=none; b=EsTIwgTBFG9rX9hhrsquJnzE7cCLq7oWGpCeBhY57RjDccct0irVInfswTvRkQoouy/wtK+shu9zlpb1OYal5a9p4Yf8tc0khAcBG8XYldIQlhHGCaq1XFZ61EBxTjS6IPWHNwC1U8imNT+kkS5pN+Fv4V8cxoS6SWcZksANaGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054485; c=relaxed/simple; bh=4YFB5h8zKkmMyRzSrqpkAovpdCwEtyubNe5Bd94jGSs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iSFgxTDCo3J05Es+z5RWSZTEzGdXZRse4NdioukA4+xWtI+vObE7tV5SraApZEZCFhBE+S0dpjLqpUwg4TDs3ZRRmflbnqv1j/dUbYVkPePzi4nAoBQ1uV7qmIsYlRxgEDA++1Vl9+AEyub69b8dNHJJ8UacMtAHPvg0ZqbpyTc= 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=RpJ2w2Qr; arc=none smtp.client-ip=209.85.222.169 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="RpJ2w2Qr" Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-7a1d3e93cceso114270785a.1 for ; Wed, 07 Aug 2024 11:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054482; x=1723659282; 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=Ci5+tjb70kTDD0CyGyfEAkcddsN33FelYMkFVd1mz+8=; b=RpJ2w2QrgL76dma32x+U9sWMKzW5q4FyF6m5iwa5Y0aje3Sj9TQ5LdELyt8tHU0Zph QqOxPCj5ORmx6rTupgTCX8KNAgbrePpp6x3ewQzyG6iPpc8HohHeEdEvY2LERjWbSG7a 2SIgsx4j8oaXDMAvHZrpPK7K4w3vR4DhTMnEXbO6RhPYSN7nTxFGeEifbluENMx5fzqX NpFZazfOrYXCWfM4CYnLTEwyC2YSa4yBuCojY6VPGP/sKl9bfIyfFInDHJc0GBDiZGnX QTIOwHvZt1p4uIvK+lkX4AE1GI3GmqlLj1zUs/A226+KwKXK99i+6TI4hQnEp98gDbXS GbIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054482; x=1723659282; 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=Ci5+tjb70kTDD0CyGyfEAkcddsN33FelYMkFVd1mz+8=; b=JZ4ZPKMPV+4s7sv7WT8DIQ49+aNFd/VZEUWkhuIivuiY2wrElIdhH1uaf5fu4bPInU uC7wtTZ0jwoDl27zcm4XJGwMy5yPvsbkgP92Xbl4FLadnt0+hHcC7tcHyyFN6iJsuF10 BHns45D79eKiRNB0Nl0wj0OtR2jsm6wI4bMjMVosGibQMC4OrxXOaQkZIushnADvyk/b AoOAVVQItX/Vn12ybrIEGGrLV3SbTKFvQhzW7E9meliQ/E0bdY7+kJgNcR+Gm+MnPFxD 9pYL2OG0Hk/ivwYkBZLwoaWWrELHwXg+sOK+HV1/+fo9K3fnCMOkZYznHRUutS3tDhuZ EIcw== X-Gm-Message-State: AOJu0YxfcEgq7SuqiTwCB2Z0dT2J1DW/hmtAShltlZ5mIrXkZuV1W583 /JWprpr9xXT7osh+ToGvYMpgrw4r/j79+jyNYzE6LXJeo3YsKAsfM25r3A== X-Google-Smtp-Source: AGHT+IFoX/t+gbtnL8wYGY8/BAjtJ0PMtnz4skmOPjkoE92yPbzlm9k/wuzWo0SvzwSOpC/LNb2jvA== X-Received: by 2002:a05:620a:178b:b0:79f:aa9:b3a0 with SMTP id af79cd13be357-7a377ba6598mr574156685a.13.1723054482286; Wed, 07 Aug 2024 11:14:42 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:42 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 08/14] doc: document BasicServiceSet API Date: Wed, 7 Aug 2024 11:14:21 -0700 Message-Id: <20240807181427.170515-8-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-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..2ebb63be --- /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 Bssid [readonly] + + MAC address of BSS diff --git a/doc/network-api.txt b/doc/network-api.txt index e4a34411..3aa68382 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. + + a(o) BasicServiceSets [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..7b067620 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 ConnectedBss [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 Wed Aug 7 18:14:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13756586 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B63FA13E3F6 for ; Wed, 7 Aug 2024 18:14:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054486; cv=none; b=W3y92d+mTsTF4mxj7kEQEcPXICqb7Aj/zLlsIVl0NPQPKRZT7eeADlFJlL53fppdirqidyrKTNztsqtNcFFlhxiAz05cEiigohoVAMX6jR3UEuVR7n/J5MSXPVC8Y6jMLfySsvzGk5bBKbk6fJWU+1r3IopTWQHEC50AWZp9rhY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054486; c=relaxed/simple; bh=0JXQUsU+CeZbduEPiJJveo0hTbm5nD6K/zdc+wnogXU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L22IXiKNVHf2/kTLubf7HuJykE74R9Rhak0qDRAHbG6XcmjuFOBjpJjduiLt2+foachwvjzYc7Dt0s56VRofygNaZwVMA5W70X9G0r080YVaYIZaAWfzepNfNf73ZM7V4UapMTc6teB7sU+7eSIgmJlFDk+K81mr7zcOJQdS3FY= 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=X8ydoxV8; arc=none smtp.client-ip=209.85.222.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X8ydoxV8" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-7a1dcba8142so88904085a.0 for ; Wed, 07 Aug 2024 11:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054483; x=1723659283; 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=X8ydoxV8T8sCNnR8jiflZZPMxwUw+ZPFnIxX8IxgqmSmuVsPSXd2sgEPxZFS5NwEBU G7RNh97Uwp6KWLv7ps11DllFrAbxB/VibWkRnCmVyfjWH12FYaOLG8/4Ife7PdNwzs0M XU6ABSUWvArqYybOrFixDy02tGoPhDkVUVDJIfbj9VSV2kpGP7DLSGvC4Udn3G0czIlc DgyGlg6oIhCgKF0UKGS2oyXucdc93EsQPpo7HIcs/ALd+LyTK1vuuL3JdJZ06vHE+QEV uypSYEtD26Gg3FtieBqe4xu/BuQ030wRigRYxE57gfI7CUe2uVXEvJlujszp/8IiYC3w 9Otg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054483; x=1723659283; 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=MFwDE50pnAKnVbNqfUJu0eJekIluxZq0szkF6KfRhU8r8iK4E0UDScij4oXYgcyh6Z RO2+o4iZ4splsLO7xd4w9XpE2rxSooDFQqkaP+reqoqOUy1BpPgUSXr2z1VJ/XNNGT5O Ak+zWtcRa7Jg/ZabsDo6yCwTvYXmjxL+8hoAzZGHN/po1NA8Tvlh5GOYca35LwQm+ykV AIroy6TYEK/a85b80dl89z17ld6nibj9zpz2mhSmfizHtO1G13kp5QWtSWTcl84vScla 1R/m6WYzv6MCIpbMFJenHyaTrmZcR0eubu66t/AGcqCAZKPquBPp6tdPipDhn6JBuHGX F8lA== X-Gm-Message-State: AOJu0YwgUgNBU5Ybjng7yTEdfey2LeY6C98r/TK7ygR2NvFj9nvHmosp pMeMufsD/zbFTv371QT34DVPGrvibKYaUoLpceEVeTqoliF1gj/BOzfiAA== X-Google-Smtp-Source: AGHT+IF/TpqGpCNlpJaemJ3pfO/08MILSQYwqOUE3nUERqe79Fx+GMIInqLCNxsuM5MFRCzAmK10Iw== X-Received: by 2002:a05:620a:4113:b0:79e:f878:7ffb with SMTP id af79cd13be357-7a377c0dbc5mr597787585a.9.1723054483442; Wed, 07 Aug 2024 11:14:43 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:43 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 09/14] client: separate property header and values into two functions Date: Wed, 7 Aug 2024 11:14:22 -0700 Message-Id: <20240807181427.170515-9-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-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 Wed Aug 7 18:14:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13756587 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (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 AE36113E039 for ; Wed, 7 Aug 2024 18:14:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054487; cv=none; b=Gt9K9tK6QamX+nqY92TNr/Dx5tW3nEzgBMoMSpBEwgFlPfuqn7whYAy/5OkvJeuQAnCEF8E/mG+s3jnDXY3HEjOgcSbc2rydfi4dVyYav2ZkYr0GFJpDo2UzVDIHhDvN388VqOQ4g0+Sokg/I1JqLNgEl+CXayl/78s40jnHJsk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054487; c=relaxed/simple; bh=Y0FM6IdMTdYxT6n/KJsgMsZ/chZmNYalxNdE7CK3QLk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=txQIasJq/PAiVpXUUb/Rm4DfVFlTFokQe/7EF3mmTC+5vtjJFYRVcEXnBeRho5nGkpvM90nF2Nwk07pjOILzIMygfJmtj6/E3xwD4KrjapjSkwj69QVvImOKV3Htew3D3EfSTaTRe2Wg0alKqeOZE4TyTKT7JyyJCxhWduO8W/c= 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=FV+HOMgh; arc=none smtp.client-ip=209.85.160.44 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="FV+HOMgh" Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-264545214efso111247fac.3 for ; Wed, 07 Aug 2024 11:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054484; x=1723659284; 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=FV+HOMghAD7nLJs0o4+CoSOGh1eGB4mqtIq1DCRePo2laryRdP0eIg6SYfPNqdwIzV 7h/VKzp86b3uTOFvtRGicK9AZpnhybTvJO5QKoTkqz+jobeieEEEkHD/fP4cUptzQlqZ Ujpc4AtoT/1EQZIaxtrp+kEjzj2WinN9Np804yOpOo8eQAXPes1YZ4ZVV1r/kP4aOE/X OdNhGfj3zANFOITRp9VjxMHuLI7w1Mi0OsLZz49YspkDfoCqgEzDuNaSd9C6M4Zyn9Ft CKHjHbXTZLqXe2YG2Lfwz1onZJfNrInRwVgqwZJU3QC1UKc0YnShsXA252aCt/X4i6Mv /vWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054484; x=1723659284; 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=r5iiPz31S1Qx2Rea6TzQMm0Oo6m7azErN/s+G82dS/Ih98nPZETyOrRrXxUOiDu5Zn EidCq+P3Z3iMDB+WDKshXjjR54ixHcBY6Pnb+N2iM4HR9QS5CL49BZrYPkL+s7kv7DIT oV6GgOG4REkVWtSfVM7QEfpQKSR2/siEKJSkPDw+Hp7gVRiLSIDGrJVdCR4hV87W7TBd URgVkogtIcGGZiISeu6/hOxsigxL4+mDX1OdVBjwGTFFvFKinL+yK1jEbj/8pL5QpogE YOxKHPEfNEPfIhKBN/YDSZZ8JY6hi40/tcsJbSPTaQndSC72MRJvUMeQ7O1sqdYontxH gs2Q== X-Gm-Message-State: AOJu0YxWSBWw79aci+0QgLt8i2lAWdhToS3Dkw1KcM/9rG+656MmL09V xdQSQ9sEM510u5IDKKeqLovHEYysl4eLD6+doVUrVwEWDxdxgEm/OR108w== X-Google-Smtp-Source: AGHT+IHPo3D2iG00BA3AGOtzLmMkwjaXBynMkzoVRGnpxG1uJbE/eJJKcEZAXrbKKvKioMa8vzR9gw== X-Received: by 2002:a05:6870:970c:b0:268:75d3:40dd with SMTP id 586e51a60fabf-26891eed9aemr20375203fac.49.1723054484583; Wed, 07 Aug 2024 11:14:44 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:44 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 10/14] client: add net.connman.iwd.BasicServiceSet definition Date: Wed, 7 Aug 2024 11:14:23 -0700 Message-Id: <20240807181427.170515-10-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-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 Wed Aug 7 18:14: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: 13756588 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.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 0528913E02E for ; Wed, 7 Aug 2024 18:14:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054488; cv=none; b=Rf51puBPSuwQgTAjOiWzVxSm3v/HjXJFJMu/wjh5r0qPw9ilOsOc7fqjtPbqbWWmFTOld0BuktxaG+2oBFQHZwYr5o6shjqLqtlkWUxjH+7ZMgXGx/H0BsF0GzgWrcahyQRZgZdpJ/tD7BxQn2VD5E0vwe1cqsTulxX4MiQRCis= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054488; c=relaxed/simple; bh=0CxoP8yLcs+mK9CigTo34USqvkY8DtaZ6lWVEiiFJh4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Lw5x+owewM3opyq8rlc+voTMdW44rwBQdbqp7f63uUr01s4/slwVIlWIJSQqzvj9j0PZQOm1E7kd5v5IilMqbdmMJozS7EWkAeuFSQG2CJAZI1g3EKkW2SIruU4WWwllIvUNbXa20cv5OZT4PDPtqRMfXZYY3GZXyHrVDQ7B06E= 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=L+vOI80/; arc=none smtp.client-ip=209.85.222.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="L+vOI80/" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7a1e4c75488so13398485a.0 for ; Wed, 07 Aug 2024 11:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054486; x=1723659286; 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=QHB5jdKwmPEJ4E50Miq0V5W+hpBUXM56GEW+CN1LpJk=; b=L+vOI80/F9drZc00e4fzfxvcnrnv9UWdbg9dfYZvKEBLEDJ4PhnpAK7pSFeu30sv2l 72nX2jXaLRJJROWksRRH/TnJO8PDP7IeRlgT4rXZsKqQclzr4RzwiISAFOYEY1zCOmfs AQQmtuvU3Ng5NLsjixHUxL8FRW++3+4u8bhQ7oMFEixMTa2FAW0wWD1Z0mnYhOElSCvE dCTILhsO8Tuar2AUJ7WLzM6kNjHIm/lZ2D6EKnJskqE8LWJvi84/AmWsYdF2rs7LUJum Gkl6Ua3CxicgDpvY/D31a2NqKsDWz3RMpkcb9CvsXaexsdv13xRLdymEBRKTrNAA2LBa vnnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054486; x=1723659286; 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=QHB5jdKwmPEJ4E50Miq0V5W+hpBUXM56GEW+CN1LpJk=; b=sO+Bqa1ktj1QD+py3ocLQ3JMuBNo4NKRa9XK7CYE7woQN58JjkViEx5XoDvq6x6ExF 0wfztP8BNASwaP5l+f/BLBW/3nEmB6ah8Z6PYJCfiz82AkAtiAE+uS/i7CpLZ2qOkuZY dUXn/mT4e3XUkBWHQhf5I6Tlr0qLFcsTo27bpnTJek4a2nRKLtxiCwcL/tSs7uW388Lj pUFj0eX0K5/ciGqL2ZtVXVjv5OtMciCsmeD2Xt6Yruf5l0k0skHKZ0w2v9QEx/iSUrNj 7H0LSzeyzugxTxRgv39bqJ/pKhDnwlxeskxEhfWfaBNiN+0TmUBNMXldgZSGp0pqCUPV P5kg== X-Gm-Message-State: AOJu0YyUNydi9J58zIY8UkiYbXDoDMG6jxyadJ+yhSEstprsOYK8vj2u KB4ukz7PXrtvB4k3MQ8HM6q6Q9zRKE5udDFsS3n1HVsbTTanVRFbT5xzMQ== X-Google-Smtp-Source: AGHT+IEEWX8nmmKVYybkWVnaYxLUOfH5zpJD6Y7spHAYLajcXbvUlbl6A+JtC62OBbNmpw6IfF1epQ== X-Received: by 2002:a05:620a:4551:b0:79e:f850:e4de with SMTP id af79cd13be357-7a34ed88bf6mr2430045585a.0.1723054485731; Wed, 07 Aug 2024 11:14:45 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:45 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 11/14] client: Add BasicServiceSets property to network Date: Wed, 7 Aug 2024 11:14:24 -0700 Message-Id: <20240807181427.170515-11-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-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..2bb986ce 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_bss(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_bss(const void *data) +{ + const struct network *network = data; + static char count[4]; + + snprintf(count, 4, "%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}, + { "BasicServiceSets", "ao", update_bss, get_bss }, { } }; @@ -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 Wed Aug 7 18:14: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: 13756589 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.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 5EF8813EFEF for ; Wed, 7 Aug 2024 18:14:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054489; cv=none; b=ko9GHcLOi8Z5FqygPDv3exRIWzIL4lroIgdTG+Cy+3VcGS6f9OxA0wmA2KNOvJKkuUhRd9+pEpbf4xE7YCCnm5GNVDWh2M4AtlFy+lm/VlZYwpCwBcEb/7hbK3TczcNYU7OSgjs/3fEml4Uj+0mZJZ0BuHQOlM+JO4imlNgK+SE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054489; c=relaxed/simple; bh=QYPChKO2IT//p8Y8bYRw1wgLZc0+lNetof2iHHvWbBo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GmoNOdXW13YNP2TB9GG3c9jM0ajL1PUEQact7OjE0QomQpyr4lblJ0YRUNBEP/NeyUXdRoJhbA6AqMR4DE7XlBregGj2c/UZkbrPp6/Hkr+tolX15uzAABSWPnMm8JrPelf5FroFbj8jspd+vniyycql5ubi5kmpa6X4GBBXgRA= 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=DaqtvT+w; arc=none smtp.client-ip=209.85.222.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="DaqtvT+w" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7a1dd2004e1so11236985a.3 for ; Wed, 07 Aug 2024 11:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054487; x=1723659287; 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=jD6bGMHugkOp/VqZ1DEnFMr3LTXFdwVCGAwhUtKdOBI=; b=DaqtvT+wDxP+HHosm3OmbXDB8KeS6d/r3vzl4HCylWMY/c9D0fPVrsWn8ulqRpGfGK bonuTqSrgXkN4R9sFNGnajkNpsin+CTcy9qR3zXnYZ3dF0skV/5OJWPH0NLHVp/8cNmw 599j1TYEIFnnX7Tq2RI3YTIcYrxu867mwR6bW8vD0A3EX1/P2t+0Lmx/PvAx04qmVnmQ S+oMjheRBFgalB7n+lBOEUHfkuMwHLlmQlfMfRaGN2YFapRIwXikWYiH5SWf0v0DUrbA bNOFstBC2SVz4XgzjelklDyg4TX6vhBUvCYNeDbY5AwMN4hCrp9ym0edfq7HkrL7jbhf 4mfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054487; x=1723659287; 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=jD6bGMHugkOp/VqZ1DEnFMr3LTXFdwVCGAwhUtKdOBI=; b=cm9MTp/AWksLhraVZ7hV68B/uK8w3eQ1jnhbk/UOrdIGlO1SiDkw55wUVFfgauNSXx iPXgTUCRerUYxZxL7Pqdp+wJ/k7smUUtFRTLAHA2WwGueWXgVn3H2xqsMxsWTxJMpqpX yDXPOkhrJgkYo1IPlm8XXmsJKD8a0q0vt8hLBO5VW8XJtiQp6Q0Nm7Yu7VtZrnnURcEy gToEk/NfY95x9kts/m3XJ2Ewg1K+1slwMmOVDCbJHiI+F8NTphT9dTQNC0x0Nhvzoi/N 7SoX3YawjVxdLorHG8j0GO8Y+rOzM5t1sgyeJb4zuoGFOySUiNXkl4lgei0yRb+GbpAZ obYg== X-Gm-Message-State: AOJu0Yze1EoO6ilYnkf9vnDPTkgHtvbsM1RbnSGcdu5r7+D1u4KExrf9 8NbSIWafEhydnHcRQqi5dcxyDcrNfFSD97v9McgRWXrFumBF6BNDAsIUpw== X-Google-Smtp-Source: AGHT+IFRXotYxVQzzWqz4zppJO0hhPhJEnju5fIhwv9eBtLi4ueT/w2w37/iCRdiFDFCdKDci5USZg== X-Received: by 2002:a05:620a:4045:b0:7a1:e9f9:d4fa with SMTP id af79cd13be357-7a34ef3ab54mr2225805585a.31.1723054486919; Wed, 07 Aug 2024 11:14:46 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:46 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 12/14] client: add BasicServiceSet interface Date: Wed, 7 Aug 2024 11:14:25 -0700 Message-Id: <20240807181427.170515-12-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-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 | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 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..273831a5 --- /dev/null +++ b/client/bss.c @@ -0,0 +1,110 @@ +/* + * + * 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" +#include "client/bss.h" + +struct bss { + char *bssid; +}; + +static const char *get_bssid(const void *data) +{ + const struct bss *bss = data; + + return bss->bssid; +} + +static void update_bssid(void *data, struct l_dbus_message_iter *variant) +{ + struct bss *bss = data; + const char *value; + + l_free(bss->bssid); + + if (!l_dbus_message_iter_get_variant(variant, "s", &value)) { + bss->bssid = NULL; + + return; + } + + bss->bssid = l_strdup(value); +} + +static const struct proxy_interface_property bss_properties[] = { + { "Bssid", "s", update_bssid, get_bssid }, + { } +}; + +static void *bss_create(void) +{ + return l_new(struct bss, 1); +} + +static void bss_destroy(void *data) +{ + struct bss *bss = data; + + l_free(bss->bssid); + 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->bssid); +} + +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 Wed Aug 7 18:14: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: 13756590 Received: from mail-vk1-f179.google.com (mail-vk1-f179.google.com [209.85.221.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8450913F42D for ; Wed, 7 Aug 2024 18:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054491; cv=none; b=hWbhyK07bi5Wr+pwb4rYYDRuYHbGObnNe4C+DxTQ8sxOREITRHt3FpJdOrSTsaCNiLZaXOJy40wtHpnbBqSbZEvLaqnRR7qyNbty9wTVYFxUW8gwgMoHaC8vVPWOvUinYC5g3sXS3vLcjj8M7/Ah+icaFGeQ1eBUbsiE+1E57/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054491; c=relaxed/simple; bh=gCdwM5boUrxXJykMfnN7bEjV0cAfhvzuqH+rcGbJXMI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e92N4RCX95GpvAF60B94zWQO8kYxxpR/Nj4qB3F8TNhgFharLFx1zZll2KW69pP2i9iJyoB9Nssun7cuIhz9VV0eMmN2Ne3bdbX0XopUgUA3mRX4smLv/YIxjuEfS+ItqdMWj5hriQSToPS2faEUP/f8Q1u+hb0mXii2dKTLUwQ= 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=h0EyIZHD; arc=none smtp.client-ip=209.85.221.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h0EyIZHD" Received: by mail-vk1-f179.google.com with SMTP id 71dfb90a1353d-4f521a22d74so41482e0c.2 for ; Wed, 07 Aug 2024 11:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054488; x=1723659288; 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=h0EyIZHDu/9vDoh8bz6LPvpH1SgizibuwPMSg+xhjztdRVMYtxflAcy850ZuKUDcaS 9EeUmxmV0JSihbiO4HDuRFygLt8uQzzdyoPYBraZwHSuTfXQouI5THtdPhW9KQOoOVP7 bp/A7nTNGGyDNAOSx90z3gvFVr7IGX0BerfOTeaqWnYakzWqAymsX87WQkEzzDm6bDr8 rNlZTngNbgzkzUWcqrKfHhTJWJ0CyfoSATPlOOq/jsuyBG5uvNaN6mGxV75mMrYbjq2/ Vyg6fWXHraL9BlIxhI4yvtEurRDrPlkLcsvPptQLtStRc77cS8XvSVLYvGmoUyHpfgBd RNMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054488; x=1723659288; 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=Oh1cxcg7+UN4MnkNwUI3bBPawbYqeMX7r9eK+wSlcMeqL/tn9NuYUR1h4K7pyP4+Jh OPJUeCZlEPByTSSy27oIzRvc3udUNjqM1DriZktCmNkK3LaTQ4sUVlo+PQRpv28ls/wZ sso/9T+juaIhekiBlFvmph0FFX/hd/iKzu7Osoc3Yj5WCNG0UG8nDPNS1UYdQ7rbBq8E cCyztl5zxTQSf+4tGrdQK5V9qDGUu5H0xfBMgsKolCMimr6feBABitX66VOhqWSPELZG aMaDgpcHTvTFm2HN4Hpxljfepm/XhByAo4rmgTg1W0PvYy6kbQw7KXoLdfroWJoCB+hq LQbw== X-Gm-Message-State: AOJu0YwmBfGx2o55OAyWiD+/BXoHwjYx6CREqpf3vY3BMumuWs8QY1Rl HIiY11vMAN7oI+JDdBGyzS5U39KyFqOWou1eUKjxv+7QA+nLUj3oAmpltg== X-Google-Smtp-Source: AGHT+IGaPrnrGdkrVeXA9pBi062MdG4fxYJtS7ANpCTtm1KJRN4V7fqDcdBrnWBnz0RfAH1iOdohrg== X-Received: by 2002:a05:6122:2513:b0:4f6:b160:3806 with SMTP id 71dfb90a1353d-4f8a0013735mr23399415e0c.11.1723054488103; Wed, 07 Aug 2024 11:14:48 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:47 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 13/14] client: refactor cmd_connect() and add find_network() Date: Wed, 7 Aug 2024 11:14:26 -0700 Message-Id: <20240807181427.170515-13-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-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 Wed Aug 7 18:14: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: 13756591 Received: from mail-vk1-f182.google.com (mail-vk1-f182.google.com [209.85.221.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 B03B113E02E for ; Wed, 7 Aug 2024 18:14:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054492; cv=none; b=nr91VFOCxrC6r63U0whxNm9mKzOFlS+rzhWGkFPEz0HbInCaSuu2fOLycyKMGr3MYnmQebncLQ5zYk2wFcNiQI3u9H4F/jyHS89dL63+Wka4FUIwsrC1EH1TvwLSc46WOY173RU9F/4hEaLLZ9fA9o5T1VHKBU7BmJqPCi8/0k8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723054492; c=relaxed/simple; bh=cgLZfJReiqyoHO2vj5i33u/5uHkuCEpQxKVkzMASb7Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YASn6rcS/0+VAifOLAKuVVwrlJkfd/e+yIWErecCz9D4+abWEOMa2Pe5a4h5Xgg4jUJdMFnpEDy1zhpYO/+tj2+PmwRWhSoovIf0sXaRXPkPVNPLXcVOiwNw6aBV78WNABH4KtHjYkoJVKaK/8WyOEqx9cFcMteGkUs4oe76tqc= 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/YTaqM; arc=none smtp.client-ip=209.85.221.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="dv/YTaqM" Received: by mail-vk1-f182.google.com with SMTP id 71dfb90a1353d-4f51981b1beso50714e0c.2 for ; Wed, 07 Aug 2024 11:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723054489; x=1723659289; 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=dv/YTaqM7C9rurSGvSTRDakNyIH5cLriIgsaRYsF3YyJH5L2c25iCMDerjkSlPcycO oAVOCgCCSTmKqE6bP9d/Nih1y5CWpXU7y3AlWIdDDON7VsLWG3Godov5op9hfbzeUp2l kc0ixnI2XX21dy2Uc9JPkn4lNg1Eh31zjmWCiudi0+5VKeSYnjuMQaegaHz/JGd9JxZo ZbM3RMmNjaIdSHDkSLxV8Ka0Ps6Ru/5JUs8hKsjdpFM8u/uEE0tpstXmDoSz+e2BWs5X mWAolMim+k/uvtR+QVHgLOjjGrPtYrJeGvJB1Ts2yI9SSoX50Ihb+diu4ri4FPpJykTN 2RZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723054489; x=1723659289; 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=vyglcEHQhNeJ62zSvqJnqtZ7JprIw7ivmBuqdKaomxwURLsUVOZ1GZnsR9ptAP0u5l AspcWnBc1COB6NUvq90rKv65dA59biYBVSzEBIVArFEPI+pZMtidWkceKyNTzTHtIKnR sezPiLBBcoKkvj1H+g9rB3Nu7OfmndmzcCvdcebF1prv8fdTk3qPqx57BputG4pu19ba /q4Ao9eavVBOD7Mh9OTVTvMCItZkpZ5s7AImNErKml0ITY62cY0HFlgyY9JbFSMpcBir KR8HhdDKzQBu9IHJ4nbi7vK/NKJrGJ0FhTEnekeDLDUYyc/OABESiAGUdwMcPRVoIYxA Rebw== X-Gm-Message-State: AOJu0YxVLXID8qTkatTyov+BsgIw+UU2JBD0YjiQgmSoVZQxK3o2zFkj b5qw7dv84T+OI9xFUGBQR50wlQRGE0d95eKWl+y8e7VAioPLceeC2FebzQ== X-Google-Smtp-Source: AGHT+IHK98KtAi39OVOe6ydKuKh5lro/cjG/p89r/Mm+6hB7SQTQ1QyZXrNJHTKnwhYdP+Bv8vVs6w== X-Received: by 2002:a05:6122:3c87:b0:4f6:ad39:dab1 with SMTP id 71dfb90a1353d-4f89ff611cfmr24127526e0c.5.1723054489331; Wed, 07 Aug 2024 11:14:49 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a3785d0db4sm82194685a.7.2024.08.07.11.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 11:14:48 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 14/14] client: add station command "get-bsses" Date: Wed, 7 Aug 2024 11:14:27 -0700 Message-Id: <20240807181427.170515-14-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com> References: <20240807181427.170515-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 }, { } };