From patchwork Tue Jan 5 18:16:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 71083 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o05IGpTU028117 for ; Tue, 5 Jan 2010 18:16:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755139Ab0AESQt (ORCPT ); Tue, 5 Jan 2010 13:16:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755132Ab0AESQt (ORCPT ); Tue, 5 Jan 2010 13:16:49 -0500 Received: from emh01.mail.saunalahti.fi ([62.142.5.107]:37016 "EHLO emh01.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755017Ab0AESQr (ORCPT ); Tue, 5 Jan 2010 13:16:47 -0500 Received: from saunalahti-vams (vs3-10.mail.saunalahti.fi [62.142.5.94]) by emh01-2.mail.saunalahti.fi (Postfix) with SMTP id 919B68C584 for ; Tue, 5 Jan 2010 20:16:46 +0200 (EET) Received: from emh02.mail.saunalahti.fi ([62.142.5.108]) by vs3-10.mail.saunalahti.fi ([62.142.5.94]) with SMTP (gateway) id A002C18E116; Tue, 05 Jan 2010 20:16:46 +0200 Received: from [127.0.1.1] (a91-155-131-184.elisa-laajakaista.fi [91.155.131.184]) by emh02.mail.saunalahti.fi (Postfix) with ESMTP id 8744F2BD51 for ; Tue, 5 Jan 2010 20:16:45 +0200 (EET) Subject: [PATCH v2 5/9] mac80211: use Probe Request template when sending a direct scan To: linux-wireless@vger.kernel.org From: Kalle Valo Date: Tue, 05 Jan 2010 20:16:44 +0200 Message-ID: <20100105181644.27418.62045.stgit@tikku> In-Reply-To: <20100105181522.27418.97100.stgit@tikku> References: <20100105181522.27418.97100.stgit@tikku> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Antivirus: VAMS Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 29e1acc..2750cce 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -989,37 +989,29 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, struct ieee80211_local *local = sdata->local; struct sk_buff *skb; struct ieee80211_mgmt *mgmt; - u8 *pos; - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200 + - ie_len); - if (!skb) { - printk(KERN_DEBUG "%s: failed to allocate buffer for probe " - "request\n", sdata->name); + size_t buf_len; + u8 *buf; + + /* FIXME: come up with a proper value */ + buf = kmalloc(200 + ie_len, GFP_KERNEL); + if (!buf) { + printk(KERN_DEBUG "%s: failed to allocate temporary IE " + "buffer\n", sdata->name); return; } - skb_reserve(skb, local->hw.extra_tx_headroom); - mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); - memset(mgmt, 0, 24); - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_PROBE_REQ); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); + buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, + local->hw.conf.channel->band); + + skb = ieee80211_probereq_get(&local->hw, &sdata->vif, + ssid, ssid_len, + buf, buf_len); + if (dst) { + mgmt = (struct ieee80211_mgmt *) skb->data; memcpy(mgmt->da, 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_tx_skb(sdata, skb);