Commit efbabc11 authored by Veerendranath Jakkam's avatar Veerendranath Jakkam Committed by Johannes Berg

cfg80211: Indicate MLO connection info in connect and roam callbacks

The MLO links used for connection with an MLD AP are decided by the
driver in case of SME offloaded to driver.

Add support for the drivers to indicate the information of links used
for MLO connection in connect and roam callbacks, update the connected
links information in wdev from connect/roam result sent by driver.
Also, send the connected links information to userspace.

Add a netlink flag attribute to indicate that userspace supports
handling of MLO connection. Drivers must not do MLO connection when this
flag is not set. This is to maintain backwards compatibility with older
supplicant versions which doesn't have support for MLO connection.
Signed-off-by: default avatarVeerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 245e5ebc
...@@ -807,7 +807,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel, ...@@ -807,7 +807,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
cfg80211_put_bss(ar->wiphy, bss); cfg80211_put_bss(ar->wiphy, bss);
} else if (vif->sme_state == SME_CONNECTED) { } else if (vif->sme_state == SME_CONNECTED) {
struct cfg80211_roam_info roam_info = { struct cfg80211_roam_info roam_info = {
.bss = bss, .links[0].bss = bss,
.req_ie = assoc_req_ie, .req_ie = assoc_req_ie,
.req_ie_len = assoc_req_len, .req_ie_len = assoc_req_len,
.resp_ie = assoc_resp_ie, .resp_ie = assoc_resp_ie,
......
...@@ -1822,8 +1822,8 @@ wmi_evt_reassoc_status(struct wil6210_vif *vif, int id, void *d, int len) ...@@ -1822,8 +1822,8 @@ wmi_evt_reassoc_status(struct wil6210_vif *vif, int id, void *d, int len)
freq = ieee80211_channel_to_frequency(ch, NL80211_BAND_60GHZ); freq = ieee80211_channel_to_frequency(ch, NL80211_BAND_60GHZ);
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
info.channel = ieee80211_get_channel(wiphy, freq); info.links[0].channel = ieee80211_get_channel(wiphy, freq);
info.bss = vif->bss; info.links[0].bss = vif->bss;
info.req_ie = assoc_req_ie; info.req_ie = assoc_req_ie;
info.req_ie_len = assoc_req_ie_len; info.req_ie_len = assoc_req_ie_len;
info.resp_ie = assoc_resp_ie; info.resp_ie = assoc_resp_ie;
......
...@@ -6017,8 +6017,8 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg, ...@@ -6017,8 +6017,8 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
done: done:
kfree(buf); kfree(buf);
roam_info.channel = notify_channel; roam_info.links[0].channel = notify_channel;
roam_info.bssid = profile->bssid; roam_info.links[0].bssid = profile->bssid;
roam_info.req_ie = conn_info->req_ie; roam_info.req_ie = conn_info->req_ie;
roam_info.req_ie_len = conn_info->req_ie_len; roam_info.req_ie_len = conn_info->req_ie_len;
roam_info.resp_ie = conn_info->resp_ie; roam_info.resp_ie = conn_info->resp_ie;
...@@ -6061,7 +6061,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg, ...@@ -6061,7 +6061,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
} else { } else {
conn_params.status = WLAN_STATUS_AUTH_TIMEOUT; conn_params.status = WLAN_STATUS_AUTH_TIMEOUT;
} }
conn_params.bssid = profile->bssid; conn_params.links[0].bssid = profile->bssid;
conn_params.req_ie = conn_info->req_ie; conn_params.req_ie = conn_info->req_ie;
conn_params.req_ie_len = conn_info->req_ie_len; conn_params.req_ie_len = conn_info->req_ie_len;
conn_params.resp_ie = conn_info->resp_ie; conn_params.resp_ie = conn_info->resp_ie;
......
...@@ -2813,8 +2813,9 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev) ...@@ -2813,8 +2813,9 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev)
resp_ie_len, 0, GFP_KERNEL); resp_ie_len, 0, GFP_KERNEL);
} else { } else {
struct cfg80211_roam_info roam_info = { struct cfg80211_roam_info roam_info = {
.channel = get_current_channel(usbdev, NULL), .links[0].channel =
.bssid = bssid, get_current_channel(usbdev, NULL),
.links[0].bssid = bssid,
.req_ie = req_ie, .req_ie = req_ie,
.req_ie_len = req_ie_len, .req_ie_len = req_ie_len,
.resp_ie = resp_ie, .resp_ie = resp_ie,
......
...@@ -450,8 +450,8 @@ void rtw_cfg80211_indicate_connect(struct adapter *padapter) ...@@ -450,8 +450,8 @@ void rtw_cfg80211_indicate_connect(struct adapter *padapter)
notify_channel = ieee80211_get_channel(wiphy, freq); notify_channel = ieee80211_get_channel(wiphy, freq);
roam_info.channel = notify_channel; roam_info.links[0].channel = notify_channel;
roam_info.bssid = cur_network->network.mac_address; roam_info.links[0].bssid = cur_network->network.mac_address;
roam_info.req_ie = roam_info.req_ie =
pmlmepriv->assoc_req+sizeof(struct ieee80211_hdr_3addr)+2; pmlmepriv->assoc_req+sizeof(struct ieee80211_hdr_3addr)+2;
roam_info.req_ie_len = roam_info.req_ie_len =
......
...@@ -645,7 +645,7 @@ void prism2_disconnected(struct wlandevice *wlandev) ...@@ -645,7 +645,7 @@ void prism2_disconnected(struct wlandevice *wlandev)
void prism2_roamed(struct wlandevice *wlandev) void prism2_roamed(struct wlandevice *wlandev)
{ {
struct cfg80211_roam_info roam_info = { struct cfg80211_roam_info roam_info = {
.bssid = wlandev->bssid, .links[0].bssid = wlandev->bssid,
}; };
cfg80211_roamed(wlandev->netdev, &roam_info, GFP_KERNEL); cfg80211_roamed(wlandev->netdev, &roam_info, GFP_KERNEL);
......
...@@ -2763,6 +2763,9 @@ struct cfg80211_assoc_link { ...@@ -2763,6 +2763,9 @@ struct cfg80211_assoc_link {
* request (connect callback). * request (connect callback).
* @ASSOC_REQ_DISABLE_HE: Disable HE * @ASSOC_REQ_DISABLE_HE: Disable HE
* @ASSOC_REQ_DISABLE_EHT: Disable EHT * @ASSOC_REQ_DISABLE_EHT: Disable EHT
* @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links.
* Drivers shall disable MLO features for the current association if this
* flag is not set.
*/ */
enum cfg80211_assoc_req_flags { enum cfg80211_assoc_req_flags {
ASSOC_REQ_DISABLE_HT = BIT(0), ASSOC_REQ_DISABLE_HT = BIT(0),
...@@ -2771,6 +2774,7 @@ enum cfg80211_assoc_req_flags { ...@@ -2771,6 +2774,7 @@ enum cfg80211_assoc_req_flags {
CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3), CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
ASSOC_REQ_DISABLE_HE = BIT(4), ASSOC_REQ_DISABLE_HE = BIT(4),
ASSOC_REQ_DISABLE_EHT = BIT(5), ASSOC_REQ_DISABLE_EHT = BIT(5),
CONNECT_REQ_MLO_SUPPORT = BIT(6),
}; };
/** /**
...@@ -5780,12 +5784,13 @@ static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev, ...@@ -5780,12 +5784,13 @@ static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,
!(wdev->valid_links & BIT(link_id))); !(wdev->valid_links & BIT(link_id)));
} }
#define for_each_valid_link(wdev, link_id) \ #define for_each_valid_link(link_info, link_id) \
for (link_id = 0; \ for (link_id = 0; \
link_id < ((wdev)->valid_links ? ARRAY_SIZE((wdev)->links) : 1); \ link_id < ((link_info)->valid_links ? \
ARRAY_SIZE((link_info)->links) : 1); \
link_id++) \ link_id++) \
if (!(wdev)->valid_links || \ if (!(link_info)->valid_links || \
((wdev)->valid_links & BIT(link_id))) ((link_info)->valid_links & BIT(link_id)))
/** /**
* DOC: Utility functions * DOC: Utility functions
...@@ -7296,13 +7301,6 @@ struct cfg80211_fils_resp_params { ...@@ -7296,13 +7301,6 @@ struct cfg80211_fils_resp_params {
* indicate that this is a failure, but without a status code. * indicate that this is a failure, but without a status code.
* @timeout_reason is used to report the reason for the timeout in that * @timeout_reason is used to report the reason for the timeout in that
* case. * case.
* @bssid: The BSSID of the AP (may be %NULL)
* @bss: Entry of bss to which STA got connected to, can be obtained through
* cfg80211_get_bss() (may be %NULL). But it is recommended to store the
* bss from the connect_request and hold a reference to it and return
* through this param to avoid a warning if the bss is expired during the
* connection, esp. for those drivers implementing connect op.
* Only one parameter among @bssid and @bss needs to be specified.
* @req_ie: Association request IEs (may be %NULL) * @req_ie: Association request IEs (may be %NULL)
* @req_ie_len: Association request IEs length * @req_ie_len: Association request IEs length
* @resp_ie: Association response IEs (may be %NULL) * @resp_ie: Association response IEs (may be %NULL)
...@@ -7314,17 +7312,41 @@ struct cfg80211_fils_resp_params { ...@@ -7314,17 +7312,41 @@ struct cfg80211_fils_resp_params {
* not known. This value is used only if @status < 0 to indicate that the * not known. This value is used only if @status < 0 to indicate that the
* failure is due to a timeout and not due to explicit rejection by the AP. * failure is due to a timeout and not due to explicit rejection by the AP.
* This value is ignored in other cases (@status >= 0). * This value is ignored in other cases (@status >= 0).
* @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise
* zero.
* @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL.
* @links : For MLO connection, contains link info for the valid links indicated
* using @valid_links. For non-MLO connection, links[0] contains the
* connected AP info.
* @links.addr: For MLO connection, MAC address of the STA link. Otherwise
* %NULL.
* @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO
* connection, links[0].bssid points to the BSSID of the AP (may be %NULL).
* @links.bss: For MLO connection, entry of bss to which STA link is connected.
* For non-MLO connection, links[0].bss points to entry of bss to which STA
* is connected. It can be obtained through cfg80211_get_bss() (may be
* %NULL). It is recommended to store the bss from the connect_request and
* hold a reference to it and return through this param to avoid a warning
* if the bss is expired during the connection, esp. for those drivers
* implementing connect op. Only one parameter among @bssid and @bss needs
* to be specified.
*/ */
struct cfg80211_connect_resp_params { struct cfg80211_connect_resp_params {
int status; int status;
const u8 *bssid;
struct cfg80211_bss *bss;
const u8 *req_ie; const u8 *req_ie;
size_t req_ie_len; size_t req_ie_len;
const u8 *resp_ie; const u8 *resp_ie;
size_t resp_ie_len; size_t resp_ie_len;
struct cfg80211_fils_resp_params fils; struct cfg80211_fils_resp_params fils;
enum nl80211_timeout_reason timeout_reason; enum nl80211_timeout_reason timeout_reason;
const u8 *ap_mld_addr;
u16 valid_links;
struct {
const u8 *addr;
const u8 *bssid;
struct cfg80211_bss *bss;
} links[IEEE80211_MLD_MAX_NUM_LINKS];
}; };
/** /**
...@@ -7394,8 +7416,8 @@ cfg80211_connect_bss(struct net_device *dev, const u8 *bssid, ...@@ -7394,8 +7416,8 @@ cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
memset(&params, 0, sizeof(params)); memset(&params, 0, sizeof(params));
params.status = status; params.status = status;
params.bssid = bssid; params.links[0].bssid = bssid;
params.bss = bss; params.links[0].bss = bss;
params.req_ie = req_ie; params.req_ie = req_ie;
params.req_ie_len = req_ie_len; params.req_ie_len = req_ie_len;
params.resp_ie = resp_ie; params.resp_ie = resp_ie;
...@@ -7466,24 +7488,40 @@ cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, ...@@ -7466,24 +7488,40 @@ cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
/** /**
* struct cfg80211_roam_info - driver initiated roaming information * struct cfg80211_roam_info - driver initiated roaming information
* *
* @channel: the channel of the new AP
* @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
* @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
* @req_ie: association request IEs (maybe be %NULL) * @req_ie: association request IEs (maybe be %NULL)
* @req_ie_len: association request IEs length * @req_ie_len: association request IEs length
* @resp_ie: association response IEs (may be %NULL) * @resp_ie: association response IEs (may be %NULL)
* @resp_ie_len: assoc response IEs length * @resp_ie_len: assoc response IEs length
* @fils: FILS related roaming information. * @fils: FILS related roaming information.
* @valid_links: For MLO roaming, BIT mask of the new valid links is set.
* Otherwise zero.
* @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL.
* @links : For MLO roaming, contains new link info for the valid links set in
* @valid_links. For non-MLO roaming, links[0] contains the new AP info.
* @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL.
* @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO
* roaming, links[0].bssid points to the BSSID of the new AP. May be
* %NULL if %links.bss is set.
* @links.channel: the channel of the new AP.
* @links.bss: For MLO roaming, entry of new bss to which STA link got
* roamed. For non-MLO roaming, links[0].bss points to entry of bss to
* which STA got roamed (may be %NULL if %links.bssid is set)
*/ */
struct cfg80211_roam_info { struct cfg80211_roam_info {
struct ieee80211_channel *channel;
struct cfg80211_bss *bss;
const u8 *bssid;
const u8 *req_ie; const u8 *req_ie;
size_t req_ie_len; size_t req_ie_len;
const u8 *resp_ie; const u8 *resp_ie;
size_t resp_ie_len; size_t resp_ie_len;
struct cfg80211_fils_resp_params fils; struct cfg80211_fils_resp_params fils;
const u8 *ap_mld_addr;
u16 valid_links;
struct {
const u8 *addr;
const u8 *bssid;
struct ieee80211_channel *channel;
struct cfg80211_bss *bss;
} links[IEEE80211_MLD_MAX_NUM_LINKS];
}; };
/** /**
......
...@@ -2690,6 +2690,10 @@ enum nl80211_commands { ...@@ -2690,6 +2690,10 @@ enum nl80211_commands {
* @NL80211_ATTR_MLD_ADDR: An MLD address, used with various commands such as * @NL80211_ATTR_MLD_ADDR: An MLD address, used with various commands such as
* authenticate/associate. * authenticate/associate.
* *
* @NL80211_ATTR_MLO_SUPPORT: Flag attribute to indicate user space supports MLO
* connection. Used with %NL80211_CMD_CONNECT. If this attribute is not
* included in NL80211_CMD_CONNECT drivers must not perform MLO connection.
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined * @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use * @__NL80211_ATTR_AFTER_LAST: internal use
...@@ -3208,6 +3212,8 @@ enum nl80211_attrs { ...@@ -3208,6 +3212,8 @@ enum nl80211_attrs {
NL80211_ATTR_MLO_LINK_ID, NL80211_ATTR_MLO_LINK_ID,
NL80211_ATTR_MLD_ADDR, NL80211_ATTR_MLD_ADDR,
NL80211_ATTR_MLO_SUPPORT,
/* add attributes here, update the policy in nl80211.c */ /* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST, __NL80211_ATTR_AFTER_LAST,
......
...@@ -42,8 +42,8 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss, ...@@ -42,8 +42,8 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,
memset(&cr, 0, sizeof(cr)); memset(&cr, 0, sizeof(cr));
cr.status = (int)le16_to_cpu(mgmt->u.assoc_resp.status_code); cr.status = (int)le16_to_cpu(mgmt->u.assoc_resp.status_code);
cr.bssid = mgmt->bssid; cr.links[0].bssid = mgmt->bssid;
cr.bss = bss; cr.links[0].bss = bss;
cr.req_ie = req_ies; cr.req_ie = req_ies;
cr.req_ie_len = req_ies_len; cr.req_ie_len = req_ies_len;
cr.resp_ie = resp_ie; cr.resp_ie = resp_ie;
......
...@@ -797,6 +797,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { ...@@ -797,6 +797,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_MLO_LINK_ID] = [NL80211_ATTR_MLO_LINK_ID] =
NLA_POLICY_RANGE(NLA_U8, 0, IEEE80211_MLD_MAX_NUM_LINKS), NLA_POLICY_RANGE(NLA_U8, 0, IEEE80211_MLD_MAX_NUM_LINKS),
[NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN), [NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN),
[NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
}; };
/* policy for the key attributes */ /* policy for the key attributes */
...@@ -11529,6 +11530,9 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) ...@@ -11529,6 +11530,9 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
connect.flags |= CONNECT_REQ_EXTERNAL_AUTH_SUPPORT; connect.flags |= CONNECT_REQ_EXTERNAL_AUTH_SUPPORT;
} }
if (nla_get_flag(info->attrs[NL80211_ATTR_MLO_SUPPORT]))
connect.flags |= CONNECT_REQ_MLO_SUPPORT;
wdev_lock(dev->ieee80211_ptr); wdev_lock(dev->ieee80211_ptr);
err = cfg80211_connect(rdev, dev, &connect, connkeys, err = cfg80211_connect(rdev, dev, &connect, connkeys,
...@@ -17304,10 +17308,29 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev, ...@@ -17304,10 +17308,29 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
{ {
struct sk_buff *msg; struct sk_buff *msg;
void *hdr; void *hdr;
unsigned int link;
size_t link_info_size = 0;
const u8 *connected_addr = cr->valid_links ?
cr->ap_mld_addr : cr->links[0].bssid;
if (cr->valid_links) {
for_each_valid_link(cr, link) {
/* Nested attribute header */
link_info_size += NLA_HDRLEN;
/* Link ID */
link_info_size += nla_total_size(sizeof(u8));
link_info_size += cr->links[link].addr ?
nla_total_size(ETH_ALEN) : 0;
link_info_size += (cr->links[link].bssid ||
cr->links[link].bss) ?
nla_total_size(ETH_ALEN) : 0;
}
}
msg = nlmsg_new(100 + cr->req_ie_len + cr->resp_ie_len + msg = nlmsg_new(100 + cr->req_ie_len + cr->resp_ie_len +
cr->fils.kek_len + cr->fils.pmk_len + cr->fils.kek_len + cr->fils.pmk_len +
(cr->fils.pmkid ? WLAN_PMKID_LEN : 0), gfp); (cr->fils.pmkid ? WLAN_PMKID_LEN : 0) + link_info_size,
gfp);
if (!msg) if (!msg)
return; return;
...@@ -17319,8 +17342,8 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev, ...@@ -17319,8 +17342,8 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
(cr->bssid && (connected_addr &&
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, cr->bssid)) || nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, connected_addr)) ||
nla_put_u16(msg, NL80211_ATTR_STATUS_CODE, nla_put_u16(msg, NL80211_ATTR_STATUS_CODE,
cr->status < 0 ? WLAN_STATUS_UNSPECIFIED_FAILURE : cr->status < 0 ? WLAN_STATUS_UNSPECIFIED_FAILURE :
cr->status) || cr->status) ||
...@@ -17346,6 +17369,38 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev, ...@@ -17346,6 +17369,38 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
nla_put(msg, NL80211_ATTR_PMKID, WLAN_PMKID_LEN, cr->fils.pmkid))))) nla_put(msg, NL80211_ATTR_PMKID, WLAN_PMKID_LEN, cr->fils.pmkid)))))
goto nla_put_failure; goto nla_put_failure;
if (cr->valid_links) {
int i = 1;
struct nlattr *nested;
nested = nla_nest_start(msg, NL80211_ATTR_MLO_LINKS);
if (!nested)
goto nla_put_failure;
for_each_valid_link(cr, link) {
struct nlattr *nested_mlo_links;
const u8 *bssid = cr->links[link].bss ?
cr->links[link].bss->bssid :
cr->links[link].bssid;
nested_mlo_links = nla_nest_start(msg, i);
if (!nested_mlo_links)
goto nla_put_failure;
if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link) ||
(bssid &&
nla_put(msg, NL80211_ATTR_BSSID, ETH_ALEN, bssid)) ||
(cr->links[link].addr &&
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN,
cr->links[link].addr)))
goto nla_put_failure;
nla_nest_end(msg, nested_mlo_links);
i++;
}
nla_nest_end(msg, nested);
}
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
...@@ -17362,11 +17417,32 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev, ...@@ -17362,11 +17417,32 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
{ {
struct sk_buff *msg; struct sk_buff *msg;
void *hdr; void *hdr;
const u8 *bssid = info->bss ? info->bss->bssid : info->bssid; size_t link_info_size = 0;
unsigned int link;
const u8 *connected_addr = info->ap_mld_addr ?
info->ap_mld_addr :
(info->links[0].bss ?
info->links[0].bss->bssid :
info->links[0].bssid);
if (info->valid_links) {
for_each_valid_link(info, link) {
/* Nested attribute header */
link_info_size += NLA_HDRLEN;
/* Link ID */
link_info_size += nla_total_size(sizeof(u8));
link_info_size += info->links[link].addr ?
nla_total_size(ETH_ALEN) : 0;
link_info_size += (info->links[link].bssid ||
info->links[link].bss) ?
nla_total_size(ETH_ALEN) : 0;
}
}
msg = nlmsg_new(100 + info->req_ie_len + info->resp_ie_len + msg = nlmsg_new(100 + info->req_ie_len + info->resp_ie_len +
info->fils.kek_len + info->fils.pmk_len + info->fils.kek_len + info->fils.pmk_len +
(info->fils.pmkid ? WLAN_PMKID_LEN : 0), gfp); (info->fils.pmkid ? WLAN_PMKID_LEN : 0) +
link_info_size, gfp);
if (!msg) if (!msg)
return; return;
...@@ -17378,7 +17454,7 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev, ...@@ -17378,7 +17454,7 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid) || nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, connected_addr) ||
(info->req_ie && (info->req_ie &&
nla_put(msg, NL80211_ATTR_REQ_IE, info->req_ie_len, nla_put(msg, NL80211_ATTR_REQ_IE, info->req_ie_len,
info->req_ie)) || info->req_ie)) ||
...@@ -17397,6 +17473,38 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev, ...@@ -17397,6 +17473,38 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
nla_put(msg, NL80211_ATTR_PMKID, WLAN_PMKID_LEN, info->fils.pmkid))) nla_put(msg, NL80211_ATTR_PMKID, WLAN_PMKID_LEN, info->fils.pmkid)))
goto nla_put_failure; goto nla_put_failure;
if (info->valid_links) {
int i = 1;
struct nlattr *nested;
nested = nla_nest_start(msg, NL80211_ATTR_MLO_LINKS);
if (!nested)
goto nla_put_failure;
for_each_valid_link(info, link) {
struct nlattr *nested_mlo_links;
const u8 *bssid = info->links[link].bss ?
info->links[link].bss->bssid :
info->links[link].bssid;
nested_mlo_links = nla_nest_start(msg, i);
if (!nested_mlo_links)
goto nla_put_failure;
if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link) ||
(bssid &&
nla_put(msg, NL80211_ATTR_BSSID, ETH_ALEN, bssid)) ||
(info->links[link].addr &&
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN,
info->links[link].addr)))
goto nla_put_failure;
nla_nest_end(msg, nested_mlo_links);
i++;
}
nla_nest_end(msg, nested);
}
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment