Skip to content

Commit 7c12ce8

Browse files
Kalle Valolinvjw
authored andcommitted
mac80211: use Probe Request template when sending a direct scan
As mac80211 now has a separate function for creating Probe Request templates, better to use it when sending direct Probe Requests to an AP. Only the bssid needs to be updated in the template before sending it. Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 05e54ea commit 7c12ce8

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

net/mac80211/util.c

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,37 +1000,29 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
10001000
struct ieee80211_local *local = sdata->local;
10011001
struct sk_buff *skb;
10021002
struct ieee80211_mgmt *mgmt;
1003-
u8 *pos;
1004-
1005-
skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200 +
1006-
ie_len);
1007-
if (!skb) {
1008-
printk(KERN_DEBUG "%s: failed to allocate buffer for probe "
1009-
"request\n", sdata->name);
1003+
size_t buf_len;
1004+
u8 *buf;
1005+
1006+
/* FIXME: come up with a proper value */
1007+
buf = kmalloc(200 + ie_len, GFP_KERNEL);
1008+
if (!buf) {
1009+
printk(KERN_DEBUG "%s: failed to allocate temporary IE "
1010+
"buffer\n", sdata->name);
10101011
return;
10111012
}
1012-
skb_reserve(skb, local->hw.extra_tx_headroom);
10131013

1014-
mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
1015-
memset(mgmt, 0, 24);
1016-
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
1017-
IEEE80211_STYPE_PROBE_REQ);
1018-
memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
1014+
buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len,
1015+
local->hw.conf.channel->band);
1016+
1017+
skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
1018+
ssid, ssid_len,
1019+
buf, buf_len);
1020+
10191021
if (dst) {
1022+
mgmt = (struct ieee80211_mgmt *) skb->data;
10201023
memcpy(mgmt->da, dst, ETH_ALEN);
10211024
memcpy(mgmt->bssid, dst, ETH_ALEN);
1022-
} else {
1023-
memset(mgmt->da, 0xff, ETH_ALEN);
1024-
memset(mgmt->bssid, 0xff, ETH_ALEN);
10251025
}
1026-
pos = skb_put(skb, 2 + ssid_len);
1027-
*pos++ = WLAN_EID_SSID;
1028-
*pos++ = ssid_len;
1029-
memcpy(pos, ssid, ssid_len);
1030-
pos += ssid_len;
1031-
1032-
skb_put(skb, ieee80211_build_preq_ies(local, pos, ie, ie_len,
1033-
local->hw.conf.channel->band));
10341026

10351027
IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
10361028
ieee80211_tx_skb(sdata, skb);

0 commit comments

Comments
 (0)