From patchwork Fri Jun 26 14:28:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 1317700 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=eWnvEme7; 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 49tfQg58rGz9sSF for ; Sat, 27 Jun 2020 00:29:15 +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=eWnvEme7Daxm9ZMdXLtm2X/Lk IS9Eg5VXTREIznabGI9s4lPO82NW5/q7abJTsvO4f1CXlT3E1M4hz/dSEACEsuHgTNH3Z8bvNgt/H CuN5jHeFWlwqdzjhWdQwdeghnQoFnZLWs5uIlrwg/etHTBSTvcAm0PxNmchobrzjt0JNazDGfiqij emp8U3KNcId00B8sdr5U12g/K4zsrTB3Qu6U12mh9kvUu4Yz5IV1Xa1BOWO1S5V4CAtNK13ttV66C d5nxHZdC2EHR03ZKoS+84OyLJ06ydIzVleSr+DbMSvG1rfs+vF319qCoCloxtQlYEohWADJupv50L vDknLWIuA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jopLC-0007ZI-QY; Fri, 26 Jun 2020 14:28:30 +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 1jopL6-0007VV-HI for hostap@lists.infradead.org; Fri, 26 Jun 2020 14:28:26 +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 AC08158006C; Fri, 26 Jun 2020 16:28:23 +0200 (CEST) From: Markus Theil To: hostap@lists.infradead.org Subject: [RESEND PATCH 01/10] mesh: use setup completion callback to complete mesh join Date: Fri, 26 Jun 2020 16:28:13 +0200 Message-Id: <20200626142822.272002-2-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200626142822.272002-1-markus.theil@tu-ilmenau.de> References: <20200626142822.272002-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_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO 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@bowerswilkins.com 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; }