From patchwork Thu Nov 7 02:01:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yeow Yeoh X-Patchwork-Id: 3150481 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B2F319F3C4 for ; Thu, 7 Nov 2013 02:03:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC720204EC for ; Thu, 7 Nov 2013 02:03:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D011120334 for ; Thu, 7 Nov 2013 02:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753189Ab3KGCDh (ORCPT ); Wed, 6 Nov 2013 21:03:37 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:48028 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753148Ab3KGCDg (ORCPT ); Wed, 6 Nov 2013 21:03:36 -0500 Received: by mail-pa0-f43.google.com with SMTP id hz1so532544pad.30 for ; Wed, 06 Nov 2013 18:03:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=paXaVxJ4glHQexq0ItnN9OQyy+p4nXqNvIhqYQ/PZZs=; b=FwFvSKevxwhwfG8tnwG9mPqYLxpUvvMN+OmK4ipizLaZaoeVTlABdv+NaxMNa9Y+VF hZK3rUhZX1e633FW28sdcTHT2V89bZlVYLUAT50C4KZuZXnkI6wzRcteWmaSvygAe4nQ 7rYVVorNHIW+wPiVZpppabN0MLBeviIR5hKeRfdWLfiET616LjbIF6rF/irfh2kk30Sw Cql6XuRngeg4gajgjuxficujecXfEORKFcOEEBla6CpHE9TUEoPIqgwzaUCnSZcUr+zA kZAz9ayzS2APYykfV503r/MWvl8TYzsx/X9yBfGn4eeksZ7uGqNBSGR1mTm8caAOb1/9 Rqxg== X-Received: by 10.66.139.196 with SMTP id ra4mr7053031pab.103.1383789816058; Wed, 06 Nov 2013 18:03:36 -0800 (PST) Received: from localhost.localdomain ([203.106.67.32]) by mx.google.com with ESMTPSA id v4sm1088509pbq.31.2013.11.06.18.02.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Nov 2013 18:03:35 -0800 (PST) From: Chun-Yeow Yeoh To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, linville@tuxdriver.com, devel@lists.open80211s.org, distro11s@cozybit.com, Chun-Yeow Yeoh Subject: [PATCH v2] mac80211: fix the mesh channel switch support Date: Thu, 7 Nov 2013 10:01:01 +0800 Message-Id: <1383789661-23644-1-git-send-email-yeohchunyeow@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Mesh STA receiving the mesh CSA action frame is not able to trigger the mesh channel switch due to the incorrect handling and comparison of mesh channel switch parameters element (MCSP)'s TTL. Make sure the MCSP's TTL is updated accordingly before calling the ieee80211_mesh_process_chnswitch. Signed-off-by: Chun-Yeow Yeoh --- v2: only allow channel switch if mesh TTL less than dot11MeshTTL (Chun-Yeow) net/mac80211/mesh.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 896fe3b..98963a4 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -945,10 +945,8 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, params.block_tx = csa_ie.mode & WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT; if (beacon) ifmsh->chsw_ttl = csa_ie.ttl - 1; - else - ifmsh->chsw_ttl = 0; - if (ifmsh->chsw_ttl > 0) + if (ifmsh->chsw_ttl < ifmsh->mshcfg.dot11MeshTTL) if (ieee80211_mesh_csa_beacon(sdata, ¶ms, false) < 0) return false; @@ -1163,7 +1161,6 @@ static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata, offset_ttl = (len < 42) ? 7 : 10; *(pos + offset_ttl) -= 1; *(pos + offset_ttl + 1) &= ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR; - sdata->u.mesh.chsw_ttl = *(pos + offset_ttl); memcpy(mgmt_fwd, mgmt, len); eth_broadcast_addr(mgmt_fwd->da); @@ -1182,7 +1179,7 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, u16 pre_value; bool fwd_csa = true; size_t baselen; - u8 *pos, ttl; + u8 *pos; if (mgmt->u.action.u.measurement.action_code != WLAN_ACTION_SPCT_CHL_SWITCH) @@ -1193,8 +1190,8 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, u.action.u.chan_switch.variable); ieee802_11_parse_elems(pos, len - baselen, false, &elems); - ttl = elems.mesh_chansw_params_ie->mesh_ttl; - if (!--ttl) + ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl; + if (!--ifmsh->chsw_ttl) fwd_csa = false; pre_value = le16_to_cpu(elems.mesh_chansw_params_ie->mesh_pre_value);