From patchwork Tue Sep 8 09:46:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilan Peer X-Patchwork-Id: 515355 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id B6FC914016A for ; Tue, 8 Sep 2015 19:52:01 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 843809C210; Tue, 8 Sep 2015 05:51:51 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Heb90RclyAId; Tue, 8 Sep 2015 05:51:51 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id F27939C199; Tue, 8 Sep 2015 05:48:28 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id F001517C072 for ; Tue, 8 Sep 2015 05:48:26 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SUrMLdBxlvGi for ; Tue, 8 Sep 2015 05:48:22 -0400 (EDT) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 165729C12A for ; Tue, 8 Sep 2015 05:47:16 -0400 (EDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 08 Sep 2015 02:47:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,489,1437462000"; d="scan'208";a="557430986" Received: from unknown (HELO JEL00311.ger.corp.intel.com) ([10.12.217.137]) by FMSMGA003.fm.intel.com with ESMTP; 08 Sep 2015 02:47:14 -0700 From: Ilan Peer To: hostap@lists.shmoo.com Subject: [PATCH 18/26] ap: Advertise supported operating classes IE Date: Tue, 8 Sep 2015 12:46:25 +0300 Message-Id: <1441705593-1184-19-git-send-email-ilan.peer@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441705593-1184-1-git-send-email-ilan.peer@intel.com> References: <1441705593-1184-1-git-send-email-ilan.peer@intel.com> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Andrei Otcheretianski Advertise current operating class in beacons and probe responses. This IE is required by the spec when extended channel switch is supported. However, since this IE doesn't reflect correctly the sub-band spectrum breakdown and can't be effectively used by clients, publish only the minimal required part which is the current op. class. Signed-off-by: Andrei Otcheretianski --- src/ap/beacon.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 32e054e..3887f4a 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -328,6 +328,34 @@ static u8 *hostapd_eid_ecsa(struct hostapd_data *hapd, u8 *eid) } +static u8 *hostapd_eid_supported_op_classes(struct hostapd_data *hapd, u8 *eid) +{ + u8 op_class, channel; + + if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) || + !hapd->iface->freq) + return eid; + + if (ieee80211_freq_to_channel_ext(hapd->iface->freq, + hapd->iconf->secondary_channel, + hapd->iconf->vht_oper_chwidth, + &op_class, &channel) == + NUM_HOSTAPD_MODES) + return eid; + + *eid++ = WLAN_EID_SUPPORTED_OPERATING_CLASSES; + *eid++ = 2; + + /* Current op. class must be first */ + *eid++ = op_class; + + /* TODO: advertise all the supported op. classes */ + *eid++ = 0; + + return eid; +} + + static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, const struct ieee80211_mgmt *req, int is_p2p, size_t *resp_len) @@ -419,6 +447,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, hapd->cs_c_off_ecsa_proberesp = csa_pos - (u8 *)resp - 1; pos = csa_pos; + pos = hostapd_eid_supported_op_classes(hapd, pos); #ifdef CONFIG_IEEE80211N /* Secondary channel IE */ @@ -1005,6 +1034,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, tailpos = csa_pos; + tailpos = hostapd_eid_supported_op_classes(hapd, tailpos); + #ifdef CONFIG_IEEE80211N /* Secondary Channel IE */ /* TODO: The spec doesn't specify secondary channel IE position */