]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Select frame TX frequency according to the transmitting link
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Mon, 22 May 2023 19:33:38 +0000 (22:33 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 7 Jun 2023 07:50:19 +0000 (10:50 +0300)
In MLO, multiple BSSs can transmit on different frequencies. Select
link frequencies according to the transmitter address.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
src/drivers/driver_nl80211.c

index 228a6417d281ce206d96450bcd0b4af517b602fe..fda215cce08ec66d1c51eff3b4fde00df3a67e1b 100644 (file)
@@ -4141,6 +4141,29 @@ static void nl80211_link_set_freq(struct i802_bss *bss, s8 link_id, int freq)
 }
 
 
+static int nl80211_get_link_freq(struct i802_bss *bss, const u8 *addr,
+                                bool bss_freq_debug)
+{
+       size_t i;
+
+       for (i = 0; i < bss->n_links; i++) {
+               if (os_memcmp(bss->links[i].addr, addr, ETH_ALEN) == 0) {
+                       wpa_printf(MSG_DEBUG,
+                                  "nl80211: Use link freq=%d for address "
+                                  MACSTR,
+                                  bss->links[i].freq, MAC2STR(addr));
+                       return bss->links[i].freq;
+               }
+       }
+
+       if (bss_freq_debug)
+               wpa_printf(MSG_DEBUG, "nl80211: Use bss->freq=%d",
+                          bss->flink->freq);
+
+       return bss->flink->freq;
+}
+
+
 static int wpa_driver_nl80211_send_mlme(struct i802_bss *bss, const u8 *data,
                                        size_t data_len, int noack,
                                        unsigned int freq, int no_cck,
@@ -4185,13 +4208,15 @@ static int wpa_driver_nl80211_send_mlme(struct i802_bss *bss, const u8 *data,
        }
 
        if (drv->device_ap_sme && is_ap_interface(drv->nlmode)) {
-               if (freq == 0) {
-                       wpa_printf(MSG_DEBUG, "nl80211: Use bss->freq=%d",
-                                  bss->flink->freq);
-                       freq = bss->flink->freq;
-               }
-               if ((int) freq == bss->flink->freq)
+               unsigned int link_freq = nl80211_get_link_freq(bss, mgmt->sa,
+                                                              !freq);
+
+               if (!freq)
+                       freq = link_freq;
+
+               if (freq == link_freq)
                        wait_time = 0;
+
                goto send_frame_cmd;
        }