linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kalle.valo@iki.fi>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 5/9] mac80211: use Probe Request template when sending a direct scan
Date: Sun, 03 Jan 2010 23:07:55 +0200	[thread overview]
Message-ID: <20100103210755.29287.4242.stgit@tikku> (raw)
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>

From: Kalle Valo <kalle.valo@nokia.com>

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>
---
 net/mac80211/util.c |   40 ++++++++++++++++------------------------
 1 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 7e38858..9713dcb 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);


  parent reply	other threads:[~2010-01-03 21:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-03 21:07 [PATCH 0/9] mac80211: templates for drivers Kalle Valo
2010-01-03 21:07 ` [PATCH 1/9] mac80211: add functions to create PS Poll and Nullfunc templates Kalle Valo
2010-01-03 21:07 ` [PATCH 2/9] mac80211: use PS Poll and Nullfunc templates when sending such frames Kalle Valo
2010-01-03 21:07 ` [PATCH 3/9] wl1251: get PS Poll and Nullfunc templates from mac80211 Kalle Valo
2010-01-03 21:07 ` [PATCH 4/9] mac80211: create Probe Request template Kalle Valo
2010-01-05  9:21   ` Johannes Berg
2010-01-05 10:15     ` Kalle Valo
2010-01-05 10:23       ` Johannes Berg
2010-01-03 21:07 ` Kalle Valo [this message]
2010-01-03 21:08 ` [PATCH 6/9] wl1251: cleanup scanning code Kalle Valo
2010-01-03 21:08 ` [PATCH 7/9] wl1251: get probe request template from mac80211 Kalle Valo
2010-01-03 21:08 ` [PATCH 8/9] wl1251: use mac80211 provided channel parameters in scanning Kalle Valo
2010-01-03 21:08 ` [PATCH 9/9] wl1251: fix sleep related error paths in wl1251_op_bss_info_changed() Kalle Valo
2010-01-05  9:22 ` [PATCH 0/9] mac80211: templates for drivers Johannes Berg
2010-01-05 10:17   ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100103210755.29287.4242.stgit@tikku \
    --to=kalle.valo@iki.fi \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).