From 320c4c8f8d0bb2b196503e54a8c9152d87f99f06 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Singh Date: Mon, 22 Apr 2024 18:10:03 +0530 Subject: [PATCH] AP MLD: Send link id to the driver during color change Send the link ID in the nl80211 command to switch color if the AP is affiliated with an AP MLD. Signed-off-by: Aditya Kumar Singh --- src/ap/hostapd.c | 6 ++++++ src/drivers/driver.h | 3 +++ src/drivers/driver_nl80211.c | 14 ++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index db0903376..a0c57b081 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -4586,6 +4586,12 @@ int hostapd_fill_cca_settings(struct hostapd_data *hapd, if (!iface || iface->conf->he_op.he_bss_color_disabled) return -1; + settings->link_id = -1; +#ifdef CONFIG_IEEE80211BE + if (hapd->conf->mld_ap) + settings->link_id = hapd->mld_link_id; +#endif /* CONFIG_IEEE80211BE */ + old_color = iface->conf->he_op.he_bss_color; iface->conf->he_op.he_bss_color = hapd->cca_color; ret = hostapd_build_beacon_data(hapd, &settings->beacon_after); diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 568f338b0..204694dd4 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2761,6 +2761,7 @@ struct csa_settings { * @counter_offset_beacon: Offset to the count field in Beacon frame tail * @counter_offset_presp: Offset to the count field in Probe Response frame * @ubpr: Unsolicited broadcast Probe Response frame data + * @link_id: If >= 0 indicates the link of the AP MLD to configure */ struct cca_settings { u8 cca_count; @@ -2773,6 +2774,8 @@ struct cca_settings { u16 counter_offset_presp; struct unsol_bcast_probe_resp ubpr; + + int link_id; }; /* TDLS peer capabilities for send_tdls_mgmt() */ diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 149f51a74..9cd416ce8 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -11403,6 +11403,20 @@ static int nl80211_switch_color(void *priv, struct cca_settings *settings) goto error; } +#ifdef CONFIG_IEEE80211BE + if (nl80211_link_valid(bss->valid_links, settings->link_id)) { + wpa_printf(MSG_DEBUG, + "nl80211: Color change request on link_id=%d", + settings->link_id); + + if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, + settings->link_id)) { + nlmsg_free(msg); + return -1; + } + } +#endif /* CONFIG_IEEE80211BE */ + ret = send_and_recv_cmd(drv, msg); if (ret) { wpa_printf(MSG_DEBUG,