[PATCH] AP: Add configuration option to specify the desired MLD address

Andrei Otcheretianski andrei.otcheretianski at intel.com
Sun Jun 18 07:15:04 PDT 2023


From: Ilan Peer <ilan.peer at intel.com>

Add mld_addr configuration option to set MLD address.
The already existing bssid configuration option can be used to
control the MLD link addresses.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 hostapd/config_file.c |  6 ++++++
 hostapd/main.c        | 12 +++++++++++-
 src/ap/ap_config.h    |  3 +++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 412ca8a9f8..d76a1a4620 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -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,
diff --git a/hostapd/main.c b/hostapd/main.c
index aebdffd1fd..b3cce4159e 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -218,7 +218,7 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
 #endif /* CONFIG_IEEE80211BE */
 
 	/* Initialize the driver interface */
-	if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
+	if (is_zero_ether_addr(b))
 		b = NULL;
 
 	os_memset(&params, 0, sizeof(params));
@@ -241,7 +241,13 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
 		params.global_priv = global.drv_priv[i];
 		break;
 	}
+#ifndef CONFIG_IEEE80211BE
 	params.bssid = b;
+#else
+	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;
@@ -278,6 +284,10 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
 		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:
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 777aa5af05..83fdbaad10 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -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 address within the MLD AP */
+	u8 mld_addr[ETH_ALEN];
 #endif /* CONFIG_IEEE80211BE */
 };
 
-- 
2.38.1




More information about the Hostap mailing list