diff options
-rw-r--r-- | include/net/mac80211.h | 17 | ||||
-rw-r--r-- | net/mac80211/tx.c | 50 |
2 files changed, 67 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 75f46e26ad60..e1e73c6abeff 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1905,6 +1905,23 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, | |||
1905 | struct ieee80211_vif *vif); | 1905 | struct ieee80211_vif *vif); |
1906 | 1906 | ||
1907 | /** | 1907 | /** |
1908 | * ieee80211_probereq_get - retrieve a Probe Request template | ||
1909 | * @hw: pointer obtained from ieee80211_alloc_hw(). | ||
1910 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
1911 | * @ssid: SSID buffer | ||
1912 | * @ssid_len: length of SSID | ||
1913 | * @ie: buffer containing all IEs except SSID for the template | ||
1914 | * @ie_len: length of the IE buffer | ||
1915 | * | ||
1916 | * Creates a Probe Request template which can, for example, be uploaded to | ||
1917 | * hardware. | ||
1918 | */ | ||
1919 | struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, | ||
1920 | struct ieee80211_vif *vif, | ||
1921 | const u8 *ssid, size_t ssid_len, | ||
1922 | const u8 *ie, size_t ie_len); | ||
1923 | |||
1924 | /** | ||
1908 | * ieee80211_rts_get - RTS frame generation function | 1925 | * ieee80211_rts_get - RTS frame generation function |
1909 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1926 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1910 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 1927 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 055b45b146d9..0661e696a1dd 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -2278,6 +2278,56 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, | |||
2278 | } | 2278 | } |
2279 | EXPORT_SYMBOL(ieee80211_nullfunc_get); | 2279 | EXPORT_SYMBOL(ieee80211_nullfunc_get); |
2280 | 2280 | ||
2281 | struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, | ||
2282 | struct ieee80211_vif *vif, | ||
2283 | const u8 *ssid, size_t ssid_len, | ||
2284 | const u8 *ie, size_t ie_len) | ||
2285 | { | ||
2286 | struct ieee80211_sub_if_data *sdata; | ||
2287 | struct ieee80211_local *local; | ||
2288 | struct ieee80211_hdr_3addr *hdr; | ||
2289 | struct sk_buff *skb; | ||
2290 | size_t ie_ssid_len; | ||
2291 | u8 *pos; | ||
2292 | |||
2293 | sdata = vif_to_sdata(vif); | ||
2294 | local = sdata->local; | ||
2295 | ie_ssid_len = 2 + ssid_len; | ||
2296 | |||
2297 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*hdr) + | ||
2298 | ie_ssid_len + ie_len); | ||
2299 | if (!skb) { | ||
2300 | printk(KERN_DEBUG "%s: failed to allocate buffer for probe " | ||
2301 | "request template\n", sdata->name); | ||
2302 | return NULL; | ||
2303 | } | ||
2304 | |||
2305 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
2306 | |||
2307 | hdr = (struct ieee80211_hdr_3addr *) skb_put(skb, sizeof(*hdr)); | ||
2308 | memset(hdr, 0, sizeof(*hdr)); | ||
2309 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
2310 | IEEE80211_STYPE_PROBE_REQ); | ||
2311 | memset(hdr->addr1, 0xff, ETH_ALEN); | ||
2312 | memcpy(hdr->addr2, vif->addr, ETH_ALEN); | ||
2313 | memset(hdr->addr3, 0xff, ETH_ALEN); | ||
2314 | |||
2315 | pos = skb_put(skb, ie_ssid_len); | ||
2316 | *pos++ = WLAN_EID_SSID; | ||
2317 | *pos++ = ssid_len; | ||
2318 | if (ssid) | ||
2319 | memcpy(pos, ssid, ssid_len); | ||
2320 | pos += ssid_len; | ||
2321 | |||
2322 | if (ie) { | ||
2323 | pos = skb_put(skb, ie_len); | ||
2324 | memcpy(pos, ie, ie_len); | ||
2325 | } | ||
2326 | |||
2327 | return skb; | ||
2328 | } | ||
2329 | EXPORT_SYMBOL(ieee80211_probereq_get); | ||
2330 | |||
2281 | void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 2331 | void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2282 | const void *frame, size_t frame_len, | 2332 | const void *frame, size_t frame_len, |
2283 | const struct ieee80211_tx_info *frame_txctl, | 2333 | const struct ieee80211_tx_info *frame_txctl, |