From patchwork Fri Jan 19 02:01:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Oh X-Patchwork-Id: 10174479 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E677D60386 for ; Fri, 19 Jan 2018 02:01:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D679E28535 for ; Fri, 19 Jan 2018 02:01:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB3CE2853A; Fri, 19 Jan 2018 02:01:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA2D828535 for ; Fri, 19 Jan 2018 02:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932439AbeASCBw (ORCPT ); Thu, 18 Jan 2018 21:01:52 -0500 Received: from mail-eopbgr00089.outbound.protection.outlook.com ([40.107.0.89]:61461 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755188AbeASCBq (ORCPT ); Thu, 18 Jan 2018 21:01:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowerswilkins.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=trOeUZ+ZzVodJL2VLIkjuAvMiV1P+OVQ6SMmVWExK3g=; b=kMI0ItHJ+kAXXpBVeh/I3L/9ibvh4tLfzYzkTVcRfE9ZhYRewziLdJSzXXtEEcO0+L58VqkefTGNX4KF5As2BwTHbq4yvGSjcJMcwUqf8dSaHv3fAf5O07fs9X8Sdzsu2X7d0ltAktV/5SrpLu9pujYgMm8pcLCA4IXajOf60gM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peter.oh@bowerswilkins.com; Received: from smtp.office365.com (2001:1900:2200:85:512:857f:ce36:a56e) by AM4PR04MB1651.eurprd04.prod.outlook.com (2a01:111:e400:59e6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Fri, 19 Jan 2018 02:01:42 +0000 From: peter.oh@bowerswilkins.com To: linux-wireless@vger.kernel.org, johannes@sipsolutions.net Cc: Peter Oh , johannes.berg@intel.com Subject: [PATCH] mac80211: mesh: fix wrong mesh TTL offset calculation Date: Thu, 18 Jan 2018 18:01:30 -0800 Message-Id: <1516327290-6162-1-git-send-email-peter.oh@bowerswilkins.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [2001:1900:2200:85:512:857f:ce36:a56e] X-ClientProxiedBy: YQXPR0101CA0006.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:15::19) To AM4PR04MB1651.eurprd04.prod.outlook.com (2a01:111:e400:59e6::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 45e5c944-0d23-4398-2fd5-08d55ee09671 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM4PR04MB1651; X-Microsoft-Exchange-Diagnostics: 1; AM4PR04MB1651; 3:q9vOF8QyH2T+HCEuPDjCFR7bAsfsfmE1OORQ7WcWlhSfGWs7bkThvmVqRLulsIn7csaO2WtUl4/lCriGQQZ26q6g4fJ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nbo0rVh3Py0fYm2Ti3fRz+zG/Uo8d6uunsHZ1NrhgLspOjcZYRgoxL1IQr7nQl1am8EbmH20Rone5wevDS9pacA==; 4:fpsq36qG9+Qb14V8ranRB50yKBEsFBg5opaompJ3J9U+XU4BwbY7PcXuUQRLRSsTHV46PmR8AeWqt13sQHNZT8WwkUm9gLDd5S8V3IxOOrRYzt+vAVZ329yXldRIbH7n1uV53QkdvDVhNSwvDwd9IF6WjZStOBrNLQqAFl1SNBI7H7sKCJIatMRIvltUv6/2cpWVuiWZ2Y+jWtShDYNq6cefD66hxu5XqKRD2aKdfMbIPu44W469UNPE578Ht0gIgCmV/NhqJ4HI+JWeeUKTUQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231023)(2400070)(944501161)(10201501046)(6041268)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:AM4PR04MB1651; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM4PR04MB1651; X-Forefront-PRVS: 0557CBAD84 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39850400004)(39380400002)(376002)(396003)(199004)(189003)(53416004)(69596002)(6666003)(9686003)(85782001)(6512007)(97736004)(16810700005)(47776003)(53936002)(16586007)(52396003)(52116002)(7736002)(386003)(36756003)(305945005)(105586002)(6506007)(316002)(106356001)(5660300001)(51416003)(50466002)(33896004)(4326008)(6486002)(50226002)(25786009)(2906002)(48376002)(81156014)(81166006)(8936002)(478600001)(86362001)(8676002)(59450400001)(68736007)(6116002)(85772001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR04MB1651; H:smtp.office365.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: bowerswilkins.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR04MB1651; 23:BA458aztPKdq6+6n/fmC80bG8Wm+BQxrZkNn/yo1/?= =?us-ascii?Q?hPuBbALIXu2TtXwQADjf3nyxUyNSydOLneDkc0TWqbbK5awWEGpqQ7qz5+9l?= =?us-ascii?Q?69lv4yTioiQAnGyKqNXH86wF2OMsJDhnCkvpNv5oOQZwja7Swn5seZbTlz+z?= =?us-ascii?Q?YbrVkc12DXAqCFFp8fRv51+PRyzmcLS4b3jC7er5vCv5s2/dDKeWNSK1EQIM?= =?us-ascii?Q?Mulmj0wr3Lpm4wWIvISWYNXiXqTV1uk79BPnysxbhGBgnbghUfnhY84CrvqZ?= =?us-ascii?Q?PtGtxo9snHeyiHqI6plKEeAyVBocISwS4zN8o9deUcP0DvI2mJPynAhIuiOU?= =?us-ascii?Q?eewHAkcaCpKT1p0obbpV6iWv3kZjTYiF5Mdr1nxPCAHCgqRH6J9x4y8bYtQx?= =?us-ascii?Q?Grty67MLYCG+rCmERjKlEWcbHOUOonB5uoPiAbCOb3c1DB6/YoUFZB7I6Uoh?= =?us-ascii?Q?9MM8AacqgBXGZa9SzzMg+JaXeri7ITCg+4A8uqJq960LP1EW7mlIqU6Q5nMA?= =?us-ascii?Q?DD92dRmFRaue6LRtII9WKU8usWcsszGRHW5RZPqnJWpZjAjxrZ8YbmWOjsff?= =?us-ascii?Q?bf9Y7bkrioI+17ylV4c5I2AGIedXD+V5ZG8uDOO46i12pteHKeOPq6S3hQrn?= =?us-ascii?Q?trcTHZ0fS7wX1SBT93QQmZSwBFzzq1q9uj4/NxAuEj/vL/Ll8rPRoHgwwvZO?= =?us-ascii?Q?+Yj9q+hTM0Sa3APXEPnuYqJ2Pyz+vr4Rykn79KBrR9/qH75fgfQrvAkCgbHD?= =?us-ascii?Q?fSLbnngCLK/v74WwTU2ctLJGutd+72Eor3yw0JaitOPxqLlnl1o+q5LmzkQQ?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GLtc0BhVTxQX33FZfrEKR4ZQRgdK9fFVo1w4Myw=; 7:W/wgYeA/yx7yWE/IDYdbUXX5spi/h63+PsnAP9Cx8JsdF3w9YtGTdXzhQChsltRc1MkPB3afCdNLQuY0gP0WvOCx/QlT2y221Qb+HC44GMp0LezbQWsicj2yVGUfhH6VqB3iTZcyJfLEs8BKEyfueSXX2UeluM0UnhXm0lctNjtHaU+78xk6kpVkkD4ZrWvungnYA9oBpvO99n1UULsNov4dAUy4Nitc9CMLAGrA3oLo/fjX4ZWCerE7EfI0+DFl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: bowerswilkins.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2018 02:01:42.1540 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45e5c944-0d23-4398-2fd5-08d55ee09671 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a75a45bb-4772-448f-a2c6-9d2413d86410 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR04MB1651 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Oh mesh TTL offset in Mesh Channel Switch Parameters element depends on not only Secondary Channel Offset element, but also affected by HT Control field and Wide Bandwidth Channel Switch element. Hence take those values place in. Signed-off-by: Peter Oh --- net/mac80211/mesh.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 73ac607..887b676 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -1255,13 +1255,16 @@ int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata, } static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, size_t len) + struct ieee80211_mgmt *mgmt, size_t len, + struct ieee802_11_elems *elems) { struct ieee80211_mgmt *mgmt_fwd; struct sk_buff *skb; struct ieee80211_local *local = sdata->local; u8 *pos = mgmt->u.action.u.chan_switch.variable; size_t offset_ttl; + /* mgmt hdr 24 + csa action 15 without sec offset and wide bw */ + unsigned int basic_hdrlen = 39; skb = dev_alloc_skb(local->tx_headroom + len); if (!skb) @@ -1269,11 +1272,17 @@ static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata, skb_reserve(skb, local->tx_headroom); mgmt_fwd = skb_put(skb, len); + if (ieee80211_has_order(mgmt->frame_control)) + basic_hdrlen += 4; + + if (elems->wide_bw_chansw_ie) + basic_hdrlen += 5; + /* offset_ttl is based on whether the secondary channel * offset is available or not. Subtract 1 from the mesh TTL * and disable the initiator flag before forwarding. */ - offset_ttl = (len < 42) ? 7 : 10; + offset_ttl = (len < basic_hdrlen) ? 7 : 10; *(pos + offset_ttl) -= 1; *(pos + offset_ttl + 1) &= ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR; @@ -1323,7 +1332,7 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, /* forward or re-broadcast the CSA frame */ if (fwd_csa) { - if (mesh_fwd_csa_frame(sdata, mgmt, len) < 0) + if (mesh_fwd_csa_frame(sdata, mgmt, len, &elems) < 0) mcsa_dbg(sdata, "Failed to forward the CSA frame"); } }