cfg80211/nl80211: Send AssocReq IEs to user space in AP mode
When user space SME/MLME (e.g., hostapd) is not used in AP mode, the IEs from the (Re)Association Request frame that was processed in firmware need to be made available for user space (e.g., RSN IE for hostapd). Allow this to be done with cfg80211_new_sta(). Add a comment pointing out the use of enum station_info_flags for all new struct station_info fields. In addition, memset the sinfo buffer to zero before use on all paths in the current tree to avoid leaving uninitialized pointers in the data. Change-Id: Ia2220d58ee81c1b7ca905cfc8eb55b6a84779d38 Signed-off-by: Deepthi Gowri <deepthi@codeaurora.org>
This commit is contained in:
@@ -536,6 +536,11 @@ struct sta_bss_parameters {
|
||||
* This number should increase every time the list of stations
|
||||
* changes, i.e. when a station is added or removed, so that
|
||||
* userspace can tell whether it got a consistent snapshot.
|
||||
* @assoc_req_ies: IEs from (Re)Association Request.
|
||||
* This is used only when in AP mode with drivers that do not use
|
||||
* user space MLME/SME implementation. The information is provided for
|
||||
* the cfg80211_new_sta() calls to notify user space of the IEs.
|
||||
* @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
|
||||
*/
|
||||
struct station_info {
|
||||
u32 filled;
|
||||
@@ -558,6 +563,14 @@ struct station_info {
|
||||
struct sta_bss_parameters bss_param;
|
||||
|
||||
int generation;
|
||||
|
||||
const u8 *assoc_req_ies;
|
||||
size_t assoc_req_ies_len;
|
||||
|
||||
/*
|
||||
* Note: Add a new enum station_info_flags value for each new field and
|
||||
* use it to check which fields are initialized.
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -334,6 +334,7 @@ static int sta_info_finish_insert(struct sta_info *sta, bool async)
|
||||
ieee80211_sta_debugfs_add(sta);
|
||||
rate_control_add_sta_debugfs(sta);
|
||||
|
||||
memset(&sinfo, 0, sizeof(sinfo));
|
||||
sinfo.filled = 0;
|
||||
sinfo.generation = local->sta_generation;
|
||||
cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL);
|
||||
|
||||
@@ -2209,6 +2209,10 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
|
||||
}
|
||||
nla_nest_end(msg, sinfoattr);
|
||||
|
||||
if (sinfo->assoc_req_ies)
|
||||
NLA_PUT(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len,
|
||||
sinfo->assoc_req_ies);
|
||||
|
||||
return genlmsg_end(msg, hdr);
|
||||
|
||||
nla_put_failure:
|
||||
@@ -2236,6 +2240,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
|
||||
}
|
||||
|
||||
while (1) {
|
||||
memset(&sinfo, 0, sizeof(sinfo));
|
||||
err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx,
|
||||
mac_addr, &sinfo);
|
||||
if (err == -ENOENT)
|
||||
|
||||
Reference in New Issue
Block a user