History

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.

Ilan Peer committed 4 years ago

Commit a083ee81 parent 6d501764 files · +74 −0Browse files

Unified · Split

4 files
  1. include/net/cfg80211.h +12 −0
  2. include/uapi/linux/nl80211.h +7 −0
  3. net/wireless/nl80211.c +38 −0
  4. net/wireless/trace.h +17 −0
include/net/cfg80211.h+12−0
@@ -8287,6 +8287,18 @@ bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, · 8286 unmodified lines
8287 bool is_4addr, u8 check_swif);8287 bool is_4addr, u8 check_swif);
8288 8288
8289 8289
8290/**
8291 * cfg80211_assoc_comeback - notification of association that was
8292 * temporarly rejected with a comeback
8293 * @netdev: network device
8294 * @bss: the bss entry with which association is in progress.
8295 * @timeout: timeout interval value TUs.
8296 *
8297 * this function may sleep. the caller must hold the corresponding wdev's mutex.
8298 */
8299void cfg80211_assoc_comeback(struct net_device *netdev,
8300 struct cfg80211_bss *bss, u32 timeout);
8301
8290/* Logging, debugging and troubleshooting/diagnostic helpers. */8302/* Logging, debugging and troubleshooting/diagnostic helpers. */
8291 8303
8292/* wiphy_printk helpers, similar to dev_printk */8304/* wiphy_printk helpers, similar to dev_printk */
include/uapi/linux/nl80211.h+7−0
@@ -1232,6 +1232,11 @@ · 1231 unmodified lines
1232 * &NL80211_ATTR_FILS_NONCES - for FILS Nonces1232 * &NL80211_ATTR_FILS_NONCES - for FILS Nonces
1233 * (STA Nonce 16 bytes followed by AP Nonce 16 bytes)1233 * (STA Nonce 16 bytes followed by AP Nonce 16 bytes)
1234 *1234 *
1235 * @NL80211_CMD_ASSOC_COMEBACK: notification about an association
1236 * temporal rejection with comeback. The event includes %NL80211_ATTR_MAC
1237 * to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to
1238 * specify the timeout value.
1239 *
1235 * @NL80211_CMD_MAX: highest used command number1240 * @NL80211_CMD_MAX: highest used command number
1236 * @__NL80211_CMD_AFTER_LAST: internal use1241 * @__NL80211_CMD_AFTER_LAST: internal use
1237 */1242 */
@@ -1474,6 +1479,8 @@ enum nl80211_commands { · 236 unmodified lines
1474 1479
1475 NL80211_CMD_SET_FILS_AAD,1480 NL80211_CMD_SET_FILS_AAD,
1476 1481
1482 NL80211_CMD_ASSOC_COMEBACK,
1483
1477 /* add new commands above here */1484 /* add new commands above here */
1478 1485
1479 /* used to define NL80211_CMD_MAX below */1486 /* used to define NL80211_CMD_MAX below */
net/wireless/nl80211.c+38−0
@@ -17064,6 +17064,44 @@ static void nl80211_send_remain_on_chan_event( · 17063 unmodified lines
17064 nlmsg_free(msg);17064 nlmsg_free(msg);
17065}17065}
17066 17066
17067void cfg80211_assoc_comeback(struct net_device *netdev,
17068 struct cfg80211_bss *bss, u32 timeout)
17069{
17070 struct wireless_dev *wdev = netdev->ieee80211_ptr;
17071 struct wiphy *wiphy = wdev->wiphy;
17072 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
17073 struct sk_buff *msg;
17074 void *hdr;
17075
17076 trace_cfg80211_assoc_comeback(wdev, bss->bssid, timeout);
17077
17078 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
17079 if (!msg)
17080 return;
17081
17082 hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_ASSOC_COMEBACK);
17083 if (!hdr) {
17084 nlmsg_free(msg);
17085 return;
17086 }
17087
17088 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
17089 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
17090 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bss->bssid) ||
17091 nla_put_u32(msg, NL80211_ATTR_TIMEOUT, timeout))
17092 goto nla_put_failure;
17093
17094 genlmsg_end(msg, hdr);
17095
17096 genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
17097 NL80211_MCGRP_MLME, GFP_KERNEL);
17098 return;
17099
17100 nla_put_failure:
17101 nlmsg_free(msg);
17102}
17103EXPORT_SYMBOL(cfg80211_assoc_comeback);
17104
17067void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,17105void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
17068 struct ieee80211_channel *chan,17106 struct ieee80211_channel *chan,
17069 unsigned int duration, gfp_t gfp)17107 unsigned int duration, gfp_t gfp)
net/wireless/trace.h+17−0
@@ -3696,6 +3696,23 @@ TRACE_EVENT(rdev_set_radar_offchan, · 3695 unmodified lines
3696 WIPHY_PR_ARG, CHAN_DEF_PR_ARG)3696 WIPHY_PR_ARG, CHAN_DEF_PR_ARG)
3697);3697);
3698 3698
3699TRACE_EVENT(cfg80211_assoc_comeback,
3700 TP_PROTO(struct wireless_dev *wdev, const u8 *bssid, u32 timeout),
3701 TP_ARGS(wdev, bssid, timeout),
3702 TP_STRUCT__entry(
3703 WDEV_ENTRY
3704 MAC_ENTRY(bssid)
3705 __field(u32, timeout)
3706 ),
3707 TP_fast_assign(
3708 WDEV_ASSIGN;
3709 MAC_ASSIGN(bssid, bssid);
3710 __entry->timeout = timeout;
3711 ),
3712 TP_printk(WDEV_PR_FMT ", " MAC_PR_FMT ", timeout: %u TUs",
3713 WDEV_PR_ARG, MAC_PR_ARG(bssid), __entry->timeout)
3714);
3715
3699#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */3716#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
3700 3717
3701#undef TRACE_INCLUDE_PATH3718#undef TRACE_INCLUDE_PATH