diff mbox series

[1/4] iw: scan: add extension tag parsing

Message ID 20201118033936.3667788-2-briannorris@chromium.org
State New
Headers show
Series [1/4] iw: scan: add extension tag parsing | expand

Commit Message

Brian Norris Nov. 18, 2020, 3:39 a.m. UTC
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 mbox series

Patch

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;