Received: by 10.223.176.46 with SMTP id f43csp279905wra; Tue, 23 Jan 2018 20:57:23 -0800 (PST) X-Google-Smtp-Source: AH8x22449hrG64uJh2MwhSVrCSJXpmzjqm7oR7VHMJXumv6YOlotqx57T7Ss7BnC0kaqQmzhLwQN X-Received: by 10.98.252.82 with SMTP id e79mr11886143pfh.159.1516769843733; Tue, 23 Jan 2018 20:57:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516769843; cv=none; d=google.com; s=arc-20160816; b=IkMo+AO799DPeVheNvyH4H3PI//GmFDNRtXgZi7f+aPppiBJYwHd2gJ8FslXLGeyfQ AWDiKkjyTI/vvh4mPLiaAcymOLbN0zhA6xmHEtxEMZZujX+DIEFHBhr6ructVnSVCcKn 9HYDP0rXIOdcW3mXxc/jkja1LNqMRIbEXHZlgx2naFhfZjzJFYS68PmDJh4rFFT92s+/ q05OTZS5v659IntcSnEuEZA95GeemjhHQbi7NdeB7ZKZPcNtz0DTdNz4az0i/6w1k591 i9t7eMOgwABDjQTkzHGtm1AlpIee5ZR5Erv80mzYPmaZHimd2O//uYqxLNpqi0kxv1w8 zPBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=uT1x+jgsEkcNd54KkfydVpsLIOZShzGpY70L13s+x5k=; b=mGOlQvwR8Eq9hqHLL1mxZWlMunYeMMI7sWSKihAh/sri3NsOJ8k2ts+JbXpCoYhdZ1 KVH9UQrtPa5U+velEc1T8tfvWDfDWFLr2dMTUcPi8UDG1iL+nZFwnIGXcTubBedMSKG2 Oqk8QdsKAQI2EGKMkFOtX56xpRgh6qPS6ibx1HPt1piJ5eJvEInROoN+zNCJMa4EwI4+ IhwZ+aHk5v8eFfyyKzcXcaTIBYFCfTcyRPIoRaPbRS9mM1+cO2oAdrlADAqFrVZc69nG P/h3yF9jW5eQWIyAEKuyjthci4ZXDQthLJK2sZVqnp6EzHmQw1Q0qdmoTYI4L2sI42KR /MEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=OhtZn4Kb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f62-v6si3752672plb.297.2018.01.23.20.57.10; Tue, 23 Jan 2018 20:57:23 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=OhtZn4Kb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932678AbeAXE4r (ORCPT + 99 others); Tue, 23 Jan 2018 23:56:47 -0500 Received: from mail-by2nam03on0097.outbound.protection.outlook.com ([104.47.42.97]:48419 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932151AbeAXEPT (ORCPT ); Tue, 23 Jan 2018 23:15:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=uT1x+jgsEkcNd54KkfydVpsLIOZShzGpY70L13s+x5k=; b=OhtZn4Kbq1xJCIQeAFJZqRB4R50ZlPb+jCPeynnbTfyI+XUHjpUXR+SQ2o7DP19dNi4JsVpBE0UAAYTIPRzILanOKT9UVdDoNHSPXbVr41tFN05qir2szWWIcBLmQ6TZD/o9hqSp/vcKJN78bIyaDbwxdjzb2NETmFZp1UAshoo= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0998.namprd21.prod.outlook.com (52.132.133.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.0; Wed, 24 Jan 2018 04:15:13 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7%2]) with mapi id 15.20.0464.000; Wed, 24 Jan 2018 04:15:13 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Chun-Yeow Yeoh , Johannes Berg , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 041/100] mac80211: fix the update of path metric for RANN frame Thread-Topic: [PATCH AUTOSEL for 4.14 041/100] mac80211: fix the update of path metric for RANN frame Thread-Index: AQHTlMndg30s/Reuo0e8h4orHYbGLw== Date: Wed, 24 Jan 2018 04:14:44 +0000 Message-ID: <20180124041414.32065-41-alexander.levin@microsoft.com> References: <20180124041414.32065-1-alexander.levin@microsoft.com> In-Reply-To: <20180124041414.32065-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0998;7:6X+uR4tDNrFaurtoJS5wELDKrtimL/vH7vaAXl4+tVLa9yHSoOdYvCGMkEr2Y8n9aR19PGP/nD/f3up+rJFFH1+odiw4LxZxBw/wq4ybaz+Zf0WydMUlvGHVlDcsqMzlg4eNzxRn4Pfk/EErshm1zo676e9NvOE/xM9Q8xCLBZF3hKIVLJvH8gv/FIj1H4GuvN3hRrtztNFAvE6yRmd1P32kO+RJkxa+UhtmZUjQo3p7XXfNqkWphkLR9gUC5t9T x-ms-office365-filtering-correlation-id: b22b1c20-c5db-49de-ec5a-08d562e11122 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020);SRVR:DM5PR2101MB0998; x-ms-traffictypediagnostic: DM5PR2101MB0998: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231046)(2400081)(944501161)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB0998;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0998; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(39380400002)(346002)(39860400002)(396003)(376002)(199004)(189003)(14454004)(3660700001)(6346003)(10290500003)(105586002)(66066001)(6506007)(8676002)(22452003)(86612001)(54906003)(10090500001)(81166006)(81156014)(76176011)(110136005)(86362001)(68736007)(106356001)(59450400001)(8936002)(3280700002)(36756003)(25786009)(107886003)(39060400002)(2501003)(6666003)(99286004)(2906002)(26005)(2950100002)(72206003)(102836004)(305945005)(6116002)(3846002)(5660300001)(4326008)(478600001)(316002)(53936002)(97736004)(575784001)(2900100001)(5250100002)(6512007)(15650500001)(6436002)(6486002)(1076002)(7736002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0998;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: ls6v4CqDSct6GQHsn+tF3Z+BMM7p0PPJ30EyPtf7hgBG9wxoQeUpG1JQWwMFOvvpWG5v5Rxys1SmeM2J3RATzg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b22b1c20-c5db-49de-ec5a-08d562e11122 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 04:14:44.5120 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0998 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- net/mac80211/mesh_hwmp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index d8bbd0d2225a..d6d3f316de4c 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c @@ -797,7 +797,7 @@ static void hwmp_rann_frame_process(struct ieee80211_su= b_if_data *sdata, 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; =20 ttl =3D rann->rann_ttl; @@ -808,7 +808,7 @@ static void hwmp_rann_frame_process(struct ieee80211_su= b_if_data *sdata, interval =3D le32_to_cpu(rann->rann_interval); hopcount =3D rann->rann_hopcount; hopcount++; - metric =3D le32_to_cpu(rann->rann_metric); + orig_metric =3D le32_to_cpu(rann->rann_metric); =20 /* Ignore our own RANNs */ if (ether_addr_equal(orig_addr, sdata->vif.addr)) @@ -825,7 +825,10 @@ static void hwmp_rann_frame_process(struct ieee80211_s= ub_if_data *sdata, return; } =20 - metric_txsta =3D airtime_link_metric_get(local, sta); + last_hop_metric =3D airtime_link_metric_get(local, sta); + new_metric =3D orig_metric + last_hop_metric; + if (new_metric < orig_metric) + new_metric =3D MAX_METRIC; =20 mpath =3D mesh_path_lookup(sdata, orig_addr); if (!mpath) { @@ -838,7 +841,7 @@ static void hwmp_rann_frame_process(struct ieee80211_su= b_if_data *sdata, } =20 if (!(SN_LT(mpath->sn, orig_sn)) && - !(mpath->sn =3D=3D orig_sn && metric < mpath->rann_metric)) { + !(mpath->sn =3D=3D orig_sn && new_metric < mpath->rann_metric)) { rcu_read_unlock(); return; } @@ -856,7 +859,7 @@ static void hwmp_rann_frame_process(struct ieee80211_su= b_if_data *sdata, } =20 mpath->sn =3D orig_sn; - mpath->rann_metric =3D metric + metric_txsta; + mpath->rann_metric =3D new_metric; mpath->is_root =3D 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(struct ieee80211_su= b_if_data *sdata, 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); } =20 rcu_read_unlock(); --=20 2.11.0