Received: by 10.223.176.5 with SMTP id f5csp989122wra; Fri, 2 Feb 2018 09:19:06 -0800 (PST) X-Google-Smtp-Source: AH8x226g7T2iOcLlBVnEpM6kvR43JPLURGqRvnMAARjhDGG/Y5R7eQP43iamPvZvFZ+/fyhKr9h1 X-Received: by 10.99.190.76 with SMTP id g12mr15538618pgo.235.1517591946634; Fri, 02 Feb 2018 09:19:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517591946; cv=none; d=google.com; s=arc-20160816; b=jR7QnHKM5bjXvnJrFKDpV3deeHyeZ2y9XM5NuET2Bh0eKBRtvD0uaJnSIxzapK7FNn jPPA4PhwuO4A0uhaM09Co5xVPvRyQojSttKgB0Lrdqr/Hnp8RrH8JS/xQwKRU/vS5MvG JJ0rKzfAojrjh9SzyDH+x66AS+/pNC8c7OxABXKVlBDnmADuLG2NOkEYroyfl3ws9ACp 1CspplNUQT0gsqD4YSuQowrf7dS6Q7jhO+eQoG31TnbwhG47YzDnsOA2RNnsrtwLekb0 s8aePA0+/SIZ74V9/WUYrPbXbCJ7ohvnvAX0D5ReL9J2+S/j/fGrzVo8Cd5iEelbRKfB +KVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=B+yACKYfP+6S0TdN+d7s0CsX8N1qPuos9sKbeKipXxw=; b=lscj6YlNAyNOd4rCt28qL8uB/+Jl2b0ytfLKl+h+I0DzSP3p5SKsxbVQ2voOQcFmWR PpNsciM2KrNzST2hlH4lTENYy52AyA4MwrxojBh38raYHoQ0T/6CEzsU1ec52pEbK05Z q4hEOarInqAnr1wPlDLUlhfzUeP5oJdNklltPkcKLcaF8t3QtC6YjWaoI/gNIoSfSn+h 6kfIwsS9CIs/uN6LXuwb1n7hEIXuzYtTxa9Uy8LIKxll9SAcLd0cB+ha5AUb7pO+7Ixh NhWVKgBchx++2zPIn2ljZXdxjVAtZ9QblXRjsn2dDzTm6D4tMMO3eqHgS63LxSRy9Ier 5lrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1-v6si2125478pln.220.2018.02.02.09.18.51; Fri, 02 Feb 2018 09:19:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753929AbeBBRSX (ORCPT + 99 others); Fri, 2 Feb 2018 12:18:23 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38656 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753395AbeBBRLa (ORCPT ); Fri, 2 Feb 2018 12:11:30 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0FCAFF0A; Fri, 2 Feb 2018 17:11:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chun-Yeow Yeoh , Johannes Berg , Sasha Levin Subject: [PATCH 4.14 070/156] mac80211: fix the update of path metric for RANN frame Date: Fri, 2 Feb 2018 17:57:31 +0100 Message-Id: <20180202140843.456332414@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chun-Yeow Yeoh [ Upstream commit fbbdad5edf0bb59786a51b94a9d006bc8c2da9a2 ] The previous path metric update from RANN frame has not considered the own link metric toward the transmitting mesh STA. Fix this. Reported-by: Michael65535 Signed-off-by: Chun-Yeow Yeoh Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/mac80211/mesh_hwmp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c @@ -797,7 +797,7 @@ static void hwmp_rann_frame_process(stru struct mesh_path *mpath; u8 ttl, flags, hopcount; const u8 *orig_addr; - u32 orig_sn, metric, metric_txsta, interval; + u32 orig_sn, new_metric, orig_metric, last_hop_metric, interval; bool root_is_gate; ttl = rann->rann_ttl; @@ -808,7 +808,7 @@ static void hwmp_rann_frame_process(stru interval = le32_to_cpu(rann->rann_interval); hopcount = rann->rann_hopcount; hopcount++; - metric = le32_to_cpu(rann->rann_metric); + orig_metric = le32_to_cpu(rann->rann_metric); /* Ignore our own RANNs */ if (ether_addr_equal(orig_addr, sdata->vif.addr)) @@ -825,7 +825,10 @@ static void hwmp_rann_frame_process(stru return; } - metric_txsta = airtime_link_metric_get(local, sta); + last_hop_metric = airtime_link_metric_get(local, sta); + new_metric = orig_metric + last_hop_metric; + if (new_metric < orig_metric) + new_metric = MAX_METRIC; mpath = mesh_path_lookup(sdata, orig_addr); if (!mpath) { @@ -838,7 +841,7 @@ static void hwmp_rann_frame_process(stru } if (!(SN_LT(mpath->sn, orig_sn)) && - !(mpath->sn == orig_sn && metric < mpath->rann_metric)) { + !(mpath->sn == orig_sn && new_metric < mpath->rann_metric)) { rcu_read_unlock(); return; } @@ -856,7 +859,7 @@ static void hwmp_rann_frame_process(stru } mpath->sn = orig_sn; - mpath->rann_metric = metric + metric_txsta; + mpath->rann_metric = new_metric; mpath->is_root = true; /* Recording RANNs sender address to send individually * addressed PREQs destined for root mesh STA */ @@ -876,7 +879,7 @@ static void hwmp_rann_frame_process(stru mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, orig_sn, 0, NULL, 0, broadcast_addr, hopcount, ttl, interval, - metric + metric_txsta, 0, sdata); + new_metric, 0, sdata); } rcu_read_unlock();