diff options
author | Jouni Malinen <jouni.malinen@atheros.com> | 2009-02-16 12:39:13 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:52:38 -0500 |
commit | 70692ad2923a379e0a10f9ec2ad93fbbe084cc46 (patch) | |
tree | f67488c396ea6e61f71e0199eea189ea939a698b /net/wireless | |
parent | 83befbde839b1deb0cd752a834ffd9fde8571ae2 (diff) |
nl80211: Optional IEs into scan request
This extends the NL80211_CMD_TRIGGER_SCAN command to allow applications
to specify a set of information element(s) to be added into Probe
Request frames with NL80211_ATTR_IE. This provides support for the
MLME-SCAN.request primitive parameter VendorSpecificInfo and can be
used, e.g., to implement WPS scanning.
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/nl80211.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 298a4de59948..67b18b3a93a0 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2286,6 +2286,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
2286 | struct wiphy *wiphy; | 2286 | struct wiphy *wiphy; |
2287 | int err, tmp, n_ssids = 0, n_channels = 0, i; | 2287 | int err, tmp, n_ssids = 0, n_channels = 0, i; |
2288 | enum ieee80211_band band; | 2288 | enum ieee80211_band band; |
2289 | size_t ie_len; | ||
2289 | 2290 | ||
2290 | err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); | 2291 | err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); |
2291 | if (err) | 2292 | if (err) |
@@ -2327,9 +2328,15 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
2327 | goto out_unlock; | 2328 | goto out_unlock; |
2328 | } | 2329 | } |
2329 | 2330 | ||
2331 | if (info->attrs[NL80211_ATTR_IE]) | ||
2332 | ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); | ||
2333 | else | ||
2334 | ie_len = 0; | ||
2335 | |||
2330 | request = kzalloc(sizeof(*request) | 2336 | request = kzalloc(sizeof(*request) |
2331 | + sizeof(*ssid) * n_ssids | 2337 | + sizeof(*ssid) * n_ssids |
2332 | + sizeof(channel) * n_channels, GFP_KERNEL); | 2338 | + sizeof(channel) * n_channels |
2339 | + ie_len, GFP_KERNEL); | ||
2333 | if (!request) { | 2340 | if (!request) { |
2334 | err = -ENOMEM; | 2341 | err = -ENOMEM; |
2335 | goto out_unlock; | 2342 | goto out_unlock; |
@@ -2340,6 +2347,12 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
2340 | if (n_ssids) | 2347 | if (n_ssids) |
2341 | request->ssids = (void *)(request->channels + n_channels); | 2348 | request->ssids = (void *)(request->channels + n_channels); |
2342 | request->n_ssids = n_ssids; | 2349 | request->n_ssids = n_ssids; |
2350 | if (ie_len) { | ||
2351 | if (request->ssids) | ||
2352 | request->ie = (void *)(request->ssids + n_ssids); | ||
2353 | else | ||
2354 | request->ie = (void *)(request->channels + n_channels); | ||
2355 | } | ||
2343 | 2356 | ||
2344 | if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { | 2357 | if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { |
2345 | /* user specified, bail out if channel not found */ | 2358 | /* user specified, bail out if channel not found */ |
@@ -2380,6 +2393,12 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
2380 | } | 2393 | } |
2381 | } | 2394 | } |
2382 | 2395 | ||
2396 | if (info->attrs[NL80211_ATTR_IE]) { | ||
2397 | request->ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); | ||
2398 | memcpy(request->ie, nla_data(info->attrs[NL80211_ATTR_IE]), | ||
2399 | request->ie_len); | ||
2400 | } | ||
2401 | |||
2383 | request->ifidx = dev->ifindex; | 2402 | request->ifidx = dev->ifindex; |
2384 | request->wiphy = &drv->wiphy; | 2403 | request->wiphy = &drv->wiphy; |
2385 | 2404 | ||