aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/hostap')
-rw-r--r--drivers/net/wireless/hostap/hostap.h3
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c32
-rw-r--r--drivers/net/wireless/hostap/hostap_ioctl.c58
3 files changed, 49 insertions, 44 deletions
diff --git a/drivers/net/wireless/hostap/hostap.h b/drivers/net/wireless/hostap/hostap.h
index 547ba84dc797..3a386a636cca 100644
--- a/drivers/net/wireless/hostap/hostap.h
+++ b/drivers/net/wireless/hostap/hostap.h
@@ -67,7 +67,8 @@ void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent,
67int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], 67int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[],
68 struct iw_quality qual[], int buf_size, 68 struct iw_quality qual[], int buf_size,
69 int aplist); 69 int aplist);
70int prism2_ap_translate_scan(struct net_device *dev, char *buffer); 70int prism2_ap_translate_scan(struct net_device *dev,
71 struct iw_request_info *info, char *buffer);
71int prism2_hostapd(struct ap_data *ap, struct prism2_hostapd_param *param); 72int prism2_hostapd(struct ap_data *ap, struct prism2_hostapd_param *param);
72 73
73 74
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 0acd9589c48c..06b23df8f69b 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -2420,7 +2420,8 @@ int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[],
2420 2420
2421/* Translate our list of Access Points & Stations to a card independant 2421/* Translate our list of Access Points & Stations to a card independant
2422 * format that the Wireless Tools will understand - Jean II */ 2422 * format that the Wireless Tools will understand - Jean II */
2423int prism2_ap_translate_scan(struct net_device *dev, char *buffer) 2423int prism2_ap_translate_scan(struct net_device *dev,
2424 struct iw_request_info *info, char *buffer)
2424{ 2425{
2425 struct hostap_interface *iface; 2426 struct hostap_interface *iface;
2426 local_info_t *local; 2427 local_info_t *local;
@@ -2449,8 +2450,8 @@ int prism2_ap_translate_scan(struct net_device *dev, char *buffer)
2449 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 2450 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
2450 memcpy(iwe.u.ap_addr.sa_data, sta->addr, ETH_ALEN); 2451 memcpy(iwe.u.ap_addr.sa_data, sta->addr, ETH_ALEN);
2451 iwe.len = IW_EV_ADDR_LEN; 2452 iwe.len = IW_EV_ADDR_LEN;
2452 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 2453 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
2453 IW_EV_ADDR_LEN); 2454 &iwe, IW_EV_ADDR_LEN);
2454 2455
2455 /* Use the mode to indicate if it's a station or 2456 /* Use the mode to indicate if it's a station or
2456 * an Access Point */ 2457 * an Access Point */
@@ -2461,8 +2462,8 @@ int prism2_ap_translate_scan(struct net_device *dev, char *buffer)
2461 else 2462 else
2462 iwe.u.mode = IW_MODE_INFRA; 2463 iwe.u.mode = IW_MODE_INFRA;
2463 iwe.len = IW_EV_UINT_LEN; 2464 iwe.len = IW_EV_UINT_LEN;
2464 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 2465 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
2465 IW_EV_UINT_LEN); 2466 &iwe, IW_EV_UINT_LEN);
2466 2467
2467 /* Some quality */ 2468 /* Some quality */
2468 memset(&iwe, 0, sizeof(iwe)); 2469 memset(&iwe, 0, sizeof(iwe));
@@ -2477,8 +2478,8 @@ int prism2_ap_translate_scan(struct net_device *dev, char *buffer)
2477 iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); 2478 iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence);
2478 iwe.u.qual.updated = sta->last_rx_updated; 2479 iwe.u.qual.updated = sta->last_rx_updated;
2479 iwe.len = IW_EV_QUAL_LEN; 2480 iwe.len = IW_EV_QUAL_LEN;
2480 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 2481 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
2481 IW_EV_QUAL_LEN); 2482 &iwe, IW_EV_QUAL_LEN);
2482 2483
2483#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 2484#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
2484 if (sta->ap) { 2485 if (sta->ap) {
@@ -2486,8 +2487,8 @@ int prism2_ap_translate_scan(struct net_device *dev, char *buffer)
2486 iwe.cmd = SIOCGIWESSID; 2487 iwe.cmd = SIOCGIWESSID;
2487 iwe.u.data.length = sta->u.ap.ssid_len; 2488 iwe.u.data.length = sta->u.ap.ssid_len;
2488 iwe.u.data.flags = 1; 2489 iwe.u.data.flags = 1;
2489 current_ev = iwe_stream_add_point(current_ev, end_buf, 2490 current_ev = iwe_stream_add_point(info, current_ev,
2490 &iwe, 2491 end_buf, &iwe,
2491 sta->u.ap.ssid); 2492 sta->u.ap.ssid);
2492 2493
2493 memset(&iwe, 0, sizeof(iwe)); 2494 memset(&iwe, 0, sizeof(iwe));
@@ -2497,10 +2498,9 @@ int prism2_ap_translate_scan(struct net_device *dev, char *buffer)
2497 IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; 2498 IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
2498 else 2499 else
2499 iwe.u.data.flags = IW_ENCODE_DISABLED; 2500 iwe.u.data.flags = IW_ENCODE_DISABLED;
2500 current_ev = iwe_stream_add_point(current_ev, end_buf, 2501 current_ev = iwe_stream_add_point(info, current_ev,
2501 &iwe, 2502 end_buf, &iwe,
2502 sta->u.ap.ssid 2503 sta->u.ap.ssid);
2503 /* 0 byte memcpy */);
2504 2504
2505 if (sta->u.ap.channel > 0 && 2505 if (sta->u.ap.channel > 0 &&
2506 sta->u.ap.channel <= FREQ_COUNT) { 2506 sta->u.ap.channel <= FREQ_COUNT) {
@@ -2510,7 +2510,7 @@ int prism2_ap_translate_scan(struct net_device *dev, char *buffer)
2510 * 100000; 2510 * 100000;
2511 iwe.u.freq.e = 1; 2511 iwe.u.freq.e = 1;
2512 current_ev = iwe_stream_add_event( 2512 current_ev = iwe_stream_add_event(
2513 current_ev, end_buf, &iwe, 2513 info, current_ev, end_buf, &iwe,
2514 IW_EV_FREQ_LEN); 2514 IW_EV_FREQ_LEN);
2515 } 2515 }
2516 2516
@@ -2519,8 +2519,8 @@ int prism2_ap_translate_scan(struct net_device *dev, char *buffer)
2519 sprintf(buf, "beacon_interval=%d", 2519 sprintf(buf, "beacon_interval=%d",
2520 sta->listen_interval); 2520 sta->listen_interval);
2521 iwe.u.data.length = strlen(buf); 2521 iwe.u.data.length = strlen(buf);
2522 current_ev = iwe_stream_add_point(current_ev, end_buf, 2522 current_ev = iwe_stream_add_point(info, current_ev,
2523 &iwe, buf); 2523 end_buf, &iwe, buf);
2524 } 2524 }
2525#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2525#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
2526 2526
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 0ca0bfeb0ada..ed52d98317cd 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -1793,6 +1793,7 @@ static int prism2_ioctl_siwscan(struct net_device *dev,
1793 1793
1794#ifndef PRISM2_NO_STATION_MODES 1794#ifndef PRISM2_NO_STATION_MODES
1795static char * __prism2_translate_scan(local_info_t *local, 1795static char * __prism2_translate_scan(local_info_t *local,
1796 struct iw_request_info *info,
1796 struct hfa384x_hostscan_result *scan, 1797 struct hfa384x_hostscan_result *scan,
1797 struct hostap_bss_info *bss, 1798 struct hostap_bss_info *bss,
1798 char *current_ev, char *end_buf) 1799 char *current_ev, char *end_buf)
@@ -1823,7 +1824,7 @@ static char * __prism2_translate_scan(local_info_t *local,
1823 iwe.cmd = SIOCGIWAP; 1824 iwe.cmd = SIOCGIWAP;
1824 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 1825 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
1825 memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN); 1826 memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN);
1826 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 1827 current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
1827 IW_EV_ADDR_LEN); 1828 IW_EV_ADDR_LEN);
1828 1829
1829 /* Other entries will be displayed in the order we give them */ 1830 /* Other entries will be displayed in the order we give them */
@@ -1832,7 +1833,8 @@ static char * __prism2_translate_scan(local_info_t *local,
1832 iwe.cmd = SIOCGIWESSID; 1833 iwe.cmd = SIOCGIWESSID;
1833 iwe.u.data.length = ssid_len; 1834 iwe.u.data.length = ssid_len;
1834 iwe.u.data.flags = 1; 1835 iwe.u.data.flags = 1;
1835 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ssid); 1836 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
1837 &iwe, ssid);
1836 1838
1837 memset(&iwe, 0, sizeof(iwe)); 1839 memset(&iwe, 0, sizeof(iwe));
1838 iwe.cmd = SIOCGIWMODE; 1840 iwe.cmd = SIOCGIWMODE;
@@ -1847,8 +1849,8 @@ static char * __prism2_translate_scan(local_info_t *local,
1847 iwe.u.mode = IW_MODE_MASTER; 1849 iwe.u.mode = IW_MODE_MASTER;
1848 else 1850 else
1849 iwe.u.mode = IW_MODE_ADHOC; 1851 iwe.u.mode = IW_MODE_ADHOC;
1850 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 1852 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
1851 IW_EV_UINT_LEN); 1853 &iwe, IW_EV_UINT_LEN);
1852 } 1854 }
1853 1855
1854 memset(&iwe, 0, sizeof(iwe)); 1856 memset(&iwe, 0, sizeof(iwe));
@@ -1864,8 +1866,8 @@ static char * __prism2_translate_scan(local_info_t *local,
1864 if (chan > 0) { 1866 if (chan > 0) {
1865 iwe.u.freq.m = freq_list[chan - 1] * 100000; 1867 iwe.u.freq.m = freq_list[chan - 1] * 100000;
1866 iwe.u.freq.e = 1; 1868 iwe.u.freq.e = 1;
1867 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 1869 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
1868 IW_EV_FREQ_LEN); 1870 &iwe, IW_EV_FREQ_LEN);
1869 } 1871 }
1870 1872
1871 if (scan) { 1873 if (scan) {
@@ -1884,8 +1886,8 @@ static char * __prism2_translate_scan(local_info_t *local,
1884 | IW_QUAL_NOISE_UPDATED 1886 | IW_QUAL_NOISE_UPDATED
1885 | IW_QUAL_QUAL_INVALID 1887 | IW_QUAL_QUAL_INVALID
1886 | IW_QUAL_DBM; 1888 | IW_QUAL_DBM;
1887 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 1889 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
1888 IW_EV_QUAL_LEN); 1890 &iwe, IW_EV_QUAL_LEN);
1889 } 1891 }
1890 1892
1891 memset(&iwe, 0, sizeof(iwe)); 1893 memset(&iwe, 0, sizeof(iwe));
@@ -1895,13 +1897,13 @@ static char * __prism2_translate_scan(local_info_t *local,
1895 else 1897 else
1896 iwe.u.data.flags = IW_ENCODE_DISABLED; 1898 iwe.u.data.flags = IW_ENCODE_DISABLED;
1897 iwe.u.data.length = 0; 1899 iwe.u.data.length = 0;
1898 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ""); 1900 current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, "");
1899 1901
1900 /* TODO: add SuppRates into BSS table */ 1902 /* TODO: add SuppRates into BSS table */
1901 if (scan) { 1903 if (scan) {
1902 memset(&iwe, 0, sizeof(iwe)); 1904 memset(&iwe, 0, sizeof(iwe));
1903 iwe.cmd = SIOCGIWRATE; 1905 iwe.cmd = SIOCGIWRATE;
1904 current_val = current_ev + IW_EV_LCP_LEN; 1906 current_val = current_ev + iwe_stream_lcp_len(info);
1905 pos = scan->sup_rates; 1907 pos = scan->sup_rates;
1906 for (i = 0; i < sizeof(scan->sup_rates); i++) { 1908 for (i = 0; i < sizeof(scan->sup_rates); i++) {
1907 if (pos[i] == 0) 1909 if (pos[i] == 0)
@@ -1909,11 +1911,11 @@ static char * __prism2_translate_scan(local_info_t *local,
1909 /* Bit rate given in 500 kb/s units (+ 0x80) */ 1911 /* Bit rate given in 500 kb/s units (+ 0x80) */
1910 iwe.u.bitrate.value = ((pos[i] & 0x7f) * 500000); 1912 iwe.u.bitrate.value = ((pos[i] & 0x7f) * 500000);
1911 current_val = iwe_stream_add_value( 1913 current_val = iwe_stream_add_value(
1912 current_ev, current_val, end_buf, &iwe, 1914 info, current_ev, current_val, end_buf, &iwe,
1913 IW_EV_PARAM_LEN); 1915 IW_EV_PARAM_LEN);
1914 } 1916 }
1915 /* Check if we added any event */ 1917 /* Check if we added any event */
1916 if ((current_val - current_ev) > IW_EV_LCP_LEN) 1918 if ((current_val - current_ev) > iwe_stream_lcp_len(info))
1917 current_ev = current_val; 1919 current_ev = current_val;
1918 } 1920 }
1919 1921
@@ -1924,15 +1926,15 @@ static char * __prism2_translate_scan(local_info_t *local,
1924 iwe.cmd = IWEVCUSTOM; 1926 iwe.cmd = IWEVCUSTOM;
1925 sprintf(buf, "bcn_int=%d", le16_to_cpu(scan->beacon_interval)); 1927 sprintf(buf, "bcn_int=%d", le16_to_cpu(scan->beacon_interval));
1926 iwe.u.data.length = strlen(buf); 1928 iwe.u.data.length = strlen(buf);
1927 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, 1929 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
1928 buf); 1930 &iwe, buf);
1929 1931
1930 memset(&iwe, 0, sizeof(iwe)); 1932 memset(&iwe, 0, sizeof(iwe));
1931 iwe.cmd = IWEVCUSTOM; 1933 iwe.cmd = IWEVCUSTOM;
1932 sprintf(buf, "resp_rate=%d", le16_to_cpu(scan->rate)); 1934 sprintf(buf, "resp_rate=%d", le16_to_cpu(scan->rate));
1933 iwe.u.data.length = strlen(buf); 1935 iwe.u.data.length = strlen(buf);
1934 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, 1936 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
1935 buf); 1937 &iwe, buf);
1936 1938
1937 if (local->last_scan_type == PRISM2_HOSTSCAN && 1939 if (local->last_scan_type == PRISM2_HOSTSCAN &&
1938 (capabilities & WLAN_CAPABILITY_IBSS)) { 1940 (capabilities & WLAN_CAPABILITY_IBSS)) {
@@ -1940,8 +1942,8 @@ static char * __prism2_translate_scan(local_info_t *local,
1940 iwe.cmd = IWEVCUSTOM; 1942 iwe.cmd = IWEVCUSTOM;
1941 sprintf(buf, "atim=%d", le16_to_cpu(scan->atim)); 1943 sprintf(buf, "atim=%d", le16_to_cpu(scan->atim));
1942 iwe.u.data.length = strlen(buf); 1944 iwe.u.data.length = strlen(buf);
1943 current_ev = iwe_stream_add_point(current_ev, end_buf, 1945 current_ev = iwe_stream_add_point(info, current_ev,
1944 &iwe, buf); 1946 end_buf, &iwe, buf);
1945 } 1947 }
1946 } 1948 }
1947 kfree(buf); 1949 kfree(buf);
@@ -1950,16 +1952,16 @@ static char * __prism2_translate_scan(local_info_t *local,
1950 memset(&iwe, 0, sizeof(iwe)); 1952 memset(&iwe, 0, sizeof(iwe));
1951 iwe.cmd = IWEVGENIE; 1953 iwe.cmd = IWEVGENIE;
1952 iwe.u.data.length = bss->wpa_ie_len; 1954 iwe.u.data.length = bss->wpa_ie_len;
1953 current_ev = iwe_stream_add_point( 1955 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
1954 current_ev, end_buf, &iwe, bss->wpa_ie); 1956 &iwe, bss->wpa_ie);
1955 } 1957 }
1956 1958
1957 if (bss && bss->rsn_ie_len > 0 && bss->rsn_ie_len <= MAX_WPA_IE_LEN) { 1959 if (bss && bss->rsn_ie_len > 0 && bss->rsn_ie_len <= MAX_WPA_IE_LEN) {
1958 memset(&iwe, 0, sizeof(iwe)); 1960 memset(&iwe, 0, sizeof(iwe));
1959 iwe.cmd = IWEVGENIE; 1961 iwe.cmd = IWEVGENIE;
1960 iwe.u.data.length = bss->rsn_ie_len; 1962 iwe.u.data.length = bss->rsn_ie_len;
1961 current_ev = iwe_stream_add_point( 1963 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
1962 current_ev, end_buf, &iwe, bss->rsn_ie); 1964 &iwe, bss->rsn_ie);
1963 } 1965 }
1964 1966
1965 return current_ev; 1967 return current_ev;
@@ -1969,6 +1971,7 @@ static char * __prism2_translate_scan(local_info_t *local,
1969/* Translate scan data returned from the card to a card independant 1971/* Translate scan data returned from the card to a card independant
1970 * format that the Wireless Tools will understand - Jean II */ 1972 * format that the Wireless Tools will understand - Jean II */
1971static inline int prism2_translate_scan(local_info_t *local, 1973static inline int prism2_translate_scan(local_info_t *local,
1974 struct iw_request_info *info,
1972 char *buffer, int buflen) 1975 char *buffer, int buflen)
1973{ 1976{
1974 struct hfa384x_hostscan_result *scan; 1977 struct hfa384x_hostscan_result *scan;
@@ -1999,13 +2002,14 @@ static inline int prism2_translate_scan(local_info_t *local,
1999 if (memcmp(bss->bssid, scan->bssid, ETH_ALEN) == 0) { 2002 if (memcmp(bss->bssid, scan->bssid, ETH_ALEN) == 0) {
2000 bss->included = 1; 2003 bss->included = 1;
2001 current_ev = __prism2_translate_scan( 2004 current_ev = __prism2_translate_scan(
2002 local, scan, bss, current_ev, end_buf); 2005 local, info, scan, bss, current_ev,
2006 end_buf);
2003 found++; 2007 found++;
2004 } 2008 }
2005 } 2009 }
2006 if (!found) { 2010 if (!found) {
2007 current_ev = __prism2_translate_scan( 2011 current_ev = __prism2_translate_scan(
2008 local, scan, NULL, current_ev, end_buf); 2012 local, info, scan, NULL, current_ev, end_buf);
2009 } 2013 }
2010 /* Check if there is space for one more entry */ 2014 /* Check if there is space for one more entry */
2011 if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) { 2015 if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) {
@@ -2023,7 +2027,7 @@ static inline int prism2_translate_scan(local_info_t *local,
2023 bss = list_entry(ptr, struct hostap_bss_info, list); 2027 bss = list_entry(ptr, struct hostap_bss_info, list);
2024 if (bss->included) 2028 if (bss->included)
2025 continue; 2029 continue;
2026 current_ev = __prism2_translate_scan(local, NULL, bss, 2030 current_ev = __prism2_translate_scan(local, info, NULL, bss,
2027 current_ev, end_buf); 2031 current_ev, end_buf);
2028 /* Check if there is space for one more entry */ 2032 /* Check if there is space for one more entry */
2029 if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) { 2033 if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) {
@@ -2070,7 +2074,7 @@ static inline int prism2_ioctl_giwscan_sta(struct net_device *dev,
2070 } 2074 }
2071 local->scan_timestamp = 0; 2075 local->scan_timestamp = 0;
2072 2076
2073 res = prism2_translate_scan(local, extra, data->length); 2077 res = prism2_translate_scan(local, info, extra, data->length);
2074 2078
2075 if (res >= 0) { 2079 if (res >= 0) {
2076 data->length = res; 2080 data->length = res;
@@ -2103,7 +2107,7 @@ static int prism2_ioctl_giwscan(struct net_device *dev,
2103 * Jean II */ 2107 * Jean II */
2104 2108
2105 /* Translate to WE format */ 2109 /* Translate to WE format */
2106 res = prism2_ap_translate_scan(dev, extra); 2110 res = prism2_ap_translate_scan(dev, info, extra);
2107 if (res >= 0) { 2111 if (res >= 0) {
2108 printk(KERN_DEBUG "Scan result translation succeeded " 2112 printk(KERN_DEBUG "Scan result translation succeeded "
2109 "(length=%d)\n", res); 2113 "(length=%d)\n", res);