From patchwork Tue Mar 17 22:02:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 6034741 X-Patchwork-Delegate: johannes@sipsolutions.net 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 56FDEBF90F for ; Tue, 17 Mar 2015 22:02:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62930203DA for ; Tue, 17 Mar 2015 22:02:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BF5E2046F for ; Tue, 17 Mar 2015 22:02:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753866AbbCQWCl (ORCPT ); Tue, 17 Mar 2015 18:02:41 -0400 Received: from mail2.candelatech.com ([208.74.158.173]:53373 "EHLO mail2.candelatech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750958AbbCQWCl (ORCPT ); Tue, 17 Mar 2015 18:02:41 -0400 Received: from v-f17-32.candelatech.com (unknown [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 3F5C940AEC4; Tue, 17 Mar 2015 15:02:40 -0700 (PDT) From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Ben Greear Subject: [PATCH] iw: Print OSEN element for HotSpot 2.0 IE. Date: Tue, 17 Mar 2015 15:02:33 -0700 Message-Id: <1426629753-16905-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.11.7 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Re-uses most of the print-rsn logic since only the header differs. Example output: ... HotSpot 2.0 OSEN: * Group cipher: NO-GROUP * Pairwise ciphers: CCMP * Authentication suites: OSEN * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c) Signed-off-by: Ben Greear --- scan.c | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/scan.c b/scan.c index 538b30e..f01921a 100644 --- a/scan.c +++ b/scan.c @@ -410,6 +410,9 @@ static void print_cipher(const uint8_t *data) case 6: printf("AES-128-CMAC"); break; + case 7: + printf("NO-GROUP"); + break; case 8: printf("GCMP"); break; @@ -466,24 +469,37 @@ static void print_auth(const uint8_t *data) data[0], data[1] ,data[2], data[3]); break; } + } else if (memcmp(data, wfa_oui, 3) == 0) { + switch (data[3]) { + case 1: + printf("OSEN"); + break; + default: + printf("%.02x-%.02x-%.02x:%d", + data[0], data[1] ,data[2], data[3]); + break; + } } else printf("%.02x-%.02x-%.02x:%d", data[0], data[1] ,data[2], data[3]); } -static void print_rsn_ie(const char *defcipher, const char *defauth, - uint8_t len, const uint8_t *data) +static void _print_rsn_ie(const char *defcipher, const char *defauth, + uint8_t len, const uint8_t *data, int is_osen) { bool first = true; - __u16 version, count, capa; + __u16 count, capa; int i; - version = data[0] + (data[1] << 8); - tab_on_first(&first); - printf("\t * Version: %d\n", version); + if (!is_osen) { + __u16 version; + version = data[0] + (data[1] << 8); + tab_on_first(&first); + printf("\t * Version: %d\n", version); - data += 2; - len -= 2; + data += 2; + len -= 2; + } if (len < 4) { tab_on_first(&first); @@ -627,6 +643,19 @@ static void print_rsn_ie(const char *defcipher, const char *defauth, } } +static void print_rsn_ie(const char *defcipher, const char *defauth, + uint8_t len, const uint8_t *data) +{ + _print_rsn_ie(defcipher, defauth, len, data, 0); +} + +static void print_osen_ie(const char *defcipher, const char *defauth, + uint8_t len, const uint8_t *data) +{ + printf("\n\t"); + _print_rsn_ie(defcipher, defauth, len, data, 1); +} + static void print_rsn(const uint8_t type, uint8_t len, const uint8_t *data) { print_rsn_ie("CCMP", "IEEE 802.1X", len, data); @@ -1076,6 +1105,11 @@ static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data) print_rsn_ie("TKIP", "IEEE 802.1X", len, data); } +static void print_wifi_osen(const uint8_t type, uint8_t len, const uint8_t *data) +{ + print_osen_ie("OSEN", "OSEN", len, data); +} + static bool print_wifi_wmm_param(const uint8_t *data, uint8_t len) { int i; @@ -1429,6 +1463,7 @@ static inline void print_hs20_ind(const uint8_t type, uint8_t len, const uint8_t static const struct ie_print wfa_printers[] = { [9] = { "P2P", print_p2p, 2, 255, BIT(PRINT_SCAN), }, [16] = { "HotSpot 2.0 Indication", print_hs20_ind, 1, 255, BIT(PRINT_SCAN), }, + [18] = { "HotSpot 2.0 OSEN", print_wifi_osen, 1, 255, BIT(PRINT_SCAN), }, }; static void print_vendor(unsigned char len, unsigned char *data,