Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Aleksman4o <aleksman4o@gmail.com>
To: iwd@lists.linux.dev
Cc: Aleks Man <aleksman4o@gmail.com>, prestwoj@gmail.com, denkenz@gmail.com
Subject: [PATCH v4 4/5] client: display BasicServiceSet RSN property
Date: Tue, 28 Jul 2026 18:46:43 +0300	[thread overview]
Message-ID: <20260728154729.3485557-5-aleksman4o@gmail.com> (raw)
In-Reply-To: <20260728154729.3485557-1-aleksman4o@gmail.com>

From: Aleks Man <aleksman4o@gmail.com>

Parse the optional RSN dictionary and include the advertised key
management and cipher capabilities in the station get-bsses output.
---
 client/bss.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/client/bss.c b/client/bss.c
index def4de7f..b5c80087 100644
--- a/client/bss.c
+++ b/client/bss.c
@@ -32,6 +32,7 @@
 
 struct bss {
 	char *address;
+	char *rsn;
 };
 
 static const char *get_address(const void *data)
@@ -57,8 +58,82 @@ static void update_address(void *data, struct l_dbus_message_iter *variant)
 	bss->address = l_strdup(value);
 }
 
+static char *string_array_to_string(struct l_dbus_message_iter *variant)
+{
+	struct l_dbus_message_iter array;
+	const char *value;
+	char **strv;
+	char *result;
+
+	if (!l_dbus_message_iter_get_variant(variant, "as", &array))
+		return NULL;
+
+	strv = l_strv_new();
+
+	while (l_dbus_message_iter_next_entry(&array, &value))
+		strv = l_strv_append(strv, value);
+
+	result = l_strjoinv(strv, ' ');
+	l_strv_free(strv);
+
+	return result;
+}
+
+static void update_rsn(void *data, struct l_dbus_message_iter *variant)
+{
+	struct bss *bss = data;
+	struct l_dbus_message_iter dict;
+	struct l_dbus_message_iter value;
+	const char *key;
+	const char *group_value;
+	char *key_mgmt = NULL;
+	char *pairwise = NULL;
+	char *group = NULL;
+
+	l_free(bss->rsn);
+	bss->rsn = NULL;
+
+	if (!variant ||
+			!l_dbus_message_iter_get_variant(variant, "a{sv}", &dict))
+		goto done;
+
+	while (l_dbus_message_iter_next_entry(&dict, &key, &value)) {
+		if (!strcmp(key, "KeyMgmt")) {
+			l_free(key_mgmt);
+			key_mgmt = string_array_to_string(&value);
+		} else if (!strcmp(key, "Pairwise")) {
+			l_free(pairwise);
+			pairwise = string_array_to_string(&value);
+		} else if (!strcmp(key, "Group") &&
+				l_dbus_message_iter_get_variant(&value, "s",
+								&group_value)) {
+			l_free(group);
+			group = l_strdup(group_value);
+		}
+	}
+
+	if (!key_mgmt || !pairwise || !group)
+		goto done;
+
+	bss->rsn = l_strdup_printf("KeyMgmt: %s; Pairwise: %s; Group: %s",
+					key_mgmt, pairwise, group);
+
+done:
+	l_free(key_mgmt);
+	l_free(pairwise);
+	l_free(group);
+}
+
+static const char *get_rsn(const void *data)
+{
+	const struct bss *bss = data;
+
+	return bss->rsn;
+}
+
 static const struct proxy_interface_property bss_properties[] = {
 	{ "Address",       "s", update_address, get_address },
+	{ "RSN",           "a{sv}", update_rsn, get_rsn },
 	{ }
 };
 
@@ -72,6 +147,7 @@ static void bss_destroy(void *data)
 	struct bss *bss = data;
 
 	l_free(bss->address);
+	l_free(bss->rsn);
 	l_free(bss);
 }
 
-- 
2.55.0


  parent reply	other threads:[~2026-07-28 15:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-11 20:07 [RFC] dbus: expose per-BSS security capabilities Алексей
2026-07-14 13:27 ` James Prestwood
2026-07-14 20:36   ` [PATCH 0/3] dbus: expose per-BSS RSN capabilities Алексей
2026-07-14 20:37     ` [PATCH 1/3] network: expose RSN capabilities on BSS Алексей
2026-07-14 20:38     ` [PATCH 2/3] doc: document BasicServiceSet RSN property Алексей
2026-07-14 20:39     ` [PATCH 3/3] auto-t: test " Алексей
2026-07-14 21:12   ` [PATCH v2 0/3] dbus: expose per-BSS RSN capabilities Aleksman4o
2026-07-14 21:12     ` [PATCH v2 1/3] network: expose RSN capabilities on BSS Aleksman4o
2026-07-14 21:12     ` [PATCH v2 2/3] doc: document BasicServiceSet RSN property Aleksman4o
2026-07-14 21:12     ` [PATCH v2 3/3] auto-t: test " Aleksman4o
2026-07-14 22:48     ` [PATCH v3 0/3] dbus: expose per-BSS RSN capabilities Aleksman4o
2026-07-14 22:48       ` [PATCH v3 1/3] network: expose RSN capabilities on BSS Aleksman4o
2026-07-14 22:48       ` [PATCH v3 2/3] doc: document BasicServiceSet RSN property Aleksman4o
2026-07-14 22:48       ` [PATCH v3 3/3] auto-t: test " Aleksman4o
2026-07-28 13:31       ` [PATCH v3 0/3] dbus: expose per-BSS RSN capabilities Aleksman4o
2026-07-28 13:40       ` James Prestwood
2026-07-28 15:46         ` [PATCH v4 0/5] " Aleksman4o
2026-07-28 15:46           ` [PATCH v4 1/5] network: expose RSN capabilities on BSS Aleksman4o
2026-07-28 15:46           ` [PATCH v4 2/5] doc: document BasicServiceSet RSN property Aleksman4o
2026-07-28 15:46           ` [PATCH v4 3/5] auto-t: test " Aleksman4o
2026-07-28 15:46           ` Aleksman4o [this message]
2026-07-28 15:46           ` [PATCH v4 5/5] client: widen BSS property value column Aleksman4o
2026-07-28 18:40           ` [PATCH v4 0/5] dbus: expose per-BSS RSN capabilities James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260728154729.3485557-5-aleksman4o@gmail.com \
    --to=aleksman4o@gmail.com \
    --cc=denkenz@gmail.com \
    --cc=iwd@lists.linux.dev \
    --cc=prestwoj@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox