* [PATCH v3] mac80211: mesh: fix wrong mesh TTL offset calculation
@ 2018-01-25 1:16 peter.oh
2018-01-25 19:01 ` Peter Oh
2018-01-27 21:00 ` kbuild test robot
0 siblings, 2 replies; 5+ messages in thread
From: peter.oh @ 2018-01-25 1:16 UTC (permalink / raw)
To: linux-wireless, johannes; +Cc: Peter Oh, johannes.berg
From: Peter Oh <peter.oh@bowerswilkins.com>
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.
Use element structure to correct the miscalculation.
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
---
net/mac80211/mesh.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 73ac607..6a381cb 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -1255,13 +1255,12 @@ 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;
skb = dev_alloc_skb(local->tx_headroom + len);
if (!skb)
@@ -1269,13 +1268,9 @@ static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata,
skb_reserve(skb, local->tx_headroom);
mgmt_fwd = skb_put(skb, len);
- /* 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;
- *(pos + offset_ttl) -= 1;
- *(pos + offset_ttl + 1) &= ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR;
+ elems->mesh_chansw_params_ie->mesh_ttl--;
+ elems->mesh_chansw_params_ie->mesh_flags &=
+ ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR;
memcpy(mgmt_fwd, mgmt, len);
eth_broadcast_addr(mgmt_fwd->da);
@@ -1323,7 +1318,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");
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mac80211: mesh: fix wrong mesh TTL offset calculation
2018-01-25 1:16 [PATCH v3] mac80211: mesh: fix wrong mesh TTL offset calculation peter.oh
@ 2018-01-25 19:01 ` Peter Oh
2018-01-25 19:48 ` Johannes Berg
2018-01-27 21:00 ` kbuild test robot
1 sibling, 1 reply; 5+ messages in thread
From: Peter Oh @ 2018-01-25 19:01 UTC (permalink / raw)
To: linux-wireless, johannes; +Cc: johannes.berg
Ignore the patch below for now. Just noticed mesh_chansw_params_ie is
constance.
will come up with new approach.
Thanks,
Peter
On 01/24/2018 05:16 PM, peter.oh@bowerswilkins.com wrote:
> From: Peter Oh <peter.oh@bowerswilkins.com>
>
> 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.
> Use element structure to correct the miscalculation.
>
> Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
> ---
> net/mac80211/mesh.c | 17 ++++++-----------
> 1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
> index 73ac607..6a381cb 100644
> --- a/net/mac80211/mesh.c
> +++ b/net/mac80211/mesh.c
> @@ -1255,13 +1255,12 @@ 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;
>
> skb = dev_alloc_skb(local->tx_headroom + len);
> if (!skb)
> @@ -1269,13 +1268,9 @@ static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata,
> skb_reserve(skb, local->tx_headroom);
> mgmt_fwd = skb_put(skb, len);
>
> - /* 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;
> - *(pos + offset_ttl) -= 1;
> - *(pos + offset_ttl + 1) &= ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR;
> + elems->mesh_chansw_params_ie->mesh_ttl--;
> + elems->mesh_chansw_params_ie->mesh_flags &=
> + ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR;
>
> memcpy(mgmt_fwd, mgmt, len);
> eth_broadcast_addr(mgmt_fwd->da);
> @@ -1323,7 +1318,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");
> }
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mac80211: mesh: fix wrong mesh TTL offset calculation
2018-01-25 19:01 ` Peter Oh
@ 2018-01-25 19:48 ` Johannes Berg
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2018-01-25 19:48 UTC (permalink / raw)
To: Peter Oh, linux-wireless
On Thu, 2018-01-25 at 11:01 -0800, Peter Oh wrote:
> Ignore the patch below for now. Just noticed mesh_chansw_params_ie is
> constance.
>
Just remove the const?
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mac80211: mesh: fix wrong mesh TTL offset calculation
2018-01-25 1:16 [PATCH v3] mac80211: mesh: fix wrong mesh TTL offset calculation peter.oh
2018-01-25 19:01 ` Peter Oh
@ 2018-01-27 21:00 ` kbuild test robot
2018-01-29 20:26 ` Peter Oh
1 sibling, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2018-01-27 21:00 UTC (permalink / raw)
To: peter.oh; +Cc: kbuild-all, linux-wireless, johannes, Peter Oh, johannes.berg
[-- Attachment #1: Type: text/plain, Size: 2326 bytes --]
Hi Peter,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on mac80211-next/master]
[also build test ERROR on v4.15-rc9 next-20180126]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/peter-oh-bowerswilkins-com/mac80211-mesh-fix-wrong-mesh-TTL-offset-calculation/20180128-042444
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: i386-randconfig-x070-201804 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
net//mac80211/mesh.c: In function 'mesh_fwd_csa_frame':
>> net//mac80211/mesh.c:1271:40: error: decrement of member 'mesh_ttl' in read-only object
elems->mesh_chansw_params_ie->mesh_ttl--;
^~
>> net//mac80211/mesh.c:1272:43: error: assignment of member 'mesh_flags' in read-only object
elems->mesh_chansw_params_ie->mesh_flags &=
^~
vim +/mesh_ttl +1271 net//mac80211/mesh.c
1256
1257 static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata,
1258 struct ieee80211_mgmt *mgmt, size_t len,
1259 struct ieee802_11_elems *elems)
1260 {
1261 struct ieee80211_mgmt *mgmt_fwd;
1262 struct sk_buff *skb;
1263 struct ieee80211_local *local = sdata->local;
1264
1265 skb = dev_alloc_skb(local->tx_headroom + len);
1266 if (!skb)
1267 return -ENOMEM;
1268 skb_reserve(skb, local->tx_headroom);
1269 mgmt_fwd = skb_put(skb, len);
1270
> 1271 elems->mesh_chansw_params_ie->mesh_ttl--;
> 1272 elems->mesh_chansw_params_ie->mesh_flags &=
1273 ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR;
1274
1275 memcpy(mgmt_fwd, mgmt, len);
1276 eth_broadcast_addr(mgmt_fwd->da);
1277 memcpy(mgmt_fwd->sa, sdata->vif.addr, ETH_ALEN);
1278 memcpy(mgmt_fwd->bssid, sdata->vif.addr, ETH_ALEN);
1279
1280 ieee80211_tx_skb(sdata, skb);
1281 return 0;
1282 }
1283
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24937 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mac80211: mesh: fix wrong mesh TTL offset calculation
2018-01-27 21:00 ` kbuild test robot
@ 2018-01-29 20:26 ` Peter Oh
0 siblings, 0 replies; 5+ messages in thread
From: Peter Oh @ 2018-01-29 20:26 UTC (permalink / raw)
To: kbuild test robot; +Cc: kbuild-all, linux-wireless, johannes, johannes.berg
I have patch v4 which fixes the warning, so we can ignore this warning I
believe.
Thanks,
Peter
On 01/27/2018 01:00 PM, kbuild test robot wrote:
> Hi Peter,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on mac80211-next/master]
> [also build test ERROR on v4.15-rc9 next-20180126]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/peter-oh-bowerswilkins-com/mac80211-mesh-fix-wrong-mesh-TTL-offset-calculation/20180128-042444
> base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
> config: i386-randconfig-x070-201804 (attached as .config)
> compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> All errors (new ones prefixed by >>):
>
> net//mac80211/mesh.c: In function 'mesh_fwd_csa_frame':
>>> net//mac80211/mesh.c:1271:40: error: decrement of member 'mesh_ttl' in read-only object
> elems->mesh_chansw_params_ie->mesh_ttl--;
> ^~
>>> net//mac80211/mesh.c:1272:43: error: assignment of member 'mesh_flags' in read-only object
> elems->mesh_chansw_params_ie->mesh_flags &=
> ^~
>
> vim +/mesh_ttl +1271 net//mac80211/mesh.c
>
> 1256
> 1257 static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata,
> 1258 struct ieee80211_mgmt *mgmt, size_t len,
> 1259 struct ieee802_11_elems *elems)
> 1260 {
> 1261 struct ieee80211_mgmt *mgmt_fwd;
> 1262 struct sk_buff *skb;
> 1263 struct ieee80211_local *local = sdata->local;
> 1264
> 1265 skb = dev_alloc_skb(local->tx_headroom + len);
> 1266 if (!skb)
> 1267 return -ENOMEM;
> 1268 skb_reserve(skb, local->tx_headroom);
> 1269 mgmt_fwd = skb_put(skb, len);
> 1270
>> 1271 elems->mesh_chansw_params_ie->mesh_ttl--;
>> 1272 elems->mesh_chansw_params_ie->mesh_flags &=
> 1273 ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR;
> 1274
> 1275 memcpy(mgmt_fwd, mgmt, len);
> 1276 eth_broadcast_addr(mgmt_fwd->da);
> 1277 memcpy(mgmt_fwd->sa, sdata->vif.addr, ETH_ALEN);
> 1278 memcpy(mgmt_fwd->bssid, sdata->vif.addr, ETH_ALEN);
> 1279
> 1280 ieee80211_tx_skb(sdata, skb);
> 1281 return 0;
> 1282 }
> 1283
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-29 20:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-25 1:16 [PATCH v3] mac80211: mesh: fix wrong mesh TTL offset calculation peter.oh
2018-01-25 19:01 ` Peter Oh
2018-01-25 19:48 ` Johannes Berg
2018-01-27 21:00 ` kbuild test robot
2018-01-29 20:26 ` Peter Oh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).