From patchwork Tue Aug 27 17:26:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 2850255 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 79C1EBF546 for ; Tue, 27 Aug 2013 17:26:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7441E20456 for ; Tue, 27 Aug 2013 17:26:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 18C1B20435 for ; Tue, 27 Aug 2013 17:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752325Ab3H0R0t (ORCPT ); Tue, 27 Aug 2013 13:26:49 -0400 Received: from mail.candelatech.com ([208.74.158.172]:34257 "EHLO ns3.lanforge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752209Ab3H0R0t (ORCPT ); Tue, 27 Aug 2013 13:26:49 -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 r7RHQGtF006719 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Aug 2013 10:26:17 -0700 From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH] iw: Print 802.11u roaming consortium IE in scan results. Date: Tue, 27 Aug 2013 10:26:15 -0700 Message-Id: <1377624375-3353-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.3.4 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 Example output: 802.11u Roaming Consortium: ANQP OIs: 0 OI 1: 01010101 Signed-off-by: Ben Greear --- :100644 100644 b1917b0... 1a48509... M scan.c scan.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+), 0 deletions(-) diff --git a/scan.c b/scan.c index b1917b0..1a48509 100644 --- a/scan.c +++ b/scan.c @@ -709,6 +709,58 @@ static void print_11u_advert(const uint8_t type, uint8_t len, const uint8_t *dat } } +static void print_11u_rcon(const uint8_t type, uint8_t len, const uint8_t *data) +{ + /* See Section 7.3.2.96 in the 802.11u spec. */ + int idx = 0; + int ln0 = data[1] & 0xf; + int ln1 = ((data[1] & 0xf0) >> 4); + int ln2 = 0; + printf("\n"); + + if (ln1) { + ln2 = len - 2 - ln0 - ln1; + } + printf("\t\tANQP OIs: %i\n", data[0]); + + if (ln0 > 0) { + printf("\t\tOI 1: "); + if (2 + ln0 > len) { + printf("Invalid IE length.\n"); + } + else { + for (idx = 0; idx < ln0; idx++) { + printf("%02hx", data[2 + idx]); + } + printf("\n"); + } + } + if (ln1 > 0) { + printf("\t\tOI 2: "); + if (2 + ln0 + ln1 > len) { + printf("Invalid IE length.\n"); + } + else { + for (idx = 0; idx < ln1; idx++) { + printf("%02hx", data[2 + ln0 + idx]); + } + printf("\n"); + } + } + if (ln2 > 0) { + printf("\t\tOI 3: "); + if (2 + ln0 + ln1 + ln2 > len) { + printf("Invalid IE length.\n"); + } + else { + for (idx = 0; idx < ln2; idx++) { + printf("%02hx", data[2 + ln0 + ln1 + idx]); + } + printf("\n"); + } + } +} + static const char *ht_secondary_offset[4] = { "no secondary", "above", @@ -988,6 +1040,7 @@ static const struct ie_print ieprinters[] = { [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), }, + [111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), }, }; static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data)