1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#include <linux/ieee80211.h>
18#include <net/cfg80211.h>
19#include <net/mac80211.h>
20#include "ieee80211_i.h"
21#include "sta_info.h"
22#include "wme.h"
23
24static void ieee80211_send_refuse_measurement_request(struct ieee80211_sub_if_data *sdata,
25 struct ieee80211_msrment_ie *request_ie,
26 const u8 *da, const u8 *bssid,
27 u8 dialog_token)
28{
29 struct ieee80211_local *local = sdata->local;
30 struct sk_buff *skb;
31 struct ieee80211_mgmt *msr_report;
32
33 skb = dev_alloc_skb(sizeof(*msr_report) + local->hw.extra_tx_headroom +
34 sizeof(struct ieee80211_msrment_ie));
35 if (!skb)
36 return;
37
38 skb_reserve(skb, local->hw.extra_tx_headroom);
39 msr_report = (struct ieee80211_mgmt *)skb_put(skb, 24);
40 memset(msr_report, 0, 24);
41 memcpy(msr_report->da, da, ETH_ALEN);
42 memcpy(msr_report->sa, sdata->vif.addr, ETH_ALEN);
43 memcpy(msr_report->bssid, bssid, ETH_ALEN);
44 msr_report->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
45 IEEE80211_STYPE_ACTION);
46
47 skb_put(skb, 1 + sizeof(msr_report->u.action.u.measurement));
48 msr_report->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT;
49 msr_report->u.action.u.measurement.action_code =
50 WLAN_ACTION_SPCT_MSR_RPRT;
51 msr_report->u.action.u.measurement.dialog_token = dialog_token;
52
53 msr_report->u.action.u.measurement.element_id = WLAN_EID_MEASURE_REPORT;
54 msr_report->u.action.u.measurement.length =
55 sizeof(struct ieee80211_msrment_ie);
56
57 memset(&msr_report->u.action.u.measurement.msr_elem, 0,
58 sizeof(struct ieee80211_msrment_ie));
59 msr_report->u.action.u.measurement.msr_elem.token = request_ie->token;
60 msr_report->u.action.u.measurement.msr_elem.mode |=
61 IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED;
62 msr_report->u.action.u.measurement.msr_elem.type = request_ie->type;
63
64 ieee80211_tx_skb(sdata, skb);
65}
66
67void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
68 struct ieee80211_mgmt *mgmt,
69 size_t len)
70{
71
72
73
74
75
76
77
78 ieee80211_send_refuse_measurement_request(sdata,
79 &mgmt->u.action.u.measurement.msr_elem,
80 mgmt->sa, mgmt->bssid,
81 mgmt->u.action.u.measurement.dialog_token);
82}
83