aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/scan.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-08-02 10:43:44 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:38 -0400
commit0c9ca690e0117e1bf415d5f3e392e27c0c472c68 (patch)
tree8d8fcda57684b0b124d527bace187f526caa2c6f /drivers/net/wireless/libertas/scan.c
parent6dbc9c89fb242873bd3e83890e59da3d6e462025 (diff)
[PATCH] libertas: kill ieeetypes_capinfo bitfield, use ieee80211.h types
Use standard BSS capability field constants from ieee80211.h. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/scan.c')
-rw-r--r--drivers/net/wireless/libertas/scan.c58
1 files changed, 24 insertions, 34 deletions
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index c3043dcb541e..8753f9344f3e 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -76,7 +76,7 @@ static inline int match_bss_no_security(struct wlan_802_11_security * secinfo,
76 && !secinfo->WPA2enabled 76 && !secinfo->WPA2enabled
77 && match_bss->wpa_ie[0] != WPA_IE 77 && match_bss->wpa_ie[0] != WPA_IE
78 && match_bss->rsn_ie[0] != WPA2_IE 78 && match_bss->rsn_ie[0] != WPA2_IE
79 && !match_bss->privacy) { 79 && !(match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
80 return 1; 80 return 1;
81 } 81 }
82 return 0; 82 return 0;
@@ -88,7 +88,7 @@ static inline int match_bss_static_wep(struct wlan_802_11_security * secinfo,
88 if ( secinfo->wep_enabled 88 if ( secinfo->wep_enabled
89 && !secinfo->WPAenabled 89 && !secinfo->WPAenabled
90 && !secinfo->WPA2enabled 90 && !secinfo->WPA2enabled
91 && match_bss->privacy) { 91 && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
92 return 1; 92 return 1;
93 } 93 }
94 return 0; 94 return 0;
@@ -101,7 +101,8 @@ static inline int match_bss_wpa(struct wlan_802_11_security * secinfo,
101 && secinfo->WPAenabled 101 && secinfo->WPAenabled
102 && (match_bss->wpa_ie[0] == WPA_IE) 102 && (match_bss->wpa_ie[0] == WPA_IE)
103 /* privacy bit may NOT be set in some APs like LinkSys WRT54G 103 /* privacy bit may NOT be set in some APs like LinkSys WRT54G
104 && bss->privacy */ 104 && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
105 */
105 ) { 106 ) {
106 return 1; 107 return 1;
107 } 108 }
@@ -115,7 +116,8 @@ static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo,
115 && secinfo->WPA2enabled 116 && secinfo->WPA2enabled
116 && (match_bss->rsn_ie[0] == WPA2_IE) 117 && (match_bss->rsn_ie[0] == WPA2_IE)
117 /* privacy bit may NOT be set in some APs like LinkSys WRT54G 118 /* privacy bit may NOT be set in some APs like LinkSys WRT54G
118 && bss->privacy */ 119 && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
120 */
119 ) { 121 ) {
120 return 1; 122 return 1;
121 } 123 }
@@ -130,7 +132,7 @@ static inline int match_bss_dynamic_wep(struct wlan_802_11_security * secinfo,
130 && !secinfo->WPA2enabled 132 && !secinfo->WPA2enabled
131 && (match_bss->wpa_ie[0] != WPA_IE) 133 && (match_bss->wpa_ie[0] != WPA_IE)
132 && (match_bss->rsn_ie[0] != WPA2_IE) 134 && (match_bss->rsn_ie[0] != WPA2_IE)
133 && match_bss->privacy) { 135 && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
134 return 1; 136 return 1;
135 } 137 }
136 return 0; 138 return 0;
@@ -177,7 +179,7 @@ static int is_network_compatible(wlan_adapter * adapter,
177 adapter->secinfo.wep_enabled ? "e" : "d", 179 adapter->secinfo.wep_enabled ? "e" : "d",
178 adapter->secinfo.WPAenabled ? "e" : "d", 180 adapter->secinfo.WPAenabled ? "e" : "d",
179 adapter->secinfo.WPA2enabled ? "e" : "d", 181 adapter->secinfo.WPA2enabled ? "e" : "d",
180 bss->privacy); 182 (bss->capability & WLAN_CAPABILITY_PRIVACY));
181 goto done; 183 goto done;
182 } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) { 184 } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) {
183 lbs_deb_scan( 185 lbs_deb_scan(
@@ -187,15 +189,14 @@ static int is_network_compatible(wlan_adapter * adapter,
187 adapter->secinfo.wep_enabled ? "e" : "d", 189 adapter->secinfo.wep_enabled ? "e" : "d",
188 adapter->secinfo.WPAenabled ? "e" : "d", 190 adapter->secinfo.WPAenabled ? "e" : "d",
189 adapter->secinfo.WPA2enabled ? "e" : "d", 191 adapter->secinfo.WPA2enabled ? "e" : "d",
190 bss->privacy); 192 (bss->capability & WLAN_CAPABILITY_PRIVACY));
191 goto done; 193 goto done;
192 } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) { 194 } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) {
193 lbs_deb_scan( 195 lbs_deb_scan(
194 "is_network_compatible() dynamic WEP: " 196 "is_network_compatible() dynamic WEP: "
195 "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n", 197 "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
196 bss->wpa_ie[0], 198 bss->wpa_ie[0], bss->rsn_ie[0],
197 bss->rsn_ie[0], 199 (bss->capability & WLAN_CAPABILITY_PRIVACY));
198 bss->privacy);
199 goto done; 200 goto done;
200 } 201 }
201 202
@@ -207,7 +208,7 @@ static int is_network_compatible(wlan_adapter * adapter,
207 adapter->secinfo.wep_enabled ? "e" : "d", 208 adapter->secinfo.wep_enabled ? "e" : "d",
208 adapter->secinfo.WPAenabled ? "e" : "d", 209 adapter->secinfo.WPAenabled ? "e" : "d",
209 adapter->secinfo.WPA2enabled ? "e" : "d", 210 adapter->secinfo.WPA2enabled ? "e" : "d",
210 bss->privacy); 211 (bss->capability & WLAN_CAPABILITY_PRIVACY));
211 212
212done: 213done:
213 lbs_deb_leave(LBS_DEB_SCAN); 214 lbs_deb_leave(LBS_DEB_SCAN);
@@ -904,8 +905,6 @@ static int libertas_process_bss(struct bss_descriptor * bss,
904 struct ieeetypes_dsparamset *pDS; 905 struct ieeetypes_dsparamset *pDS;
905 struct ieeetypes_cfparamset *pCF; 906 struct ieeetypes_cfparamset *pCF;
906 struct ieeetypes_ibssparamset *pibss; 907 struct ieeetypes_ibssparamset *pibss;
907 struct ieeetypes_capinfo *pcap;
908 struct WLAN_802_11_FIXED_IEs fixedie;
909 u8 *pcurrentptr; 908 u8 *pcurrentptr;
910 u8 *pRate; 909 u8 *pRate;
911 u8 elemlen; 910 u8 elemlen;
@@ -974,24 +973,28 @@ static int libertas_process_bss(struct bss_descriptor * bss,
974 bytesleftforcurrentbeacon -= 1; 973 bytesleftforcurrentbeacon -= 1;
975 974
976 /* time stamp is 8 bytes long */ 975 /* time stamp is 8 bytes long */
977 fixedie.timestamp = bss->timestamp = le64_to_cpup((void *)pcurrentptr); 976 bss->timestamp = le64_to_cpup((void *)pcurrentptr);
978 pcurrentptr += 8; 977 pcurrentptr += 8;
979 bytesleftforcurrentbeacon -= 8; 978 bytesleftforcurrentbeacon -= 8;
980 979
981 /* beacon interval is 2 bytes long */ 980 /* beacon interval is 2 bytes long */
982 fixedie.beaconinterval = bss->beaconperiod = le16_to_cpup((void *)pcurrentptr); 981 bss->beaconperiod = le16_to_cpup((void *)pcurrentptr);
983 pcurrentptr += 2; 982 pcurrentptr += 2;
984 bytesleftforcurrentbeacon -= 2; 983 bytesleftforcurrentbeacon -= 2;
985 984
986 /* capability information is 2 bytes long */ 985 /* capability information is 2 bytes long */
987 memcpy(&fixedie.capabilities, pcurrentptr, 2); 986 bss->capability = le16_to_cpup((void *)pcurrentptr);
988 lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n", 987 lbs_deb_scan("process_bss: capabilities = 0x%4X\n", bss->capability);
989 fixedie.capabilities);
990 pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities;
991 memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo));
992 pcurrentptr += 2; 988 pcurrentptr += 2;
993 bytesleftforcurrentbeacon -= 2; 989 bytesleftforcurrentbeacon -= 2;
994 990
991 if (bss->capability & WLAN_CAPABILITY_PRIVACY)
992 lbs_deb_scan("process_bss: AP WEP enabled\n");
993 if (bss->capability & WLAN_CAPABILITY_IBSS)
994 bss->mode = IW_MODE_ADHOC;
995 else
996 bss->mode = IW_MODE_INFRA;
997
995 /* rest of the current buffer are IE's */ 998 /* rest of the current buffer are IE's */
996 lbs_deb_scan("process_bss: IE length for this AP = %d\n", 999 lbs_deb_scan("process_bss: IE length for this AP = %d\n",
997 bytesleftforcurrentbeacon); 1000 bytesleftforcurrentbeacon);
@@ -999,19 +1002,6 @@ static int libertas_process_bss(struct bss_descriptor * bss,
999 lbs_dbg_hex("process_bss: IE info", (u8 *) pcurrentptr, 1002 lbs_dbg_hex("process_bss: IE info", (u8 *) pcurrentptr,
1000 bytesleftforcurrentbeacon); 1003 bytesleftforcurrentbeacon);
1001 1004
1002 if (pcap->privacy) {
1003 lbs_deb_scan("process_bss: AP WEP enabled\n");
1004 bss->privacy = wlan802_11privfilter8021xWEP;
1005 } else {
1006 bss->privacy = wlan802_11privfilteracceptall;
1007 }
1008
1009 if (pcap->ibss == 1) {
1010 bss->mode = IW_MODE_ADHOC;
1011 } else {
1012 bss->mode = IW_MODE_INFRA;
1013 }
1014
1015 /* process variable IE */ 1005 /* process variable IE */
1016 while (bytesleftforcurrentbeacon >= 2) { 1006 while (bytesleftforcurrentbeacon >= 2) {
1017 elemID = (enum ieeetypes_elementid) (*((u8 *) pcurrentptr)); 1007 elemID = (enum ieeetypes_elementid) (*((u8 *) pcurrentptr));
@@ -1550,7 +1540,7 @@ static inline char *libertas_translate_scan(wlan_private *priv,
1550 1540
1551 /* Add encryption capability */ 1541 /* Add encryption capability */
1552 iwe.cmd = SIOCGIWENCODE; 1542 iwe.cmd = SIOCGIWENCODE;
1553 if (bss->privacy) { 1543 if (bss->capability & WLAN_CAPABILITY_PRIVACY) {
1554 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; 1544 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
1555 } else { 1545 } else {
1556 iwe.u.data.flags = IW_ENCODE_DISABLED; 1546 iwe.u.data.flags = IW_ENCODE_DISABLED;