Skip to content

Commit 53ad07e

Browse files
committed
wifi: cfg80211: support reporting failed links
For assoc and connect result APIs, support reporting failed links; they should still come with the BSS pointer in the case of assoc, so they're released correctly. In the case of connect result, this is optional. Signed-off-by: Johannes Berg <[email protected]>
1 parent 9b41a9d commit 53ad07e

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

include/net/cfg80211.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6933,6 +6933,8 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
69336933
* @ap_mld_addr: AP MLD address (in case of MLO)
69346934
* @links: per-link information indexed by link ID, use links[0] for
69356935
* non-MLO connections
6936+
* @links.status: Set this (along with a BSS pointer) for links that
6937+
* were rejected by the AP.
69366938
*/
69376939
struct cfg80211_rx_assoc_resp {
69386940
const u8 *buf;
@@ -6944,6 +6946,7 @@ struct cfg80211_rx_assoc_resp {
69446946
struct {
69456947
const u8 *addr;
69466948
struct cfg80211_bss *bss;
6949+
u16 status;
69476950
} links[IEEE80211_MLD_MAX_NUM_LINKS];
69486951
};
69496952

@@ -7454,6 +7457,9 @@ struct cfg80211_fils_resp_params {
74547457
* if the bss is expired during the connection, esp. for those drivers
74557458
* implementing connect op. Only one parameter among @bssid and @bss needs
74567459
* to be specified.
7460+
* @links.status: per-link status code, to report a status code that's not
7461+
* %WLAN_STATUS_SUCCESS for a given link, it must also be in the
7462+
* @valid_links bitmap and may have a BSS pointer (which is then released)
74577463
*/
74587464
struct cfg80211_connect_resp_params {
74597465
int status;
@@ -7470,6 +7476,7 @@ struct cfg80211_connect_resp_params {
74707476
const u8 *addr;
74717477
const u8 *bssid;
74727478
struct cfg80211_bss *bss;
7479+
u16 status;
74737480
} links[IEEE80211_MLD_MAX_NUM_LINKS];
74747481
};
74757482

net/wireless/mlme.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ void cfg80211_rx_assoc_resp(struct net_device *dev,
4242
unsigned int link_id;
4343

4444
for (link_id = 0; link_id < ARRAY_SIZE(data->links); link_id++) {
45+
cr.links[link_id].status = data->links[link_id].status;
46+
WARN_ON_ONCE(cr.links[link_id].status != WLAN_STATUS_SUCCESS &&
47+
(!cr.ap_mld_addr || !cr.links[link_id].bss));
48+
4549
cr.links[link_id].bss = data->links[link_id].bss;
4650
if (!cr.links[link_id].bss)
4751
continue;

net/wireless/nl80211.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17745,6 +17745,7 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
1774517745
link_info_size += (cr->links[link].bssid ||
1774617746
cr->links[link].bss) ?
1774717747
nla_total_size(ETH_ALEN) : 0;
17748+
link_info_size += nla_total_size(sizeof(u16));
1774817749
}
1774917750
}
1775017751

@@ -17813,7 +17814,9 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
1781317814
nla_put(msg, NL80211_ATTR_BSSID, ETH_ALEN, bssid)) ||
1781417815
(cr->links[link].addr &&
1781517816
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN,
17816-
cr->links[link].addr)))
17817+
cr->links[link].addr)) ||
17818+
nla_put_u16(msg, NL80211_ATTR_STATUS_CODE,
17819+
cr->links[link].status))
1781717820
goto nla_put_failure;
1781817821

1781917822
nla_nest_end(msg, nested_mlo_links);

net/wireless/sme.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,10 @@ void __cfg80211_connect_result(struct net_device *dev,
793793
}
794794

795795
for_each_valid_link(cr, link) {
796+
/* don't do extra lookups for failures */
797+
if (cr->links[link].status != WLAN_STATUS_SUCCESS)
798+
continue;
799+
796800
if (cr->links[link].bss)
797801
continue;
798802

@@ -829,6 +833,16 @@ void __cfg80211_connect_result(struct net_device *dev,
829833
}
830834

831835
memset(wdev->links, 0, sizeof(wdev->links));
836+
for_each_valid_link(cr, link) {
837+
if (cr->links[link].status == WLAN_STATUS_SUCCESS)
838+
continue;
839+
cr->valid_links &= ~BIT(link);
840+
/* don't require bss pointer for failed links */
841+
if (!cr->links[link].bss)
842+
continue;
843+
cfg80211_unhold_bss(bss_from_pub(cr->links[link].bss));
844+
cfg80211_put_bss(wdev->wiphy, cr->links[link].bss);
845+
}
832846
wdev->valid_links = cr->valid_links;
833847
for_each_valid_link(cr, link)
834848
wdev->links[link].client.current_bss =

0 commit comments

Comments
 (0)