From patchwork Thu Aug 29 22:23:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 2851630 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 638F5C0AB5 for ; Thu, 29 Aug 2013 22:24:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 84C8B204FE for ; Thu, 29 Aug 2013 22:24:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B1C5A204E7 for ; Thu, 29 Aug 2013 22:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756646Ab3H2WYV (ORCPT ); Thu, 29 Aug 2013 18:24:21 -0400 Received: from mail.candelatech.com ([208.74.158.172]:46044 "EHLO ns3.lanforge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754106Ab3H2WYU (ORCPT ); Thu, 29 Aug 2013 18:24:20 -0400 Received: from localhost.localdomain (firewall.candelatech.com [70.89.124.249]) by ns3.lanforge.com (8.14.2/8.14.2) with ESMTP id r7TMNs00006954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 29 Aug 2013 15:23:56 -0700 From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH v2 2/4] iw: Print 802.11u Advertisement IE info in scan results. Date: Thu, 29 Aug 2013 15:23:45 -0700 Message-Id: <1377815027-3736-2-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1377815027-3736-1-git-send-email-greearb@candelatech.com> References: <1377815027-3736-1-git-send-email-greearb@candelatech.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Greear Sample output looks like: 802.11u Advertisement: Query Response Info: 0x7f Query Response Length Limit: 127 ANQP Signed-off-by: Ben Greear --- :100644 100644 e8957d1... 53cef39... M scan.c scan.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/scan.c b/scan.c index e8957d1..53cef39 100644 --- a/scan.c +++ b/scan.c @@ -679,6 +679,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", @@ -957,6 +989,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)