From patchwork Tue Jun 30 12:18:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319820 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=VFR16eDU; 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 49x3N72hcGz9sTJ 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=BJHgB1+edcS5vjs7gQW7pvggqSYYnMMga459ZBVSG4s=; b=VFR16eDUaIuOxL9Q/gco7nmYl 0XASZDniKVRlpFgiibk8JRdPC+haK7KHwg/dtNxCr+Jr8aN21W0ZaO/vOrKMBBMI+ulpiR+3h82lQ DAx18bxalx3B1PzqgjiUSOQysKqT7IwT64dLMxPRrfJdzNrAvccxPDVY/4wQDTXeTIvolwv47zH7Z 81U19bMJwvaGxzQf1kdk+E8BnA2+JtfBxfp9egNEJMNkCkmpOX1Zmu9NGa2JOWWbpInVKyrfSoenW zEnoYSmzG+S6aqMe38xaessvbkSOvsm+BXhzF4XWeuYUEr16kaflj2YjCYuxiCS5zshaJTut3uEOS c7oUmV5eg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEa-00030g-BY; Tue, 30 Jun 2020 12:19:32 +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-0002xt-Gc 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 47AF7580082; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 01/12] mesh: use setup completion callback to complete mesh join Date: Tue, 30 Jun 2020 14:18:56 +0200 Message-Id: <20200630121907.132751-2-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: masashi.honma@gmail.com, Peter Oh Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Peter Oh mesh join function is the last function to be called during mesh join process, but it's been called a bit earlier than it's supposed to be, so that some mesh parameter values such as VHT capabilities not applied correct when mesh join is in process. Moreover current design of mesh join that is called directly after mesh initialization isn't suitable for DFS channels to use, since mesh join process should be paused until DFS CAC is done and resumed after it's done. The callback will be called by hostapd_setup_interface_complete_sync. There is possiblity that completing mesh init fails, so add error handle codes. Signed-off-by: Peter Oh --- src/ap/hostapd.c | 11 ++++++++++- wpa_supplicant/mesh.c | 12 ++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index b37f49f9a..04aebe31a 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -434,6 +434,8 @@ static void hostapd_free_hapd_data(struct hostapd_data *hapd) #ifdef CONFIG_MESH wpabuf_free(hapd->mesh_pending_auth); hapd->mesh_pending_auth = NULL; + /* handling setup failure is already done */ + hapd->setup_complete_cb = NULL; #endif /* CONFIG_MESH */ hostapd_clean_rrm(hapd); @@ -2156,6 +2158,13 @@ dfs_offload: if (hapd->setup_complete_cb) hapd->setup_complete_cb(hapd->setup_complete_cb_ctx); +#ifdef CONFIG_MESH + if (delay_apply_cfg && iface->mconf == NULL) { + wpa_printf(MSG_ERROR, "Error while completing mesh init"); + goto fail; + } +#endif /* CONFIG_MESH */ + wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", iface->bss[0]->conf->iface); if (iface->interfaces && iface->interfaces->terminate_on_error > 0) @@ -2299,7 +2308,7 @@ int hostapd_setup_interface(struct hostapd_iface *iface) ret = setup_interface(iface); if (ret) { wpa_printf(MSG_ERROR, "%s: Unable to setup interface.", - iface->bss[0]->conf->iface); + iface->conf ? iface->conf->bss[0]->iface : "N/A"); return -1; } diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 941c95cfd..1453bdc01 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -193,7 +193,6 @@ static int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s) return !wpa_s->mesh_rsn ? -1 : 0; } - static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) { struct hostapd_iface *ifmsh = wpa_s->ifmsh; @@ -244,6 +243,13 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) } +static void wpas_mesh_complete_cb(void *arg) +{ + struct wpa_supplicant *wpa_s = arg; + wpas_mesh_complete(wpa_s); +} + + static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, struct hostapd_freq_params *freq) @@ -267,6 +273,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, if (!ifmsh) return -ENOMEM; + ifmsh->owner = wpa_s; ifmsh->drv_flags = wpa_s->drv_flags; ifmsh->drv_flags2 = wpa_s->drv_flags2; ifmsh->num_bss = 1; @@ -285,6 +292,8 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, bss->drv_priv = wpa_s->drv_priv; bss->iface = ifmsh; bss->mesh_sta_free_cb = mesh_mpm_free_sta; + bss->setup_complete_cb = wpas_mesh_complete_cb; + bss->setup_complete_cb_ctx = wpa_s; frequency = ssid->frequency; if (frequency != freq->freq && frequency == freq->freq + freq->sec_channel_offset * 20) { @@ -523,7 +532,6 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, goto out; } - ret = wpas_mesh_complete(wpa_s); out: return ret; } From patchwork Tue Jun 30 12:18:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319816 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=AQtJcwP+; 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 49x3N65sC2z9sT2 for ; Tue, 30 Jun 2020 22:20:22 +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=1aAiCLuKJD16YFF9Jp+24eNJ6iQ5Q9LojojE1GZO9w8=; b=AQtJcwP+JbboF1pT8PSzoV5pX IzdgDrSjP1faMIFOLptkeylTZYUuAZXtMZfycV4gRVnh/jr5hrMoiU5LwWJChYJlN26cd3UhgThzi iajEFv3z+itmcM45wHvMJe4jT0+3+Z7dw/fTC/0gF2EbI8VcxqdDu9qjiHa9v6URZmA/Eotcvj6OK +wZ/xHSHPX6V0OJcHbVT8yW/uWpsNMXX+IP8R3/6TWM8G6qLosP3RwLhj2DPw3ggonCDRox1uW9LR qV+s1MbOkWY0Kt5DLT8bu4Bmf93mrqRRw084FBxRzFqExoogtcqE5JfdOXmPHdkumLke3vGH3NL3P 6YL8ecjzQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEX-0002zi-A6; Tue, 30 Jun 2020 12:19:29 +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-0002xu-Ge 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 58A1D580083; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 02/12] mesh: update ssid->frequency as pri/sec channel switch Date: Tue, 30 Jun 2020 14:18:57 +0200 Message-Id: <20200630121907.132751-3-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: masashi.honma@gmail.com, Peter Oh Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Peter Oh ssid->frequency is one of variables used to gets channel number from given frequency. Leave it as unchanged when pri/sec channel switched will cause picking up wrong channel number after applying secondary channel offset for HT40 and leads failing interface bring-up. Signed-off-by: Peter Oh --- wpa_supplicant/mesh.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 1453bdc01..778541bc0 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -299,6 +299,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, frequency == freq->freq + freq->sec_channel_offset * 20) { wpa_printf(MSG_DEBUG, "mesh: pri/sec channels switched"); frequency = freq->freq; + ssid->frequency = frequency; } wpa_s->assoc_freq = frequency; wpa_s->current_ssid = ssid; 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; From patchwork Tue Jun 30 12:18:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319826 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=PHjqXHak; 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 49x3NC4WdZz9sRN for ; Tue, 30 Jun 2020 22:20:27 +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=1Qi7S8VIUz5S6DrH1WczRN4QYhuUUFA1hI2drmbn5i4=; b=PHjqXHak9PaoTTL3zLMETVfTK FrkhxczNjHnUPKpjXgqXS/j/XPt3ZlW4qFuCXtyFY0OzNCOk5Etforhs5Cg+RFFodNxG/sTucfRCH kpsGEZQ7H2Qpk94V5SyXLk6eFafYSLo85E9J+X5LbVXCTcQblvQTS4OZFxWJJ+e2hIpIPiH19byEh 2d2gEZCC0rSqDm9rkxOiqyqtFbsml+CaahKXCR4v4KjpZPGiz9l0vweMlaK1JxYKD5Gq4b8E0t68S 2toW9eul1hFULuEGeub19Tz7oRyOSAW9jTvjPgy6S/RxFw1HtL/kulVi4YkUM73eN9Yvv0BLEjL/6 8VFN5p4+g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEU-0002yw-2u; Tue, 30 Jun 2020 12:19:26 +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-0002xw-Gi for hostap@lists.infradead.org; Tue, 30 Jun 2020 12:19:23 +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 6D461580085; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 04/12] mesh: do not set offchanok on DFS channels in non-ETSI Date: Tue, 30 Jun 2020 14:18:59 +0200 Message-Id: <20200630121907.132751-5-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: masashi.honma@gmail.com, Peter Oh Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Peter Oh mac80211 does not allow mgmt tx to use off channel on DFS channels in non-ETSI domain, because it will invalidate CAC result on current operating channel. (mac80211 commit: 34373d12f3cbb74960a73431138ef619d857996f) Hence don't set offchanok for mgmt tx in case of DFS channels in non-ETSI. Signed-off-by: Peter Oh --- src/drivers/driver_nl80211.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index ea16d8daf..3a91c7c70 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -7876,7 +7876,11 @@ static int wpa_driver_nl80211_send_action(struct i802_bss *bss, int ret = -1; u8 *buf; struct ieee80211_hdr *hdr; + struct hostapd_hw_modes *modes; int offchanok = 1; + u16 num_modes, flags; + u8 dfs_domain; + int i; if (is_ap_interface(drv->nlmode) && (int) freq == bss->freq && bss->beacon_set) @@ -7905,6 +7909,21 @@ static int wpa_driver_nl80211_send_action(struct i802_bss *bss, os_memset(bss->rand_addr, 0, ETH_ALEN); } + if (is_mesh_interface(drv->nlmode)) { + modes = nl80211_get_hw_feature_data(bss, &num_modes, + &flags, &dfs_domain); + if (dfs_domain != HOSTAPD_DFS_REGION_ETSI && + ieee80211_is_dfs(bss->freq, modes, num_modes)) + offchanok = 0; + if (modes) { + for (i = 0; i < num_modes; i++) { + os_free(modes[i].channels); + os_free(modes[i].rates); + } + os_free(modes); + } + } + if (is_ap_interface(drv->nlmode) && (!(drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || (int) freq == bss->freq || drv->device_ap_sme || From patchwork Tue Jun 30 12:19:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319815 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=VzJOQdm1; 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 49x3N60hcNz9sRk for ; Tue, 30 Jun 2020 22:20:21 +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=X+cj5D4QU32lBBcsu8RfpGxktWePrh3L/bI3lX3ttgQ=; b=VzJOQdm12HHiv4Gd2wbLsL89p oMyV4DpBEdWoBphVwEmFv0CaN2tXEUBStUo68OtngHd0tz6OoRODLD5Hu76RyJUAKaLpMkm2zZldO tN0Uxb9exsqtPG2lAWrdXvckGaID3FU6pYJ35vdqLDdIJ1vIF5vL4tntyEFfikez+y+zh0PRwgun2 WTTHN02MDLbZwy13NERgj0U2EqYPXVy2i75T9cCmUITYS15F8KFDJiteCRZcT3JZ9m1raJm2C3MIE l+PCZTebpe37vfMrQTDZ9jwHmnNL8NyE7VjgTewFmibppcp/14/Lypx/YoP4LY1diobBGwiWT2Lw7 lC1YbbY1g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEd-00031Q-DS; Tue, 30 Jun 2020 12:19:35 +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 1jqFES-0002yJ-Ki for hostap@lists.infradead.org; Tue, 30 Jun 2020 12:19:25 +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 7475E580086; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 05/12] mesh: fix channel switch error during CAC Date: Tue, 30 Jun 2020 14:19:00 +0200 Message-Id: <20200630121907.132751-6-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: masashi.honma@gmail.com, Peter Oh Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Peter Oh Mesh interface has used its channel parameters that configured during its initialization even after channel switched due to DFS radar detection during CAC which caused channel switch error. This change fixes the error by updating its channel parameters when channel's been changed from initial one. Signed-off-by: Peter Oh --- wpa_supplicant/mesh.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 778541bc0..15c285812 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -13,6 +13,7 @@ #include "utils/uuid.h" #include "common/ieee802_11_defs.h" #include "common/wpa_ctrl.h" +#include "common/hw_features_common.h" #include "ap/sta_info.h" #include "ap/hostapd.h" #include "ap/ieee802_11.h" @@ -206,6 +207,39 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) return -1; } + /* + * inspect if channel's been changed since initialized. + * i.e. DFS radar detection + */ + if (ifmsh->freq != params->freq.freq) { + wpa_s->assoc_freq = ifmsh->freq; + ssid->frequency = ifmsh->freq; + struct he_capabilities *he_capab = NULL; + + if (ifmsh->current_mode) + he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH]; + + if (hostapd_set_freq_params(¶ms->freq, + ifmsh->conf->hw_mode, + ifmsh->freq, + ifmsh->conf->channel, + ifmsh->conf->enable_edmg, + ifmsh->conf->edmg_channel, + ifmsh->conf->ieee80211n, + ifmsh->conf->ieee80211ac, + ifmsh->conf->ieee80211ax, + ifmsh->conf->secondary_channel, + hostapd_get_oper_chwidth(ifmsh->conf), + hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), + hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), + ifmsh->conf->vht_capab, + he_capab)) { + wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); + wpa_supplicant_mesh_deinit(wpa_s); + return -1; + } + } + if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && wpas_mesh_init_rsn(wpa_s)) { wpa_printf(MSG_ERROR, From patchwork Tue Jun 30 12:19:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319822 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=0lYd/2sv; 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 49x3N74JtQz9sR4 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=bDBGTV1nCfHgbTooURwlCv3dvWNSAV/Wqgpw+GArOI8=; b=0lYd/2svTBSmk2VHGsZelopiR unVBmxDh7grKXZyuL9iwaSStSGHf9aeAzC2WbEzIvI3VEsEenJsW86L1UQSFbTpGp7QHjlRvAKweM pQmtPB0k8KvYZq6ghfnzgBKa7t0Myd9VW4bSMHgRtfczaTf41tSqwlVuYqJ2ELDigOsgdX2bgK/js AxCzT6JyYfIT1303YJ5Cmv8bz03QfuylET5npWiH5VWg/GQqflKoWlKiTv4iUBAPpowkhWeIQdX/L 1m+HWGGkBsV90s4mjPBWCP/vLAoxp1osVbVFwWFMi8TNC8xcFKbUOmH1Hel5zQyISboCiBB0oNzhh HkWPBigEQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEc-000318-3H; Tue, 30 Jun 2020 12:19:34 +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 1jqFES-0002yK-LM for hostap@lists.infradead.org; Tue, 30 Jun 2020 12:19:25 +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 7AE61580087; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 06/12] mesh: inform kernel driver DFS handler in userspace Date: Tue, 30 Jun 2020 14:19:01 +0200 Message-Id: <20200630121907.132751-7-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: masashi.honma@gmail.com, Peter Oh Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Peter Oh NL80211_ATTR_HANDLE_DFS is required by kerenel space to enable DFS channels that indicates DFS handler resides in userspace. Signed-off-by: Peter Oh --- src/drivers/driver.h | 1 + src/drivers/driver_nl80211.c | 3 +++ wpa_supplicant/mesh.c | 1 + 3 files changed, 5 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index cb412cbfe..e4102b31b 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1543,6 +1543,7 @@ struct wpa_driver_mesh_join_params { #define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004 #define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008 unsigned int flags; + u8 handle_dfs; }; struct wpa_driver_set_key_params { diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 3a91c7c70..d922eda74 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -10168,6 +10168,9 @@ static int nl80211_join_mesh(struct i802_bss *bss, wpa_printf(MSG_DEBUG, " * flags=%08X", params->flags); + if (params->handle_dfs) + if (nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS)) + goto fail; container = nla_nest_start(msg, NL80211_ATTR_MESH_SETUP); if (!container) goto fail; diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 15c285812..c350e762b 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -355,6 +355,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, conf->country[0] = wpa_s->conf->country[0]; conf->country[1] = wpa_s->conf->country[1]; conf->country[2] = ' '; + wpa_s->mesh_params->handle_dfs = 1; } bss->iconf = conf; From patchwork Tue Jun 30 12:19:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319825 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=xClC8T8v; 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 49x3N72xtkz9sTR 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=HXMiSxNnRD45La86wi8M4DIVGMnekzMFX4SOR1f8q5o=; b=xClC8T8viIXHqZuzoVYQ5ACnB TqPOAXaUhZh+tpUOCOGhFRp9MPZ/pH/m3B5ij/oWnCaR/yZ7PZVdz8bcIMFRn0c/dxrNozfEf8J5Q l5CVA8wwnq0+mbOXTziKpN/WNrt5+X9SJEjLBb5WDTvrsCkF8kH4+zmkj9SwdDSr+yzsmYmV/MmLb m5VlIMhHtTa33ltQoN07x2zbxs1Ugh9Prd+769lWPnROK2xBbmpfRRC6Ja5TqQehLr27BV41xLvjf 7+mSfh6DKqYSQFOzaZgILq6K//aQPDlzxsl4H16qvGqSv7PA2SI4DJwvfwQzS0Sh8QQm4unfYwAI1 p9g1hZxaA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEi-00033S-9K; Tue, 30 Jun 2020 12:19:40 +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 1jqFET-0002yV-4r for hostap@lists.infradead.org; Tue, 30 Jun 2020 12:19:29 +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 7DFF1580088; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 07/12] mesh: fixes for mesh init/deinit Date: Tue, 30 Jun 2020 14:19:02 +0200 Message-Id: <20200630121907.132751-8-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: masashi.honma@gmail.com, Markus Theil Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Send mesh group started notification after join completion callback is called. Implement outstanding TODO, to leave the mesh network on deinit. Signed-off-by: Markus Theil --- wpa_supplicant/mesh.c | 32 ++++++++++++++++++++------------ wpa_supplicant/mesh.h | 6 ++++-- wpa_supplicant/wpa_supplicant.c | 8 ++------ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index c350e762b..5eb2a29d5 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -30,20 +30,20 @@ static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s) { - wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh); + wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true); wpa_s->ifmsh = NULL; wpa_s->current_ssid = NULL; os_free(wpa_s->mesh_rsn); wpa_s->mesh_rsn = NULL; os_free(wpa_s->mesh_params); wpa_s->mesh_params = NULL; - /* TODO: leave mesh (stop beacon). This will happen on link down - * anyway, so it's not urgent */ + wpa_supplicant_leave_mesh(wpa_s, false); } void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s, - struct hostapd_iface *ifmsh) + struct hostapd_iface *ifmsh, + bool also_clear_hostapd) { if (!ifmsh) return; @@ -64,8 +64,10 @@ void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s, } /* take care of shared data */ - hostapd_interface_deinit(ifmsh); - hostapd_interface_free(ifmsh); + if (also_clear_hostapd) { + hostapd_interface_deinit(ifmsh); + hostapd_interface_free(ifmsh); + } } @@ -244,8 +246,7 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) wpas_mesh_init_rsn(wpa_s)) { wpa_printf(MSG_ERROR, "mesh: RSN initialization failed - deinit mesh"); - wpa_supplicant_mesh_deinit(wpa_s); - wpa_drv_leave_mesh(wpa_s); + wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, false); return -1; } @@ -270,9 +271,15 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) /* hostapd sets the interface down until we associate */ wpa_drv_set_operstate(wpa_s, 1); - if (!ret) + if (!ret) { wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); + wpa_msg(wpa_s, MSG_INFO, MESH_GROUP_STARTED "ssid=\"%s\" id=%d", + wpa_ssid_txt(ssid->ssid, ssid->ssid_len), + ssid->id); + wpas_notify_mesh_group_started(wpa_s, ssid); + } + return ret; } @@ -563,7 +570,7 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, wpa_s->mesh_params = params; if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh"); - wpa_drv_leave_mesh(wpa_s); + wpa_supplicant_leave_mesh(wpa_s, true); ret = -1; goto out; } @@ -573,14 +580,15 @@ out: } -int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s) +int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s, bool need_deinit) { int ret = 0; wpa_msg(wpa_s, MSG_INFO, "leaving mesh"); /* Need to send peering close messages first */ - wpa_supplicant_mesh_deinit(wpa_s); + if (need_deinit) + wpa_supplicant_mesh_deinit(wpa_s); ret = wpa_drv_leave_mesh(wpa_s); if (ret) diff --git a/wpa_supplicant/mesh.h b/wpa_supplicant/mesh.h index 7317083c9..a429e5e27 100644 --- a/wpa_supplicant/mesh.h +++ b/wpa_supplicant/mesh.h @@ -11,9 +11,11 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); -int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s); +int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s, + bool need_deinit); void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s, - struct hostapd_iface *ifmsh); + struct hostapd_iface *ifmsh, + bool also_clear_hostapd); int wpas_mesh_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end); int wpas_mesh_add_interface(struct wpa_supplicant *wpa_s, char *ifname, diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index d5ed6f87e..3d95dff52 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2232,10 +2232,6 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, return; } wpa_s->current_bss = bss; - wpa_msg(wpa_s, MSG_INFO, MESH_GROUP_STARTED "ssid=\"%s\" id=%d", - wpa_ssid_txt(ssid->ssid, ssid->ssid_len), - ssid->id); - wpas_notify_mesh_group_started(wpa_s, ssid); #else /* CONFIG_MESH */ wpa_msg(wpa_s, MSG_ERROR, "mesh mode support not included in the build"); @@ -3949,7 +3945,7 @@ void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s, wpa_s->ifname); wpas_notify_mesh_group_removed(wpa_s, mconf->meshid, mconf->meshid_len, reason_code); - wpa_supplicant_leave_mesh(wpa_s); + wpa_supplicant_leave_mesh(wpa_s, true); } #endif /* CONFIG_MESH */ @@ -6562,7 +6558,7 @@ static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s, #ifdef CONFIG_MESH if (wpa_s->ifmsh) { - wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh); + wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true); wpa_s->ifmsh = NULL; } #endif /* CONFIG_MESH */ From patchwork Tue Jun 30 12:19:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319823 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=FLW86g9J; 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 49x3N7073qz9sT6 for ; Tue, 30 Jun 2020 22:20:21 +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=yPrqv3yxENCDAHLSrJpMFeYf1dbhgUqb9FZ+hE54Nz4=; b=FLW86g9JtulKptBkHmfW5WNS9 VOSOvs4s7tj8vHki+HpNoKrCPM+zkivBORFAzzHddLcxeR7Ap32txtpSzEuaJprjckBzABDwdbzhq CiDEt0FTJJ1b61b70hkzWidTZ7OQhw1hMOg60Z8/zGeQTgUr5eO/N5qDBP7HC8IVF6qT2m3rUMqVq sDVlCyydxK4cxAnfmPdjJxMp+pcWYDEhbyqJQ6EV+VIA6fjs5J9tVElnCc9Hg4BeLqaE4zcQc/apv KESSpbPvZ7p0wPGLdThDLSMA7GN/B84IBYrbvODeUC21hYYt6UDCk18QRNc7OY6HN4TCxX+EYpiJL zX2o9wpCQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEk-000340-8u; Tue, 30 Jun 2020 12:19:42 +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 1jqFET-0002yW-5u for hostap@lists.infradead.org; Tue, 30 Jun 2020 12:19:29 +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 81285580089; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 08/12] mesh: fix DFS deinit/init Date: Tue, 30 Jun 2020 14:19:03 +0200 Message-Id: <20200630121907.132751-9-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: masashi.honma@gmail.com, Markus Theil Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The hostapd DFS code deinitializes and initializes the AP interface, if a clean channel switch is not possible. In this case the AP code paths would deinit the driver, for example nl80211, without wpa_supplicant code paths getting notice of this. Therefore add callbacks for wpa_supplicant mesh methods, which are called on init/deinit of the AP bss. These callbacks are then used to handle the reset in the mesh code. Signed-off-by: Markus Theil --- src/ap/dfs.c | 2 +- src/ap/hostapd.c | 17 ++++++-- src/ap/hostapd.h | 6 +++ wpa_supplicant/mesh.c | 90 +++++++++++++++++++++++++++++++++++++------ 4 files changed, 100 insertions(+), 15 deletions(-) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 2c914baa2..25dad3482 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -1112,7 +1112,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) oper_centr_freq_seg0_idx, oper_centr_freq_seg1_idx, cmode->vht_capab, - &cmode->he_capab[IEEE80211_MODE_AP]); + &cmode->he_capab[iface->conf->hw_mode]); if (err) { wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params"); diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 04aebe31a..1579ae7fe 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -354,7 +354,7 @@ static int hostapd_broadcast_wep_set(struct hostapd_data *hapd) #endif /* CONFIG_WEP */ -static void hostapd_free_hapd_data(struct hostapd_data *hapd) +void hostapd_free_hapd_data(struct hostapd_data *hapd) { os_free(hapd->probereq_cb); hapd->probereq_cb = NULL; @@ -498,7 +498,7 @@ static void sta_track_deinit(struct hostapd_iface *iface) } -static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) +void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) { wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); #ifdef NEED_AP_MLME @@ -626,7 +626,7 @@ static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason) } -static void hostapd_bss_deinit_no_free(struct hostapd_data *hapd) +void hostapd_bss_deinit_no_free(struct hostapd_data *hapd) { hostapd_free_stas(hapd); hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING); @@ -2690,6 +2690,13 @@ int hostapd_enable_iface(struct hostapd_iface *hapd_iface) { size_t j; + if (hapd_iface == NULL) + return -1; + + if (hapd_iface->enable_iface_cb != NULL) { + return hapd_iface->enable_iface_cb(hapd_iface); + } + if (hapd_iface->bss[0]->drv_priv != NULL) { wpa_printf(MSG_ERROR, "Interface %s already enabled", hapd_iface->conf->bss[0]->iface); @@ -2751,6 +2758,10 @@ int hostapd_disable_iface(struct hostapd_iface *hapd_iface) if (hapd_iface == NULL) return -1; + if (hapd_iface->disable_iface_cb != NULL) { + return hapd_iface->disable_iface_cb(hapd_iface); + } + if (hapd_iface->bss[0]->drv_priv == NULL) { wpa_printf(MSG_INFO, "Interface %s already disabled", hapd_iface->conf->bss[0]->iface); diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index b70d13fba..4ce31416d 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -589,6 +589,9 @@ struct hostapd_iface { /* Previous WMM element information */ struct hostapd_wmm_ac_params prev_wmm[WMM_AC_NUM]; + + int (*enable_iface_cb)(struct hostapd_iface *iface); + int (*disable_iface_cb)(struct hostapd_iface *iface); }; /* hostapd.c */ @@ -617,6 +620,9 @@ void hostapd_interface_deinit_free(struct hostapd_iface *iface); int hostapd_enable_iface(struct hostapd_iface *hapd_iface); int hostapd_reload_iface(struct hostapd_iface *hapd_iface); int hostapd_disable_iface(struct hostapd_iface *hapd_iface); +void hostapd_bss_deinit_no_free(struct hostapd_data *hapd); +void hostapd_free_hapd_data(struct hostapd_data *hapd); +void hostapd_cleanup_iface_partial(struct hostapd_iface *iface); int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf); int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf); void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator); diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 5eb2a29d5..0742cabbc 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -28,15 +28,20 @@ #include "mesh.h" -static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s) +static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s, bool also_clear_hostapd) { - wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, true); - wpa_s->ifmsh = NULL; - wpa_s->current_ssid = NULL; + wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, also_clear_hostapd); + + if (also_clear_hostapd) { + wpa_s->ifmsh = NULL; + wpa_s->current_ssid = NULL; + os_free(wpa_s->mesh_params); + wpa_s->mesh_params = NULL; + } + os_free(wpa_s->mesh_rsn); wpa_s->mesh_rsn = NULL; - os_free(wpa_s->mesh_params); - wpa_s->mesh_params = NULL; + wpa_supplicant_leave_mesh(wpa_s, false); } @@ -237,7 +242,7 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) ifmsh->conf->vht_capab, he_capab)) { wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); - wpa_supplicant_mesh_deinit(wpa_s); + wpa_supplicant_mesh_deinit(wpa_s, true); return -1; } } @@ -246,7 +251,7 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) wpas_mesh_init_rsn(wpa_s)) { wpa_printf(MSG_ERROR, "mesh: RSN initialization failed - deinit mesh"); - wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, false); + wpa_supplicant_mesh_deinit(wpa_s, false); return -1; } @@ -291,6 +296,67 @@ static void wpas_mesh_complete_cb(void *arg) } +static int wpa_supplicant_mesh_enable_iface_cb(struct hostapd_iface *ifmsh) +{ + struct wpa_supplicant *wpa_s = ifmsh->owner; + struct hostapd_data *bss; + + ifmsh->mconf = mesh_config_create(wpa_s, wpa_s->current_ssid); + + bss = ifmsh->bss[0]; + bss->msg_ctx = wpa_s; + os_memcpy(bss->own_addr, wpa_s->own_addr, ETH_ALEN); + bss->driver = wpa_s->driver; + bss->drv_priv = wpa_s->drv_priv; + bss->iface = ifmsh; + bss->mesh_sta_free_cb = mesh_mpm_free_sta; + bss->setup_complete_cb = wpas_mesh_complete_cb; + bss->setup_complete_cb_ctx = wpa_s; + + bss->conf->start_disabled = 1; + bss->conf->mesh = MESH_ENABLED; + bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; + + if (wpa_drv_init_mesh(wpa_s)) { + wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver"); + return -1; + } + + if (hostapd_setup_interface(ifmsh)) { + wpa_printf(MSG_ERROR, + "Failed to initialize hostapd interface for mesh"); + return -1; + } + + return 0; +} + + +static int wpa_supplicant_mesh_disable_iface_cb(struct hostapd_iface *ifmsh) +{ + struct wpa_supplicant *wpa_s = ifmsh->owner; + int j; + + wpa_supplicant_mesh_deinit(wpa_s, false); + +#ifdef NEED_AP_MLME + for (j = 0; j < ifmsh->num_bss; j++) + hostapd_cleanup_cs_params(ifmsh->bss[j]); +#endif /* NEED_AP_MLME */ + + /* same as hostapd_interface_deinit without deinitializing ctrl-iface */ + for (j = 0; j < ifmsh->num_bss; j++) { + struct hostapd_data *hapd = ifmsh->bss[j]; + hostapd_bss_deinit_no_free(hapd); + hostapd_free_hapd_data(hapd); + } + + hostapd_cleanup_iface_partial(ifmsh); + + return 0; +} + + static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, struct hostapd_freq_params *freq) @@ -318,6 +384,8 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, ifmsh->drv_flags = wpa_s->drv_flags; ifmsh->drv_flags2 = wpa_s->drv_flags2; ifmsh->num_bss = 1; + ifmsh->enable_iface_cb = wpa_supplicant_mesh_enable_iface_cb; + ifmsh->disable_iface_cb = wpa_supplicant_mesh_disable_iface_cb; ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss, sizeof(struct hostapd_data *)); if (!ifmsh->bss) @@ -451,7 +519,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, return 0; out_free: - wpa_supplicant_mesh_deinit(wpa_s); + wpa_supplicant_mesh_deinit(wpa_s, true); return -ENOMEM; } @@ -499,7 +567,7 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, goto out; } - wpa_supplicant_mesh_deinit(wpa_s); + wpa_supplicant_mesh_deinit(wpa_s, true); wpa_s->pairwise_cipher = WPA_CIPHER_NONE; wpa_s->group_cipher = WPA_CIPHER_NONE; @@ -588,7 +656,7 @@ int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s, bool need_deinit) /* Need to send peering close messages first */ if (need_deinit) - wpa_supplicant_mesh_deinit(wpa_s); + wpa_supplicant_mesh_deinit(wpa_s, true); ret = wpa_drv_leave_mesh(wpa_s); if (ret) From patchwork Tue Jun 30 12:19:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319821 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=p6XvV3wK; 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 49x3N72npbz9sTM for ; Tue, 30 Jun 2020 22:20:23 +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=anvmWiTy5/4A6vjpTCyNTDT3K6gQJJoVfdqu+SHyrVo=; b=p6XvV3wK6GTePDS1xiVsForpX w69o4nHaUjF4rrDL/TpwSEl5VeQeDJLLFrmNDx3xCOQEPHONfhG0kU3VPtvL+gfd6yI/Do+XrUcET dJkCySQVuU5j2XsHvTIRudZvPnxHevsUWJHPPeNKXY8INGrDIqStYgQ4PIOesrcUo9GI9qhz0d0QL cslW/X7l95zKjnyniRshj9FjkOmijUVYBYXFkjb/WAa469IV6/5QXB14gn005ej90ZU4GwtETPU5v O0PWck89T7UB78VruZtmaLkuBxNwKudsl1D/QZLIhf88bgGTzyHtZjwbA0PwjAuy1kD6+OMRvhJYu 8mF/7tdVg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEg-00032Z-6j; Tue, 30 Jun 2020 12:19:38 +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 1jqFET-0002yg-EP for hostap@lists.infradead.org; Tue, 30 Jun 2020 12:19:28 +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 84E9E58008A; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 09/12] tests: DFS test for wpa_supplicant mesh Date: Tue, 30 Jun 2020 14:19:04 +0200 Message-Id: <20200630121907.132751-10-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: masashi.honma@gmail.com, Markus Theil Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add a test with uses a DFS channel, waits for CAC afterwards successfull mesh join and then triggers a radar event and check if the mesh comes up again on the same device. Signed-off-by: Markus Theil --- tests/hwsim/test_wpas_mesh.py | 56 +++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py index b7f98468b..8149b5b1e 100644 --- a/tests/hwsim/test_wpas_mesh.py +++ b/tests/hwsim/test_wpas_mesh.py @@ -80,8 +80,23 @@ def check_mesh_scan(dev, params, other_started=False, beacon_int=0): if '[MESH]' not in bss['flags']: raise Exception("BSS output did not include MESH flag") -def check_mesh_group_added(dev): - ev = dev.wait_event(["MESH-GROUP-STARTED"]) +def check_dfs_started(dev, timeout=10): + ev = dev.wait_event(["DFS-CAC-START"], timeout=timeout) + if ev is None: + raise Exception("Test exception: CAC did not start") + +def check_dfs_finished(dev, timeout=70): + ev = dev.wait_event(["DFS-CAC-COMPLETED"], timeout=timeout) + if ev is None: + raise Exception("Test exception: CAC did not finish") + +def check_mesh_radar_handling_finished(dev, timeout=75): + ev = dev.wait_event(["CTRL-EVENT-CHANNEL-SWITCH", "MESH-GROUP-STARTED"], timeout=timeout) + if ev is None: + raise Exception("Test exception: Couldn't join mesh") + +def check_mesh_group_added(dev, timeout=10): + ev = dev.wait_event(["MESH-GROUP-STARTED"], timeout=timeout) if ev is None: raise Exception("Test exception: Couldn't join mesh") @@ -91,6 +106,10 @@ def check_mesh_group_removed(dev): if ev is None: raise Exception("Test exception: Couldn't leave mesh") +def check_regdom_change(dev, timeout=10): + ev = dev.wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=timeout) + if ev is None: + raise Exception("Test exception: No regdom change happened.") def check_mesh_peer_connected(dev, timeout=10): ev = dev.wait_event(["MESH-PEER-CONNECTED"], timeout=timeout) @@ -167,6 +186,39 @@ def test_wpas_mesh_group_remove(dev): check_mesh_group_removed(dev[0]) dev[0].mesh_group_remove() +def dfs_simulate_radar(dev): + logger.info("Trigger a simulated radar event") + phyname = dev.get_driver_status_field("phyname") + radar_file = '/sys/kernel/debug/ieee80211/' + phyname + '/hwsim/dfs_simulate_radar' + with open(radar_file, 'w') as f: + f.write('1') + +@long_duration_test +def test_wpas_mesh_peer_connected_dfs(dev): + """wpa_supplicant MESH peer connected""" + dev[0].set("country", "DE") + dev[1].set("country", "DE") + + check_regdom_change(dev[0]) + check_regdom_change(dev[1]) + + check_mesh_support(dev[0]) + add_open_mesh_network(dev[0], freq="5500", beacon_int=160) + add_open_mesh_network(dev[1], freq="5500", beacon_int=160) + check_dfs_started(dev[0]) + check_dfs_finished(dev[0]) + check_mesh_joined_connected(dev, timeout0=10) + + dfs_simulate_radar(dev[0]) + + check_mesh_radar_handling_finished(dev[0], timeout=75) + + dev[0].set("country", "00") + dev[1].set("country", "00") + + check_regdom_change(dev[0]) + check_regdom_change(dev[1]) + def test_wpas_mesh_peer_connected(dev): """wpa_supplicant MESH peer connected""" check_mesh_support(dev[0]) From patchwork Tue Jun 30 12:19:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319819 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=GHzaAzBb; 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 49x3N72hcmz9sTK for ; Tue, 30 Jun 2020 22:20:21 +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=4L7/RhgGyNalzX5n5DAWeB+0p6DXXKIelkrG/YBqg2c=; b=GHzaAzBbdSv1TQShCWMEWUVlQ 4v2Rfc8w3MlWk0obAuOGXQ22Cdeeqa5o2i5Ce1jh+vNBctpvhlwe/XECC8G9w0VqRhwioarMte+zL g6Sq1EUlJXoTlwaTMGAkQdmJDfvIHCKSgHl5LoIRp0HGoCmJtRZUT2UBKlLYkqsrYmA3Ml710bOZA 6b7KcK6cQ0EgJ4S2XD8WTHh9oQOlkPprozXID/Dp5Q5JMiai66odvuyinBwJNxPbNj0dzgDGB/No6 t05L/IeSorpbkhxrDJ8VmDATlweZrmnYK6fNRP8YXDAnrZGMcPI/WhB6c9etgzYLAHPqaCg9+aK/g 075bxd9HQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEe-00031x-Vc; Tue, 30 Jun 2020 12:19:37 +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 1jqFEU-0002z2-Dz for hostap@lists.infradead.org; Tue, 30 Jun 2020 12:19:28 +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 885FB58008B; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 10/12] mesh: fix mesh_oom test Date: Tue, 30 Jun 2020 14:19:05 +0200 Message-Id: <20200630121907.132751-11-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: masashi.honma@gmail.com, Markus Theil Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Only change freq params, if ifmsh->freq is set initially, which only happens if hostapd_get_hw_features in setup_interface2 succeeds. Signed-off-by: Markus Theil --- wpa_supplicant/mesh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 0742cabbc..383ec1c7b 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -218,7 +218,7 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) * inspect if channel's been changed since initialized. * i.e. DFS radar detection */ - if (ifmsh->freq != params->freq.freq) { + if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) { wpa_s->assoc_freq = ifmsh->freq; ssid->frequency = ifmsh->freq; struct he_capabilities *he_capab = NULL; From patchwork Tue Jun 30 12:19:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319817 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=UOJgsfMQ; 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 49x3N64qzSz9sSd for ; Tue, 30 Jun 2020 22:20:22 +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=G/eZ2lzoCgEvaMFO24YalNg7GAOTYtjy7f7qv+QFZuU=; b=UOJgsfMQ7yMvXhuPqEvqgqtTC IiVYsgRB34QPblAxxwFXEF/r6RHx4vxdOE+YPRjaKXbzoHDLjnSnU3YzxmNGUYj3cu5BfnIJmwDYt L72oAaG9jE41PTG9qMgW7ye+/0CBW2yxoZeRO9npFebKn9EYlr+vznbq5uj+nf7mmY4OVWWj2Mquw i1AMzohsRHN3oCymV9F7i7BMUXWz1E36pAZ4qB2ai1x2A+w11O3jEQJ/ez36ssLalboiF2m2rQt1I Rk3h7YgQR8cYyP4OY852SNd2JRuX1v2bhrA6hQoJx3D8NvcXVBEyLCxVC18UjVUDA0BNWBTK9T+gi rOURC41rg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEp-00036U-Fy; Tue, 30 Jun 2020 12:19:47 +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 1jqFEU-0002z3-Gt for hostap@lists.infradead.org; Tue, 30 Jun 2020 12:19:30 +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 8B7BB58008C; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 11/12] mesh: move mesh freq setting to own function Date: Tue, 30 Jun 2020 14:19:06 +0200 Message-Id: <20200630121907.132751-12-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: masashi.honma@gmail.com, Markus Theil Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Markus Theil --- wpa_supplicant/mesh.c | 63 ++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 383ec1c7b..f3788bf36 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -31,7 +31,7 @@ static void wpa_supplicant_mesh_deinit(struct wpa_supplicant *wpa_s, bool also_clear_hostapd) { wpa_supplicant_mesh_iface_deinit(wpa_s, wpa_s->ifmsh, also_clear_hostapd); - + if (also_clear_hostapd) { wpa_s->ifmsh = NULL; wpa_s->current_ssid = NULL; @@ -201,6 +201,40 @@ static int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s) return !wpa_s->mesh_rsn ? -1 : 0; } + +static int wpas_mesh_update_freq_params(struct wpa_supplicant *wpa_s) +{ + struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params; + struct hostapd_iface *ifmsh = wpa_s->ifmsh; + struct he_capabilities *he_capab = NULL; + + if (ifmsh->current_mode) + he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH]; + + if (hostapd_set_freq_params(¶ms->freq, + ifmsh->conf->hw_mode, + ifmsh->freq, + ifmsh->conf->channel, + ifmsh->conf->enable_edmg, + ifmsh->conf->edmg_channel, + ifmsh->conf->ieee80211n, + ifmsh->conf->ieee80211ac, + ifmsh->conf->ieee80211ax, + ifmsh->conf->secondary_channel, + hostapd_get_oper_chwidth(ifmsh->conf), + hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), + hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), + ifmsh->conf->vht_capab, + he_capab)) { + wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); + wpa_supplicant_mesh_deinit(wpa_s, true); + return -1; + } + + return 0; +} + + static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) { struct hostapd_iface *ifmsh = wpa_s->ifmsh; @@ -221,30 +255,8 @@ static int wpas_mesh_complete(struct wpa_supplicant *wpa_s) if (ifmsh->freq > 0 && ifmsh->freq != params->freq.freq) { wpa_s->assoc_freq = ifmsh->freq; ssid->frequency = ifmsh->freq; - struct he_capabilities *he_capab = NULL; - - if (ifmsh->current_mode) - he_capab = &ifmsh->current_mode->he_capab[IEEE80211_MODE_MESH]; - - if (hostapd_set_freq_params(¶ms->freq, - ifmsh->conf->hw_mode, - ifmsh->freq, - ifmsh->conf->channel, - ifmsh->conf->enable_edmg, - ifmsh->conf->edmg_channel, - ifmsh->conf->ieee80211n, - ifmsh->conf->ieee80211ac, - ifmsh->conf->ieee80211ax, - ifmsh->conf->secondary_channel, - hostapd_get_oper_chwidth(ifmsh->conf), - hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), - hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), - ifmsh->conf->vht_capab, - he_capab)) { - wpa_printf(MSG_ERROR, "Error updating mesh frequency params."); - wpa_supplicant_mesh_deinit(wpa_s, true); + if (wpas_mesh_update_freq_params(wpa_s) != 0) return -1; - } } if (ifmsh->mconf->security != MESH_CONF_SEC_NONE && @@ -302,7 +314,7 @@ static int wpa_supplicant_mesh_enable_iface_cb(struct hostapd_iface *ifmsh) struct hostapd_data *bss; ifmsh->mconf = mesh_config_create(wpa_s, wpa_s->current_ssid); - + bss = ifmsh->bss[0]; bss->msg_ctx = wpa_s; os_memcpy(bss->own_addr, wpa_s->own_addr, ETH_ALEN); @@ -518,6 +530,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, } return 0; + out_free: wpa_supplicant_mesh_deinit(wpa_s, true); return -ENOMEM; From patchwork Tue Jun 30 12:19:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1319824 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=HfPzR1sX; 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 49x3N81lgqz9sTT for ; Tue, 30 Jun 2020 22:20:24 +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=EGms9HEAIt4cSaCKZak7YYhuy+JSedapECaGzam1kf0=; b=HfPzR1sX3GXlftwL+6dHiqQsN +v2a3V0k38iYEgW1viNyYdqmy4/doE5sy4zhNSqOc+tmMZmPgcJ0eRxNpn4AV/22qGDm0QZatcQv1 1TZwGO3kKcXdj6ItGfBQIPyZwKqzQQmd8mk/NAdtBERV/sel1S3yQH2iuZpGn6l3wkHtT/B0b5A6D kU7pF6XbpnqF52+ttNNzrQw6760VeP6HRLDLUhWlqyke/ektuAEtiUls9pky9w1ms2CIVvy0Fc6in ZjPW1174Pxwnmcq+gxFpyNzlPiGi5PKobcSGH8lSMDOkr1umlYe2idAFWOgtmVDkwzOLyuxGAwYVU WUz/cy9rg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqFEr-00037g-Gt; Tue, 30 Jun 2020 12:19:49 +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 1jqFEX-0002zf-9T for hostap@lists.infradead.org; Tue, 30 Jun 2020 12:19:30 +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 97ACD58008D; Tue, 30 Jun 2020 14:19:21 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [PATCH v2 12/12] mesh: use deterministic channel on channel switch Date: Tue, 30 Jun 2020 14:19:07 +0200 Message-Id: <20200630121907.132751-13-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: masashi.honma@gmail.com, Markus Theil Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch uses a deterministic channel on DFS channel switch in mesh networks. Otherwise, when switching to a usable but not available channel, no CSA can be sent and a random channel is choosen without notification of other nodes. It is then quite likely, that the mesh network gets disconnected. Fix this by using a deterministic number, based on the sha256 hash of the mesh ID, in order to use at least a different number in each mesh network. Signed-off-by: Markus Theil --- src/ap/dfs.c | 20 +++++++++++++++++++- src/drivers/driver_nl80211.c | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 25dad3482..8f3630bf8 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -17,6 +17,7 @@ #include "ap_drv_ops.h" #include "drivers/driver.h" #include "dfs.h" +#include "crypto/crypto.h" static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1) @@ -480,9 +481,14 @@ dfs_get_valid_channel(struct hostapd_iface *iface, int num_available_chandefs; int chan_idx, chan_idx2; int sec_chan_idx_80p80 = -1; + bool is_mesh = false; int i; u32 _rand; +#ifdef CONFIG_MESH + is_mesh = iface->mconf; +#endif + wpa_printf(MSG_DEBUG, "DFS: Selecting random channel"); *secondary_channel = 0; *oper_centr_freq_seg0_idx = 0; @@ -502,8 +508,20 @@ dfs_get_valid_channel(struct hostapd_iface *iface, if (num_available_chandefs == 0) return NULL; - if (os_get_random((u8 *) &_rand, sizeof(_rand)) < 0) + /* try to use deterministic channel in mesh, so that both sides + * have a chance to switch to the same channel */ + if (is_mesh) { +#ifdef CONFIG_MESH + u64 hash[4]; + const u8 *meshid[1] = { &iface->mconf->meshid[0] }; + const size_t meshid_len = iface->mconf->meshid_len; + + sha256_vector(1, meshid, &meshid_len, (u8 *)&hash[0]); + _rand = hash[0] + hash[1] + hash[2] + hash[3]; +#endif + } else if (os_get_random((u8 *) &_rand, sizeof(_rand)) < 0) return NULL; + chan_idx = _rand % num_available_chandefs; dfs_find_channel(iface, &chan, chan_idx, skip_radar); if (!chan) { diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index d922eda74..18521f832 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -9568,6 +9568,10 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings) if (ret) goto error; + if (drv->nlmode == NL80211_IFTYPE_MESH_POINT) { + nla_put_flag(msg, NL80211_ATTR_HANDLE_DFS); + } + /* beacon_csa params */ beacon_csa = nla_nest_start(msg, NL80211_ATTR_CSA_IES); if (!beacon_csa)