conf->punct_acs_threshold = val;
} else if (os_strcmp(buf, "mld_ap") == 0) {
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",
for (i = 0; i < iface->interfaces->count; ++i) {
struct hostapd_iface *h_iface = iface->interfaces->iface[i];
struct hostapd_data *h_hapd = h_iface->bss[0];
- struct hostapd_bss_config *h_conf = h_hapd->conf;
- if (!h_conf->mld_ap ||
- h_conf->mld_id != iface->bss[0]->conf->mld_id)
+ if (!hostapd_is_ml_partner(h_hapd, iface->bss[0]))
continue;
if (hostapd_enable_iface(h_iface)) {
for (i = 0; i < iface->interfaces->count; ++i) {
struct hostapd_iface *h_iface = iface->interfaces->iface[i];
struct hostapd_data *h_hapd = h_iface->bss[0];
- struct hostapd_bss_config *h_conf = h_hapd->conf;
- if (!h_conf->mld_ap ||
- h_conf->mld_id != iface->bss[0]->conf->mld_id)
+ if (!hostapd_is_ml_partner(h_hapd, iface->bss[0]))
continue;
if (!h_hapd->mld_first_bss) {
for (i = 0; i < iface->interfaces->count; ++i) {
struct hostapd_iface *h_iface = iface->interfaces->iface[i];
struct hostapd_data *h_hapd = h_iface->bss[0];
- struct hostapd_bss_config *h_conf = h_hapd->conf;
- if (!h_conf->mld_ap ||
- h_conf->mld_id != iface->bss[0]->conf->mld_id ||
+ if (!hostapd_is_ml_partner(h_hapd, iface->bss[0]) ||
!h_hapd->mld_first_bss)
continue;
# 1 = yes (MLO)
#mld_ap=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
continue;
}
- if (!hconf->mld_ap || hconf->mld_id != conf->mld_id) {
+ if (!hconf->mld_ap) {
wpa_printf(MSG_DEBUG,
- "MLD: Skip non matching mld_id");
+ "MLD: Skip non-MLD");
+ continue;
+ }
+
+ if (!hostapd_is_ml_partner(hapd, h_hapd)) {
+ wpa_printf(MSG_DEBUG,
+ "MLD: Skip non matching MLD vif name");
continue;
}
* We want to include the AP MLD ID in the response if it was
* included in the request.
*/
- probed_mld_id = mld_id != -1 ? mld_id : hapd->conf->mld_id;
+ probed_mld_id = mld_id != -1 ? mld_id : hostapd_get_mld_id(hapd);
for_each_mld_link(link, i, j, hapd->iface->interfaces,
probed_mld_id) {
continue;
#ifdef CONFIG_IEEE80211BE
- if (hapd->conf->mld_ap && other->bss[0]->conf->mld_ap &&
- hapd->conf->mld_id == other->bss[0]->conf->mld_id)
+ if (hostapd_is_ml_partner(hapd, other->bss[0]))
mld_ap = true;
#endif /* CONFIG_IEEE80211BE */
"mld_id[%d]=%d\n"
"mld_link_id[%d]=%d\n",
(int) i, MAC2STR(bss->mld_addr),
- (int) i, bss->conf->mld_id,
+ (int) i, hostapd_get_mld_id(bss),
(int) i, bss->mld_link_id);
if (os_snprintf_error(buflen - len, ret))
return len;
struct hostapd_iface *h =
hapd->iface->interfaces->iface[i];
struct hostapd_data *h_hapd = h->bss[0];
- struct hostapd_bss_config *hconf = h_hapd->conf;
- if (!hconf->mld_ap ||
- hconf->mld_id != hapd->conf->mld_id)
+ if (!hostapd_is_ml_partner(h_hapd, hapd))
continue;
h_hapd = hostapd_find_by_sta(h, src, false);
struct hostapd_iface *h_iface =
hapd_iface->interfaces->iface[j];
struct hostapd_data *h_hapd = h_iface->bss[0];
- struct hostapd_bss_config *h_conf = h_hapd->conf;
- if (!h_conf->mld_ap ||
- h_conf->mld_id !=
- hapd_iface->bss[0]->conf->mld_id ||
+ if (!hostapd_is_ml_partner(h_hapd,
+ hapd_iface->bss[0]) ||
h_iface == hapd_iface)
continue;
#ifdef CONFIG_IEEE80211BE
+
struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd,
u8 link_id)
{
for (i = 0; i < hapd->iface->interfaces->count; i++) {
struct hostapd_iface *h = hapd->iface->interfaces->iface[i];
struct hostapd_data *h_hapd = h->bss[0];
- struct hostapd_bss_config *hconf = h_hapd->conf;
- if (!hconf->mld_ap || hconf->mld_id != hapd->conf->mld_id)
+ if (!hostapd_is_ml_partner(hapd, h_hapd))
continue;
if (h_hapd->mld_link_id == link_id)
return NULL;
}
+
+
+bool hostapd_is_ml_partner(struct hostapd_data *hapd1,
+ struct hostapd_data *hapd2)
+{
+ if (!hapd1->conf->mld_ap || !hapd2->conf->mld_ap)
+ return false;
+
+ return !os_strcmp(hapd1->conf->iface, hapd2->conf->iface);
+}
+
+
+u8 hostapd_get_mld_id(struct hostapd_data *hapd)
+{
+ if (!hapd->conf->mld_ap)
+ return 255;
+
+ /* MLD ID 0 represents self */
+ return 0;
+
+ /* TODO: MLD ID for Multiple BSS cases */
+}
+
#endif /* CONFIG_IEEE80211BE */
struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd,
u8 link_id);
int hostapd_link_remove(struct hostapd_data *hapd, u32 count);
+bool hostapd_is_ml_partner(struct hostapd_data *hapd1,
+ struct hostapd_data *hapd2);
+u8 hostapd_get_mld_id(struct hostapd_data *hapd);
#ifdef CONFIG_IEEE80211BE
#define for_each_mld_link(_link, _bss_idx, _iface_idx, _ifaces, _mld_id) \
for (_link = \
(_ifaces)->iface[_iface_idx]->bss[_bss_idx]; \
_link && _link->conf->mld_ap && \
- _link->conf->mld_id == _mld_id; \
+ hostapd_get_mld_id(_link) == _mld_id; \
_link = NULL)
#else /* CONFIG_IEEE80211BE */
#define for_each_mld_link(_link, _bss_idx, _iface_idx, _ifaces, _mld_id) \
if (hapd->iface == iface)
continue;
- if (iface->bss[0]->conf->mld_ap &&
- hapd->conf->mld_id == iface->bss[0]->conf->mld_id &&
+ if (hostapd_is_ml_partner(hapd, iface->bss[0]) &&
i == iface->bss[0]->mld_link_id)
break;
}
tmp_hapd =
assoc_hapd->iface->interfaces->iface[i]->bss[0];
- if (!tmp_hapd->conf->mld_ap ||
- assoc_hapd->conf->mld_id != tmp_hapd->conf->mld_id)
+ if (!hostapd_is_ml_partner(assoc_hapd, tmp_hapd))
continue;
for (tmp_sta = tmp_hapd->sta_list; tmp_sta;
struct hostapd_data *tmp_hapd =
hapd->iface->interfaces->iface[i]->bss[0];
- if (!tmp_hapd->conf->mld_ap ||
- hapd->conf->mld_id != tmp_hapd->conf->mld_id)
+ if (!hostapd_is_ml_partner(tmp_hapd, hapd))
continue;
for (tmp_sta = tmp_hapd->sta_list; tmp_sta;
bool ap_mld = false;
#ifdef CONFIG_IEEE80211BE
- if (hapd->conf->mld_ap && iface->bss[0]->conf->mld_ap &&
- hapd->conf->mld_id == iface->bss[0]->conf->mld_id)
+ if (hostapd_is_ml_partner(hapd, iface->bss[0]))
ap_mld = true;
#endif /* CONFIG_IEEE80211BE */
#ifdef CONFIG_IEEE80211BE
u8 param_ch = hapd->eht_mld_bss_param_change;
- if (reporting_hapd->conf->mld_ap &&
- bss->conf->mld_id == reporting_hapd->conf->mld_id)
+ if (hostapd_is_ml_partner(bss, reporting_hapd))
*eid++ = 0;
else
- *eid++ = hapd->conf->mld_id;
+ *eid++ = hostapd_get_mld_id(hapd);
*eid++ = hapd->mld_link_id | ((param_ch & 0xF) << 4);
*eid = (param_ch >> 4) & 0xF;
bool ap_mld = false;
#ifdef CONFIG_IEEE80211BE
- if (hapd->conf->mld_ap && iface->bss[0]->conf->mld_ap &&
- hapd->conf->mld_id == iface->bss[0]->conf->mld_id)
+ if (hostapd_is_ml_partner(hapd, iface->bss[0]))
ap_mld = true;
#endif /* CONFIG_IEEE80211BE */
if (include_mld_id) {
wpa_printf(MSG_DEBUG, "MLD: AP MLD ID=0x%x",
- hapd->conf->mld_id);
- wpabuf_put_u8(buf, hapd->conf->mld_id);
+ hostapd_get_mld_id(hapd));
+ wpabuf_put_u8(buf, hostapd_get_mld_id(hapd));
}
if (!mld_info)
if (hapd == other_hapd)
continue;
- if (other_hapd->conf->mld_ap &&
- other_hapd->conf->mld_id == hapd->conf->mld_id &&
+ if (hostapd_is_ml_partner(hapd, other_hapd) &&
link_id == other_hapd->mld_link_id)
break;
}
struct hostapd_data *tmp_hapd =
hapd->iface->interfaces->iface[i]->bss[0];
- if (!tmp_hapd->conf->mld_ap ||
- hapd->conf->mld_id != tmp_hapd->conf->mld_id)
+ if (!hostapd_is_ml_partner(hapd, tmp_hapd))
continue;
for (tmp_sta = tmp_hapd->sta_list; tmp_sta;
tmp_hapd = interfaces->iface[i]->bss[0];
- if (!tmp_hapd->conf->mld_ap ||
- assoc_hapd->conf->mld_id != tmp_hapd->conf->mld_id)
+ if (!hostapd_is_ml_partner(tmp_hapd, assoc_hapd))
continue;
for (tmp_sta = tmp_hapd->sta_list; tmp_sta;
unsigned int i, j;
for_each_mld_link(tmp_hapd, i, j, hapd->iface->interfaces,
- hapd->conf->mld_id) {
+ hostapd_get_mld_id(hapd)) {
struct sta_info *tmp_sta;
if (hapd == tmp_hapd)
struct hostapd_iface *iface =
hapd->iface->interfaces->iface[j];
- if (!iface->bss[0]->conf->mld_ap ||
- hapd->conf->mld_id != iface->bss[0]->conf->mld_id ||
+ if (!hostapd_is_ml_partner(hapd, iface->bss[0]) ||
link_id != iface->bss[0]->mld_link_id ||
!iface->bss[0]->wpa_auth)
continue;
struct hostapd_iface *iface =
hapd->iface->interfaces->iface[j];
- if (!iface->bss[0]->conf->mld_ap ||
- hapd->conf->mld_id != iface->bss[0]->conf->mld_id ||
+ if (!hostapd_is_ml_partner(hapd, iface->bss[0]) ||
link_id != iface->bss[0]->mld_link_id ||
!iface->bss[0]->wpa_auth)
continue;