Received: by 10.223.176.5 with SMTP id f5csp1082309wra; Fri, 2 Feb 2018 10:52:10 -0800 (PST) X-Google-Smtp-Source: AH8x227iiHwzlT11pr0beqE0TwtYltO6x7SiipAYKJIMrFpOcq9Il6uawzxM+OMP0UNTHdiDbr2l X-Received: by 2002:a17:902:a711:: with SMTP id w17-v6mr22194978plq.299.1517597530126; Fri, 02 Feb 2018 10:52:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517597530; cv=none; d=google.com; s=arc-20160816; b=NxXI/aYtKjxtlpqK1YPbiEWBqDcF8JyKvzUhE3XKNFQkKg3EvhOF4TUh3zoGRLvWkp OOtcN0Yi6Ctt7hWT5U7rkEqNCKZTzJdYUqz/k9yZx785DmRC6IiTvzDgQWZo7dJZ9Rr1 F20HTQ6oYBFYMFb/IDgb5NOde3r6kfcoJz0ArofSzVYLFFghhICaKIReZAHoT4om4qPl 24/rQtx44Qwcpz8Ae9E2pAi0LiRPdIz6XYqhhF9nnbWXAnIzvsh/Ruk7uAG9reAmQUg/ Y1HRH05LuLYlmyeKZDZgH2hfz3ZWEbnrNQIdniQge3N5gBYeNssXzW0nYyt/Fn5eH6Ht jugQ== 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=YqsiivzQT7AAiGlmUMxQnIYjNTPQMNFVGqSZpicueuA=; b=O4TeEy2eNjnmuL/tpR4H5SiA3eeYl1g6Pm5PNCp+PP8nOA4KaMkHQSN4vFSLkaqdqh K4Iy0igpbF0DxWKS+pEk2cyUeztwYJ4iw1RjQj3PN3vBxcCP9F4pkPxMB10PjMjBpLm3 1/bnv5jMnVGhp7IVnjpvIuKE8moAHKyoAk+1PQECPlpo3tpXO5IRB33BAotHsnoHvGed 25+ObMvHfBpWwAD91C/RClPA8NQmNyrDM91MLbt8uuP1Kl4CyqPfjojS48pKoS6fNFzP MBcMYIXjB4fS1DHO6U/7jw8NRPY5GtpT0lgEZZBeGc+8U0HCbkBop4r5164syU+WGg8u lKjw== 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 t71si1844019pgb.484.2018.02.02.10.51.54; Fri, 02 Feb 2018 10:52:10 -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 S1752762AbeBBRCY (ORCPT + 99 others); Fri, 2 Feb 2018 12:02:24 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34804 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752633AbeBBRAp (ORCPT ); Fri, 2 Feb 2018 12:00:45 -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 D8327E4D; Fri, 2 Feb 2018 17:00:44 +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.4 34/67] mac80211: fix the update of path metric for RANN frame Date: Fri, 2 Feb 2018 17:58:03 +0100 Message-Id: <20180202140819.420313005@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140815.091718203@linuxfoundation.org> References: <20180202140815.091718203@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.4-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 @@ -776,7 +776,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; @@ -787,7 +787,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)) @@ -804,7 +804,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) { @@ -817,7 +820,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; } @@ -835,7 +838,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 */ @@ -855,7 +858,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();