提交 7c12ce8b 编写于 作者: K Kalle Valo 提交者: John W. Linville

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: NKalle Valo <kalle.valo@nokia.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 05e54ea6
...@@ -1000,37 +1000,29 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, ...@@ -1000,37 +1000,29 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct sk_buff *skb; struct sk_buff *skb;
struct ieee80211_mgmt *mgmt; struct ieee80211_mgmt *mgmt;
u8 *pos; size_t buf_len;
u8 *buf;
skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200 +
ie_len); /* FIXME: come up with a proper value */
if (!skb) { buf = kmalloc(200 + ie_len, GFP_KERNEL);
printk(KERN_DEBUG "%s: failed to allocate buffer for probe " if (!buf) {
"request\n", sdata->name); printk(KERN_DEBUG "%s: failed to allocate temporary IE "
"buffer\n", sdata->name);
return; return;
} }
skb_reserve(skb, local->hw.extra_tx_headroom);
mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len,
memset(mgmt, 0, 24); local->hw.conf.channel->band);
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_PROBE_REQ); skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); ssid, ssid_len,
buf, buf_len);
if (dst) { if (dst) {
mgmt = (struct ieee80211_mgmt *) skb->data;
memcpy(mgmt->da, dst, ETH_ALEN); memcpy(mgmt->da, dst, ETH_ALEN);
memcpy(mgmt->bssid, dst, ETH_ALEN); memcpy(mgmt->bssid, dst, ETH_ALEN);
} else {
memset(mgmt->da, 0xff, ETH_ALEN);
memset(mgmt->bssid, 0xff, ETH_ALEN);
} }
pos = skb_put(skb, 2 + ssid_len);
*pos++ = WLAN_EID_SSID;
*pos++ = ssid_len;
memcpy(pos, ssid, ssid_len);
pos += ssid_len;
skb_put(skb, ieee80211_build_preq_ies(local, pos, ie, ie_len,
local->hw.conf.channel->band));
IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
ieee80211_tx_skb(sdata, skb); ieee80211_tx_skb(sdata, skb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册