diff options
Diffstat (limited to 'net/ieee80211/ieee80211_wx.c')
-rw-r--r-- | net/ieee80211/ieee80211_wx.c | 152 |
1 files changed, 128 insertions, 24 deletions
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index f87c6b89f845..af7f9bbfd18a 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
@@ -149,9 +149,7 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
149 | iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID | | 149 | iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID | |
150 | IW_QUAL_LEVEL_INVALID; | 150 | IW_QUAL_LEVEL_INVALID; |
151 | iwe.u.qual.qual = 0; | 151 | iwe.u.qual.qual = 0; |
152 | iwe.u.qual.level = 0; | ||
153 | } else { | 152 | } else { |
154 | iwe.u.qual.level = network->stats.rssi; | ||
155 | if (ieee->perfect_rssi == ieee->worst_rssi) | 153 | if (ieee->perfect_rssi == ieee->worst_rssi) |
156 | iwe.u.qual.qual = 100; | 154 | iwe.u.qual.qual = 100; |
157 | else | 155 | else |
@@ -179,6 +177,13 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
179 | iwe.u.qual.noise = network->stats.noise; | 177 | iwe.u.qual.noise = network->stats.noise; |
180 | } | 178 | } |
181 | 179 | ||
180 | if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) { | ||
181 | iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID; | ||
182 | iwe.u.qual.level = 0; | ||
183 | } else { | ||
184 | iwe.u.qual.level = network->stats.signal; | ||
185 | } | ||
186 | |||
182 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); | 187 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); |
183 | 188 | ||
184 | iwe.cmd = IWEVCUSTOM; | 189 | iwe.cmd = IWEVCUSTOM; |
@@ -188,33 +193,21 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
188 | if (iwe.u.data.length) | 193 | if (iwe.u.data.length) |
189 | start = iwe_stream_add_point(start, stop, &iwe, custom); | 194 | start = iwe_stream_add_point(start, stop, &iwe, custom); |
190 | 195 | ||
196 | memset(&iwe, 0, sizeof(iwe)); | ||
191 | if (network->wpa_ie_len) { | 197 | if (network->wpa_ie_len) { |
192 | char buf[MAX_WPA_IE_LEN * 2 + 30]; | 198 | char buf[MAX_WPA_IE_LEN]; |
193 | 199 | memcpy(buf, network->wpa_ie, network->wpa_ie_len); | |
194 | u8 *p = buf; | 200 | iwe.cmd = IWEVGENIE; |
195 | p += sprintf(p, "wpa_ie="); | 201 | iwe.u.data.length = network->wpa_ie_len; |
196 | for (i = 0; i < network->wpa_ie_len; i++) { | ||
197 | p += sprintf(p, "%02x", network->wpa_ie[i]); | ||
198 | } | ||
199 | |||
200 | memset(&iwe, 0, sizeof(iwe)); | ||
201 | iwe.cmd = IWEVCUSTOM; | ||
202 | iwe.u.data.length = strlen(buf); | ||
203 | start = iwe_stream_add_point(start, stop, &iwe, buf); | 202 | start = iwe_stream_add_point(start, stop, &iwe, buf); |
204 | } | 203 | } |
205 | 204 | ||
205 | memset(&iwe, 0, sizeof(iwe)); | ||
206 | if (network->rsn_ie_len) { | 206 | if (network->rsn_ie_len) { |
207 | char buf[MAX_WPA_IE_LEN * 2 + 30]; | 207 | char buf[MAX_WPA_IE_LEN]; |
208 | 208 | memcpy(buf, network->rsn_ie, network->rsn_ie_len); | |
209 | u8 *p = buf; | 209 | iwe.cmd = IWEVGENIE; |
210 | p += sprintf(p, "rsn_ie="); | 210 | iwe.u.data.length = network->rsn_ie_len; |
211 | for (i = 0; i < network->rsn_ie_len; i++) { | ||
212 | p += sprintf(p, "%02x", network->rsn_ie[i]); | ||
213 | } | ||
214 | |||
215 | memset(&iwe, 0, sizeof(iwe)); | ||
216 | iwe.cmd = IWEVCUSTOM; | ||
217 | iwe.u.data.length = strlen(buf); | ||
218 | start = iwe_stream_add_point(start, stop, &iwe, buf); | 211 | start = iwe_stream_add_point(start, stop, &iwe, buf); |
219 | } | 212 | } |
220 | 213 | ||
@@ -229,6 +222,28 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
229 | if (iwe.u.data.length) | 222 | if (iwe.u.data.length) |
230 | start = iwe_stream_add_point(start, stop, &iwe, custom); | 223 | start = iwe_stream_add_point(start, stop, &iwe, custom); |
231 | 224 | ||
225 | /* Add spectrum management information */ | ||
226 | iwe.cmd = -1; | ||
227 | p = custom; | ||
228 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Channel flags: "); | ||
229 | |||
230 | if (ieee80211_get_channel_flags(ieee, network->channel) & | ||
231 | IEEE80211_CH_INVALID) { | ||
232 | iwe.cmd = IWEVCUSTOM; | ||
233 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "INVALID "); | ||
234 | } | ||
235 | |||
236 | if (ieee80211_get_channel_flags(ieee, network->channel) & | ||
237 | IEEE80211_CH_RADAR_DETECT) { | ||
238 | iwe.cmd = IWEVCUSTOM; | ||
239 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "DFS "); | ||
240 | } | ||
241 | |||
242 | if (iwe.cmd == IWEVCUSTOM) { | ||
243 | iwe.u.data.length = p - custom; | ||
244 | start = iwe_stream_add_point(start, stop, &iwe, custom); | ||
245 | } | ||
246 | |||
232 | return start; | 247 | return start; |
233 | } | 248 | } |
234 | 249 | ||
@@ -734,9 +749,98 @@ int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, | |||
734 | return 0; | 749 | return 0; |
735 | } | 750 | } |
736 | 751 | ||
752 | int ieee80211_wx_set_auth(struct net_device *dev, | ||
753 | struct iw_request_info *info, | ||
754 | union iwreq_data *wrqu, | ||
755 | char *extra) | ||
756 | { | ||
757 | struct ieee80211_device *ieee = netdev_priv(dev); | ||
758 | unsigned long flags; | ||
759 | int err = 0; | ||
760 | |||
761 | spin_lock_irqsave(&ieee->lock, flags); | ||
762 | |||
763 | switch (wrqu->param.flags & IW_AUTH_INDEX) { | ||
764 | case IW_AUTH_WPA_VERSION: | ||
765 | case IW_AUTH_CIPHER_PAIRWISE: | ||
766 | case IW_AUTH_CIPHER_GROUP: | ||
767 | case IW_AUTH_KEY_MGMT: | ||
768 | /* | ||
769 | * Host AP driver does not use these parameters and allows | ||
770 | * wpa_supplicant to control them internally. | ||
771 | */ | ||
772 | break; | ||
773 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
774 | break; /* FIXME */ | ||
775 | case IW_AUTH_DROP_UNENCRYPTED: | ||
776 | ieee->drop_unencrypted = !!wrqu->param.value; | ||
777 | break; | ||
778 | case IW_AUTH_80211_AUTH_ALG: | ||
779 | break; /* FIXME */ | ||
780 | case IW_AUTH_WPA_ENABLED: | ||
781 | ieee->privacy_invoked = ieee->wpa_enabled = !!wrqu->param.value; | ||
782 | break; | ||
783 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
784 | ieee->ieee802_1x = !!wrqu->param.value; | ||
785 | break; | ||
786 | case IW_AUTH_PRIVACY_INVOKED: | ||
787 | ieee->privacy_invoked = !!wrqu->param.value; | ||
788 | break; | ||
789 | default: | ||
790 | err = -EOPNOTSUPP; | ||
791 | break; | ||
792 | } | ||
793 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
794 | return err; | ||
795 | } | ||
796 | |||
797 | int ieee80211_wx_get_auth(struct net_device *dev, | ||
798 | struct iw_request_info *info, | ||
799 | union iwreq_data *wrqu, | ||
800 | char *extra) | ||
801 | { | ||
802 | struct ieee80211_device *ieee = netdev_priv(dev); | ||
803 | unsigned long flags; | ||
804 | int err = 0; | ||
805 | |||
806 | spin_lock_irqsave(&ieee->lock, flags); | ||
807 | |||
808 | switch (wrqu->param.flags & IW_AUTH_INDEX) { | ||
809 | case IW_AUTH_WPA_VERSION: | ||
810 | case IW_AUTH_CIPHER_PAIRWISE: | ||
811 | case IW_AUTH_CIPHER_GROUP: | ||
812 | case IW_AUTH_KEY_MGMT: | ||
813 | case IW_AUTH_TKIP_COUNTERMEASURES: /* FIXME */ | ||
814 | case IW_AUTH_80211_AUTH_ALG: /* FIXME */ | ||
815 | /* | ||
816 | * Host AP driver does not use these parameters and allows | ||
817 | * wpa_supplicant to control them internally. | ||
818 | */ | ||
819 | err = -EOPNOTSUPP; | ||
820 | break; | ||
821 | case IW_AUTH_DROP_UNENCRYPTED: | ||
822 | wrqu->param.value = ieee->drop_unencrypted; | ||
823 | break; | ||
824 | case IW_AUTH_WPA_ENABLED: | ||
825 | wrqu->param.value = ieee->wpa_enabled; | ||
826 | break; | ||
827 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
828 | wrqu->param.value = ieee->ieee802_1x; | ||
829 | break; | ||
830 | default: | ||
831 | err = -EOPNOTSUPP; | ||
832 | break; | ||
833 | } | ||
834 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
835 | return err; | ||
836 | } | ||
837 | |||
737 | EXPORT_SYMBOL(ieee80211_wx_set_encodeext); | 838 | EXPORT_SYMBOL(ieee80211_wx_set_encodeext); |
738 | EXPORT_SYMBOL(ieee80211_wx_get_encodeext); | 839 | EXPORT_SYMBOL(ieee80211_wx_get_encodeext); |
739 | 840 | ||
740 | EXPORT_SYMBOL(ieee80211_wx_get_scan); | 841 | EXPORT_SYMBOL(ieee80211_wx_get_scan); |
741 | EXPORT_SYMBOL(ieee80211_wx_set_encode); | 842 | EXPORT_SYMBOL(ieee80211_wx_set_encode); |
742 | EXPORT_SYMBOL(ieee80211_wx_get_encode); | 843 | EXPORT_SYMBOL(ieee80211_wx_get_encode); |
844 | |||
845 | EXPORT_SYMBOL_GPL(ieee80211_wx_set_auth); | ||
846 | EXPORT_SYMBOL_GPL(ieee80211_wx_get_auth); | ||