mac80211: add probe request building flags

Add flags to pass through to probe request building and
change the "bool directed" to be one of them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
This commit is contained in:
Johannes Berg 2018-05-28 15:47:38 +02:00 committed by Johannes Berg
parent db0a4ad80d
commit 00387f3215
4 changed files with 26 additions and 16 deletions

View File

@ -2031,24 +2031,30 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
const u8 *bssid, u16 stype, u16 reason, const u8 *bssid, u16 stype, u16 reason,
bool send_frame, u8 *frame_buf); bool send_frame, u8 *frame_buf);
enum {
IEEE80211_PROBE_FLAG_DIRECTED = BIT(0),
};
int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
size_t buffer_len, size_t buffer_len,
struct ieee80211_scan_ies *ie_desc, struct ieee80211_scan_ies *ie_desc,
const u8 *ie, size_t ie_len, const u8 *ie, size_t ie_len,
u8 bands_used, u32 *rate_masks, u8 bands_used, u32 *rate_masks,
struct cfg80211_chan_def *chandef); struct cfg80211_chan_def *chandef,
u32 flags);
struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
const u8 *src, const u8 *dst, const u8 *src, const u8 *dst,
u32 ratemask, u32 ratemask,
struct ieee80211_channel *chan, struct ieee80211_channel *chan,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len, const u8 *ie, size_t ie_len,
bool directed); u32 flags);
void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
const u8 *src, const u8 *dst, const u8 *src, const u8 *dst,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len, const u8 *ie, size_t ie_len,
u32 ratemask, bool directed, u32 tx_flags, u32 ratemask, u32 flags, u32 tx_flags,
struct ieee80211_channel *channel, bool scan); struct ieee80211_channel *channel, bool scan);
u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata, u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,

View File

@ -2267,7 +2267,8 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
ieee80211_send_probe_req(sdata, sdata->vif.addr, dst, ieee80211_send_probe_req(sdata, sdata->vif.addr, dst,
ssid + 2, ssid_len, NULL, ssid + 2, ssid_len, NULL,
0, (u32) -1, true, 0, 0, (u32) -1,
IEEE80211_PROBE_FLAG_DIRECTED, 0,
ifmgd->associated->channel, false); ifmgd->associated->channel, false);
rcu_read_unlock(); rcu_read_unlock();
} }
@ -2370,7 +2371,7 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
skb = ieee80211_build_probe_req(sdata, sdata->vif.addr, cbss->bssid, skb = ieee80211_build_probe_req(sdata, sdata->vif.addr, cbss->bssid,
(u32) -1, cbss->channel, (u32) -1, cbss->channel,
ssid + 2, ssid_len, ssid + 2, ssid_len,
NULL, 0, true); NULL, 0, IEEE80211_PROBE_FLAG_DIRECTED);
rcu_read_unlock(); rcu_read_unlock();
return skb; return skb;

View File

