Received: by 10.223.176.5 with SMTP id f5csp2841212wra; Mon, 5 Feb 2018 10:45:52 -0800 (PST) X-Google-Smtp-Source: AH8x226/vQH5k8wupX8zW1Vij5MPD1fReeTodx9i2R2aZjJOhuUCtecyq4cGjI5gxvzDxNm/EHn8 X-Received: by 2002:a17:902:82c5:: with SMTP id u5-v6mr28593395plz.401.1517856352798; Mon, 05 Feb 2018 10:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517856352; cv=none; d=google.com; s=arc-20160816; b=XlrH2S4erw+Xi2AoINcfcvUmELuJIed8m4VV3shW6DYvonD3WZ6SPqnj16gtm8YwnT l7NhGIXPqjm8+xn6q3KuYDCeSmCocNX/UdwLl8P6DcwkeVDm1AhNUzGgmjzP/rXYyXO4 n7VR18FsGXz6tb1cbIz105R+q/sXeFp1AoXzF4kW9h7eAC4IO/g1ZObW4xzAgMqG5iJu l7EiuormoLngSJFjEZoiT3iJWGLiJYK7p99lsH35TjJyGB60BJtrpCpv0OVqvadrYwXq ps8BoG2LtaxM/+MkHggD3RE5CUgPmFRuaV0iFlmUdeCslW3IqxU3Nj8GzCQv8C02H9W0 /BUg== 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=sPaXgRs0+e2nmPmqkYEskZf55YXJOSYg/iycc/xZV3M=; b=wZ03V5vyKWgHQw01Dm6IVCGrh9NzIP75O1+CU0EKwKS3k3Z8YwDon1gC5WjOVU45mR ZJ6kMFwmG4tdo08GPm2Bux3tzSDDNT84BxC2e50DKHjd/7g/KXPy3Kd4cRxwWK5YsKbG j+WgialZgKjzzcJz9g6WZ6Xh5xG+7VjxFln93TVXXAhaQfYCJY9UvXHMfbFXojk8GfH0 gn9a3RKCtyYXD5gcuK/1IDkIY2tzoNDJtpfDUkD5LZv4CWzuyRg/F8cAZUwiMGzgDXru ng/HmG0GjQVpQCCjU5/X875snn6YPKvuJFuOC8nPYG229TCNhOVb+go9XMwk44HowY5T 1cXg== 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 g6si365246pgs.717.2018.02.05.10.45.38; Mon, 05 Feb 2018 10:45:52 -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 S1753745AbeBESoI (ORCPT + 99 others); Mon, 5 Feb 2018 13:44:08 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53330 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753872AbeBES0O (ORCPT ); Mon, 5 Feb 2018 13:26:14 -0500 Received: from localhost (unknown [104.132.1.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EFA701157; Mon, 5 Feb 2018 18:26:05 +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 3.18 13/36] mac80211: fix the update of path metric for RANN frame Date: Mon, 5 Feb 2018 10:23:41 -0800 Message-Id: <20180205182352.318675842@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180205182351.774761393@linuxfoundation.org> References: <20180205182351.774761393@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 3.18-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 @@ -763,7 +763,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; @@ -774,7 +774,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)) @@ -791,7 +791,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) { @@ -804,7 +807,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; } @@ -822,7 +825,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 */ @@ -842,7 +845,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();