]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: MLD address conversion for hostapd_drv_send_action_addr3_ap()
authorJouni Malinen <j@w1.fi>
Sat, 13 Jan 2024 10:19:12 +0000 (12:19 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 13 Jan 2024 17:09:31 +0000 (19:09 +0200)
Commit 31e025c033f3 ("AP: When sending Action frames, use the AP MLD MAC
address if needed") added this for hostapd_drv_send_action(), but the
A3=BSSID variant of that function needs similar changes for GAS to work
correctly with STAs that are currently associated with MLO.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/ap_drv_ops.c

index 588c4cf44795f213a1e9cf727f492286271a6fa9..3dec6eca68bb1708be82f1cdc35ef7af1b0e2ba3 100644 (file)
@@ -882,9 +882,9 @@ int hostapd_drv_wnm_oper(struct hostapd_data *hapd, enum wnm_oper oper,
 }
 
 
-int hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
-                           unsigned int wait, const u8 *dst, const u8 *data,
-                           size_t len)
+static int hapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
+                               unsigned int wait, const u8 *dst,
+                               const u8 *data, size_t len, bool addr3_ap)
 {
        const u8 *own_addr = hapd->own_addr;
        const u8 *bssid;
@@ -896,7 +896,7 @@ int hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
        if (!hapd->driver || !hapd->driver->send_action || !hapd->drv_priv)
                return 0;
        bssid = hapd->own_addr;
-       if (!is_multicast_ether_addr(dst) &&
+       if (!addr3_ap && !is_multicast_ether_addr(dst) &&
            len > 0 && data[0] == WLAN_ACTION_PUBLIC) {
                /*
                 * Public Action frames to a STA that is not a member of the BSS
@@ -905,7 +905,7 @@ int hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
                sta = ap_get_sta(hapd, dst);
                if (!sta || !(sta->flags & WLAN_STA_ASSOC))
                        bssid = wildcard_bssid;
-       } else if (is_broadcast_ether_addr(dst) &&
+       } else if (!addr3_ap && is_broadcast_ether_addr(dst) &&
                   len > 0 && data[0] == WLAN_ACTION_PUBLIC) {
                /*
                 * The only current use case of Public Action frames with
@@ -930,16 +930,20 @@ int hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
 }
 
 
+int hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
+                           unsigned int wait, const u8 *dst, const u8 *data,
+                           size_t len)
+{
+       return hapd_drv_send_action(hapd, freq, wait, dst, data, len, false);
+}
+
+
 int hostapd_drv_send_action_addr3_ap(struct hostapd_data *hapd,
                                     unsigned int freq,
                                     unsigned int wait, const u8 *dst,
                                     const u8 *data, size_t len)
 {
-       if (hapd->driver == NULL || hapd->driver->send_action == NULL)
-               return 0;
-       return hapd->driver->send_action(hapd->drv_priv, freq, wait, dst,
-                                        hapd->own_addr, hapd->own_addr, data,
-                                        len, 0);
+       return hapd_drv_send_action(hapd, freq, wait, dst, data, len, true);
 }