]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: Print 802.11u Advertisement IE info in scan results.
authorBen Greear <greearb@candelatech.com>
Thu, 29 Aug 2013 22:23:45 +0000 (15:23 -0700)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 30 Aug 2013 11:48:14 +0000 (13:48 +0200)
Sample output looks like:

802.11u Advertisement:
Query Response Info: 0x7f
Query Response Length Limit: 127
ANQP

Signed-off-by: Ben Greear <greearb@candelatech.com>
scan.c

diff --git a/scan.c b/scan.c
index 52b0f1faf1ebd1bb44677aa3d832827c470e79b7..b1b41f49ed1d9f81853bf9de00832ae25084e1b4 100644 (file)
--- a/scan.c
+++ b/scan.c
@@ -673,6 +673,38 @@ static void print_interworking(const uint8_t type, uint8_t len, const uint8_t *d
                       data[1], data[2], data[3], data[4], data[5], data[6]);
 }
 
+static void print_11u_advert(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+       /* See Section 7.3.2.93 in the 802.11u spec. */
+       /* TODO: This code below does not decode private protocol IDs */
+       int idx = 0;
+       printf("\n");
+       while (idx < (len - 1)) {
+               uint8_t qri = data[idx];
+               uint8_t proto_id = data[idx + 1];
+               printf("\t\tQuery Response Info: 0x%hx\n", (unsigned short)(qri));
+               printf("\t\t\tQuery Response Length Limit: %i\n",
+                      (qri & 0x7f));
+               if (qri & (1<<7))
+                       printf("\t\t\tPAME-BI\n");
+               switch(proto_id) {
+               case 0:
+                       printf("\t\t\tANQP\n"); break;
+               case 1:
+                       printf("\t\t\tMIH Information Service\n"); break;
+               case 2:
+                       printf("\t\t\tMIH Command and Event Services Capability Discovery\n"); break;
+               case 3:
+                       printf("\t\t\tEmergency Alert System (EAS)\n"); break;
+               case 221:
+                       printf("\t\t\tVendor Specific\n"); break;
+               default:
+                       printf("\t\t\tReserved: %i\n", proto_id); break;
+               }
+               idx += 2;
+       }
+}
+
 static const char *ht_secondary_offset[4] = {
        "no secondary",
        "above",
@@ -951,6 +983,7 @@ static const struct ie_print ieprinters[] = {
        [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
        [127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), },
        [107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
+       [108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
 };
 
 static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data)