c7101b1dbcfa9218fb2aa9d2995e1fda02d0cf4b
[openwrt/staging/linusw.git] /
1 From d869c753b79a1423c2bd9b0afdfa0d89d55a930c Mon Sep 17 00:00:00 2001
2 From: Markus Theil <markus.theil@tu-ilmenau.de>
3 Date: Tue, 30 Jun 2020 13:53:18 +0200
4 Subject: [PATCH 02/19] mesh: fix channel init order, disable pri/sec channel
5 switch
6
7 wpa_supplicant_conf_ap_ht has to happen before hostapd_setup_interface
8 in order for its configuration settings to have effect on interface
9 configuration.
10
11 Disable primary and secondary channel switch because of missing tie
12 breaking rule/frames in mesh networks. A rather long comment about
13 this issue is placed in mesh.c in the corresponding place.
14
15 In consequence, remove mesh coex test, which contradicts this change.
16
17 I was not able to reproduce the memory corruption during
18 mesh_secure_ocv_mix_legacy, which lead to a revert of a similar patch
19 in the past.
20
21 Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
22 ---
23 tests/hwsim/test_wpas_mesh.py | 50 -----------------------------------
24 wpa_supplicant/mesh.c | 25 ++++++++++++++++--
25 2 files changed, 23 insertions(+), 52 deletions(-)
26
27 --- a/tests/hwsim/test_wpas_mesh.py
28 +++ b/tests/hwsim/test_wpas_mesh.py
29 @@ -933,56 +933,6 @@ def _test_wpas_mesh_open_5ghz(dev, apdev
30 dev[0].dump_monitor()
31 dev[1].dump_monitor()
32
33 -def test_wpas_mesh_open_5ghz_coex(dev, apdev):
34 - """Mesh network on 5 GHz band and 20/40 coex change"""
35 - try:
36 - _test_wpas_mesh_open_5ghz_coex(dev, apdev)
37 - finally:
38 - dev[0].request("MESH_GROUP_REMOVE " + dev[0].ifname)
39 - dev[1].request("MESH_GROUP_REMOVE " + dev[1].ifname)
40 - set_world_reg(apdev0=apdev[0], dev0=dev[0])
41 - dev[0].flush_scan_cache()
42 - dev[1].flush_scan_cache()
43 -
44 -def _test_wpas_mesh_open_5ghz_coex(dev, apdev):
45 - check_mesh_support(dev[0])
46 - subprocess.call(['iw', 'reg', 'set', 'US'])
47 -
48 - # Start a 20 MHz BSS on channel 40 that would be the secondary channel of
49 - # HT40+ mesh on channel 36.
50 - params = {"ssid": "test-ht40",
51 - "hw_mode": "a",
52 - "channel": "40",
53 - "country_code": "US"}
54 - hapd = hostapd.add_ap(apdev[0], params)
55 - bssid = hapd.own_addr()
56 -
57 - for i in range(2):
58 - for j in range(5):
59 - ev = dev[i].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=5)
60 - if ev is None:
61 - raise Exception("No regdom change event")
62 - if "alpha2=US" in ev:
63 - break
64 - dev[i].scan_for_bss(bssid, freq=5200)
65 - add_open_mesh_network(dev[i], freq="5180")
66 -
67 - check_mesh_joined_connected(dev)
68 -
69 - freq = dev[0].get_status_field("freq")
70 - if freq != "5200":
71 - raise Exception("Unexpected STATUS freq=" + freq)
72 - sig = dev[0].request("SIGNAL_POLL").splitlines()
73 - if "FREQUENCY=5200" not in sig:
74 - raise Exception("Unexpected SIGNAL_POLL output: " + str(sig))
75 -
76 - hapd.disable()
77 - dev[0].mesh_group_remove()
78 - dev[1].mesh_group_remove()
79 - check_mesh_group_removed(dev[0])
80 - check_mesh_group_removed(dev[1])
81 - dev[0].dump_monitor()
82 - dev[1].dump_monitor()
83
84 def test_wpas_mesh_open_ht40(dev, apdev):
85 """Mesh and HT40 support difference"""
86 --- a/wpa_supplicant/mesh.c
87 +++ b/wpa_supplicant/mesh.c
88 @@ -363,6 +363,29 @@ static int wpa_supplicant_mesh_init(stru
89 conf->basic_rates[rate_len] = -1;
90 }
91
92 + /* While it can enhance performance to switch the primary channel, which
93 + * is also the secondary channel of another network at the same time),
94 + * to the other primary channel, problems exist with this in mesh networks.
95 + *
96 + * Example with problems:
97 + * - 3 mesh nodes M1-M3, freq (5200, 5180)
98 + * - other node O1, e.g. AP mode, freq (5180, 5200),
99 + * Locations: O1 M1 M2 M3
100 + *
101 + * M3 can only send frames to M1 over M2, no direct connection is possible
102 + * Start O1, M1 and M3 first, M1 or O1 will switch channels to align with
103 + * each other. M3 does not swap, because M1 or O1 cannot be reached.
104 + * M2 is started afterwards and can either connect to M3 or M1 because of
105 + * this primary secondary channel switch.
106 + *
107 + * Solutions: (1) central coordination -> not always possible
108 + * (2) disable pri/sec channel switch in mesh networks
109 + *
110 + * In AP mode, when all nodes can work independently, this poses of course
111 + * no problem, therefore disable it only in mesh mode.`*/
112 + conf->no_pri_sec_switch = 1;
113 + wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
114 +
115 if (wpa_drv_init_mesh(wpa_s)) {
116 wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver");
117 return -1;
118 @@ -374,8 +397,6 @@ static int wpa_supplicant_mesh_init(stru
119 return -1;
120 }
121
122 - wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
123 -
124 return 0;
125 out_free:
126 wpa_supplicant_mesh_deinit(wpa_s);