From patchwork Mon May 11 07:42:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neo Jou X-Patchwork-Id: 1287518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=qE/p9GqR; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=KLaeM1wi; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49LCbc27ksz9sRY for ; Mon, 11 May 2020 17:43:24 +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=0lsSeSBZihOFvB2a6ug8rlYq5oL72arwZNhxKNjg3Kw=; b=qE/ p9GqR6SK9UFwTVpFjetVihvXA+Aw+AQOk3FkLcoFqYLyvbIIYs14ymJ4/Z6+sAO5j5vc9L8LiSo+p xK6hZ8JF7gkzEwW3Rv6gP4V3GDiQK1mazZzONmrLIdRpUMRLZrnRKN1I7Z0uQJkJ802BK8wgVkhOV vFLwt5vDuGF9f94luZU/BCwlftGLj8Wu3F4PzJXG1L+XFkLzcmphdDxQS3t6TGYBVcVNc39BouW70 UEntlAWimTfrn1VX2wkliaR7iobZiCvs8l7a+PpOPA/ZWjnyu45txM9TSzC44PBfxDdOHezm7KCuB XvfckcNYEMkVcGchmHYI40IsYilX2LQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jY35f-0007VD-Kx; Mon, 11 May 2020 07:43:07 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jY35b-0007Tw-LH for hostap@lists.infradead.org; Mon, 11 May 2020 07:43:04 +0000 Received: by mail-pl1-x641.google.com with SMTP id b12so1672311plz.13 for ; Mon, 11 May 2020 00:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=u9fnUIDpm20l+ZK0LVzUHOg7rAlMTd14v0MuTxJwttA=; b=KLaeM1wiFWzl6v25XZQVaC3gpo3LHpHsAmkZLpLLo65puA9wucFbwYfvmvQzsQQUeA PeKoAkwfWoDFBhH6Qg1564kiDdIxDofFR7CNWQ8FV9HRtcQ3iBfhOfgRK6xDH3wIV1CX i+tTl2ajFlVBUSw0QpMDmRGVVbMCVuhterNAty9eTPD5fY+yGyvytTAZzSK3grWARTHI 3MjPW6vbMtLvUTPa+C1nVX9Ed65ZcwIZxY6nHhahRChKJ8yzN5oujKFiJyiSBqYWSUE+ mGSv3hqktyXZfk2n5tWlK0jwO/P7/rm+6CepZcR4rgTLo+HFqhsgM3BiKraObWnSZsEo Kp3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=u9fnUIDpm20l+ZK0LVzUHOg7rAlMTd14v0MuTxJwttA=; b=OUuAdzOOWMABnGOmpSF043IBCgUp7oj0M8gX5MCxSMx+pF1/Jq8y38JT07p6TePfYJ t0XyQdC0W7g5Nz9wOVxfNk0lHIjW8A01QX6JSDneLBG/BWx7mJ5LrxKFnrXataasdpMg NRDM4Wy4HPXC2LiJxYjVxVIYsqelB39jv9s6Jo7CEAkteNyTec9eFMfZTeEy7g3o2agm PTgCItN7qWblkvKHWfWjiLPnq84c6BSpq9JaF3AVo5WIoNzDcu4UXCKSDnTWjbg8C5hi lqPm0CNX8eja6BlDCkgNgVPHU0q138n6op1fSVJxxwpMu+nqFI1LfZqUjr/k9/nrX3eu im0g== X-Gm-Message-State: AGi0PuZ7fkd4FyS9n1s2mDxBOvu711kUltEjHTuX+FLA/4PbebHe8YeS dFQKNYCOfV7LNlaJubjErtXshdZONyBVSw== X-Google-Smtp-Source: APiQypL+2NDmQRHqmAHogF+1m+XUIau4eOZd6C80rhVpwWDOSp6s6SIDWBAPA7gYcDajQq88eZhAKg== X-Received: by 2002:a17:90a:fc89:: with SMTP id ci9mr20555863pjb.140.1589182982316; Mon, 11 May 2020 00:43:02 -0700 (PDT) Received: from localhost ([49.216.75.103]) by smtp.gmail.com with ESMTPSA id q21sm8392081pfg.131.2020.05.11.00.43.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:43:01 -0700 (PDT) From: neojou@gmail.com To: hostap@lists.infradead.org Subject: [PATCH] ACS: channel selection based freqlist Date: Mon, 11 May 2020 15:42:49 +0800 Message-Id: <1589182969-3523-1-git-send-email-neojou@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200511_004303_692066_02372553 X-CRM114-Status: UNSURE ( 8.58 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [neojou[at]gmail.com] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: neo_jou , neojou@gmail.com MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: neo_jou When doing ACS, check freqlist also if there is the config. Signed-off-by: neojou --- src/ap/acs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ap/acs.c b/src/ap/acs.c index 5c01610..6f074db 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -511,6 +511,14 @@ static int is_in_chanlist(struct hostapd_iface *iface, return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan); } +static int is_in_freqlist(struct hostapd_iface *iface, + struct hostapd_channel_data *chan) +{ + if (!iface->conf->acs_freq_list.num) + return 1; + + return freq_range_list_includes(&iface->conf->acs_freq_list, chan->freq); +} static void acs_survey_mode_interference_factor( struct hostapd_iface *iface, struct hostapd_hw_modes *mode) @@ -527,6 +535,9 @@ static void acs_survey_mode_interference_factor( if (!is_in_chanlist(iface, chan)) continue; + if (!is_in_freqlist(iface, chan)) + continue; + wpa_printf(MSG_DEBUG, "ACS: Survey analysis for channel %d (%d MHz)", chan->chan, chan->freq); @@ -651,6 +662,9 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, if (!is_in_chanlist(iface, chan)) continue; + if (!is_in_freqlist(iface, chan)) + continue; + if (!chan_bw_allowed(chan, bw, 1, 1)) { wpa_printf(MSG_DEBUG, "ACS: Channel %d: BW %u is not supported", @@ -1013,6 +1027,9 @@ static int * acs_request_scan_add_freqs(struct hostapd_iface *iface, if (!is_in_chanlist(iface, chan)) continue; + if (!is_in_freqlist(iface, chan)) + continue; + *freq++ = chan->freq; }