From patchwork Sun Nov 9 16:50:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arik Nemtsov X-Patchwork-Id: 5261611 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C070C9F295 for ; Sun, 9 Nov 2014 16:50:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3D492011D for ; Sun, 9 Nov 2014 16:50:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB8C120136 for ; Sun, 9 Nov 2014 16:50:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752099AbaKIQuo (ORCPT ); Sun, 9 Nov 2014 11:50:44 -0500 Received: from mail-wg0-f53.google.com ([74.125.82.53]:37262 "EHLO mail-wg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751954AbaKIQum (ORCPT ); Sun, 9 Nov 2014 11:50:42 -0500 Received: by mail-wg0-f53.google.com with SMTP id b13so7092009wgh.40 for ; Sun, 09 Nov 2014 08:50:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=krTubMJ8Zmz3SUAAlqaDiMZw9xGjjwRHE0kRinGDn8A=; b=cw2LLXI4tjCrtP0um6aj3z3065CzasSoFGPZLhCKFRv/rvhCVszJB1i6f+2jzDIi1p Qdi/5/EMAwvXDLT+keo+ZBMUuqKDHxdeuEgo6I/ViDjlWxWd4zcZVBowOs3h3u+xFKfK 2cTqYRTQoN/QOTXrRQDAnjXC7eD5S0adlLvwu1EeAQ5iDrGSvORiEIg8SVPmEgWLMtbY wM3q0xsPGmez+z23kLk7KnZqp/kIszFsiZXURPg9Ic5T3N5aqVmdW799IxMMCsYjWiwf JfV0XRHu5eYSVGAeLRV6w27+JLoVsjMTMy/kyijihzh7teC6bxhIGeTBxdzEfcU7cyA5 2PFw== X-Gm-Message-State: ALoCoQm/jPvsjxrk424doLKzjqLNz21WO4FEYkO9CLd7M2GuuJyAeL5NclsLPBinqVtaCUMU7ZXN X-Received: by 10.180.21.166 with SMTP id w6mr22968877wie.43.1415551841734; Sun, 09 Nov 2014 08:50:41 -0800 (PST) Received: from athena.amr.corp.intel.com (93-172-126-236.bb.netvision.net.il. [93.172.126.236]) by mx.google.com with ESMTPSA id r2sm9994037wif.23.2014.11.09.08.50.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 09 Nov 2014 08:50:41 -0800 (PST) From: Arik Nemtsov To: Cc: Johannes Berg , Arik Nemtsov Subject: [PATCH 12/16] mac80211: add parsing of TDLS specific IEs Date: Sun, 9 Nov 2014 18:50:18 +0200 Message-Id: <1415551822-20121-12-git-send-email-arik@wizery.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415551822-20121-1-git-send-email-arik@wizery.com> References: <1415551822-20121-1-git-send-email-arik@wizery.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=-6.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_RHS_DOB 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 These are used in TDLS channel switching code. Signed-off-by: Arik Nemtsov Reviewed-by: Johannes Berg Signed-off-by: Arik Nemtsov --- include/linux/ieee80211.h | 15 +++++++++++++++ net/mac80211/ieee80211_i.h | 2 ++ net/mac80211/util.c | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index fbb02d2..4f4eea8 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -1067,6 +1067,12 @@ struct ieee80211_pspoll { /* TDLS */ +/* Channel switch timing */ +struct ieee80211_ch_switch_timing { + __le16 switch_time; + __le16 switch_timeout; +} __packed; + /* Link-id information element */ struct ieee80211_tdls_lnkie { u8 ie_type; /* Link Identifier IE */ @@ -1108,6 +1114,15 @@ struct ieee80211_tdls_data { u8 dialog_token; u8 variable[0]; } __packed discover_req; + struct { + u8 target_channel; + u8 oper_class; + u8 variable[0]; + } __packed chan_switch_req; + struct { + __le16 status_code; + u8 variable[0]; + } __packed chan_switch_resp; } u; } __packed; diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 4b3a7e7..e786ab6 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1400,6 +1400,8 @@ struct ieee802_11_elems { size_t total_len; /* pointers to IEs */ + const struct ieee80211_tdls_lnkie *lnk_id; + const struct ieee80211_ch_switch_timing *ch_sw_timing; const u8 *ext_capab; const u8 *ssid; const u8 *supp_rates; diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 3ca0c2e..9e5bfd6 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -832,6 +832,8 @@ u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, case WLAN_EID_WIDE_BW_CHANNEL_SWITCH: case WLAN_EID_CHAN_SWITCH_PARAM: case WLAN_EID_EXT_CAPABILITY: + case WLAN_EID_CHAN_SWITCH_TIMING: + case WLAN_EID_LINK_ID: /* * not listing WLAN_EID_CHANNEL_SWITCH_WRAPPER -- it seems possible * that if the content gets bigger it might be needed more than once @@ -851,6 +853,20 @@ u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, elem_parse_failed = false; switch (id) { + case WLAN_EID_LINK_ID: + if (elen + 2 != sizeof(struct ieee80211_tdls_lnkie)) { + elem_parse_failed = true; + break; + } + elems->lnk_id = (void *)(pos - 2); + break; + case WLAN_EID_CHAN_SWITCH_TIMING: + if (elen != sizeof(struct ieee80211_ch_switch_timing)) { + elem_parse_failed = true; + break; + } + elems->ch_sw_timing = (void *)pos; + break; case WLAN_EID_EXT_CAPABILITY: elems->ext_capab = pos; elems->ext_capab_len = elen;