From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH] monitor: indicate if the MPDU was invalid
Date: Tue, 2 Jan 2024 05:03:55 -0800 [thread overview]
Message-ID: <20240102130355.17660-1-prestwoj@gmail.com> (raw)
If the frame was not parsed as an MPDU indicate this in iwmon. This
also adds handling to print probe requests.
---
monitor/nlmon.c | 43 ++++++++++++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/monitor/nlmon.c b/monitor/nlmon.c
index ed40264b..6845ca53 100644
--- a/monitor/nlmon.c
+++ b/monitor/nlmon.c
@@ -5128,6 +5128,16 @@ static void print_probe_response(unsigned int level,
(const uint8_t *) mmpdu + len - resp->ies);
}
+static void print_probe_request(unsigned int level,
+ const struct mmpdu_header *mmpdu, size_t len)
+{
+ const struct mmpdu_probe_request *req = mmpdu_body(mmpdu);
+
+ print_attr(level, "Subtype: Probe Request");
+ print_ie(level + 1, "Probe Request IEs", req->ies,
+ (const uint8_t *) mmpdu + len - req->ies);
+}
+
static void print_beacon(unsigned int level,
const struct mmpdu_header *mmpdu, size_t len)
{
@@ -5165,7 +5175,10 @@ static void print_frame_type(unsigned int level, const char *label,
switch (subtype) {
case 0x00:
- str = "Association request";
+ if (mpdu)
+ str = "Association request";
+ else
+ str = "Association request (invalid MPDU)";
break;
case 0x01:
if (mpdu)
@@ -5174,19 +5187,28 @@ static void print_frame_type(unsigned int level, const char *label,
str = "Association response";
break;
case 0x02:
- str = "Reassociation request";
+ if (mpdu)
+ str = "Reassociation request";
+ else
+ str = "Reassociation request (invalid MPDU)";
break;
case 0x03:
- str = "Reassociation response";
+ if (mpdu)
+ str = "Reassociation response";
+ else
+ str = "Reassociation response (invalid MPDU)";
break;
case 0x04:
- str = "Probe request";
+ if (mpdu)
+ print_probe_request(level + 1, mpdu, size);
+ else
+ str = "Probe request (invalid MPDU)";
break;
case 0x05:
if (mpdu)
print_probe_response(level + 1, mpdu, size);
else
- str = "Probe response";
+ str = "Probe response (invalid MPDU)";
break;
case 0x06:
str = "Timing Advertisement";
@@ -5195,25 +5217,28 @@ static void print_frame_type(unsigned int level, const char *label,
if (mpdu)
print_beacon(level + 1, mpdu, size);
else
- str = "Beacon";
+ str = "Beacon (invalid MPDU)";
break;
case 0x09:
str = "ATIM";
break;
case 0x0a:
- str = "Disassociation";
+ if (mpdu)
+ str = "Disassociation";
+ else
+ str = "Disassociation (invalid MPDU)";
break;
case 0x0b:
if (mpdu)
print_authentication_mgmt_frame(level + 1, mpdu, size);
else
- str = "Authentication";
+ str = "Authentication (invalid MPDU)";
break;
case 0x0c:
if (mpdu)
print_deauthentication_mgmt_frame(level + 1, mpdu);
else
- str = "Deauthentication";
+ str = "Deauthentication (invalid MPDU)";
break;
case 0x0d:
case 0x0e:
--
2.34.1
next reply other threads:[~2024-01-02 13:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-02 13:03 James Prestwood [this message]
2024-01-02 17:02 ` [PATCH] monitor: indicate if the MPDU was invalid 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=20240102130355.17660-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