@ -336,7 +336,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local)
local->hw_scan_ies_bufsize, local->hw_scan_ies_bufsize,
&local->hw_scan_req->ies, &local->hw_scan_req->ies,
req->ie, req->ie_len, req->ie, req->ie_len,
bands_used, req->rates, &chandef); bands_used, req->rates, &chandef, 0);
local->hw_scan_req->req.ie_len = ielen; local->hw_scan_req->req.ie_len = ielen;
local->hw_scan_req->req.no_cck = req->no_cck; local->hw_scan_req->req.no_cck = req->no_cck;
ether_addr_copy(local->hw_scan_req->req.mac_addr, req->mac_addr); ether_addr_copy(local->hw_scan_req->req.mac_addr, req->mac_addr);
@ -552,7 +552,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
sdata, local->scan_addr, scan_req->bssid, sdata, local->scan_addr, scan_req->bssid,
scan_req->ssids[i].ssid, scan_req->ssids[i].ssid_len, scan_req->ssids[i].ssid, scan_req->ssids[i].ssid_len,
scan_req->ie, scan_req->ie_len, scan_req->ie, scan_req->ie_len,
scan_req->rates[band], false, scan_req->rates[band], 0,
tx_flags, local->hw.conf.chandef.chan, true); tx_flags, local->hw.conf.chandef.chan, true);
/* /*
@ -1167,7 +1167,8 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
ieee80211_build_preq_ies(local, ie, num_bands * iebufsz, ieee80211_build_preq_ies(local, ie, num_bands * iebufsz,
&sched_scan_ies, req->ie, &sched_scan_ies, req->ie,
req->ie_len, bands_used, rate_masks, &chandef); req->ie_len, bands_used, rate_masks, &chandef,
0);
ret = drv_sched_scan_start(local, sdata, req, &sched_scan_ies); ret = drv_sched_scan_start(local, sdata, req, &sched_scan_ies);
if (ret == 0) { if (ret == 0) {

View File

@ -1353,7 +1353,7 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_local *local,
enum nl80211_band band, enum nl80211_band band,
u32 rate_mask, u32 rate_mask,
struct cfg80211_chan_def *chandef, struct cfg80211_chan_def *chandef,
size_t *offset) size_t *offset, u32 flags)
{ {
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
u8 *pos = buffer, *end = buffer + buffer_len; u8 *pos = buffer, *end = buffer + buffer_len;
@ -1518,7 +1518,8 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
struct ieee80211_scan_ies *ie_desc, struct ieee80211_scan_ies *ie_desc,
const u8 *ie, size_t ie_len, const u8 *ie, size_t ie_len,
u8 bands_used, u32 *rate_masks, u8 bands_used, u32 *rate_masks,
struct cfg80211_chan_def *chandef) struct cfg80211_chan_def *chandef,
u32 flags)
{ {
size_t pos = 0, old_pos = 0, custom_ie_offset = 0; size_t pos = 0, old_pos = 0, custom_ie_offset = 0;
int i; int i;
@ -1533,7 +1534,8 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
ie, ie_len, i, ie, ie_len, i,
rate_masks[i], rate_masks[i],
chandef, chandef,
&custom_ie_offset); &custom_ie_offset,
flags);
ie_desc->ies[i] = buffer + old_pos; ie_desc->ies[i] = buffer + old_pos;
ie_desc->len[i] = pos - old_pos; ie_desc->len[i] = pos - old_pos;
old_pos = pos; old_pos = pos;
@ -1561,7 +1563,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
struct ieee80211_channel *chan, struct ieee80211_channel *chan,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len, const u8 *ie, size_t ie_len,
bool directed) u32 flags)
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct cfg80211_chan_def chandef; struct cfg80211_chan_def chandef;
@ -1577,7 +1579,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
* badly-behaved APs don't respond when this parameter is included. * badly-behaved APs don't respond when this parameter is included.
*/ */
chandef.width = sdata->vif.bss_conf.chandef.width; chandef.width = sdata->vif.bss_conf.chandef.width;
if (directed) if (flags & IEEE80211_PROBE_FLAG_DIRECTED)
chandef.chan = NULL; chandef.chan = NULL;
else else
chandef.chan = chan; chandef.chan = chan;
@ -1591,7 +1593,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
ies_len = ieee80211_build_preq_ies(local, skb_tail_pointer(skb), ies_len = ieee80211_build_preq_ies(local, skb_tail_pointer(skb),
skb_tailroom(skb), &dummy_ie_desc, skb_tailroom(skb), &dummy_ie_desc,
ie, ie_len, BIT(chan->band), ie, ie_len, BIT(chan->band),
rate_masks, &chandef); rate_masks, &chandef, flags);
skb_put(skb, ies_len); skb_put(skb, ies_len);
if (dst) { if (dst) {
@ -1609,14 +1611,14 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
const u8 *src, const u8 *dst, const u8 *src, const u8 *dst,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len, const u8 *ie, size_t ie_len,
u32 ratemask, bool directed, u32 tx_flags, u32 ratemask, u32 flags, u32 tx_flags,
struct ieee80211_channel *channel, bool scan) struct ieee80211_channel *channel, bool scan)
{ {
struct sk_buff *skb; struct sk_buff *skb;
skb = ieee80211_build_probe_req(sdata, src, dst, ratemask, channel, skb = ieee80211_build_probe_req(sdata, src, dst, ratemask, channel,
ssid, ssid_len, ssid, ssid_len,
ie, ie_len, directed); ie, ie_len, flags);
if (skb) { if (skb) {
IEEE80211_SKB_CB(skb)->flags |= tx_flags; IEEE80211_SKB_CB(skb)->flags |= tx_flags;
if (scan) if (scan)