71ae00e0162792478a9e41a1bb57bfe6c5288c83
[openwrt/openwrt.git] /
1 From 0d47666f48a084363ee54f389bec2865de4934b8 Mon Sep 17 00:00:00 2001
2 From: Benjamin Berg <benjamin@sipsolutions.net>
3 Date: Wed, 30 Apr 2025 20:25:38 +0200
4 Subject: [PATCH] wifi: mac80211: do not offer a mesh path if forwarding is
5 disabled
6
7 When processing a PREQ the code would always check whether we have a
8 mesh path locally and reply accordingly. However, when forwarding is
9 disabled then we should not reply with this information as we will not
10 forward data packets down that path.
11
12 Move the check for dot11MeshForwarding up in the function and skip the
13 mesh path lookup in that case. In the else block, set forward to false
14 so that the rest of the function becomes a no-op and the
15 dot11MeshForwarding check does not need to be duplicated.
16
17 This explains an effect observed in the Freifunk community where mesh
18 forwarding is disabled. In that case a mesh with three STAs and only bad
19 links in between them, individual STAs would occionally have indirect
20 mpath entries. This should not have happened.
21
22 Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
23 Reviewed-by: Rouven Czerwinski <rouven@czerwinskis.de>
24 ---
25 net/mac80211/mesh_hwmp.c | 6 ++++--
26 1 file changed, 4 insertions(+), 2 deletions(-)
27
28 --- a/net/mac80211/mesh_hwmp.c
29 +++ b/net/mac80211/mesh_hwmp.c
30 @@ -636,7 +636,7 @@ static void hwmp_preq_frame_process(stru
31 mesh_path_add_gate(mpath);
32 }
33 rcu_read_unlock();
34 - } else {
35 + } else if (ifmsh->mshcfg.dot11MeshForwarding) {
36 rcu_read_lock();
37 mpath = mesh_path_lookup(sdata, target_addr);
38 if (mpath) {
39 @@ -654,6 +654,8 @@ static void hwmp_preq_frame_process(stru
40 }
41 }
42 rcu_read_unlock();
43 + } else {
44 + forward = false;
45 }
46
47 if (reply) {
48 @@ -671,7 +673,7 @@ static void hwmp_preq_frame_process(stru
49 }
50 }
51
52 - if (forward && ifmsh->mshcfg.dot11MeshForwarding) {
53 + if (forward) {
54 u32 preq_id;
55 u8 hopcount;
56