From patchwork Thu Oct 15 17:08:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 530824 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]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A46001402B7 for ; Fri, 16 Oct 2015 04:10:43 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id CC1EC17C932; Thu, 15 Oct 2015 13:10:07 -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 TxA5VLROGIpJ; Thu, 15 Oct 2015 13:10:07 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9D50A17C941; Thu, 15 Oct 2015 13:09:13 -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 A909017C648 for ; Thu, 15 Oct 2015 13:08:28 -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 hIVezd1gYJQv for ; Thu, 15 Oct 2015 13:08:26 -0400 (EDT) Received: from mail2.candelatech.com (mail2.candelatech.com [208.74.158.173]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2189817C7EA for ; Thu, 15 Oct 2015 13:08:14 -0400 (EDT) Received: from localhost.localdomain (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 1F90C40A69D; Thu, 15 Oct 2015 10:08:14 -0700 (PDT) From: greearb@candelatech.com To: hostap@lists.shmoo.com Subject: [RFC 4/4] scan: Use specified legacy rateset in probe requests. Date: Thu, 15 Oct 2015 13:08:05 -0400 Message-Id: <1444928885-4909-4-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1444928885-4909-1-git-send-email-greearb@candelatech.com> References: <1444928885-4909-1-git-send-email-greearb@candelatech.com> Cc: j@w1.fi, Ben Greear 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: Ben Greear If user has specified a legacy rateset, then use that in probe requests so that the proper rates are advertised on the air. Could do the same with HT/VHT rates someday perhaps. Signed-off-by: Ben Greear --- src/drivers/driver_nl80211_scan.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c index 4b762ea..1a64cbe 100644 --- a/src/drivers/driver_nl80211_scan.c +++ b/src/drivers/driver_nl80211_scan.c @@ -111,6 +111,8 @@ nl80211_scan_common(struct i802_bss *bss, u8 cmd, struct nl_msg *msg; size_t i; u32 scan_flags = 0; + struct nlattr *nlrates; + unsigned char rates[12]; msg = nl80211_cmd_msg(bss, 0, cmd); if (!msg) @@ -133,6 +135,30 @@ nl80211_scan_common(struct i802_bss *bss, u8 cmd, nla_nest_end(msg, ssids); } + i = nl80211_build_legacy_rateset(bss->adv_legacy_rates, 0, rates); + if (bss->adv_legacy_rates & (1<<31)) { + /* User has specified a legacy rateset, use it. */ + nlrates = nla_nest_start(msg, NL80211_ATTR_SCAN_SUPP_RATES); + if (!nlrates) + goto fail; + + if (nla_put(msg, NL80211_BAND_2GHZ, i, rates)) + goto fail; + + /* If only /b rates are set, then we will just ignore + * setting 5Ghz at all and assume that other config will keep + * us from trying to use that band. + */ + if (bss->adv_legacy_rates & 0xFF0) { + i = nl80211_build_legacy_rateset(bss->adv_legacy_rates, 1, rates); + if (nla_put(msg, NL80211_BAND_5GHZ, i, rates)) + goto fail; + } + + /* TODO: Someday pay attention to individual HT/VHT rates as well? */ + nla_nest_end(msg, nlrates); + } + if (params->extra_ies) { wpa_hexdump(MSG_MSGDUMP, "nl80211: Scan extra IEs", params->extra_ies, params->extra_ies_len);