mac80211: Save probe response data for bss

Allow setting a probe response template for an interface operating in
AP mode. Low level drivers are notified about changes in the probe
response template and are able to retrieve a copy of the current probe
response. This data can, for example, be uploaded to hardware as a
template.

Signed-off-by: Guy Eilam <guy@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Arik Nemtsov
2011-11-10 11:28:57 +02:00
committed by John W. Linville
parent 00f740e1a3
commit 0294582126
6 changed files with 90 additions and 6 deletions

View File

@ -491,6 +491,31 @@ static void ieee80211_config_ap_ssid(struct ieee80211_sub_if_data *sdata,
(params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE);
}
static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
u8 *resp, size_t resp_len)
{
struct sk_buff *new, *old;
if (!resp || !resp_len)
return -EINVAL;
old = sdata->u.ap.probe_resp;
new = dev_alloc_skb(resp_len);
if (!new)
return -ENOMEM;
memcpy(skb_put(new, resp_len), resp, resp_len);
rcu_assign_pointer(sdata->u.ap.probe_resp, new);
synchronize_rcu();
if (old)
dev_kfree_skb(old);
return 0;
}
/*
* This handles both adding a beacon and setting new beacon info
*/
@ -501,6 +526,7 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
int new_head_len, new_tail_len;
int size;
int err = -EINVAL;
u32 changed = 0;
old = rtnl_dereference(sdata->u.ap.beacon);
@ -584,11 +610,17 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
kfree(old);
ieee80211_config_ap_ssid(sdata, params);
err = ieee80211_set_probe_resp(sdata, params->probe_resp,
params->probe_resp_len);
if (!err)
changed |= BSS_CHANGED_AP_PROBE_RESP;
ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED |
BSS_CHANGED_BEACON |
BSS_CHANGED_SSID);
ieee80211_config_ap_ssid(sdata, params);
changed |= BSS_CHANGED_BEACON_ENABLED |
BSS_CHANGED_BEACON |
BSS_CHANGED_SSID;
ieee80211_bss_info_change_notify(sdata, changed);
return 0;
}