[PATCH] nl80211: correct netlink attributes of set_supp_port() for MLD
Zong-Zhe Yang
kyang.zongz at gmail.com
Fri Nov 22 00:21:43 PST 2024
From: Zong-Zhe Yang <kevin_yang at realtek.com>
When MLD, wpa_driver_nl80211_set_supp_port() gets
`nl80211: Failed to set STA flag: -22 (Invalid argument)`
due to imprecise netlink attributes.
For MLD, NL80211_ATTR_MLO_LINK_ID is required. Otherwise,
sta_link_apply_parameters() cannot get the target link.
Additionally, for MLD, NL80211_ATTR_MAC describes "link" address.
And, NL80211_ATTR_MLD_ADDR describes MLD address.
Signed-off-by: Zong-Zhe Yang <kevin_yang at realtek.com>
---
src/drivers/driver_nl80211.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 3f9789df3745..8dd782d5b7be 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -7703,11 +7703,13 @@ static int wpa_driver_nl80211_set_supp_port(void *priv, int authorized)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
+ const struct driver_sta_mlo_info *mld =
+ drv->sta_mlo_info.valid_links ? &drv->sta_mlo_info : NULL;
+ const u8 *connected_addr = mld ?
+ mld->links[mld->assoc_link_id].bssid : drv->bssid;
struct nl_msg *msg;
struct nl80211_sta_flag_update upd;
int ret;
- const u8 *connected_addr = drv->sta_mlo_info.valid_links ?
- drv->sta_mlo_info.ap_mld_addr : drv->bssid;
if (!drv->associated && is_zero_ether_addr(connected_addr) &&
!authorized) {
@@ -7730,6 +7732,16 @@ static int wpa_driver_nl80211_set_supp_port(void *priv, int authorized)
return -ENOBUFS;
}
+ if (!mld)
+ goto send;
+
+ if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, mld->assoc_link_id) ||
+ nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN, mld->ap_mld_addr)) {
+ nlmsg_free(msg);
+ return -ENOBUFS;
+ }
+
+send:
ret = send_and_recv_cmd(drv, msg);
if (!ret)
return 0;
--
2.39.0
More information about the Hostap
mailing list