iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes
Date: Thu, 23 Feb 2023 10:14:16 -0800	[thread overview]
Message-ID: <20230223181417.1384624-1-prestwoj@gmail.com> (raw)

---
 monitor/nlmon.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/monitor/nlmon.c b/monitor/nlmon.c
index 25a15154..a7ce2412 100644
--- a/monitor/nlmon.c
+++ b/monitor/nlmon.c
@@ -5068,6 +5068,16 @@ static void print_probe_response(unsigned int level,
 			(const uint8_t *) mmpdu + len - resp->ies);
 }
 
+static void print_beacon(unsigned int level,
+				const struct mmpdu_header *mmpdu, size_t len)
+{
+	const struct mmpdu_beacon *beacon = mmpdu_body(mmpdu);
+
+	print_attr(level, "Subtype: Beacon");
+	print_ie(level + 1, "Beacon IEs", beacon->ies,
+			(const uint8_t *) mmpdu + len - beacon->ies);
+}
+
 static void print_frame_type(unsigned int level, const char *label,
 					const void *data, uint16_t size)
 {
@@ -5122,7 +5132,10 @@ static void print_frame_type(unsigned int level, const char *label,
 		str = "Timing Advertisement";
 		break;
 	case 0x08:
-		str = "Beacon";
+		if (mpdu)
+			print_beacon(level + 1, mpdu, size);
+		else
+			str = "Beacon";
 		break;
 	case 0x09:
 		str = "ATIM";
@@ -6240,9 +6253,10 @@ static const struct attr_entry attr_table[] = {
 	{ NL80211_ATTR_DTIM_PERIOD,
 			"DTIM Period", ATTR_U32 },
 	{ NL80211_ATTR_BEACON_HEAD,
-			"Beacon Head", ATTR_BINARY },
+			"Beacon Head",  ATTR_CUSTOM, { .function = print_frame } },
 	{ NL80211_ATTR_BEACON_TAIL,
-			"Beacon Tail", ATTR_BINARY },
+			"Beacon Tail", ATTR_CUSTOM,
+				{ .function = print_management_ies } },
 	{ NL80211_ATTR_STA_AID,
 			"Station AID", ATTR_U16 },
 	{ NL80211_ATTR_STA_FLAGS,
@@ -6520,7 +6534,8 @@ static const struct attr_entry attr_table[] = {
 	{ NL80211_ATTR_PROBE_RESP_OFFLOAD,
 			"Probe Response Offload" },
 	{ NL80211_ATTR_PROBE_RESP,
-			"Probe Response" },
+			"Probe Response", ATTR_CUSTOM,
+					{ .function = print_frame} },
 	{ NL80211_ATTR_DFS_REGION,
 			"DFS Region", ATTR_U8 },
 	{ NL80211_ATTR_DISABLE_HT,
-- 
2.34.3


             reply	other threads:[~2023-02-23 18:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 18:14 James Prestwood [this message]
2023-02-23 18:14 ` [PATCH 2/2] netdev: check iftype in channel switch event James Prestwood
2023-02-27 16:25 ` [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes Denis Kenzior

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=20230223181417.1384624-1-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).