All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
	David Poole <dpoole@cradlepoint.com>,
	Ben Greear <greearb@candelatech.com>,
	John Crispin <john@phrozen.org>,
	Brian Norris <briannorris@chromium.org>
Subject: [PATCH 1/4] iw: scan: add extension tag parsing
Date: Tue, 17 Nov 2020 19:39:33 -0800	[thread overview]
Message-ID: <20201118033936.3667788-2-briannorris@chromium.org> (raw)
In-Reply-To: <20201118033936.3667788-1-briannorris@chromium.org>

HE IEs are part of the extension tag (ID 255).

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 scan.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/scan.c b/scan.c
index 8c23483ecede..58a09983c5c7 100644
--- a/scan.c
+++ b/scan.c
@@ -2272,6 +2272,36 @@ static void print_vendor(unsigned char len, unsigned char *data,
 	printf("\n");
 }
 
+static const struct ie_print ext_printers[] = {
+};
+
+static void print_extension(unsigned char len, unsigned char *ie,
+			    bool unknown, enum print_ie_type ptype)
+{
+	unsigned char tag;
+
+	if (len < 1) {
+		printf("\tExtension IE: <empty>\n");
+		return;
+	}
+
+	tag = ie[0];
+	if (tag < ARRAY_SIZE(ext_printers) && ext_printers[tag].name &&
+	    ext_printers[tag].flags & BIT(ptype)) {
+		print_ie(&ext_printers[tag], tag, len - 1, ie + 1, NULL);
+		return;
+	}
+
+	if (unknown) {
+		int i;
+
+		printf("\tUnknown Extension ID (%d):", ie[0]);
+		for (i = 1; i < len; i++)
+			printf(" %.2x", ie[i]);
+		printf("\n");
+	}
+}
+
 void print_ies(unsigned char *ie, int ielen, bool unknown,
 	       enum print_ie_type ptype)
 {
@@ -2290,6 +2320,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
 				 ie[0], ie[1], ie + 2, &ie_buffer);
 		} else if (ie[0] == 221 /* vendor */) {
 			print_vendor(ie[1], ie + 2, unknown, ptype);
+		} else if (ie[0] == 255 /* extension */) {
+			print_extension(ie[1], ie + 2, unknown, ptype);
 		} else if (unknown) {
 			int i;
 
-- 
2.29.2.299.gdc1121823c-goog


  reply	other threads:[~2020-11-18  3:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18  3:39 [PATCH 0/4] iw: add HE capabilities scan parsing Brian Norris
2020-11-18  3:39 ` Brian Norris [this message]
2020-11-18  3:39 ` [PATCH 2/4] iw: util: factor out HE capability parser Brian Norris
2020-11-18  3:39 ` [PATCH 3/4] iw: scan: parse HE capabilities Brian Norris
2020-11-18  3:39 ` [PATCH 4/4] iw: scan: fixup HE caps whitespace Brian Norris
2020-11-19 15:06 ` [PATCH 0/4] iw: add HE capabilities scan parsing David Poole
2020-11-19 19:20   ` Brian Norris

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=20201118033936.3667788-2-briannorris@chromium.org \
    --to=briannorris@chromium.org \
    --cc=dpoole@cradlepoint.com \
    --cc=greearb@candelatech.com \
    --cc=johannes@sipsolutions.net \
    --cc=john@phrozen.org \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.