[PATCH v2 1/2] AP: Add configuration option to specify the desired MLD address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ilan Peer <ilan.peer@xxxxxxxxx>

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@xxxxxxxxx>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx>
Signed-off-by: Manaswini Paluri <quic_mpaluri@xxxxxxxxxxx>
---
v2:
- Add documentation for the new conf parameter mld_addr in hostapd.conf
- Update comments for the changes done in hostapd_driver_init()
- Move BSSID empty check to separate patch
- Remove duplicate link MAC address randomization
---
 hostapd/config_file.c |  6 ++++++
 hostapd/hostapd.conf  |  6 ++++++
 hostapd/main.c        | 20 +++++++++++++++++---
 src/ap/ap_config.h    |  3 +++
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 412ca8a9f..d76a1a462 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/hostapd.conf b/hostapd/hostapd.conf
index 30fb06d1c..c4e5d58f2 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -1048,6 +1048,12 @@ wmm_ac_vo_acm=0
 # MLD ID - Affiliated MLD ID
 #mld_id=1
 
+# AP MLD ADDRESS - AP MLD MAC address of this AP
+# The configured address will be set as interface hardware address and used as
+# AP MLD MAC address. If not set current interface hardware address will be used
+# as AP MLD MAC address.
+#mld_addr=02:03:04:05:06:07
+
 ##### IEEE 802.1X-2004 related configuration ##################################
 
 # Require IEEE 802.1X authorization
diff --git a/hostapd/main.c b/hostapd/main.c
index aebdffd1f..ac9a47a48 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -242,6 +242,16 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
 		break;
 	}
 	params.bssid = b;
+#ifdef CONFIG_IEEE80211BE
+	/*
+	 * Use the configured MLD address as interface hardware address if this
+	 * AP is 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 +280,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:
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 777aa5af0..83fdbaad1 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.17.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux