[PATCH] nl80211: correct netlink attributes of set_supp_port() for MLD

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

 



From: Zong-Zhe Yang <kevin_yang@xxxxxxxxxxx>

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@xxxxxxxxxxx>
---
 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


_______________________________________________
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