]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Add configuration option to specify the desired MLD address
authorIlan Peer <ilan.peer@intel.com>
Tue, 25 Jul 2023 07:16:57 +0000 (12:46 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 11 Aug 2023 09:12:43 +0000 (12:12 +0300)
Add mld_addr configuration option to set the MLD MAC address.
The already existing bssid configuration option can be used to
control the AP MLD's link addresses.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Manaswini Paluri <quic_mpaluri@quicinc.com>
hostapd/config_file.c
hostapd/hostapd.conf
hostapd/main.c
src/ap/ap_config.h

index 412ca8a9f89b521354f962694c7efdb472244675..6c6cc69c41746a64862e53fc61a0e5c2f0c9388f 100644 (file)
@@ -4776,6 +4776,12 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                bss->mld_ap = !!atoi(pos);
        } else if (os_strcmp(buf, "mld_id") == 0) {
                bss->mld_id = atoi(pos);
+       } else if (os_strcmp(buf, "mld_addr") == 0) {
+               if (hwaddr_aton(pos, bss->mld_addr)) {
+                       wpa_printf(MSG_ERROR, "Line %d: Invalid mld_addr",
+                                  line);
+                       return 1;
+               }
 #endif /* CONFIG_IEEE80211BE */
        } else {
                wpa_printf(MSG_ERROR,
index 30fb06d1c85c8229c7cc8ad84c5e9819952b359f..bafc9232b3b295c71e6183dacdc70d027400955d 100644 (file)
@@ -1048,6 +1048,12 @@ wmm_ac_vo_acm=0
 # MLD ID - Affiliated MLD ID
 #mld_id=1
 
+# AP MLD MAC address
+# The configured address will be set as the interface hardware address and used
+# as the AP MLD MAC address. If not set, the current interface hardware address
+# will be used as the AP MLD MAC address.
+#mld_addr=02:03:04:05:06:07
+
 ##### IEEE 802.1X-2004 related configuration ##################################
 
 # Require IEEE 802.1X authorization
index aebdffd1fd49ee9bd729b2b876fb6a29d90ca201..336203ea3ffe95a5a15da171cb434fa1afeba54d 100644 (file)
@@ -242,6 +242,15 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
                break;
        }
        params.bssid = b;
+#ifdef CONFIG_IEEE80211BE
+       /*
+        * Use the configured MLD MAC address as the interface hardware address
+        * if this AP is a part of an AP MLD.
+        */
+       if (!is_zero_ether_addr(hapd->conf->mld_addr) && hapd->conf->mld_ap)
+               params.bssid = hapd->conf->mld_addr;
+#endif /* CONFIG_IEEE80211BE */
+
        params.ifname = hapd->conf->iface;
        params.driver_params = hapd->iconf->driver_params;
        params.use_pae_group_addr = hapd->conf->use_pae_group_addr;
@@ -270,14 +279,18 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
 #ifdef CONFIG_IEEE80211BE
        /*
         * This is the first interface added to the AP MLD, so have the
-        * interface hardware address be the MLD address and set a link address
-        * to this interface.
+        * interface hardware address be the MLD address, while the link address
+        * would be derived from the original interface address if BSSID is not
+        * configured, and otherwise it would be the configured BSSID.
         */
        if (hapd->conf->mld_ap) {
                os_memcpy(hapd->mld_addr, hapd->own_addr, ETH_ALEN);
-               random_mac_addr_keep_oui(hapd->own_addr);
                hapd->mld_next_link_id = 0;
                hapd->mld_link_id = hapd->mld_next_link_id++;
+               if (!b)
+                       random_mac_addr_keep_oui(hapd->own_addr);
+               else
+                       os_memcpy(hapd->own_addr, b, ETH_ALEN);
        }
 
 setup_mld:
index 777aa5af0558eb85c04f2717f547809eab067539..8b3700be4d9a99f17c22aec8d81ed80bc48f6c04 100644 (file)
@@ -944,6 +944,9 @@ struct hostapd_bss_config {
 
        /* The MLD ID to which the AP MLD is affiliated with */
        u8 mld_id;
+
+       /* The AP's MLD MAC address within the AP MLD */
+       u8 mld_addr[ETH_ALEN];
 #endif /* CONFIG_IEEE80211BE */
 };