Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wext: Emit event stream entries correctly when compat.

Three major portions to this change:

1) Add IW_EV_COMPAT_LCP_LEN, IW_EV_COMPAT_POINT_OFF,
and IW_EV_COMPAT_POINT_LEN helper defines.

2) Delete iw_stream_check_add_*(), they are unused.

3) Add iw_request_info argument to iwe_stream_add_*(), and use it to
size the event and pointer lengths correctly depending upon whether
IW_REQUEST_FLAG_COMPAT is set or not.

4) The mechanical transformations to the drivers and wireless stack
bits to get the iw_request_info passed down into the routines
modified in #3. Also, explicit references to IW_EV_LCP_LEN are
replaced with iwe_stream_lcp_len(info).

With a lot of help and bug fixes from Masakazu Mokuno.

Signed-off-by: David S. Miller <davem@davemloft.net>

+351 -314
+16 -14
drivers/net/ps3_gelic_wireless.c
··· 571 571 * independent format 572 572 */ 573 573 static char *gelic_wl_translate_scan(struct net_device *netdev, 574 + struct iw_request_info *info, 574 575 char *ev, 575 576 char *stop, 576 577 struct gelic_wl_scan_info *network) ··· 589 588 iwe.cmd = SIOCGIWAP; 590 589 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 591 590 memcpy(iwe.u.ap_addr.sa_data, &scan->bssid[2], ETH_ALEN); 592 - ev = iwe_stream_add_event(ev, stop, &iwe, IW_EV_ADDR_LEN); 591 + ev = iwe_stream_add_event(info, ev, stop, &iwe, IW_EV_ADDR_LEN); 593 592 594 593 /* ESSID */ 595 594 iwe.cmd = SIOCGIWESSID; 596 595 iwe.u.data.flags = 1; 597 596 iwe.u.data.length = strnlen(scan->essid, 32); 598 - ev = iwe_stream_add_point(ev, stop, &iwe, scan->essid); 597 + ev = iwe_stream_add_point(info, ev, stop, &iwe, scan->essid); 599 598 600 599 /* FREQUENCY */ 601 600 iwe.cmd = SIOCGIWFREQ; 602 601 iwe.u.freq.m = be16_to_cpu(scan->channel); 603 602 iwe.u.freq.e = 0; /* table value in MHz */ 604 603 iwe.u.freq.i = 0; 605 - ev = iwe_stream_add_event(ev, stop, &iwe, IW_EV_FREQ_LEN); 604 + ev = iwe_stream_add_event(info, ev, stop, &iwe, IW_EV_FREQ_LEN); 606 605 607 606 /* RATES */ 608 607 iwe.cmd = SIOCGIWRATE; 609 608 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; 610 609 /* to stuff multiple values in one event */ 611 - tmp = ev + IW_EV_LCP_LEN; 610 + tmp = ev + iwe_stream_lcp_len(info); 612 611 /* put them in ascendant order (older is first) */ 613 612 i = 0; 614 613 j = 0; ··· 621 620 else 622 621 rate = scan->rate[i++] & 0x7f; 623 622 iwe.u.bitrate.value = rate * 500000; /* 500kbps unit */ 624 - tmp = iwe_stream_add_value(ev, tmp, stop, &iwe, 623 + tmp = iwe_stream_add_value(info, ev, tmp, stop, &iwe, 625 624 IW_EV_PARAM_LEN); 626 625 } 627 626 while (j < network->rate_ext_len) { 628 627 iwe.u.bitrate.value = (scan->ext_rate[j++] & 0x7f) * 500000; 629 - tmp = iwe_stream_add_value(ev, tmp, stop, &iwe, 628 + tmp = iwe_stream_add_value(info, ev, tmp, stop, &iwe, 630 629 IW_EV_PARAM_LEN); 631 630 } 632 631 /* Check if we added any rate */ 633 - if (IW_EV_LCP_LEN < (tmp - ev)) 632 + if (iwe_stream_lcp_len(info) < (tmp - ev)) 634 633 ev = tmp; 635 634 636 635 /* ENCODE */ ··· 640 639 else 641 640 iwe.u.data.flags = IW_ENCODE_DISABLED; 642 641 iwe.u.data.length = 0; 643 - ev = iwe_stream_add_point(ev, stop, &iwe, scan->essid); 642 + ev = iwe_stream_add_point(info, ev, stop, &iwe, scan->essid); 644 643 645 644 /* MODE */ 646 645 iwe.cmd = SIOCGIWMODE; ··· 650 649 iwe.u.mode = IW_MODE_MASTER; 651 650 else 652 651 iwe.u.mode = IW_MODE_ADHOC; 653 - ev = iwe_stream_add_event(ev, stop, &iwe, IW_EV_UINT_LEN); 652 + ev = iwe_stream_add_event(info, ev, stop, &iwe, IW_EV_UINT_LEN); 654 653 } 655 654 656 655 /* QUAL */ ··· 660 659 iwe.u.qual.level = be16_to_cpu(scan->rssi); 661 660 iwe.u.qual.qual = be16_to_cpu(scan->rssi); 662 661 iwe.u.qual.noise = 0; 663 - ev = iwe_stream_add_event(ev, stop, &iwe, IW_EV_QUAL_LEN); 662 + ev = iwe_stream_add_event(info, ev, stop, &iwe, IW_EV_QUAL_LEN); 664 663 665 664 /* RSN */ 666 665 memset(&iwe, 0, sizeof(iwe)); ··· 670 669 if (len) { 671 670 iwe.cmd = IWEVGENIE; 672 671 iwe.u.data.length = len; 673 - ev = iwe_stream_add_point(ev, stop, &iwe, buf); 672 + ev = iwe_stream_add_point(info, ev, stop, &iwe, buf); 674 673 } 675 674 } else { 676 675 /* this scan info has IE data */ ··· 685 684 memcpy(buf, ie_info.wpa.data, ie_info.wpa.len); 686 685 iwe.cmd = IWEVGENIE; 687 686 iwe.u.data.length = ie_info.wpa.len; 688 - ev = iwe_stream_add_point(ev, stop, &iwe, buf); 687 + ev = iwe_stream_add_point(info, ev, stop, &iwe, buf); 689 688 } 690 689 691 690 if (ie_info.rsn.len && (ie_info.rsn.len <= sizeof(buf))) { ··· 693 692 memcpy(buf, ie_info.rsn.data, ie_info.rsn.len); 694 693 iwe.cmd = IWEVGENIE; 695 694 iwe.u.data.length = ie_info.rsn.len; 696 - ev = iwe_stream_add_point(ev, stop, &iwe, buf); 695 + ev = iwe_stream_add_point(info, ev, stop, &iwe, buf); 697 696 } 698 697 } 699 698 ··· 738 737 if (wl->scan_age == 0 || 739 738 time_after(scan_info->last_scanned + wl->scan_age, 740 739 this_time)) 741 - ev = gelic_wl_translate_scan(netdev, ev, stop, 740 + ev = gelic_wl_translate_scan(netdev, info, 741 + ev, stop, 742 742 scan_info); 743 743 else 744 744 pr_debug("%s:entry too old\n", __func__);
+28 -15
drivers/net/wireless/airo.c
··· 7156 7156 * format that the Wireless Tools will understand - Jean II 7157 7157 */ 7158 7158 static inline char *airo_translate_scan(struct net_device *dev, 7159 + struct iw_request_info *info, 7159 7160 char *current_ev, 7160 7161 char *end_buf, 7161 7162 BSSListRid *bss) ··· 7173 7172 iwe.cmd = SIOCGIWAP; 7174 7173 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 7175 7174 memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN); 7176 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); 7175 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 7176 + &iwe, IW_EV_ADDR_LEN); 7177 7177 7178 7178 /* Other entries will be displayed in the order we give them */ 7179 7179 ··· 7184 7182 iwe.u.data.length = 32; 7185 7183 iwe.cmd = SIOCGIWESSID; 7186 7184 iwe.u.data.flags = 1; 7187 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->ssid); 7185 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 7186 + &iwe, bss->ssid); 7188 7187 7189 7188 /* Add mode */ 7190 7189 iwe.cmd = SIOCGIWMODE; ··· 7195 7192 iwe.u.mode = IW_MODE_MASTER; 7196 7193 else 7197 7194 iwe.u.mode = IW_MODE_ADHOC; 7198 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN); 7195 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 7196 + &iwe, IW_EV_UINT_LEN); 7199 7197 } 7200 7198 7201 7199 /* Add frequency */ ··· 7207 7203 */ 7208 7204 iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000; 7209 7205 iwe.u.freq.e = 1; 7210 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); 7206 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 7207 + &iwe, IW_EV_FREQ_LEN); 7211 7208 7212 7209 dBm = le16_to_cpu(bss->dBm); 7213 7210 ··· 7228 7223 | IW_QUAL_DBM; 7229 7224 } 7230 7225 iwe.u.qual.noise = ai->wstats.qual.noise; 7231 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); 7226 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 7227 + &iwe, IW_EV_QUAL_LEN); 7232 7228 7233 7229 /* Add encryption capability */ 7234 7230 iwe.cmd = SIOCGIWENCODE; ··· 7238 7232 else 7239 7233 iwe.u.data.flags = IW_ENCODE_DISABLED; 7240 7234 iwe.u.data.length = 0; 7241 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->ssid); 7235 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 7236 + &iwe, bss->ssid); 7242 7237 7243 7238 /* Rate : stuffing multiple values in a single event require a bit 7244 7239 * more of magic - Jean II */ 7245 - current_val = current_ev + IW_EV_LCP_LEN; 7240 + current_val = current_ev + iwe_stream_lcp_len(info); 7246 7241 7247 7242 iwe.cmd = SIOCGIWRATE; 7248 7243 /* Those two flags are ignored... */ ··· 7256 7249 /* Bit rate given in 500 kb/s units (+ 0x80) */ 7257 7250 iwe.u.bitrate.value = ((bss->rates[i] & 0x7f) * 500000); 7258 7251 /* Add new value to event */ 7259 - current_val = iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); 7252 + current_val = iwe_stream_add_value(info, current_ev, 7253 + current_val, end_buf, 7254 + &iwe, IW_EV_PARAM_LEN); 7260 7255 } 7261 7256 /* Check if we added any event */ 7262 - if((current_val - current_ev) > IW_EV_LCP_LEN) 7257 + if ((current_val - current_ev) > iwe_stream_lcp_len(info)) 7263 7258 current_ev = current_val; 7264 7259 7265 7260 /* Beacon interval */ ··· 7270 7261 iwe.cmd = IWEVCUSTOM; 7271 7262 sprintf(buf, "bcn_int=%d", bss->beaconInterval); 7272 7263 iwe.u.data.length = strlen(buf); 7273 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf); 7264 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 7265 + &iwe, buf); 7274 7266 kfree(buf); 7275 7267 } 7276 7268 ··· 7305 7295 iwe.cmd = IWEVGENIE; 7306 7296 iwe.u.data.length = min(info_element->len + 2, 7307 7297 MAX_WPA_IE_LEN); 7308 - current_ev = iwe_stream_add_point(current_ev, end_buf, 7309 - &iwe, (char *) info_element); 7298 + current_ev = iwe_stream_add_point( 7299 + info, current_ev, 7300 + end_buf, &iwe, 7301 + (char *) info_element); 7310 7302 } 7311 7303 break; 7312 7304 ··· 7316 7304 iwe.cmd = IWEVGENIE; 7317 7305 iwe.u.data.length = min(info_element->len + 2, 7318 7306 MAX_WPA_IE_LEN); 7319 - current_ev = iwe_stream_add_point(current_ev, end_buf, 7320 - &iwe, (char *) info_element); 7307 + current_ev = iwe_stream_add_point( 7308 + info, current_ev, end_buf, 7309 + &iwe, (char *) info_element); 7321 7310 break; 7322 7311 7323 7312 default: ··· 7357 7344 7358 7345 list_for_each_entry (net, &ai->network_list, list) { 7359 7346 /* Translate to WE format this entry */ 7360 - current_ev = airo_translate_scan(dev, current_ev, 7347 + current_ev = airo_translate_scan(dev, info, current_ev, 7361 7348 extra + dwrq->length, 7362 7349 &net->bss); 7363 7350
+18 -6
drivers/net/wireless/atmel.c
··· 2310 2310 iwe.cmd = SIOCGIWAP; 2311 2311 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 2312 2312 memcpy(iwe.u.ap_addr.sa_data, priv->BSSinfo[i].BSSID, 6); 2313 - current_ev = iwe_stream_add_event(current_ev, extra + IW_SCAN_MAX_DATA, &iwe, IW_EV_ADDR_LEN); 2313 + current_ev = iwe_stream_add_event(info, current_ev, 2314 + extra + IW_SCAN_MAX_DATA, 2315 + &iwe, IW_EV_ADDR_LEN); 2314 2316 2315 2317 iwe.u.data.length = priv->BSSinfo[i].SSIDsize; 2316 2318 if (iwe.u.data.length > 32) 2317 2319 iwe.u.data.length = 32; 2318 2320 iwe.cmd = SIOCGIWESSID; 2319 2321 iwe.u.data.flags = 1; 2320 - current_ev = iwe_stream_add_point(current_ev, extra + IW_SCAN_MAX_DATA, &iwe, priv->BSSinfo[i].SSID); 2322 + current_ev = iwe_stream_add_point(info, current_ev, 2323 + extra + IW_SCAN_MAX_DATA, 2324 + &iwe, priv->BSSinfo[i].SSID); 2321 2325 2322 2326 iwe.cmd = SIOCGIWMODE; 2323 2327 iwe.u.mode = priv->BSSinfo[i].BSStype; 2324 - current_ev = iwe_stream_add_event(current_ev, extra + IW_SCAN_MAX_DATA, &iwe, IW_EV_UINT_LEN); 2328 + current_ev = iwe_stream_add_event(info, current_ev, 2329 + extra + IW_SCAN_MAX_DATA, 2330 + &iwe, IW_EV_UINT_LEN); 2325 2331 2326 2332 iwe.cmd = SIOCGIWFREQ; 2327 2333 iwe.u.freq.m = priv->BSSinfo[i].channel; 2328 2334 iwe.u.freq.e = 0; 2329 - current_ev = iwe_stream_add_event(current_ev, extra + IW_SCAN_MAX_DATA, &iwe, IW_EV_FREQ_LEN); 2335 + current_ev = iwe_stream_add_event(info, current_ev, 2336 + extra + IW_SCAN_MAX_DATA, 2337 + &iwe, IW_EV_FREQ_LEN); 2330 2338 2331 2339 /* Add quality statistics */ 2332 2340 iwe.cmd = IWEVQUAL; 2333 2341 iwe.u.qual.level = priv->BSSinfo[i].RSSI; 2334 2342 iwe.u.qual.qual = iwe.u.qual.level; 2335 2343 /* iwe.u.qual.noise = SOMETHING */ 2336 - current_ev = iwe_stream_add_event(current_ev, extra + IW_SCAN_MAX_DATA , &iwe, IW_EV_QUAL_LEN); 2344 + current_ev = iwe_stream_add_event(info, current_ev, 2345 + extra + IW_SCAN_MAX_DATA, 2346 + &iwe, IW_EV_QUAL_LEN); 2337 2347 2338 2348 2339 2349 iwe.cmd = SIOCGIWENCODE; ··· 2352 2342 else 2353 2343 iwe.u.data.flags = IW_ENCODE_DISABLED; 2354 2344 iwe.u.data.length = 0; 2355 - current_ev = iwe_stream_add_point(current_ev, extra + IW_SCAN_MAX_DATA, &iwe, NULL); 2345 + current_ev = iwe_stream_add_point(info, current_ev, 2346 + extra + IW_SCAN_MAX_DATA, 2347 + &iwe, NULL); 2356 2348 } 2357 2349 2358 2350 /* Length of data */
+2 -1
drivers/net/wireless/hostap/hostap.h
··· 67 67 int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], 68 68 struct iw_quality qual[], int buf_size, 69 69 int aplist); 70 - int prism2_ap_translate_scan(struct net_device *dev, char *buffer); 70 + int prism2_ap_translate_scan(struct net_device *dev, 71 + struct iw_request_info *info, char *buffer); 71 72 int prism2_hostapd(struct ap_data *ap, struct prism2_hostapd_param *param); 72 73 73 74
+16 -16
drivers/net/wireless/hostap/hostap_ap.c
··· 2420 2420 2421 2421 /* Translate our list of Access Points & Stations to a card independant 2422 2422 * format that the Wireless Tools will understand - Jean II */ 2423 - int prism2_ap_translate_scan(struct net_device *dev, char *buffer) 2423 + int prism2_ap_translate_scan(struct net_device *dev, 2424 + struct iw_request_info *info, char *buffer) 2424 2425 { 2425 2426 struct hostap_interface *iface; 2426 2427 local_info_t *local; ··· 2450 2449 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 2451 2450 memcpy(iwe.u.ap_addr.sa_data, sta->addr, ETH_ALEN); 2452 2451 iwe.len = IW_EV_ADDR_LEN; 2453 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 2454 - IW_EV_ADDR_LEN); 2452 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 2453 + &iwe, IW_EV_ADDR_LEN); 2455 2454 2456 2455 /* Use the mode to indicate if it's a station or 2457 2456 * an Access Point */ ··· 2462 2461 else 2463 2462 iwe.u.mode = IW_MODE_INFRA; 2464 2463 iwe.len = IW_EV_UINT_LEN; 2465 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 2466 - IW_EV_UINT_LEN); 2464 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 2465 + &iwe, IW_EV_UINT_LEN); 2467 2466 2468 2467 /* Some quality */ 2469 2468 memset(&iwe, 0, sizeof(iwe)); ··· 2478 2477 iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); 2479 2478 iwe.u.qual.updated = sta->last_rx_updated; 2480 2479 iwe.len = IW_EV_QUAL_LEN; 2481 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 2482 - IW_EV_QUAL_LEN); 2480 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 2481 + &iwe, IW_EV_QUAL_LEN); 2483 2482 2484 2483 #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 2485 2484 if (sta->ap) { ··· 2487 2486 iwe.cmd = SIOCGIWESSID; 2488 2487 iwe.u.data.length = sta->u.ap.ssid_len; 2489 2488 iwe.u.data.flags = 1; 2490 - current_ev = iwe_stream_add_point(current_ev, end_buf, 2491 - &iwe, 2489 + current_ev = iwe_stream_add_point(info, current_ev, 2490 + end_buf, &iwe, 2492 2491 sta->u.ap.ssid); 2493 2492 2494 2493 memset(&iwe, 0, sizeof(iwe)); ··· 2498 2497 IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; 2499 2498 else 2500 2499 iwe.u.data.flags = IW_ENCODE_DISABLED; 2501 - current_ev = iwe_stream_add_point(current_ev, end_buf, 2502 - &iwe, 2503 - sta->u.ap.ssid 2504 - /* 0 byte memcpy */); 2500 + current_ev = iwe_stream_add_point(info, current_ev, 2501 + end_buf, &iwe, 2502 + sta->u.ap.ssid); 2505 2503 2506 2504 if (sta->u.ap.channel > 0 && 2507 2505 sta->u.ap.channel <= FREQ_COUNT) { ··· 2510 2510 * 100000; 2511 2511 iwe.u.freq.e = 1; 2512 2512 current_ev = iwe_stream_add_event( 2513 - current_ev, end_buf, &iwe, 2513 + info, current_ev, end_buf, &iwe, 2514 2514 IW_EV_FREQ_LEN); 2515 2515 } 2516 2516 ··· 2519 2519 sprintf(buf, "beacon_interval=%d", 2520 2520 sta->listen_interval); 2521 2521 iwe.u.data.length = strlen(buf); 2522 - current_ev = iwe_stream_add_point(current_ev, end_buf, 2523 - &iwe, buf); 2522 + current_ev = iwe_stream_add_point(info, current_ev, 2523 + end_buf, &iwe, buf); 2524 2524 } 2525 2525 #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2526 2526
+31 -27
drivers/net/wireless/hostap/hostap_ioctl.c
··· 1793 1793 1794 1794 #ifndef PRISM2_NO_STATION_MODES 1795 1795 static char * __prism2_translate_scan(local_info_t *local, 1796 + struct iw_request_info *info, 1796 1797 struct hfa384x_hostscan_result *scan, 1797 1798 struct hostap_bss_info *bss, 1798 1799 char *current_ev, char *end_buf) ··· 1824 1823 iwe.cmd = SIOCGIWAP; 1825 1824 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 1826 1825 memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN); 1827 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 1826 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, 1828 1827 IW_EV_ADDR_LEN); 1829 1828 1830 1829 /* Other entries will be displayed in the order we give them */ ··· 1833 1832 iwe.cmd = SIOCGIWESSID; 1834 1833 iwe.u.data.length = ssid_len; 1835 1834 iwe.u.data.flags = 1; 1836 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ssid); 1835 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 1836 + &iwe, ssid); 1837 1837 1838 1838 memset(&iwe, 0, sizeof(iwe)); 1839 1839 iwe.cmd = SIOCGIWMODE; ··· 1849 1847 iwe.u.mode = IW_MODE_MASTER; 1850 1848 else 1851 1849 iwe.u.mode = IW_MODE_ADHOC; 1852 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 1853 - IW_EV_UINT_LEN); 1850 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 1851 + &iwe, IW_EV_UINT_LEN); 1854 1852 } 1855 1853 1856 1854 memset(&iwe, 0, sizeof(iwe)); ··· 1866 1864 if (chan > 0) { 1867 1865 iwe.u.freq.m = freq_list[chan - 1] * 100000; 1868 1866 iwe.u.freq.e = 1; 1869 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 1870 - IW_EV_FREQ_LEN); 1867 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 1868 + &iwe, IW_EV_FREQ_LEN); 1871 1869 } 1872 1870 1873 1871 if (scan) { ··· 1886 1884 | IW_QUAL_NOISE_UPDATED 1887 1885 | IW_QUAL_QUAL_INVALID 1888 1886 | IW_QUAL_DBM; 1889 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 1890 - IW_EV_QUAL_LEN); 1887 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 1888 + &iwe, IW_EV_QUAL_LEN); 1891 1889 } 1892 1890 1893 1891 memset(&iwe, 0, sizeof(iwe)); ··· 1897 1895 else 1898 1896 iwe.u.data.flags = IW_ENCODE_DISABLED; 1899 1897 iwe.u.data.length = 0; 1900 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ""); 1898 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, ""); 1901 1899 1902 1900 /* TODO: add SuppRates into BSS table */ 1903 1901 if (scan) { 1904 1902 memset(&iwe, 0, sizeof(iwe)); 1905 1903 iwe.cmd = SIOCGIWRATE; 1906 - current_val = current_ev + IW_EV_LCP_LEN; 1904 + current_val = current_ev + iwe_stream_lcp_len(info); 1907 1905 pos = scan->sup_rates; 1908 1906 for (i = 0; i < sizeof(scan->sup_rates); i++) { 1909 1907 if (pos[i] == 0) ··· 1911 1909 /* Bit rate given in 500 kb/s units (+ 0x80) */ 1912 1910 iwe.u.bitrate.value = ((pos[i] & 0x7f) * 500000); 1913 1911 current_val = iwe_stream_add_value( 1914 - current_ev, current_val, end_buf, &iwe, 1912 + info, current_ev, current_val, end_buf, &iwe, 1915 1913 IW_EV_PARAM_LEN); 1916 1914 } 1917 1915 /* Check if we added any event */ 1918 - if ((current_val - current_ev) > IW_EV_LCP_LEN) 1916 + if ((current_val - current_ev) > iwe_stream_lcp_len(info)) 1919 1917 current_ev = current_val; 1920 1918 } 1921 1919 ··· 1926 1924 iwe.cmd = IWEVCUSTOM; 1927 1925 sprintf(buf, "bcn_int=%d", le16_to_cpu(scan->beacon_interval)); 1928 1926 iwe.u.data.length = strlen(buf); 1929 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, 1930 - buf); 1927 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 1928 + &iwe, buf); 1931 1929 1932 1930 memset(&iwe, 0, sizeof(iwe)); 1933 1931 iwe.cmd = IWEVCUSTOM; 1934 1932 sprintf(buf, "resp_rate=%d", le16_to_cpu(scan->rate)); 1935 1933 iwe.u.data.length = strlen(buf); 1936 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, 1937 - buf); 1934 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 1935 + &iwe, buf); 1938 1936 1939 1937 if (local->last_scan_type == PRISM2_HOSTSCAN && 1940 1938 (capabilities & WLAN_CAPABILITY_IBSS)) { ··· 1942 1940 iwe.cmd = IWEVCUSTOM; 1943 1941 sprintf(buf, "atim=%d", le16_to_cpu(scan->atim)); 1944 1942 iwe.u.data.length = strlen(buf); 1945 - current_ev = iwe_stream_add_point(current_ev, end_buf, 1946 - &iwe, buf); 1943 + current_ev = iwe_stream_add_point(info, current_ev, 1944 + end_buf, &iwe, buf); 1947 1945 } 1948 1946 } 1949 1947 kfree(buf); ··· 1952 1950 memset(&iwe, 0, sizeof(iwe)); 1953 1951 iwe.cmd = IWEVGENIE; 1954 1952 iwe.u.data.length = bss->wpa_ie_len; 1955 - current_ev = iwe_stream_add_point( 1956 - current_ev, end_buf, &iwe, bss->wpa_ie); 1953 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 1954 + &iwe, bss->wpa_ie); 1957 1955 } 1958 1956 1959 1957 if (bss && bss->rsn_ie_len > 0 && bss->rsn_ie_len <= MAX_WPA_IE_LEN) { 1960 1958 memset(&iwe, 0, sizeof(iwe)); 1961 1959 iwe.cmd = IWEVGENIE; 1962 1960 iwe.u.data.length = bss->rsn_ie_len; 1963 - current_ev = iwe_stream_add_point( 1964 - current_ev, end_buf, &iwe, bss->rsn_ie); 1961 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 1962 + &iwe, bss->rsn_ie); 1965 1963 } 1966 1964 1967 1965 return current_ev; ··· 1971 1969 /* Translate scan data returned from the card to a card independant 1972 1970 * format that the Wireless Tools will understand - Jean II */ 1973 1971 static inline int prism2_translate_scan(local_info_t *local, 1972 + struct iw_request_info *info, 1974 1973 char *buffer, int buflen) 1975 1974 { 1976 1975 struct hfa384x_hostscan_result *scan; ··· 2002 1999 if (memcmp(bss->bssid, scan->bssid, ETH_ALEN) == 0) { 2003 2000 bss->included = 1; 2004 2001 current_ev = __prism2_translate_scan( 2005 - local, scan, bss, current_ev, end_buf); 2002 + local, info, scan, bss, current_ev, 2003 + end_buf); 2006 2004 found++; 2007 2005 } 2008 2006 } 2009 2007 if (!found) { 2010 2008 current_ev = __prism2_translate_scan( 2011 - local, scan, NULL, current_ev, end_buf); 2009 + local, info, scan, NULL, current_ev, end_buf); 2012 2010 } 2013 2011 /* Check if there is space for one more entry */ 2014 2012 if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) { ··· 2027 2023 bss = list_entry(ptr, struct hostap_bss_info, list); 2028 2024 if (bss->included) 2029 2025 continue; 2030 - current_ev = __prism2_translate_scan(local, NULL, bss, 2026 + current_ev = __prism2_translate_scan(local, info, NULL, bss, 2031 2027 current_ev, end_buf); 2032 2028 /* Check if there is space for one more entry */ 2033 2029 if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) { ··· 2074 2070 } 2075 2071 local->scan_timestamp = 0; 2076 2072 2077 - res = prism2_translate_scan(local, extra, data->length); 2073 + res = prism2_translate_scan(local, info, extra, data->length); 2078 2074 2079 2075 if (res >= 0) { 2080 2076 data->length = res; ··· 2107 2103 * Jean II */ 2108 2104 2109 2105 /* Translate to WE format */ 2110 - res = prism2_ap_translate_scan(dev, extra); 2106 + res = prism2_ap_translate_scan(dev, info, extra); 2111 2107 if (res >= 0) { 2112 2108 printk(KERN_DEBUG "Scan result translation succeeded " 2113 2109 "(length=%d)\n", res);
+19 -17
drivers/net/wireless/libertas/scan.c
··· 776 776 #define MAX_CUSTOM_LEN 64 777 777 778 778 static inline char *lbs_translate_scan(struct lbs_private *priv, 779 - char *start, char *stop, 780 - struct bss_descriptor *bss) 779 + struct iw_request_info *info, 780 + char *start, char *stop, 781 + struct bss_descriptor *bss) 781 782 { 782 783 struct chan_freq_power *cfp; 783 784 char *current_val; /* For rates */ ··· 802 801 iwe.cmd = SIOCGIWAP; 803 802 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 804 803 memcpy(iwe.u.ap_addr.sa_data, &bss->bssid, ETH_ALEN); 805 - start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN); 804 + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); 806 805 807 806 /* SSID */ 808 807 iwe.cmd = SIOCGIWESSID; 809 808 iwe.u.data.flags = 1; 810 809 iwe.u.data.length = min((uint32_t) bss->ssid_len, (uint32_t) IW_ESSID_MAX_SIZE); 811 - start = iwe_stream_add_point(start, stop, &iwe, bss->ssid); 810 + start = iwe_stream_add_point(info, start, stop, &iwe, bss->ssid); 812 811 813 812 /* Mode */ 814 813 iwe.cmd = SIOCGIWMODE; 815 814 iwe.u.mode = bss->mode; 816 - start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN); 815 + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_UINT_LEN); 817 816 818 817 /* Frequency */ 819 818 iwe.cmd = SIOCGIWFREQ; 820 819 iwe.u.freq.m = (long)cfp->freq * 100000; 821 820 iwe.u.freq.e = 1; 822 - start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN); 821 + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN); 823 822 824 823 /* Add quality statistics */ 825 824 iwe.cmd = IWEVQUAL; ··· 853 852 nf = priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; 854 853 iwe.u.qual.level = CAL_RSSI(snr, nf); 855 854 } 856 - start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); 855 + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); 857 856 858 857 /* Add encryption capability */ 859 858 iwe.cmd = SIOCGIWENCODE; ··· 863 862 iwe.u.data.flags = IW_ENCODE_DISABLED; 864 863 } 865 864 iwe.u.data.length = 0; 866 - start = iwe_stream_add_point(start, stop, &iwe, bss->ssid); 865 + start = iwe_stream_add_point(info, start, stop, &iwe, bss->ssid); 867 866 868 - current_val = start + IW_EV_LCP_LEN; 867 + current_val = start + iwe_stream_lcp_len(info); 869 868 870 869 iwe.cmd = SIOCGIWRATE; 871 870 iwe.u.bitrate.fixed = 0; ··· 875 874 for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) { 876 875 /* Bit rate given in 500 kb/s units */ 877 876 iwe.u.bitrate.value = bss->rates[j] * 500000; 878 - current_val = iwe_stream_add_value(start, current_val, 879 - stop, &iwe, IW_EV_PARAM_LEN); 877 + current_val = iwe_stream_add_value(info, start, current_val, 878 + stop, &iwe, IW_EV_PARAM_LEN); 880 879 } 881 880 if ((bss->mode == IW_MODE_ADHOC) && priv->adhoccreate 882 881 && !lbs_ssid_cmp(priv->curbssparams.ssid, 883 882 priv->curbssparams.ssid_len, 884 883 bss->ssid, bss->ssid_len)) { 885 884 iwe.u.bitrate.value = 22 * 500000; 886 - current_val = iwe_stream_add_value(start, current_val, 885 + current_val = iwe_stream_add_value(info, start, current_val, 887 886 stop, &iwe, IW_EV_PARAM_LEN); 888 887 } 889 888 /* Check if we added any event */ 890 - if((current_val - start) > IW_EV_LCP_LEN) 889 + if ((current_val - start) > iwe_stream_lcp_len(info)) 891 890 start = current_val; 892 891 893 892 memset(&iwe, 0, sizeof(iwe)); ··· 896 895 memcpy(buf, bss->wpa_ie, bss->wpa_ie_len); 897 896 iwe.cmd = IWEVGENIE; 898 897 iwe.u.data.length = bss->wpa_ie_len; 899 - start = iwe_stream_add_point(start, stop, &iwe, buf); 898 + start = iwe_stream_add_point(info, start, stop, &iwe, buf); 900 899 } 901 900 902 901 memset(&iwe, 0, sizeof(iwe)); ··· 905 904 memcpy(buf, bss->rsn_ie, bss->rsn_ie_len); 906 905 iwe.cmd = IWEVGENIE; 907 906 iwe.u.data.length = bss->rsn_ie_len; 908 - start = iwe_stream_add_point(start, stop, &iwe, buf); 907 + start = iwe_stream_add_point(info, start, stop, &iwe, buf); 909 908 } 910 909 911 910 if (bss->mesh) { ··· 916 915 p += snprintf(p, MAX_CUSTOM_LEN, "mesh-type: olpc"); 917 916 iwe.u.data.length = p - custom; 918 917 if (iwe.u.data.length) 919 - start = iwe_stream_add_point(start, stop, &iwe, custom); 918 + start = iwe_stream_add_point(info, start, stop, 919 + &iwe, custom); 920 920 } 921 921 922 922 out: ··· 1038 1036 } 1039 1037 1040 1038 /* Translate to WE format this entry */ 1041 - next_ev = lbs_translate_scan(priv, ev, stop, iter_bss); 1039 + next_ev = lbs_translate_scan(priv, info, ev, stop, iter_bss); 1042 1040 if (next_ev == NULL) 1043 1041 continue; 1044 1042 ev = next_ev;
+19 -11
drivers/net/wireless/orinoco.c
··· 4046 4046 * format that the Wireless Tools will understand - Jean II 4047 4047 * Return message length or -errno for fatal errors */ 4048 4048 static inline char *orinoco_translate_scan(struct net_device *dev, 4049 + struct iw_request_info *info, 4049 4050 char *current_ev, 4050 4051 char *end_buf, 4051 4052 union hermes_scan_info *bss, ··· 4063 4062 iwe.cmd = SIOCGIWAP; 4064 4063 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 4065 4064 memcpy(iwe.u.ap_addr.sa_data, bss->a.bssid, ETH_ALEN); 4066 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); 4065 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 4066 + &iwe, IW_EV_ADDR_LEN); 4067 4067 4068 4068 /* Other entries will be displayed in the order we give them */ 4069 4069 ··· 4074 4072 iwe.u.data.length = 32; 4075 4073 iwe.cmd = SIOCGIWESSID; 4076 4074 iwe.u.data.flags = 1; 4077 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->a.essid); 4075 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 4076 + &iwe, bss->a.essid); 4078 4077 4079 4078 /* Add mode */ 4080 4079 iwe.cmd = SIOCGIWMODE; ··· 4085 4082 iwe.u.mode = IW_MODE_MASTER; 4086 4083 else 4087 4084 iwe.u.mode = IW_MODE_ADHOC; 4088 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN); 4085 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 4086 + &iwe, IW_EV_UINT_LEN); 4089 4087 } 4090 4088 4091 4089 channel = bss->s.channel; ··· 4095 4091 iwe.cmd = SIOCGIWFREQ; 4096 4092 iwe.u.freq.m = channel_frequency[channel-1] * 100000; 4097 4093 iwe.u.freq.e = 1; 4098 - current_ev = iwe_stream_add_event(current_ev, end_buf, 4094 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 4099 4095 &iwe, IW_EV_FREQ_LEN); 4100 4096 } 4101 4097 ··· 4110 4106 iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise; 4111 4107 else 4112 4108 iwe.u.qual.qual = 0; 4113 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); 4109 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 4110 + &iwe, IW_EV_QUAL_LEN); 4114 4111 4115 4112 /* Add encryption capability */ 4116 4113 iwe.cmd = SIOCGIWENCODE; ··· 4120 4115 else 4121 4116 iwe.u.data.flags = IW_ENCODE_DISABLED; 4122 4117 iwe.u.data.length = 0; 4123 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->a.essid); 4118 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 4119 + &iwe, bss->a.essid); 4124 4120 4125 4121 /* Add EXTRA: Age to display seconds since last beacon/probe response 4126 4122 * for given network. */ ··· 4132 4126 jiffies_to_msecs(jiffies - last_scanned)); 4133 4127 iwe.u.data.length = p - custom; 4134 4128 if (iwe.u.data.length) 4135 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, custom); 4129 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 4130 + &iwe, custom); 4136 4131 4137 4132 /* Bit rate is not available in Lucent/Agere firmwares */ 4138 4133 if (priv->firmware_type != FIRMWARE_TYPE_AGERE) { 4139 - char *current_val = current_ev + IW_EV_LCP_LEN; 4134 + char *current_val = current_ev + iwe_stream_lcp_len(info); 4140 4135 int i; 4141 4136 int step; 4142 4137 ··· 4156 4149 break; 4157 4150 /* Bit rate given in 500 kb/s units (+ 0x80) */ 4158 4151 iwe.u.bitrate.value = ((bss->p.rates[i] & 0x7f) * 500000); 4159 - current_val = iwe_stream_add_value(current_ev, current_val, 4152 + current_val = iwe_stream_add_value(info, current_ev, 4153 + current_val, 4160 4154 end_buf, &iwe, 4161 4155 IW_EV_PARAM_LEN); 4162 4156 } 4163 4157 /* Check if we added any event */ 4164 - if ((current_val - current_ev) > IW_EV_LCP_LEN) 4158 + if ((current_val - current_ev) > iwe_stream_lcp_len(info)) 4165 4159 current_ev = current_val; 4166 4160 } 4167 4161 ··· 4198 4190 4199 4191 list_for_each_entry(bss, &priv->bss_list, list) { 4200 4192 /* Translate to WE format this entry */ 4201 - current_ev = orinoco_translate_scan(dev, current_ev, 4193 + current_ev = orinoco_translate_scan(dev, info, current_ev, 4202 4194 extra + srq->length, 4203 4195 &bss->bss, 4204 4196 bss->last_scanned);
+27 -22
drivers/net/wireless/prism54/isl_ioctl.c
··· 571 571 */ 572 572 573 573 static char * 574 - prism54_translate_bss(struct net_device *ndev, char *current_ev, 575 - char *end_buf, struct obj_bss *bss, char noise) 574 + prism54_translate_bss(struct net_device *ndev, struct iw_request_info *info, 575 + char *current_ev, char *end_buf, struct obj_bss *bss, 576 + char noise) 576 577 { 577 578 struct iw_event iwe; /* Temporary buffer */ 578 579 short cap; ··· 585 584 memcpy(iwe.u.ap_addr.sa_data, bss->address, 6); 586 585 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 587 586 iwe.cmd = SIOCGIWAP; 588 - current_ev = 589 - iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); 587 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 588 + &iwe, IW_EV_ADDR_LEN); 590 589 591 590 /* The following entries will be displayed in the same order we give them */ 592 591 ··· 594 593 iwe.u.data.length = bss->ssid.length; 595 594 iwe.u.data.flags = 1; 596 595 iwe.cmd = SIOCGIWESSID; 597 - current_ev = iwe_stream_add_point(current_ev, end_buf, 596 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 598 597 &iwe, bss->ssid.octets); 599 598 600 599 /* Capabilities */ ··· 611 610 iwe.u.mode = IW_MODE_ADHOC; 612 611 iwe.cmd = SIOCGIWMODE; 613 612 if (iwe.u.mode) 614 - current_ev = 615 - iwe_stream_add_event(current_ev, end_buf, &iwe, 616 - IW_EV_UINT_LEN); 613 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 614 + &iwe, IW_EV_UINT_LEN); 617 615 618 616 /* Encryption capability */ 619 617 if (cap & CAP_CRYPT) ··· 621 621 iwe.u.data.flags = IW_ENCODE_DISABLED; 622 622 iwe.u.data.length = 0; 623 623 iwe.cmd = SIOCGIWENCODE; 624 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, NULL); 624 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 625 + &iwe, NULL); 625 626 626 627 /* Add frequency. (short) bss->channel is the frequency in MHz */ 627 628 iwe.u.freq.m = bss->channel; 628 629 iwe.u.freq.e = 6; 629 630 iwe.cmd = SIOCGIWFREQ; 630 - current_ev = 631 - iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); 631 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 632 + &iwe, IW_EV_FREQ_LEN); 632 633 633 634 /* Add quality statistics */ 634 635 iwe.u.qual.level = bss->rssi; ··· 637 636 /* do a simple SNR for quality */ 638 637 iwe.u.qual.qual = bss->rssi - noise; 639 638 iwe.cmd = IWEVQUAL; 640 - current_ev = 641 - iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); 639 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 640 + &iwe, IW_EV_QUAL_LEN); 642 641 643 642 /* Add WPA/RSN Information Element, if any */ 644 643 wpa_ie_len = prism54_wpa_bss_ie_get(priv, bss->address, wpa_ie); 645 644 if (wpa_ie_len > 0) { 646 645 iwe.cmd = IWEVGENIE; 647 646 iwe.u.data.length = min(wpa_ie_len, (size_t)MAX_WPA_IE_LEN); 648 - current_ev = iwe_stream_add_point(current_ev, end_buf, 649 - &iwe, wpa_ie); 647 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 648 + &iwe, wpa_ie); 650 649 } 651 650 /* Do the bitrates */ 652 651 { 653 - char * current_val = current_ev + IW_EV_LCP_LEN; 652 + char *current_val = current_ev + iwe_stream_lcp_len(info); 654 653 int i; 655 654 int mask; 656 655 ··· 663 662 for(i = 0; i < sizeof(scan_rate_list); i++) { 664 663 if(bss->rates & mask) { 665 664 iwe.u.bitrate.value = (scan_rate_list[i] * 500000); 666 - current_val = iwe_stream_add_value(current_ev, current_val, 667 - end_buf, &iwe, 668 - IW_EV_PARAM_LEN); 665 + current_val = iwe_stream_add_value( 666 + info, current_ev, current_val, 667 + end_buf, &iwe, IW_EV_PARAM_LEN); 669 668 } 670 669 mask <<= 1; 671 670 } 672 671 /* Check if we added any event */ 673 - if ((current_val - current_ev) > IW_EV_LCP_LEN) 672 + if ((current_val - current_ev) > iwe_stream_lcp_len(info)) 674 673 current_ev = current_val; 675 674 } 676 675 ··· 711 710 712 711 /* ok now, scan the list and translate its info */ 713 712 for (i = 0; i < (int) bsslist->nr; i++) { 714 - current_ev = prism54_translate_bss(ndev, current_ev, 713 + current_ev = prism54_translate_bss(ndev, info, current_ev, 715 714 extra + dwrq->length, 716 715 &(bsslist->bsslist[i]), 717 716 noise); ··· 2705 2704 struct prism2_hostapd_param *param) 2706 2705 { 2707 2706 islpci_private *priv = netdev_priv(ndev); 2707 + struct iw_request_info info; 2708 2708 int i, rvalue; 2709 2709 struct obj_bsslist *bsslist; 2710 2710 u32 noise = 0; ··· 2729 2727 rvalue |= mgt_get_request(priv, DOT11_OID_BSSLIST, 0, NULL, &r); 2730 2728 bsslist = r.ptr; 2731 2729 2730 + info.cmd = PRISM54_HOSTAPD; 2731 + info.flags = 0; 2732 + 2732 2733 /* ok now, scan the list and translate its info */ 2733 2734 for (i = 0; i < min(IW_MAX_AP, (int) bsslist->nr); i++) 2734 - current_ev = prism54_translate_bss(ndev, current_ev, 2735 + current_ev = prism54_translate_bss(ndev, &info, current_ev, 2735 2736 extra + IW_SCAN_MAX_DATA, 2736 2737 &(bsslist->bsslist[i]), 2737 2738 noise);
+17 -15
drivers/net/wireless/rndis_wlan.c
··· 1648 1648 1649 1649 1650 1650 static char *rndis_translate_scan(struct net_device *dev, 1651 - char *cev, char *end_buf, struct ndis_80211_bssid_ex *bssid) 1651 + struct iw_request_info *info, char *cev, 1652 + char *end_buf, 1653 + struct ndis_80211_bssid_ex *bssid) 1652 1654 { 1653 1655 #ifdef DEBUG 1654 1656 struct usbnet *usbdev = dev->priv; ··· 1669 1667 iwe.cmd = SIOCGIWAP; 1670 1668 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 1671 1669 memcpy(iwe.u.ap_addr.sa_data, bssid->mac, ETH_ALEN); 1672 - cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_ADDR_LEN); 1670 + cev = iwe_stream_add_event(info, cev, end_buf, &iwe, IW_EV_ADDR_LEN); 1673 1671 1674 1672 devdbg(usbdev, "SSID(%d) %s", le32_to_cpu(bssid->ssid.length), 1675 1673 bssid->ssid.essid); 1676 1674 iwe.cmd = SIOCGIWESSID; 1677 1675 iwe.u.essid.length = le32_to_cpu(bssid->ssid.length); 1678 1676 iwe.u.essid.flags = 1; 1679 - cev = iwe_stream_add_point(cev, end_buf, &iwe, bssid->ssid.essid); 1677 + cev = iwe_stream_add_point(info, cev, end_buf, &iwe, bssid->ssid.essid); 1680 1678 1681 1679 devdbg(usbdev, "MODE %d", le32_to_cpu(bssid->net_infra)); 1682 1680 iwe.cmd = SIOCGIWMODE; ··· 1692 1690 iwe.u.mode = IW_MODE_AUTO; 1693 1691 break; 1694 1692 } 1695 - cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_UINT_LEN); 1693 + cev = iwe_stream_add_event(info, cev, end_buf, &iwe, IW_EV_UINT_LEN); 1696 1694 1697 1695 devdbg(usbdev, "FREQ %d kHz", le32_to_cpu(bssid->config.ds_config)); 1698 1696 iwe.cmd = SIOCGIWFREQ; 1699 1697 dsconfig_to_freq(le32_to_cpu(bssid->config.ds_config), &iwe.u.freq); 1700 - cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_FREQ_LEN); 1698 + cev = iwe_stream_add_event(info, cev, end_buf, &iwe, IW_EV_FREQ_LEN); 1701 1699 1702 1700 devdbg(usbdev, "QUAL %d", le32_to_cpu(bssid->rssi)); 1703 1701 iwe.cmd = IWEVQUAL; ··· 1706 1704 iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED 1707 1705 | IW_QUAL_LEVEL_UPDATED 1708 1706 | IW_QUAL_NOISE_INVALID; 1709 - cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_QUAL_LEN); 1707 + cev = iwe_stream_add_event(info, cev, end_buf, &iwe, IW_EV_QUAL_LEN); 1710 1708 1711 1709 devdbg(usbdev, "ENCODE %d", le32_to_cpu(bssid->privacy)); 1712 1710 iwe.cmd = SIOCGIWENCODE; ··· 1716 1714 else 1717 1715 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; 1718 1716 1719 - cev = iwe_stream_add_point(cev, end_buf, &iwe, NULL); 1717 + cev = iwe_stream_add_point(info, cev, end_buf, &iwe, NULL); 1720 1718 1721 1719 devdbg(usbdev, "RATES:"); 1722 - current_val = cev + IW_EV_LCP_LEN; 1720 + current_val = cev + iwe_stream_lcp_len(info); 1723 1721 iwe.cmd = SIOCGIWRATE; 1724 1722 for (i = 0; i < sizeof(bssid->rates); i++) { 1725 1723 if (bssid->rates[i] & 0x7f) { ··· 1727 1725 ((bssid->rates[i] & 0x7f) * 1728 1726 500000); 1729 1727 devdbg(usbdev, " %d", iwe.u.bitrate.value); 1730 - current_val = iwe_stream_add_value(cev, 1728 + current_val = iwe_stream_add_value(info, cev, 1731 1729 current_val, end_buf, &iwe, 1732 1730 IW_EV_PARAM_LEN); 1733 1731 } 1734 1732 } 1735 1733 1736 - if ((current_val - cev) > IW_EV_LCP_LEN) 1734 + if ((current_val - cev) > iwe_stream_lcp_len(info)) 1737 1735 cev = current_val; 1738 1736 1739 1737 beacon = le32_to_cpu(bssid->config.beacon_period); ··· 1741 1739 iwe.cmd = IWEVCUSTOM; 1742 1740 snprintf(sbuf, sizeof(sbuf), "bcn_int=%d", beacon); 1743 1741 iwe.u.data.length = strlen(sbuf); 1744 - cev = iwe_stream_add_point(cev, end_buf, &iwe, sbuf); 1742 + cev = iwe_stream_add_point(info, cev, end_buf, &iwe, sbuf); 1745 1743 1746 1744 atim = le32_to_cpu(bssid->config.atim_window); 1747 1745 devdbg(usbdev, "ATIM %d", atim); 1748 1746 iwe.cmd = IWEVCUSTOM; 1749 1747 snprintf(sbuf, sizeof(sbuf), "atim=%u", atim); 1750 1748 iwe.u.data.length = strlen(sbuf); 1751 - cev = iwe_stream_add_point(cev, end_buf, &iwe, sbuf); 1749 + cev = iwe_stream_add_point(info, cev, end_buf, &iwe, sbuf); 1752 1750 1753 1751 ie = (void *)(bssid->ies + sizeof(struct ndis_80211_fixed_ies)); 1754 1752 ie_len = min(bssid_len - (int)sizeof(*bssid), ··· 1762 1760 (ie->id == MFIE_TYPE_RSN) ? 2 : 1); 1763 1761 iwe.cmd = IWEVGENIE; 1764 1762 iwe.u.data.length = min(ie->len + 2, MAX_WPA_IE_LEN); 1765 - cev = iwe_stream_add_point(cev, end_buf, &iwe, 1763 + cev = iwe_stream_add_point(info, cev, end_buf, &iwe, 1766 1764 (u8 *)ie); 1767 1765 } 1768 1766 ··· 1805 1803 devdbg(usbdev, "SIOCGIWSCAN: %d BSSIDs found", count); 1806 1804 1807 1805 while (count && ((void *)bssid + bssid_len) <= (buf + len)) { 1808 - cev = rndis_translate_scan(dev, cev, extra + IW_SCAN_MAX_DATA, 1809 - bssid); 1806 + cev = rndis_translate_scan(dev, info, cev, 1807 + extra + IW_SCAN_MAX_DATA, bssid); 1810 1808 bssid = (void *)bssid + bssid_len; 1811 1809 bssid_len = le32_to_cpu(bssid->length); 1812 1810 count--;
+5 -5
drivers/net/wireless/wl3501_cs.c
··· 1624 1624 iwe.cmd = SIOCGIWAP; 1625 1625 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 1626 1626 memcpy(iwe.u.ap_addr.sa_data, this->bss_set[i].bssid, ETH_ALEN); 1627 - current_ev = iwe_stream_add_event(current_ev, 1627 + current_ev = iwe_stream_add_event(info, current_ev, 1628 1628 extra + IW_SCAN_MAX_DATA, 1629 1629 &iwe, IW_EV_ADDR_LEN); 1630 1630 iwe.cmd = SIOCGIWESSID; 1631 1631 iwe.u.data.flags = 1; 1632 1632 iwe.u.data.length = this->bss_set[i].ssid.el.len; 1633 - current_ev = iwe_stream_add_point(current_ev, 1633 + current_ev = iwe_stream_add_point(info, current_ev, 1634 1634 extra + IW_SCAN_MAX_DATA, 1635 1635 &iwe, 1636 1636 this->bss_set[i].ssid.essid); 1637 1637 iwe.cmd = SIOCGIWMODE; 1638 1638 iwe.u.mode = this->bss_set[i].bss_type; 1639 - current_ev = iwe_stream_add_event(current_ev, 1639 + current_ev = iwe_stream_add_event(info, current_ev, 1640 1640 extra + IW_SCAN_MAX_DATA, 1641 1641 &iwe, IW_EV_UINT_LEN); 1642 1642 iwe.cmd = SIOCGIWFREQ; 1643 1643 iwe.u.freq.m = this->bss_set[i].ds_pset.chan; 1644 1644 iwe.u.freq.e = 0; 1645 - current_ev = iwe_stream_add_event(current_ev, 1645 + current_ev = iwe_stream_add_event(info, current_ev, 1646 1646 extra + IW_SCAN_MAX_DATA, 1647 1647 &iwe, IW_EV_FREQ_LEN); 1648 1648 iwe.cmd = SIOCGIWENCODE; ··· 1651 1651 else 1652 1652 iwe.u.data.flags = IW_ENCODE_DISABLED; 1653 1653 iwe.u.data.length = 0; 1654 - current_ev = iwe_stream_add_point(current_ev, 1654 + current_ev = iwe_stream_add_point(info, current_ev, 1655 1655 extra + IW_SCAN_MAX_DATA, 1656 1656 &iwe, NULL); 1657 1657 }
+13 -8
drivers/net/wireless/zd1201.c
··· 1152 1152 iwe.cmd = SIOCGIWAP; 1153 1153 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 1154 1154 memcpy(iwe.u.ap_addr.sa_data, zd->rxdata+i+6, 6); 1155 - cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_ADDR_LEN); 1155 + cev = iwe_stream_add_event(info, cev, end_buf, 1156 + &iwe, IW_EV_ADDR_LEN); 1156 1157 1157 1158 iwe.cmd = SIOCGIWESSID; 1158 1159 iwe.u.data.length = zd->rxdata[i+16]; 1159 1160 iwe.u.data.flags = 1; 1160 - cev = iwe_stream_add_point(cev, end_buf, &iwe, zd->rxdata+i+18); 1161 + cev = iwe_stream_add_point(info, cev, end_buf, 1162 + &iwe, zd->rxdata+i+18); 1161 1163 1162 1164 iwe.cmd = SIOCGIWMODE; 1163 1165 if (zd->rxdata[i+14]&0x01) 1164 1166 iwe.u.mode = IW_MODE_MASTER; 1165 1167 else 1166 1168 iwe.u.mode = IW_MODE_ADHOC; 1167 - cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_UINT_LEN); 1169 + cev = iwe_stream_add_event(info, cev, end_buf, 1170 + &iwe, IW_EV_UINT_LEN); 1168 1171 1169 1172 iwe.cmd = SIOCGIWFREQ; 1170 1173 iwe.u.freq.m = zd->rxdata[i+0]; 1171 1174 iwe.u.freq.e = 0; 1172 - cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_FREQ_LEN); 1175 + cev = iwe_stream_add_event(info, cev, end_buf, 1176 + &iwe, IW_EV_FREQ_LEN); 1173 1177 1174 1178 iwe.cmd = SIOCGIWRATE; 1175 1179 iwe.u.bitrate.fixed = 0; 1176 1180 iwe.u.bitrate.disabled = 0; 1177 1181 for (j=0; j<10; j++) if (zd->rxdata[i+50+j]) { 1178 1182 iwe.u.bitrate.value = (zd->rxdata[i+50+j]&0x7f)*500000; 1179 - cev=iwe_stream_add_event(cev, end_buf, &iwe, 1180 - IW_EV_PARAM_LEN); 1183 + cev = iwe_stream_add_event(info, cev, end_buf, 1184 + &iwe, IW_EV_PARAM_LEN); 1181 1185 } 1182 1186 1183 1187 iwe.cmd = SIOCGIWENCODE; ··· 1190 1186 iwe.u.data.flags = IW_ENCODE_ENABLED; 1191 1187 else 1192 1188 iwe.u.data.flags = IW_ENCODE_DISABLED; 1193 - cev = iwe_stream_add_point(cev, end_buf, &iwe, NULL); 1189 + cev = iwe_stream_add_point(info, cev, end_buf, &iwe, NULL); 1194 1190 1195 1191 iwe.cmd = IWEVQUAL; 1196 1192 iwe.u.qual.qual = zd->rxdata[i+4]; 1197 1193 iwe.u.qual.noise= zd->rxdata[i+2]/10-100; 1198 1194 iwe.u.qual.level = (256+zd->rxdata[i+4]*100)/255-100; 1199 1195 iwe.u.qual.updated = 7; 1200 - cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_QUAL_LEN); 1196 + cev = iwe_stream_add_event(info, cev, end_buf, 1197 + &iwe, IW_EV_QUAL_LEN); 1201 1198 } 1202 1199 1203 1200 if (!enabled_save)
+15
include/linux/wireless.h
··· 1113 1113 #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ 1114 1114 IW_EV_POINT_OFF) 1115 1115 1116 + #ifdef __KERNEL__ 1117 + #ifdef CONFIG_COMPAT 1118 + struct __compat_iw_event { 1119 + __u16 len; /* Real length of this stuff */ 1120 + __u16 cmd; /* Wireless IOCTL */ 1121 + compat_caddr_t pointer; 1122 + }; 1123 + #define IW_EV_COMPAT_LCP_LEN offsetof(struct __compat_iw_event, pointer) 1124 + #define IW_EV_COMPAT_POINT_OFF offsetof(struct compat_iw_point, length) 1125 + #define IW_EV_COMPAT_POINT_LEN \ 1126 + (IW_EV_COMPAT_LCP_LEN + sizeof(struct compat_iw_point) - \ 1127 + IW_EV_COMPAT_POINT_OFF) 1128 + #endif 1129 + #endif 1130 + 1116 1131 /* Size of the Event prefix when packed in stream */ 1117 1132 #define IW_EV_LCP_PK_LEN (4) 1118 1133 /* Size of the various events when packed in stream */
+54 -107
include/net/iw_handler.h
··· 478 478 * Function that are so simple that it's more efficient inlining them 479 479 */ 480 480 481 + static inline int iwe_stream_lcp_len(struct iw_request_info *info) 482 + { 483 + #ifdef CONFIG_COMPAT 484 + if (info->flags & IW_REQUEST_FLAG_COMPAT) 485 + return IW_EV_COMPAT_LCP_LEN; 486 + #endif 487 + return IW_EV_LCP_LEN; 488 + } 489 + 490 + static inline int iwe_stream_point_len(struct iw_request_info *info) 491 + { 492 + #ifdef CONFIG_COMPAT 493 + if (info->flags & IW_REQUEST_FLAG_COMPAT) 494 + return IW_EV_COMPAT_POINT_LEN; 495 + #endif 496 + return IW_EV_POINT_LEN; 497 + } 498 + 499 + static inline int iwe_stream_event_len_adjust(struct iw_request_info *info, 500 + int event_len) 501 + { 502 + #ifdef CONFIG_COMPAT 503 + if (info->flags & IW_REQUEST_FLAG_COMPAT) { 504 + event_len -= IW_EV_LCP_LEN; 505 + event_len += IW_EV_COMPAT_LCP_LEN; 506 + } 507 + #endif 508 + 509 + return event_len; 510 + } 511 + 481 512 /*------------------------------------------------------------------*/ 482 513 /* 483 514 * Wrapper to add an Wireless Event to a stream of events. 484 515 */ 485 516 static inline char * 486 - iwe_stream_add_event(char * stream, /* Stream of events */ 487 - char * ends, /* End of stream */ 488 - struct iw_event *iwe, /* Payload */ 489 - int event_len) /* Real size of payload */ 517 + iwe_stream_add_event(struct iw_request_info *info, char *stream, char *ends, 518 + struct iw_event *iwe, int event_len) 490 519 { 520 + int lcp_len = iwe_stream_lcp_len(info); 521 + 522 + event_len = iwe_stream_event_len_adjust(info, event_len); 523 + 491 524 /* Check if it's possible */ 492 525 if(likely((stream + event_len) < ends)) { 493 526 iwe->len = event_len; 494 527 /* Beware of alignement issues on 64 bits */ 495 528 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN); 496 - memcpy(stream + IW_EV_LCP_LEN, 497 - ((char *) iwe) + IW_EV_LCP_LEN, 498 - event_len - IW_EV_LCP_LEN); 529 + memcpy(stream + lcp_len, &iwe->u, 530 + event_len - lcp_len); 499 531 stream += event_len; 500 532 } 501 533 return stream; ··· 539 507 * stream of events. 540 508 */ 541 509 static inline char * 542 - iwe_stream_add_point(char * stream, /* Stream of events */ 543 - char * ends, /* End of stream */ 544 - struct iw_event *iwe, /* Payload length + flags */ 545 - char * extra) /* More payload */ 510 + iwe_stream_add_point(struct iw_request_info *info, char *stream, char *ends, 511 + struct iw_event *iwe, char *extra) 546 512 { 547 - int event_len = IW_EV_POINT_LEN + iwe->u.data.length; 513 + int event_len = iwe_stream_point_len(info) + iwe->u.data.length; 514 + int point_len = iwe_stream_point_len(info); 515 + int lcp_len = iwe_stream_lcp_len(info); 516 + 548 517 /* Check if it's possible */ 549 518 if(likely((stream + event_len) < ends)) { 550 519 iwe->len = event_len; 551 520 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN); 552 - memcpy(stream + IW_EV_LCP_LEN, 553 - ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 521 + memcpy(stream + lcp_len, 522 + ((char *) &iwe->u) + IW_EV_POINT_OFF, 554 523 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN); 555 - memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length); 524 + memcpy(stream + point_len, extra, iwe->u.data.length); 556 525 stream += event_len; 557 526 } 558 527 return stream; ··· 566 533 * At the first run, you need to have (value = event + IW_EV_LCP_LEN). 567 534 */ 568 535 static inline char * 569 - iwe_stream_add_value(char * event, /* Event in the stream */ 570 - char * value, /* Value in event */ 571 - char * ends, /* End of stream */ 572 - struct iw_event *iwe, /* Payload */ 573 - int event_len) /* Real size of payload */ 536 + iwe_stream_add_value(struct iw_request_info *info, char *event, char *value, 537 + char *ends, struct iw_event *iwe, int event_len) 574 538 { 539 + int lcp_len = iwe_stream_lcp_len(info); 540 + 575 541 /* Don't duplicate LCP */ 576 542 event_len -= IW_EV_LCP_LEN; 577 543 578 544 /* Check if it's possible */ 579 545 if(likely((value + event_len) < ends)) { 580 546 /* Add new value */ 581 - memcpy(value, (char *) iwe + IW_EV_LCP_LEN, event_len); 547 + memcpy(value, &iwe->u, event_len); 582 548 value += event_len; 583 549 /* Patch LCP */ 584 550 iwe->len = value - event; 585 - memcpy(event, (char *) iwe, IW_EV_LCP_LEN); 551 + memcpy(event, (char *) iwe, lcp_len); 586 552 } 587 - return value; 588 - } 589 - 590 - /*------------------------------------------------------------------*/ 591 - /* 592 - * Wrapper to add an Wireless Event to a stream of events. 593 - * Same as above, with explicit error check... 594 - */ 595 - static inline char * 596 - iwe_stream_check_add_event(char * stream, /* Stream of events */ 597 - char * ends, /* End of stream */ 598 - struct iw_event *iwe, /* Payload */ 599 - int event_len, /* Size of payload */ 600 - int * perr) /* Error report */ 601 - { 602 - /* Check if it's possible, set error if not */ 603 - if(likely((stream + event_len) < ends)) { 604 - iwe->len = event_len; 605 - /* Beware of alignement issues on 64 bits */ 606 - memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN); 607 - memcpy(stream + IW_EV_LCP_LEN, 608 - ((char *) iwe) + IW_EV_LCP_LEN, 609 - event_len - IW_EV_LCP_LEN); 610 - stream += event_len; 611 - } else 612 - *perr = -E2BIG; 613 - return stream; 614 - } 615 - 616 - /*------------------------------------------------------------------*/ 617 - /* 618 - * Wrapper to add an short Wireless Event containing a pointer to a 619 - * stream of events. 620 - * Same as above, with explicit error check... 621 - */ 622 - static inline char * 623 - iwe_stream_check_add_point(char * stream, /* Stream of events */ 624 - char * ends, /* End of stream */ 625 - struct iw_event *iwe, /* Payload length + flags */ 626 - char * extra, /* More payload */ 627 - int * perr) /* Error report */ 628 - { 629 - int event_len = IW_EV_POINT_LEN + iwe->u.data.length; 630 - /* Check if it's possible */ 631 - if(likely((stream + event_len) < ends)) { 632 - iwe->len = event_len; 633 - memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN); 634 - memcpy(stream + IW_EV_LCP_LEN, 635 - ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 636 - IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN); 637 - memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length); 638 - stream += event_len; 639 - } else 640 - *perr = -E2BIG; 641 - return stream; 642 - } 643 - 644 - /*------------------------------------------------------------------*/ 645 - /* 646 - * Wrapper to add a value to a Wireless Event in a stream of events. 647 - * Be careful, this one is tricky to use properly : 648 - * At the first run, you need to have (value = event + IW_EV_LCP_LEN). 649 - * Same as above, with explicit error check... 650 - */ 651 - static inline char * 652 - iwe_stream_check_add_value(char * event, /* Event in the stream */ 653 - char * value, /* Value in event */ 654 - char * ends, /* End of stream */ 655 - struct iw_event *iwe, /* Payload */ 656 - int event_len, /* Size of payload */ 657 - int * perr) /* Error report */ 658 - { 659 - /* Don't duplicate LCP */ 660 - event_len -= IW_EV_LCP_LEN; 661 - 662 - /* Check if it's possible */ 663 - if(likely((value + event_len) < ends)) { 664 - /* Add new value */ 665 - memcpy(value, (char *) iwe + IW_EV_LCP_LEN, event_len); 666 - value += event_len; 667 - /* Patch LCP */ 668 - iwe->len = value - event; 669 - memcpy(event, (char *) iwe, IW_EV_LCP_LEN); 670 - } else 671 - *perr = -E2BIG; 672 553 return value; 673 554 } 674 555
+28 -20
net/ieee80211/ieee80211_wx.c
··· 43 43 44 44 #define MAX_CUSTOM_LEN 64 45 45 static char *ieee80211_translate_scan(struct ieee80211_device *ieee, 46 - char *start, char *stop, 47 - struct ieee80211_network *network) 46 + char *start, char *stop, 47 + struct ieee80211_network *network, 48 + struct iw_request_info *info) 48 49 { 49 50 char custom[MAX_CUSTOM_LEN]; 50 51 char *p; ··· 58 57 iwe.cmd = SIOCGIWAP; 59 58 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 60 59 memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN); 61 - start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN); 60 + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); 62 61 63 62 /* Remaining entries will be displayed in the order we provide them */ 64 63 ··· 67 66 iwe.u.data.flags = 1; 68 67 if (network->flags & NETWORK_EMPTY_ESSID) { 69 68 iwe.u.data.length = sizeof("<hidden>"); 70 - start = iwe_stream_add_point(start, stop, &iwe, "<hidden>"); 69 + start = iwe_stream_add_point(info, start, stop, 70 + &iwe, "<hidden>"); 71 71 } else { 72 72 iwe.u.data.length = min(network->ssid_len, (u8) 32); 73 - start = iwe_stream_add_point(start, stop, &iwe, network->ssid); 73 + start = iwe_stream_add_point(info, start, stop, 74 + &iwe, network->ssid); 74 75 } 75 76 76 77 /* Add the protocol name */ 77 78 iwe.cmd = SIOCGIWNAME; 78 79 snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", 79 80 ieee80211_modes[network->mode]); 80 - start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN); 81 + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN); 81 82 82 83 /* Add mode */ 83 84 iwe.cmd = SIOCGIWMODE; ··· 89 86 else 90 87 iwe.u.mode = IW_MODE_ADHOC; 91 88 92 - start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN); 89 + start = iwe_stream_add_event(info, start, stop, 90 + &iwe, IW_EV_UINT_LEN); 93 91 } 94 92 95 93 /* Add channel and frequency */ ··· 99 95 iwe.u.freq.m = ieee80211_channel_to_freq(ieee, network->channel); 100 96 iwe.u.freq.e = 6; 101 97 iwe.u.freq.i = 0; 102 - start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN); 98 + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN); 103 99 104 100 /* Add encryption capability */ 105 101 iwe.cmd = SIOCGIWENCODE; ··· 108 104 else 109 105 iwe.u.data.flags = IW_ENCODE_DISABLED; 110 106 iwe.u.data.length = 0; 111 - start = iwe_stream_add_point(start, stop, &iwe, network->ssid); 107 + start = iwe_stream_add_point(info, start, stop, 108 + &iwe, network->ssid); 112 109 113 110 /* Add basic and extended rates */ 114 111 /* Rate : stuffing multiple values in a single event require a bit 115 112 * more of magic - Jean II */ 116 - current_val = start + IW_EV_LCP_LEN; 113 + current_val = start + iwe_stream_lcp_len(info); 117 114 iwe.cmd = SIOCGIWRATE; 118 115 /* Those two flags are ignored... */ 119 116 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; ··· 129 124 /* Bit rate given in 500 kb/s units (+ 0x80) */ 130 125 iwe.u.bitrate.value = ((rate & 0x7f) * 500000); 131 126 /* Add new value to event */ 132 - current_val = iwe_stream_add_value(start, current_val, stop, &iwe, IW_EV_PARAM_LEN); 127 + current_val = iwe_stream_add_value(info, start, current_val, 128 + stop, &iwe, IW_EV_PARAM_LEN); 133 129 } 134 130 for (; j < network->rates_ex_len; j++) { 135 131 rate = network->rates_ex[j] & 0x7F; 136 132 /* Bit rate given in 500 kb/s units (+ 0x80) */ 137 133 iwe.u.bitrate.value = ((rate & 0x7f) * 500000); 138 134 /* Add new value to event */ 139 - current_val = iwe_stream_add_value(start, current_val, stop, &iwe, IW_EV_PARAM_LEN); 135 + current_val = iwe_stream_add_value(info, start, current_val, 136 + stop, &iwe, IW_EV_PARAM_LEN); 140 137 } 141 138 /* Check if we added any rate */ 142 - if((current_val - start) > IW_EV_LCP_LEN) 139 + if ((current_val - start) > iwe_stream_lcp_len(info)) 143 140 start = current_val; 144 141 145 142 /* Add quality statistics */ ··· 188 181 iwe.u.qual.level = network->stats.signal; 189 182 } 190 183 191 - start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); 184 + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); 192 185 193 186 iwe.cmd = IWEVCUSTOM; 194 187 p = custom; 195 188 196 189 iwe.u.data.length = p - custom; 197 190 if (iwe.u.data.length) 198 - start = iwe_stream_add_point(start, stop, &iwe, custom); 191 + start = iwe_stream_add_point(info, start, stop, &iwe, custom); 199 192 200 193 memset(&iwe, 0, sizeof(iwe)); 201 194 if (network->wpa_ie_len) { ··· 203 196 memcpy(buf, network->wpa_ie, network->wpa_ie_len); 204 197 iwe.cmd = IWEVGENIE; 205 198 iwe.u.data.length = network->wpa_ie_len; 206 - start = iwe_stream_add_point(start, stop, &iwe, buf); 199 + start = iwe_stream_add_point(info, start, stop, &iwe, buf); 207 200 } 208 201 209 202 memset(&iwe, 0, sizeof(iwe)); ··· 212 205 memcpy(buf, network->rsn_ie, network->rsn_ie_len); 213 206 iwe.cmd = IWEVGENIE; 214 207 iwe.u.data.length = network->rsn_ie_len; 215 - start = iwe_stream_add_point(start, stop, &iwe, buf); 208 + start = iwe_stream_add_point(info, start, stop, &iwe, buf); 216 209 } 217 210 218 211 /* Add EXTRA: Age to display seconds since last beacon/probe response ··· 224 217 jiffies_to_msecs(jiffies - network->last_scanned)); 225 218 iwe.u.data.length = p - custom; 226 219 if (iwe.u.data.length) 227 - start = iwe_stream_add_point(start, stop, &iwe, custom); 220 + start = iwe_stream_add_point(info, start, stop, &iwe, custom); 228 221 229 222 /* Add spectrum management information */ 230 223 iwe.cmd = -1; ··· 245 238 246 239 if (iwe.cmd == IWEVCUSTOM) { 247 240 iwe.u.data.length = p - custom; 248 - start = iwe_stream_add_point(start, stop, &iwe, custom); 241 + start = iwe_stream_add_point(info, start, stop, &iwe, custom); 249 242 } 250 243 251 244 return start; ··· 279 272 280 273 if (ieee->scan_age == 0 || 281 274 time_after(network->last_scanned + ieee->scan_age, jiffies)) 282 - ev = ieee80211_translate_scan(ieee, ev, stop, network); 275 + ev = ieee80211_translate_scan(ieee, ev, stop, network, 276 + info); 283 277 else 284 278 IEEE80211_DEBUG_SCAN("Not showing network '%s (" 285 279 "%s)' due to age (%dms).\n",
+4 -1
net/mac80211/ieee80211_i.h
··· 24 24 #include <linux/spinlock.h> 25 25 #include <linux/etherdevice.h> 26 26 #include <net/wireless.h> 27 + #include <net/iw_handler.h> 27 28 #include "key.h" 28 29 #include "sta_info.h" 29 30 ··· 868 867 int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len); 869 868 void ieee80211_sta_req_auth(struct net_device *dev, 870 869 struct ieee80211_if_sta *ifsta); 871 - int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len); 870 + int ieee80211_sta_scan_results(struct net_device *dev, 871 + struct iw_request_info *info, 872 + char *buf, size_t len); 872 873 ieee80211_rx_result ieee80211_sta_rx_scan( 873 874 struct net_device *dev, struct sk_buff *skb, 874 875 struct ieee80211_rx_status *rx_status);
+38 -28
net/mac80211/mlme.c
··· 4087 4087 4088 4088 static char * 4089 4089 ieee80211_sta_scan_result(struct net_device *dev, 4090 + struct iw_request_info *info, 4090 4091 struct ieee80211_sta_bss *bss, 4091 4092 char *current_ev, char *end_buf) 4092 4093 { ··· 4102 4101 iwe.cmd = SIOCGIWAP; 4103 4102 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 4104 4103 memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN); 4105 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 4104 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, 4106 4105 IW_EV_ADDR_LEN); 4107 4106 4108 4107 memset(&iwe, 0, sizeof(iwe)); ··· 4110 4109 if (bss_mesh_cfg(bss)) { 4111 4110 iwe.u.data.length = bss_mesh_id_len(bss); 4112 4111 iwe.u.data.flags = 1; 4113 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, 4114 - bss_mesh_id(bss)); 4112 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 4113 + &iwe, bss_mesh_id(bss)); 4115 4114 } else { 4116 4115 iwe.u.data.length = bss->ssid_len; 4117 4116 iwe.u.data.flags = 1; 4118 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, 4119 - bss->ssid); 4117 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 4118 + &iwe, bss->ssid); 4120 4119 } 4121 4120 4122 4121 if (bss->capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS) ··· 4129 4128 iwe.u.mode = IW_MODE_MASTER; 4130 4129 else 4131 4130 iwe.u.mode = IW_MODE_ADHOC; 4132 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 4133 - IW_EV_UINT_LEN); 4131 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, 4132 + &iwe, IW_EV_UINT_LEN); 4134 4133 } 4135 4134 4136 4135 memset(&iwe, 0, sizeof(iwe)); 4137 4136 iwe.cmd = SIOCGIWFREQ; 4138 4137 iwe.u.freq.m = ieee80211_frequency_to_channel(bss->freq); 4139 4138 iwe.u.freq.e = 0; 4140 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 4139 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, 4141 4140 IW_EV_FREQ_LEN); 4142 4141 4143 4142 memset(&iwe, 0, sizeof(iwe)); 4144 4143 iwe.cmd = SIOCGIWFREQ; 4145 4144 iwe.u.freq.m = bss->freq; 4146 4145 iwe.u.freq.e = 6; 4147 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 4146 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, 4148 4147 IW_EV_FREQ_LEN); 4149 4148 memset(&iwe, 0, sizeof(iwe)); 4150 4149 iwe.cmd = IWEVQUAL; ··· 4152 4151 iwe.u.qual.level = bss->signal; 4153 4152 iwe.u.qual.noise = bss->noise; 4154 4153 iwe.u.qual.updated = local->wstats_flags; 4155 - current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 4154 + current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, 4156 4155 IW_EV_QUAL_LEN); 4157 4156 4158 4157 memset(&iwe, 0, sizeof(iwe)); ··· 4162 4161 else 4163 4162 iwe.u.data.flags = IW_ENCODE_DISABLED; 4164 4163 iwe.u.data.length = 0; 4165 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ""); 4164 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 4165 + &iwe, ""); 4166 4166 4167 4167 if (bss && bss->wpa_ie) { 4168 4168 memset(&iwe, 0, sizeof(iwe)); 4169 4169 iwe.cmd = IWEVGENIE; 4170 4170 iwe.u.data.length = bss->wpa_ie_len; 4171 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, 4172 - bss->wpa_ie); 4171 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 4172 + &iwe, bss->wpa_ie); 4173 4173 } 4174 4174 4175 4175 if (bss && bss->rsn_ie) { 4176 4176 memset(&iwe, 0, sizeof(iwe)); 4177 4177 iwe.cmd = IWEVGENIE; 4178 4178 iwe.u.data.length = bss->rsn_ie_len; 4179 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, 4180 - bss->rsn_ie); 4179 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 4180 + &iwe, bss->rsn_ie); 4181 4181 } 4182 4182 4183 4183 if (bss && bss->ht_ie) { 4184 4184 memset(&iwe, 0, sizeof(iwe)); 4185 4185 iwe.cmd = IWEVGENIE; 4186 4186 iwe.u.data.length = bss->ht_ie_len; 4187 - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, 4188 - bss->ht_ie); 4187 + current_ev = iwe_stream_add_point(info, current_ev, end_buf, 4188 + &iwe, bss->ht_ie); 4189 4189 } 4190 4190 4191 4191 if (bss && bss->supp_rates_len > 0) { 4192 4192 /* display all supported rates in readable format */ 4193 - char *p = current_ev + IW_EV_LCP_LEN; 4193 + char *p = current_ev + iwe_stream_lcp_len(info); 4194 4194 int i; 4195 4195 4196 4196 memset(&iwe, 0, sizeof(iwe)); ··· 4202 4200 for (i = 0; i < bss->supp_rates_len; i++) { 4203 4201 iwe.u.bitrate.value = ((bss->supp_rates[i] & 4204 4202 0x7f) * 500000); 4205 - p = iwe_stream_add_value(current_ev, p, 4203 + p = iwe_stream_add_value(info, current_ev, p, 4206 4204 end_buf, &iwe, IW_EV_PARAM_LEN); 4207 4205 } 4208 4206 current_ev = p; ··· 4216 4214 iwe.cmd = IWEVCUSTOM; 4217 4215 sprintf(buf, "tsf=%016llx", (unsigned long long)(bss->timestamp)); 4218 4216 iwe.u.data.length = strlen(buf); 4219 - current_ev = iwe_stream_add_point(current_ev, end_buf, 4217 + current_ev = iwe_stream_add_point(info, current_ev, 4218 + end_buf, 4220 4219 &iwe, buf); 4221 4220 kfree(buf); 4222 4221 } ··· 4232 4229 iwe.cmd = IWEVCUSTOM; 4233 4230 sprintf(buf, "Mesh network (version %d)", cfg[0]); 4234 4231 iwe.u.data.length = strlen(buf); 4235 - current_ev = iwe_stream_add_point(current_ev, end_buf, 4232 + current_ev = iwe_stream_add_point(info, current_ev, 4233 + end_buf, 4236 4234 &iwe, buf); 4237 4235 sprintf(buf, "Path Selection Protocol ID: " 4238 4236 "0x%02X%02X%02X%02X", cfg[1], cfg[2], cfg[3], 4239 4237 cfg[4]); 4240 4238 iwe.u.data.length = strlen(buf); 4241 - current_ev = iwe_stream_add_point(current_ev, end_buf, 4239 + current_ev = iwe_stream_add_point(info, current_ev, 4240 + end_buf, 4242 4241 &iwe, buf); 4243 4242 sprintf(buf, "Path Selection Metric ID: " 4244 4243 "0x%02X%02X%02X%02X", cfg[5], cfg[6], cfg[7], 4245 4244 cfg[8]); 4246 4245 iwe.u.data.length = strlen(buf); 4247 - current_ev = iwe_stream_add_point(current_ev, end_buf, 4246 + current_ev = iwe_stream_add_point(info, current_ev, 4247 + end_buf, 4248 4248 &iwe, buf); 4249 4249 sprintf(buf, "Congestion Control Mode ID: " 4250 4250 "0x%02X%02X%02X%02X", cfg[9], cfg[10], 4251 4251 cfg[11], cfg[12]); 4252 4252 iwe.u.data.length = strlen(buf); 4253 - current_ev = iwe_stream_add_point(current_ev, end_buf, 4253 + current_ev = iwe_stream_add_point(info, current_ev, 4254 + end_buf, 4254 4255 &iwe, buf); 4255 4256 sprintf(buf, "Channel Precedence: " 4256 4257 "0x%02X%02X%02X%02X", cfg[13], cfg[14], 4257 4258 cfg[15], cfg[16]); 4258 4259 iwe.u.data.length = strlen(buf); 4259 - current_ev = iwe_stream_add_point(current_ev, end_buf, 4260 + current_ev = iwe_stream_add_point(info, current_ev, 4261 + end_buf, 4260 4262 &iwe, buf); 4261 4263 kfree(buf); 4262 4264 } ··· 4271 4263 } 4272 4264 4273 4265 4274 - int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len) 4266 + int ieee80211_sta_scan_results(struct net_device *dev, 4267 + struct iw_request_info *info, 4268 + char *buf, size_t len) 4275 4269 { 4276 4270 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 4277 4271 char *current_ev = buf; ··· 4286 4276 spin_unlock_bh(&local->sta_bss_lock); 4287 4277 return -E2BIG; 4288 4278 } 4289 - current_ev = ieee80211_sta_scan_result(dev, bss, current_ev, 4290 - end_buf); 4279 + current_ev = ieee80211_sta_scan_result(dev, info, bss, 4280 + current_ev, end_buf); 4291 4281 } 4292 4282 spin_unlock_bh(&local->sta_bss_lock); 4293 4283 return current_ev - buf;
+1 -1
net/mac80211/wext.c
··· 567 567 if (local->sta_sw_scanning || local->sta_hw_scanning) 568 568 return -EAGAIN; 569 569 570 - res = ieee80211_sta_scan_results(dev, extra, data->length); 570 + res = ieee80211_sta_scan_results(dev, info, extra, data->length); 571 571 if (res >= 0) { 572 572 data->length = res; 573 573 return 0;