]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
NAN: Process received NAN SDFs with NAN Network ID in A3 on AP
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 13 Sep 2024 18:58:51 +0000 (21:58 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 13 Sep 2024 19:08:15 +0000 (22:08 +0300)
hostapd did not accept NAN SDFs that used NAN Network ID instead of
Wildcard BSSID in A3. Extend this to process NAN Network ID just like
Wildcard BSSID for these frames to allow the specific group address to
be used.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/ap/drv_callbacks.c
src/ap/ieee802_11.c
src/common/nan_de.c
src/common/nan_de.h

index 6c98cb903ba41400d4c4ab8df5b753ae5912a54a..4862c4f4f62b90bb836134b48f60bc9fa01bc742 100644 (file)
@@ -18,6 +18,7 @@
 #include "common/dpp.h"
 #include "common/sae.h"
 #include "common/hw_features_common.h"
+#include "common/nan_de.h"
 #include "crypto/random.h"
 #include "p2p/p2p.h"
 #include "wps/wps.h"
@@ -1855,6 +1856,11 @@ static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface,
        if (bssid[0] == 0xff && bssid[1] == 0xff && bssid[2] == 0xff &&
            bssid[3] == 0xff && bssid[4] == 0xff && bssid[5] == 0xff)
                return HAPD_BROADCAST;
+#ifdef CONFIG_NAN_USD
+       if (nan_de_is_nan_network_id(bssid))
+               return HAPD_BROADCAST; /* Process NAN Network ID like broadcast
+                                       */
+#endif /* CONFIG_NAN_USD */
 
        for (i = 0; i < iface->num_bss; i++) {
                struct hostapd_data *hapd;
index d4552f2f4a0e1b5fc052d70b9e45319de7689209..281d18dc60a0977a362c19dbb668014255582218 100644 (file)
@@ -26,6 +26,7 @@
 #include "common/wpa_common.h"
 #include "common/wpa_ctrl.h"
 #include "common/ptksa_cache.h"
+#include "common/nan_de.h"
 #include "radius/radius.h"
 #include "radius/radius_client.h"
 #include "p2p/p2p.h"
@@ -6295,6 +6296,9 @@ int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
        }
 
        if (!is_broadcast_ether_addr(mgmt->bssid) &&
+#ifdef CONFIG_NAN_USD
+           !nan_de_is_nan_network_id(mgmt->bssid) &&
+#endif /* CONFIG_NAN_USD */
 #ifdef CONFIG_P2P
            /* Invitation responses can be sent with the peer MAC as BSSID */
            !((hapd->conf->p2p & P2P_GROUP_OWNER) &&
index acde4f3b2acdfe4b783b5c7cbf11d627d0a17f5e..6051cb85832469f8c7b4786732e9580e83246c64 100644 (file)
@@ -79,6 +79,12 @@ struct nan_de {
 };
 
 
+bool nan_de_is_nan_network_id(const u8 *addr)
+{
+       return ether_addr_equal(addr, nan_network_id);
+}
+
+
 struct nan_de * nan_de_init(const u8 *nmi, bool offload, bool ap,
                            const struct nan_callbacks *cb)
 {
index f369a5721e79ea83be4301195d67339b168c0dd3..8e5282f981596712f59b61f7c3457cdb5703feea 100644 (file)
@@ -59,6 +59,7 @@ struct nan_callbacks {
                                      unsigned int freq);
 };
 
+bool nan_de_is_nan_network_id(const u8 *addr);
 struct nan_de * nan_de_init(const u8 *nmi, bool offload, bool ap,
                            const struct nan_callbacks *cb);
 void nan_de_flush(struct nan_de *de);