From patchwork Wed Sep 18 07:39:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neo Jou X-Patchwork-Id: 1163800 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=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.b="YZn8S5eP"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="d57xpy2f"; 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 46YBj65L9xz9sCJ for ; Wed, 18 Sep 2019 17:40:26 +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=PSEpBd/Wen8BN5WWa1R7B2A4UhvTk4+zxhseLsIsqbQ=; b=YZn 8S5ePSP5lxqEOfS4reQ83zeed8MGt5EhoK/z0yIRGpqIESD9WVQYP43ZSKGHZ4dOmUgRoAO/1klt2 yO0V+8gyBlDWy0wfAhaLlUvAjsf/CmJObGkPsmhv3ykIj1le0a1+4svnkOb26zd2Ndm8X2ZuTTiJX 2uW45AdIu3QwiSW0+naX4Wjmp6BEVA3oWayEDbHAxEyhDus24RepMZw6auPv4HhjQq0yrBcIVgt+5 SwzGcqSCNx28EvsSLyRCxHNoH5PNZRxiuXuNK+SEFwm8Km7QpXL+6eBlFhAuhyPqmVhOQIe014e96 BbTnR2ANRjE5VASDlMG3DOtLi/cs1GQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iAUZW-0005vG-5X; Wed, 18 Sep 2019 07:40:18 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iAUZR-0005uu-T7 for hostap@lists.infradead.org; Wed, 18 Sep 2019 07:40:15 +0000 Received: by mail-pl1-x643.google.com with SMTP id x6so1232921plv.6 for ; Wed, 18 Sep 2019 00:40:13 -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=8wvhhoJMp8VWIBvV0LW90w7lz+258japRaJO+nzF2CU=; b=d57xpy2f/wgxrHfG93phJSZL3+IwWtw0rqzHiOIMc66O5vV/LCCc+D+GB2Zmlcpbot Zl3ebBbrLpLSncpeofbzG8FvygRXHxxeO2MG5888iRPWn8xXtsZ+ZUbo9Nz+1JiT+6Y4 ws+0shJndmgqISdYSzcMb1zhAbvhMEyYtbiO2l+gDdH+HpRHxIO1s1k6J4a5dKXC4ABl 2hUd4nxYnrdJtqPkY78HUFlELM6j/TSWv39w2C8XXVlm7fHLspuKRHAmq7lLqZ3PEAxx YJccAm5DkOQoKbQtmNafWhA2iEgZLHgPrrWRoisT6hEY6L/s17D1+/0crEFDKClte01Q PSyA== 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=8wvhhoJMp8VWIBvV0LW90w7lz+258japRaJO+nzF2CU=; b=ZTYU0GUzsIC8FpjAs8Nj0OMP0m2oPBgRCp80PKNBTSEstXBQx6NoRHGMwaT0gbjnsE ByFI3BDXlqlhwlA7ciQr/oVsEc/HxbwtwgAj44farEG7i1X4FLrRuFQPGvloyu99xyPc ijQuXcXSoVfyjJf9x9BSd3VnGzdnCraUkDivGvF48hqCG/vW9BdJbf7v+Euc8nzvrEal 9cYIKnm9y0tZIRcR2Y2RLx8fAjbNiQ9I2XZr8/10vzCZydKgLkktvGx5mDy2KnKPPZ94 CeKWlcElInzEl+wYXEBQFCxqHwQjQytW2k+Dro7d2yDiUSKU5pjBExhdtNijJaU+bTZq qsaA== X-Gm-Message-State: APjAAAVJTdKFas1+vHBAekhy/MYWRqpijVwqsojjRcNIw3+LsKIb7qxs V58WG52B0WQQoRsmudXxGSmPoiKT X-Google-Smtp-Source: APXvYqwFzhuM05kOlTRvCbyJ+Eh/uh3vAAsTcPQAe2wCm9Rug8MCN0KCYlIq6hJ859kd0ShaUkcGGw== X-Received: by 2002:a17:902:7045:: with SMTP id h5mr2745033plt.161.1568792412751; Wed, 18 Sep 2019 00:40:12 -0700 (PDT) Received: from localhost ([49.215.225.194]) by smtp.gmail.com with ESMTPSA id v191sm8285182pgb.41.2019.09.18.00.40.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2019 00:40:11 -0700 (PDT) From: neojou@gmail.com To: hostap@lists.infradead.org Subject: [PATCH] ACS: to improve the checking of available ACS channel list Date: Wed, 18 Sep 2019 15:39:50 +0800 Message-Id: <1568792390-8232-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-20190918_004013_955131_34088D25 X-CRM114-Status: GOOD ( 12.32 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 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:643 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -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: neojou@gmail.com MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Neo Jou When we set "channel=0" in hostapd.conf to enable ACS function, and set the wrong channel list, e.g. chanlist=222-999 on purpose, hostapd will still start ACS process to compute ideal channel, even there is no available channel in this setting. Though there is no problem since hostapd fails to initialize interface, it spends time and may cause some problem to tell if the setting is correct at the first. Thus would like to suggest the following patch, we can check if there is any available channels in the function acs_request_scan() at the first, and return -1 if no available channel, then it will fail at acs_init(), without doing ACS computation. It will show the following in the log: Could not select hw_mode and channel. (-3) wlan0: interface state UNINITIALIZED->DISABLED Then we can know the setting is incorrect at the first at hostapd_select_hw_mode(), instead of waiting for scan callback function to know if the setting is ok for ACS or not. It can save time and help to tell if the setting is correct at the initial function at the first. Signed-off-by: Neo Jou --- src/ap/acs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ap/acs.c b/src/ap/acs.c index 11178a1..e1e196d 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -942,6 +942,10 @@ static int acs_request_scan(struct hostapd_iface *iface) } *freq = 0; + if (params.freqs == freq) { /* No available channel */ + return -1; + } + iface->scan_cb = acs_scan_complete; wpa_printf(MSG_DEBUG, "ACS: Scanning %d / %d",