From patchwork Mon Nov 28 15:38:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 700028 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tS9pp70qsz9vFq for ; Tue, 29 Nov 2016 02:39:45 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cBO1c-00084e-MJ; Mon, 28 Nov 2016 15:39:24 +0000 Received: from s3.sipsolutions.net ([5.9.151.49] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cBO1Y-0007st-D2 for hostap@lists.infradead.org; Mon, 28 Nov 2016 15:39:21 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.88) (envelope-from ) id 1cBO18-0006vJ-99; Mon, 28 Nov 2016 16:38:54 +0100 From: Benjamin Berg To: hostap@lists.infradead.org Subject: [RFC 3/6] mesh: Allow DFS channels to be selected if dfs is enabled Date: Mon, 28 Nov 2016 16:38:40 +0100 Message-Id: <20161128153843.3179-4-benjamin@sipsolutions.net> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161128153843.3179-1-benjamin@sipsolutions.net> References: <20161128153843.3179-1-benjamin@sipsolutions.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161128_073920_700935_10958A05 X-CRM114-Status: UNSURE ( 8.61 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-3.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [5.9.151.49 listed in list.dnswl.org] -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr . Pannirselvam Kanagaratnam" , Benjamin Berg , Simon Wunderlich MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Note: DFS is assumed to be usable if a country code has been set Signed-off-by: Benjamin Berg --- wpa_supplicant/wpa_supplicant.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 5d6326a..3f37077 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1862,6 +1862,9 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, struct hostapd_freq_params vht_freq; int chwidth, seg0, seg1; u32 vht_caps = 0; + /* Assume DFS is allowed if country is set for now! */ + int dfs_enabled = wpa_s->conf->country[0] && + (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR); freq->freq = ssid->frequency; @@ -1938,7 +1941,9 @@ 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) || + (!dfs_enabled && !(pri_chan->flag & HOSTAPD_CHAN_RADAR) && + (pri_chan->flag & HOSTAPD_CHAN_NO_IR))) return; #ifdef CONFIG_HT_OVERRIDES @@ -1965,7 +1970,9 @@ 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) || + (!dfs_enabled && !(sec_chan->flag & HOSTAPD_CHAN_RADAR) && + (sec_chan->flag & HOSTAPD_CHAN_NO_IR))) return; freq->channel = pri_chan->chan; @@ -2049,7 +2056,9 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, 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) || + (!dfs_enabled && !(chan->flag & HOSTAPD_CHAN_RADAR) && + (chan->flag & HOSTAPD_CHAN_NO_IR))) return; } @@ -2070,9 +2079,9 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, if (!chan) continue; - if (chan->flag & (HOSTAPD_CHAN_DISABLED | - HOSTAPD_CHAN_NO_IR | - HOSTAPD_CHAN_RADAR)) + if ((chan->flag & HOSTAPD_CHAN_DISABLED) || + (!dfs_enabled && !(chan->flag & HOSTAPD_CHAN_RADAR) && + (chan->flag & HOSTAPD_CHAN_NO_IR))) continue; /* Found a suitable second segment for 80+80 */