]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mesh: Fix channel init order, disable pri/sec channel switch
authorMarkus Theil <markus.theil@tu-ilmenau.de>
Tue, 30 Jun 2020 11:53:18 +0000 (13:53 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 14 Oct 2020 09:44:15 +0000 (12:44 +0300)
wpa_supplicant_conf_ap_ht() has to happen before
hostapd_setup_interface() in order for its configuration settings to
have effect on interface configuration.

Disable primary and secondary channel switch because of missing tie
breaking rule/frames in mesh networks. A rather long comment about
this issue is placed in mesh.c in the corresponding place.

I was not able to reproduce the memory corruption during
mesh_secure_ocv_mix_legacy, which lead to a revert of a similar patch in
the past.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
wpa_supplicant/mesh.c

index 8cacf28e1a80c92a90389e2594745f12ffa5d837..558d87ae2283ccfc0fe78e527913d719cf6c626a 100644 (file)
@@ -363,6 +363,31 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
                conf->basic_rates[rate_len] = -1;
        }
 
+       /* While it can enhance performance to switch the primary channel, which
+        * is also the secondary channel of another network at the same time),
+        * to the other primary channel, problems exist with this in mesh
+        * networks.
+        *
+        * Example with problems:
+        *     - 3 mesh nodes M1-M3, freq (5200, 5180)
+        *     - other node O1, e.g. AP mode, freq (5180, 5200),
+        * Locations: O1 M1      M2      M3
+        *
+        * M3 can only send frames to M1 over M2, no direct connection is
+        * possible
+        * Start O1, M1 and M3 first, M1 or O1 will switch channels to align
+        * with* each other. M3 does not swap, because M1 or O1 cannot be
+        * reached. M2 is started afterwards and can either connect to M3 or M1
+        * because of this primary secondary channel switch.
+        *
+        * Solutions: (1) central coordination -> not always possible
+        *            (2) disable pri/sec channel switch in mesh networks
+        *
+        * In AP mode, when all nodes can work independently, this poses of
+        * course no problem, therefore disable it only in mesh mode. */
+       conf->no_pri_sec_switch = 1;
+       wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
+
        if (wpa_drv_init_mesh(wpa_s)) {
                wpa_msg(wpa_s, MSG_ERROR, "Failed to init mesh in driver");
                return -1;
@@ -374,8 +399,6 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
                return -1;
        }
 
-       wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf);
-
        return 0;
 out_free:
        wpa_supplicant_mesh_deinit(wpa_s);