| From 6d8d507daa752c4068194a7ce1607b745ea6d3c3 Mon Sep 17 00:00:00 2001 |
| From: Brian Norris <briannorris@chromium.org> |
| Date: Tue, 17 Nov 2020 19:39:33 -0800 |
| Subject: [PATCH] iw: scan: add extension tag parsing |
| |
| HE IEs are part of the extension tag (ID 255). |
| |
| Signed-off-by: Brian Norris <briannorris@chromium.org> |
| Link: https://lore.kernel.org/r/20201118033936.3667788-2-briannorris@chromium.org |
| Signed-off-by: Johannes Berg <johannes.berg@intel.com> |
| --- |
| 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.30.0.365.g02bc693789-goog |
| |