From patchwork Wed Oct 10 20:47:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 10635251 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C03014DB for ; Wed, 10 Oct 2018 20:48:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E6222A6E0 for ; Wed, 10 Oct 2018 20:48:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C5D32A925; Wed, 10 Oct 2018 20:48:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C78C32A6E0 for ; Wed, 10 Oct 2018 20:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725869AbeJKEMN (ORCPT ); Thu, 11 Oct 2018 00:12:13 -0400 Received: from mx2.mailbox.org ([80.241.60.215]:14472 "EHLO mx2.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725822AbeJKEMN (ORCPT ); Thu, 11 Oct 2018 00:12:13 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 77B044062F; Wed, 10 Oct 2018 22:48:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id DKge78E_7PTE; Wed, 10 Oct 2018 22:48:19 +0200 (CEST) From: Hauke Mehrtens To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Hauke Mehrtens Subject: [PATCH 2/2] iw: scan: parse OWE Transition Mode element Date: Wed, 10 Oct 2018 22:47:47 +0200 Message-Id: <20181010204747.1555-2-hauke@hauke-m.de> In-Reply-To: <20181010204747.1555-1-hauke@hauke-m.de> References: <20181010204747.1555-1-hauke@hauke-m.de> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds code to parse the Opportunistic Wireless Encryption Transition Mode element. Without this patch the output looks like this: WFA 0x1c, data: 00 37 b7 36 dc 0c 08 4f 70 65 6e 57 72 74 34 With this patch it looks like this: OWE Transition Mode: BSSID: 00:37:b7:36:dc:0c SSID: OpenWrt4 Signed-off-by: Hauke Mehrtens --- scan.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scan.c b/scan.c index 7695216..a798c70 100644 --- a/scan.c +++ b/scan.c @@ -1950,10 +1950,39 @@ static inline void print_hs20_ind(const uint8_t type, uint8_t len, printf("\t\tUnexpected length: %i\n", len); } +static void print_wifi_owe_tarns(const uint8_t type, uint8_t len, + const uint8_t *data, + const struct print_ies_data *ie_buffer) +{ + char mac_addr[20]; + int ssid_len; + + printf("\n"); + if (len < 7) + return; + + mac_addr_n2a(mac_addr, data); + printf("\t\tBSSID: %s\n", mac_addr); + + ssid_len = data[6]; + if (ssid_len > len - 7) + return; + printf("\t\tSSID: "); + print_ssid_escaped(ssid_len, data + 7); + printf("\n"); + + /* optional elements */ + if (len >= ssid_len + 9) { + printf("\t\tBand Info: %u\n", data[ssid_len + 7]); + printf("\t\tChannel Info: %u\n", data[ssid_len + 8]); + } +} + 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), }, + [28] = { "OWE Transition Mode", print_wifi_owe_tarns, 7, 255, BIT(PRINT_SCAN), }, }; static void print_vendor(unsigned char len, unsigned char *data,