Commit a083ee8a authored by Ilan Peer's avatar Ilan Peer Committed by Johannes Berg

cfg80211: Add support for notifying association comeback

Thought the underline driver MLME can handle association temporal
rejection with comeback, it is still useful to notify this to
user space, as user space might want to handle the temporal
rejection differently. For example, in case the comeback time
is too long, user space can deauthenticate immediately and try
to associate with a different AP.
Signed-off-by: default avatarIlan Peer <ilan.peer@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211129152938.2467809e8cb3.I45574185b582666bc78eef0c29a4c36b478e5382@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 6d501764
...@@ -8287,6 +8287,18 @@ bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, ...@@ -8287,6 +8287,18 @@ bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
bool is_4addr, u8 check_swif); bool is_4addr, u8 check_swif);
/**
* cfg80211_assoc_comeback - notification of association that was
* temporarly rejected with a comeback
* @netdev: network device
* @bss: the bss entry with which association is in progress.
* @timeout: timeout interval value TUs.
*
* this function may sleep. the caller must hold the corresponding wdev's mutex.
*/
void cfg80211_assoc_comeback(struct net_device *netdev,
struct cfg80211_bss *bss, u32 timeout);
/* Logging, debugging and troubleshooting/diagnostic helpers. */ /* Logging, debugging and troubleshooting/diagnostic helpers. */
/* wiphy_printk helpers, similar to dev_printk */ /* wiphy_printk helpers, similar to dev_printk */
......
...@@ -1232,6 +1232,11 @@ ...@@ -1232,6 +1232,11 @@
* &NL80211_ATTR_FILS_NONCES - for FILS Nonces * &NL80211_ATTR_FILS_NONCES - for FILS Nonces
* (STA Nonce 16 bytes followed by AP Nonce 16 bytes) * (STA Nonce 16 bytes followed by AP Nonce 16 bytes)
* *
* @NL80211_CMD_ASSOC_COMEBACK: notification about an association
* temporal rejection with comeback. The event includes %NL80211_ATTR_MAC
* to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to
* specify the timeout value.
*
* @NL80211_CMD_MAX: highest used command number * @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use * @__NL80211_CMD_AFTER_LAST: internal use
*/ */
...@@ -1474,6 +1479,8 @@ enum nl80211_commands { ...@@ -1474,6 +1479,8 @@ enum nl80211_commands {
NL80211_CMD_SET_FILS_AAD, NL80211_CMD_SET_FILS_AAD,
NL80211_CMD_ASSOC_COMEBACK,
/* add new commands above here */ /* add new commands above here */
/* used to define NL80211_CMD_MAX below */ /* used to define NL80211_CMD_MAX below */
......
...@@ -17064,6 +17064,44 @@ static void nl80211_send_remain_on_chan_event( ...@@ -17064,6 +17064,44 @@ static void nl80211_send_remain_on_chan_event(
nlmsg_free(msg); nlmsg_free(msg);
} }
void cfg80211_assoc_comeback(struct net_device *netdev,
struct cfg80211_bss *bss, u32 timeout)
{
struct wireless_dev *wdev = netdev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
struct sk_buff *msg;
void *hdr;
trace_cfg80211_assoc_comeback(wdev, bss->bssid, timeout);
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!msg)
return;
hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_ASSOC_COMEBACK);
if (!hdr) {
nlmsg_free(msg);
return;
}
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bss->bssid) ||
nla_put_u32(msg, NL80211_ATTR_TIMEOUT, timeout))
goto nla_put_failure;
genlmsg_end(msg, hdr);
genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
NL80211_MCGRP_MLME, GFP_KERNEL);
return;
nla_put_failure:
nlmsg_free(msg);
}
EXPORT_SYMBOL(cfg80211_assoc_comeback);
void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
struct ieee80211_channel *chan, struct ieee80211_channel *chan,
unsigned int duration, gfp_t gfp) unsigned int duration, gfp_t gfp)
......
...@@ -3696,6 +3696,23 @@ TRACE_EVENT(rdev_set_radar_offchan, ...@@ -3696,6 +3696,23 @@ TRACE_EVENT(rdev_set_radar_offchan,
WIPHY_PR_ARG, CHAN_DEF_PR_ARG) WIPHY_PR_ARG, CHAN_DEF_PR_ARG)
); );
TRACE_EVENT(cfg80211_assoc_comeback,
TP_PROTO(struct wireless_dev *wdev, const u8 *bssid, u32 timeout),
TP_ARGS(wdev, bssid, timeout),
TP_STRUCT__entry(
WDEV_ENTRY
MAC_ENTRY(bssid)
__field(u32, timeout)
),
TP_fast_assign(
WDEV_ASSIGN;
MAC_ASSIGN(bssid, bssid);
__entry->timeout = timeout;
),
TP_printk(WDEV_PR_FMT ", " MAC_PR_FMT ", timeout: %u TUs",
WDEV_PR_ARG, MAC_PR_ARG(bssid), __entry->timeout)
);
#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH #undef TRACE_INCLUDE_PATH
......
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