From patchwork Tue Jun 30 12:18:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319814 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=2001:8b0:10b:1231::1; helo=merlin.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=tu-ilmenau.de 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=merlin.20170209 header.b=oCtmmBPO; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 49x3N567mtz9sRN for ; Tue, 30 Jun 2020 22:20:20 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=YyQeWn5x2zLCl2zvpgds7C+7Qqjq3Pw47OwzBxkxLCI=; b=oCtmmBPO+q1g/FuBo6kA426Rw T0ikSoHtOno7VV32u9EE375fQlpxnvU3sCF3pABJzepFGFtMwiZsBhErfX/+bjPIoA8PoKG99SKxU tKKN62pPkEClr9HMD428gPqBJwM+xo1JvBjqn6wUOcG/DEXSV5oSx6+t22h3XqkRr1hLG3fc3xnr+ V9d9Nas0msK/8LOtybaeDiQcEoqVW5I+LZZkGfd0ZswtDKWhuEpHpHGtshySjZPhORFnSKWupQB+F K/y0dPXgFnu7BO0gr4reHlU0tcl+/Oth9JQakiObOlCtRf+k5wW9xkKlviuFrczRNY5tfdCUlGGbL ewDFoT1Sg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEZ-00030U-Is; Tue, 30 Jun 2020 12:19:31 +0000 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEQ-0002xv-Gg for hostap@lists.infradead.org; Tue, 30 Jun 2020 12:19:24 +0000 Received: from legolas.prakinf.tu-ilmenau.de (unknown [141.24.207.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 5BBF5580084; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 03/12] mesh: Allow DFS channels to be selected if dfs is enabled Date: Tue, 30 Jun 2020 14:18:58 +0200 Message-Id: <20200630121907.132751-4-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200630121907.132751-1-markus.theil@tu-ilmenau.de> References: <20200630121907.132751-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [141.24.186.67 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 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: Benjamin Berg , masashi.honma@gmail.com, Peter Oh Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Peter Oh Note: DFS is assumed to be usable if a country code has been set Signed-off-by: Benjamin Berg Signed-off-by: Peter Oh --- wpa_supplicant/wpa_supplicant.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index e7989baef..d5ed6f87e 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2356,6 +2356,8 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, int chwidth, seg0, seg1; u32 vht_caps = 0; int is_24ghz; + int dfs_enabled = wpa_s->conf->country[0] && + (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); freq->freq = ssid->frequency; @@ -2443,8 +2445,11 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, return; /* Check primary channel flags */ - if (pri_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) + if (pri_chan->flag & HOSTAPD_CHAN_DISABLED) return; + if (pri_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) + if (!dfs_enabled) + return; freq->channel = pri_chan->chan; @@ -2477,8 +2482,11 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, return; /* Check secondary channel flags */ - if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) + if (sec_chan->flag & HOSTAPD_CHAN_DISABLED) return; + if (sec_chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) + if (!dfs_enabled) + return; if (ht40 == -1) { if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS)) @@ -2571,8 +2579,11 @@ skip_ht40: return; /* Back to HT configuration if channel not usable */ - if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR)) + if (chan->flag & HOSTAPD_CHAN_DISABLED) return; + if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR)) + if (!dfs_enabled) + return; } chwidth = CHANWIDTH_80MHZ; @@ -2592,10 +2603,12 @@ skip_ht40: if (!chan) continue; - if (chan->flag & (HOSTAPD_CHAN_DISABLED | - HOSTAPD_CHAN_NO_IR | - HOSTAPD_CHAN_RADAR)) + if (chan->flag & HOSTAPD_CHAN_DISABLED) continue; + if (chan->flag & (HOSTAPD_CHAN_RADAR | + HOSTAPD_CHAN_NO_IR)) + if (!dfs_enabled) + continue; /* Found a suitable second segment for 80+80 */ chwidth = CHANWIDTH_80P80MHZ;