From patchwork Fri Aug 24 19:01:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 961993 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=candelatech.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tZaTXGM7"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41xrHv2wBkz9ryn for ; Sat, 25 Aug 2018 05:02:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=IYXWFpMicS+zRZWVzmYDJ0aRA5VAQN+Tw5WwTSMq9pM=; b=tZa TXGM7FDTW+mpomwy+B2TRPQb7aYYM/UDhGY5Iz+zdFMNYxF0qkISSmAZ1q5okKaGiTH4jZOhfxC5w od5I5pX7/i21IW4B44jP+U0oDgq4dO7XVVTAA1c39Vsg7SgW39orSwHWjbkm2dLbcjeuIumalgk4T dzKxdG4KRqjVa/TmYVsIOD6gBFyb8ezZ/PUmAPPPNtJfsvGIClJqHOSiirD/qzW3yceLmD2Vd44px bQp/dCO7tYBSyHPw8VC6Erab5fbhHlLLiGYVMABtog8XIjCjkDdkJZyYXjj+IXEdDK2QwymAc74xb dsJY9x3IIFok9vQB7xT6gnCJUX5xtbA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftHLB-00052W-Fn; Fri, 24 Aug 2018 19:01:49 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftHL8-00051M-Lx for hostap@lists.infradead.org; Fri, 24 Aug 2018 19:01:48 +0000 Received: from v-f24-64.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id BA3E040A30A; Fri, 24 Aug 2018 12:01:31 -0700 (PDT) From: greearb@candelatech.com To: hostap@lists.infradead.org Subject: [PATCH 1/2] supported op class should take freq-list into account. Date: Fri, 24 Aug 2018 12:01:28 -0700 Message-Id: <1535137289-5425-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.7.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180824_120146_736059_87807321 X-CRM114-Status: GOOD ( 10.75 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: j@w1.fi, Ben Greear MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Ben Greear If a station is configured to scan only a subset of frequencies, then the supported operating classes may need to be more limited than what the hardware supports. Signed-off-by: Ben Greear --- wpa_supplicant/op_classes.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/wpa_supplicant/op_classes.c b/wpa_supplicant/op_classes.c index d23b009..d886134 100644 --- a/wpa_supplicant/op_classes.c +++ b/wpa_supplicant/op_classes.c @@ -14,6 +14,7 @@ #include "utils/common.h" #include "common/ieee802_11_common.h" #include "wpa_supplicant_i.h" +#include "config.h" static enum chan_allowed allow_channel(struct hostapd_hw_modes *mode, u8 chan, @@ -214,11 +215,41 @@ static int wpas_op_class_supported(struct wpa_supplicant *wpa_s, size_t i; struct hostapd_hw_modes *mode; int found; + int z; + int freq2 = 0; + int freq5 = 0; mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, op_class->mode); if (!mode) return 0; + /* If we are configured to disable certain things, then take that + * into account here. + */ + if (wpa_s->conf->freq_list && wpa_s->conf->freq_list[0]) { + z = 0; + while (1) { + int f = wpa_s->conf->freq_list[z]; + if (f == 0) + break; /* end of list */ + if (f > 3000) + freq5 = 1; + else if (f < 3000) + freq2 = 1; + z++; + } + } + else { + /* No frequencies specified, can use anything hardware supports */ + freq2 = freq5 = 1; + } + if ((op_class->op_class >= 115) && (op_class->op_class <= 130) && (!freq5)) { + return 0; + } + if ((op_class->op_class <= 84) && (op_class->op_class >= 81) && (!freq2)) { + return 0; + } + if (op_class->op_class == 128) { u8 channels[] = { 42, 58, 106, 122, 138, 155 };