diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-07-21 05:02:45 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-07-21 05:02:45 -0400 |
| commit | e27772b48df91a954a74b1411b57d83b945a58c7 (patch) | |
| tree | ebd4a434d9e3cbd0844109e4469f91daac581b59 /drivers/net/wireless/hostap/hostap_ioctl.c | |
| parent | d092633bff3b19faffc480fe9810805e7792a029 (diff) | |
| parent | 14b395e35d1afdd8019d11b92e28041fad591b71 (diff) | |
Merge branch 'linus' into x86/urgent
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_ioctl.c')
| -rw-r--r-- | drivers/net/wireless/hostap/hostap_ioctl.c | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 0ca0bfeb0ada..3f8b1d7036e5 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
| @@ -897,6 +897,8 @@ static void hostap_monitor_set_type(local_info_t *local) | |||
| 897 | if (local->monitor_type == PRISM2_MONITOR_PRISM || | 897 | if (local->monitor_type == PRISM2_MONITOR_PRISM || |
| 898 | local->monitor_type == PRISM2_MONITOR_CAPHDR) { | 898 | local->monitor_type == PRISM2_MONITOR_CAPHDR) { |
| 899 | dev->type = ARPHRD_IEEE80211_PRISM; | 899 | dev->type = ARPHRD_IEEE80211_PRISM; |
| 900 | } else if (local->monitor_type == PRISM2_MONITOR_RADIOTAP) { | ||
| 901 | dev->type = ARPHRD_IEEE80211_RADIOTAP; | ||
| 900 | } else { | 902 | } else { |
| 901 | dev->type = ARPHRD_IEEE80211; | 903 | dev->type = ARPHRD_IEEE80211; |
| 902 | } | 904 | } |
| @@ -1793,6 +1795,7 @@ static int prism2_ioctl_siwscan(struct net_device *dev, | |||
| 1793 | 1795 | ||
| 1794 | #ifndef PRISM2_NO_STATION_MODES | 1796 | #ifndef PRISM2_NO_STATION_MODES |
| 1795 | static char * __prism2_translate_scan(local_info_t *local, | 1797 | static char * __prism2_translate_scan(local_info_t *local, |
| 1798 | struct iw_request_info *info, | ||
| 1796 | struct hfa384x_hostscan_result *scan, | 1799 | struct hfa384x_hostscan_result *scan, |
| 1797 | struct hostap_bss_info *bss, | 1800 | struct hostap_bss_info *bss, |
| 1798 | char *current_ev, char *end_buf) | 1801 | char *current_ev, char *end_buf) |
| @@ -1823,7 +1826,7 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1823 | iwe.cmd = SIOCGIWAP; | 1826 | iwe.cmd = SIOCGIWAP; |
| 1824 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | 1827 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; |
| 1825 | memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN); | 1828 | memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN); |
| 1826 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1829 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, |
| 1827 | IW_EV_ADDR_LEN); | 1830 | IW_EV_ADDR_LEN); |
| 1828 | 1831 | ||
| 1829 | /* Other entries will be displayed in the order we give them */ | 1832 | /* Other entries will be displayed in the order we give them */ |
| @@ -1832,7 +1835,8 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1832 | iwe.cmd = SIOCGIWESSID; | 1835 | iwe.cmd = SIOCGIWESSID; |
| 1833 | iwe.u.data.length = ssid_len; | 1836 | iwe.u.data.length = ssid_len; |
| 1834 | iwe.u.data.flags = 1; | 1837 | iwe.u.data.flags = 1; |
| 1835 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ssid); | 1838 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
| 1839 | &iwe, ssid); | ||
| 1836 | 1840 | ||
| 1837 | memset(&iwe, 0, sizeof(iwe)); | 1841 | memset(&iwe, 0, sizeof(iwe)); |
| 1838 | iwe.cmd = SIOCGIWMODE; | 1842 | iwe.cmd = SIOCGIWMODE; |
| @@ -1847,8 +1851,8 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1847 | iwe.u.mode = IW_MODE_MASTER; | 1851 | iwe.u.mode = IW_MODE_MASTER; |
| 1848 | else | 1852 | else |
| 1849 | iwe.u.mode = IW_MODE_ADHOC; | 1853 | iwe.u.mode = IW_MODE_ADHOC; |
| 1850 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1854 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
| 1851 | IW_EV_UINT_LEN); | 1855 | &iwe, IW_EV_UINT_LEN); |
| 1852 | } | 1856 | } |
| 1853 | 1857 | ||
| 1854 | memset(&iwe, 0, sizeof(iwe)); | 1858 | memset(&iwe, 0, sizeof(iwe)); |
| @@ -1864,8 +1868,8 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1864 | if (chan > 0) { | 1868 | if (chan > 0) { |
| 1865 | iwe.u.freq.m = freq_list[chan - 1] * 100000; | 1869 | iwe.u.freq.m = freq_list[chan - 1] * 100000; |
| 1866 | iwe.u.freq.e = 1; | 1870 | iwe.u.freq.e = 1; |
| 1867 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1871 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
| 1868 | IW_EV_FREQ_LEN); | 1872 | &iwe, IW_EV_FREQ_LEN); |
| 1869 | } | 1873 | } |
| 1870 | 1874 | ||
| 1871 | if (scan) { | 1875 | if (scan) { |
| @@ -1884,8 +1888,8 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1884 | | IW_QUAL_NOISE_UPDATED | 1888 | | IW_QUAL_NOISE_UPDATED |
| 1885 | | IW_QUAL_QUAL_INVALID | 1889 | | IW_QUAL_QUAL_INVALID |
| 1886 | | IW_QUAL_DBM; | 1890 | | IW_QUAL_DBM; |
| 1887 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1891 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
| 1888 | IW_EV_QUAL_LEN); | 1892 | &iwe, IW_EV_QUAL_LEN); |
| 1889 | } | 1893 | } |
| 1890 | 1894 | ||
| 1891 | memset(&iwe, 0, sizeof(iwe)); | 1895 | memset(&iwe, 0, sizeof(iwe)); |
| @@ -1895,13 +1899,13 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1895 | else | 1899 | else |
| 1896 | iwe.u.data.flags = IW_ENCODE_DISABLED; | 1900 | iwe.u.data.flags = IW_ENCODE_DISABLED; |
| 1897 | iwe.u.data.length = 0; | 1901 | iwe.u.data.length = 0; |
| 1898 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ""); | 1902 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, ""); |
| 1899 | 1903 | ||
| 1900 | /* TODO: add SuppRates into BSS table */ | 1904 | /* TODO: add SuppRates into BSS table */ |
| 1901 | if (scan) { | 1905 | if (scan) { |
| 1902 | memset(&iwe, 0, sizeof(iwe)); | 1906 | memset(&iwe, 0, sizeof(iwe)); |
| 1903 | iwe.cmd = SIOCGIWRATE; | 1907 | iwe.cmd = SIOCGIWRATE; |
| 1904 | current_val = current_ev + IW_EV_LCP_LEN; | 1908 | current_val = current_ev + iwe_stream_lcp_len(info); |
| 1905 | pos = scan->sup_rates; | 1909 | pos = scan->sup_rates; |
| 1906 | for (i = 0; i < sizeof(scan->sup_rates); i++) { | 1910 | for (i = 0; i < sizeof(scan->sup_rates); i++) { |
| 1907 | if (pos[i] == 0) | 1911 | if (pos[i] == 0) |
| @@ -1909,11 +1913,11 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1909 | /* Bit rate given in 500 kb/s units (+ 0x80) */ | 1913 | /* Bit rate given in 500 kb/s units (+ 0x80) */ |
| 1910 | iwe.u.bitrate.value = ((pos[i] & 0x7f) * 500000); | 1914 | iwe.u.bitrate.value = ((pos[i] & 0x7f) * 500000); |
| 1911 | current_val = iwe_stream_add_value( | 1915 | current_val = iwe_stream_add_value( |
| 1912 | current_ev, current_val, end_buf, &iwe, | 1916 | info, current_ev, current_val, end_buf, &iwe, |
| 1913 | IW_EV_PARAM_LEN); | 1917 | IW_EV_PARAM_LEN); |
| 1914 | } | 1918 | } |
| 1915 | /* Check if we added any event */ | 1919 | /* Check if we added any event */ |
| 1916 | if ((current_val - current_ev) > IW_EV_LCP_LEN) | 1920 | if ((current_val - current_ev) > iwe_stream_lcp_len(info)) |
| 1917 | current_ev = current_val; | 1921 | current_ev = current_val; |
| 1918 | } | 1922 | } |
| 1919 | 1923 | ||
| @@ -1924,15 +1928,15 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1924 | iwe.cmd = IWEVCUSTOM; | 1928 | iwe.cmd = IWEVCUSTOM; |
| 1925 | sprintf(buf, "bcn_int=%d", le16_to_cpu(scan->beacon_interval)); | 1929 | sprintf(buf, "bcn_int=%d", le16_to_cpu(scan->beacon_interval)); |
| 1926 | iwe.u.data.length = strlen(buf); | 1930 | iwe.u.data.length = strlen(buf); |
| 1927 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, | 1931 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
| 1928 | buf); | 1932 | &iwe, buf); |
| 1929 | 1933 | ||
| 1930 | memset(&iwe, 0, sizeof(iwe)); | 1934 | memset(&iwe, 0, sizeof(iwe)); |
| 1931 | iwe.cmd = IWEVCUSTOM; | 1935 | iwe.cmd = IWEVCUSTOM; |
| 1932 | sprintf(buf, "resp_rate=%d", le16_to_cpu(scan->rate)); | 1936 | sprintf(buf, "resp_rate=%d", le16_to_cpu(scan->rate)); |
| 1933 | iwe.u.data.length = strlen(buf); | 1937 | iwe.u.data.length = strlen(buf); |
| 1934 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, | 1938 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
| 1935 | buf); | 1939 | &iwe, buf); |
| 1936 | 1940 | ||
| 1937 | if (local->last_scan_type == PRISM2_HOSTSCAN && | 1941 | if (local->last_scan_type == PRISM2_HOSTSCAN && |
| 1938 | (capabilities & WLAN_CAPABILITY_IBSS)) { | 1942 | (capabilities & WLAN_CAPABILITY_IBSS)) { |
| @@ -1940,8 +1944,8 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1940 | iwe.cmd = IWEVCUSTOM; | 1944 | iwe.cmd = IWEVCUSTOM; |
| 1941 | sprintf(buf, "atim=%d", le16_to_cpu(scan->atim)); | 1945 | sprintf(buf, "atim=%d", le16_to_cpu(scan->atim)); |
| 1942 | iwe.u.data.length = strlen(buf); | 1946 | iwe.u.data.length = strlen(buf); |
| 1943 | current_ev = iwe_stream_add_point(current_ev, end_buf, | 1947 | current_ev = iwe_stream_add_point(info, current_ev, |
| 1944 | &iwe, buf); | 1948 | end_buf, &iwe, buf); |
| 1945 | } | 1949 | } |
| 1946 | } | 1950 | } |
| 1947 | kfree(buf); | 1951 | kfree(buf); |
| @@ -1950,16 +1954,16 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1950 | memset(&iwe, 0, sizeof(iwe)); | 1954 | memset(&iwe, 0, sizeof(iwe)); |
| 1951 | iwe.cmd = IWEVGENIE; | 1955 | iwe.cmd = IWEVGENIE; |
| 1952 | iwe.u.data.length = bss->wpa_ie_len; | 1956 | iwe.u.data.length = bss->wpa_ie_len; |
| 1953 | current_ev = iwe_stream_add_point( | 1957 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
| 1954 | current_ev, end_buf, &iwe, bss->wpa_ie); | 1958 | &iwe, bss->wpa_ie); |
| 1955 | } | 1959 | } |
| 1956 | 1960 | ||
| 1957 | if (bss && bss->rsn_ie_len > 0 && bss->rsn_ie_len <= MAX_WPA_IE_LEN) { | 1961 | if (bss && bss->rsn_ie_len > 0 && bss->rsn_ie_len <= MAX_WPA_IE_LEN) { |
| 1958 | memset(&iwe, 0, sizeof(iwe)); | 1962 | memset(&iwe, 0, sizeof(iwe)); |
| 1959 | iwe.cmd = IWEVGENIE; | 1963 | iwe.cmd = IWEVGENIE; |
| 1960 | iwe.u.data.length = bss->rsn_ie_len; | 1964 | iwe.u.data.length = bss->rsn_ie_len; |
| 1961 | current_ev = iwe_stream_add_point( | 1965 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
| 1962 | current_ev, end_buf, &iwe, bss->rsn_ie); | 1966 | &iwe, bss->rsn_ie); |
| 1963 | } | 1967 | } |
| 1964 | 1968 | ||
| 1965 | return current_ev; | 1969 | return current_ev; |
| @@ -1969,6 +1973,7 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
| 1969 | /* Translate scan data returned from the card to a card independant | 1973 | /* Translate scan data returned from the card to a card independant |
| 1970 | * format that the Wireless Tools will understand - Jean II */ | 1974 | * format that the Wireless Tools will understand - Jean II */ |
| 1971 | static inline int prism2_translate_scan(local_info_t *local, | 1975 | static inline int prism2_translate_scan(local_info_t *local, |
| 1976 | struct iw_request_info *info, | ||
| 1972 | char *buffer, int buflen) | 1977 | char *buffer, int buflen) |
| 1973 | { | 1978 | { |
| 1974 | struct hfa384x_hostscan_result *scan; | 1979 | struct hfa384x_hostscan_result *scan; |
| @@ -1999,13 +2004,14 @@ static inline int prism2_translate_scan(local_info_t *local, | |||
| 1999 | if (memcmp(bss->bssid, scan->bssid, ETH_ALEN) == 0) { | 2004 | if (memcmp(bss->bssid, scan->bssid, ETH_ALEN) == 0) { |
| 2000 | bss->included = 1; | 2005 | bss->included = 1; |
| 2001 | current_ev = __prism2_translate_scan( | 2006 | current_ev = __prism2_translate_scan( |
| 2002 | local, scan, bss, current_ev, end_buf); | 2007 | local, info, scan, bss, current_ev, |
| 2008 | end_buf); | ||
| 2003 | found++; | 2009 | found++; |
| 2004 | } | 2010 | } |
| 2005 | } | 2011 | } |
| 2006 | if (!found) { | 2012 | if (!found) { |
| 2007 | current_ev = __prism2_translate_scan( | 2013 | current_ev = __prism2_translate_scan( |
| 2008 | local, scan, NULL, current_ev, end_buf); | 2014 | local, info, scan, NULL, current_ev, end_buf); |
| 2009 | } | 2015 | } |
| 2010 | /* Check if there is space for one more entry */ | 2016 | /* Check if there is space for one more entry */ |
| 2011 | if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) { | 2017 | if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) { |
| @@ -2023,7 +2029,7 @@ static inline int prism2_translate_scan(local_info_t *local, | |||
| 2023 | bss = list_entry(ptr, struct hostap_bss_info, list); | 2029 | bss = list_entry(ptr, struct hostap_bss_info, list); |
| 2024 | if (bss->included) | 2030 | if (bss->included) |
| 2025 | continue; | 2031 | continue; |
| 2026 | current_ev = __prism2_translate_scan(local, NULL, bss, | 2032 | current_ev = __prism2_translate_scan(local, info, NULL, bss, |
| 2027 | current_ev, end_buf); | 2033 | current_ev, end_buf); |
| 2028 | /* Check if there is space for one more entry */ | 2034 | /* Check if there is space for one more entry */ |
| 2029 | if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) { | 2035 | if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) { |
| @@ -2070,7 +2076,7 @@ static inline int prism2_ioctl_giwscan_sta(struct net_device *dev, | |||
| 2070 | } | 2076 | } |
| 2071 | local->scan_timestamp = 0; | 2077 | local->scan_timestamp = 0; |
| 2072 | 2078 | ||
| 2073 | res = prism2_translate_scan(local, extra, data->length); | 2079 | res = prism2_translate_scan(local, info, extra, data->length); |
| 2074 | 2080 | ||
| 2075 | if (res >= 0) { | 2081 | if (res >= 0) { |
| 2076 | data->length = res; | 2082 | data->length = res; |
| @@ -2103,7 +2109,7 @@ static int prism2_ioctl_giwscan(struct net_device *dev, | |||
| 2103 | * Jean II */ | 2109 | * Jean II */ |
| 2104 | 2110 | ||
| 2105 | /* Translate to WE format */ | 2111 | /* Translate to WE format */ |
| 2106 | res = prism2_ap_translate_scan(dev, extra); | 2112 | res = prism2_ap_translate_scan(dev, info, extra); |
| 2107 | if (res >= 0) { | 2113 | if (res >= 0) { |
| 2108 | printk(KERN_DEBUG "Scan result translation succeeded " | 2114 | printk(KERN_DEBUG "Scan result translation succeeded " |
| 2109 | "(length=%d)\n", res); | 2115 | "(length=%d)\n", res); |
| @@ -2516,7 +2522,8 @@ static int prism2_ioctl_priv_prism2_param(struct net_device *dev, | |||
| 2516 | case PRISM2_PARAM_MONITOR_TYPE: | 2522 | case PRISM2_PARAM_MONITOR_TYPE: |
| 2517 | if (value != PRISM2_MONITOR_80211 && | 2523 | if (value != PRISM2_MONITOR_80211 && |
| 2518 | value != PRISM2_MONITOR_CAPHDR && | 2524 | value != PRISM2_MONITOR_CAPHDR && |
| 2519 | value != PRISM2_MONITOR_PRISM) { | 2525 | value != PRISM2_MONITOR_PRISM && |
| 2526 | value != PRISM2_MONITOR_RADIOTAP) { | ||
| 2520 | ret = -EINVAL; | 2527 | ret = -EINVAL; |
| 2521 | break; | 2528 | break; |
| 2522 | } | 2529 | } |
