aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/scan.c')
-rw-r--r--drivers/net/wireless/libertas/scan.c203
1 files changed, 82 insertions, 121 deletions
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index e18706238951..3c0b1a2a1727 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -1,6 +1,3 @@
1/* -*- mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
2/* vi: set expandtab shiftwidth=4 tabstop=4 textwidth=78: */
3
4/** 1/**
5 * Functions implementing wlan scan IOCTL and firmware command APIs 2 * Functions implementing wlan scan IOCTL and firmware command APIs
6 * 3 *
@@ -87,118 +84,95 @@
87 * 84 *
88 * @return Index in scantable, or error code if negative 85 * @return Index in scantable, or error code if negative
89 */ 86 */
90static int is_network_compatible(wlan_adapter * adapter, int index, int mode) 87static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
91{ 88{
92 ENTER(); 89 ENTER();
93 90
94 if (adapter->scantable[index].inframode == mode) { 91 if (adapter->scantable[index].mode == mode) {
95 if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 92 if ( !adapter->secinfo.wep_enabled
96 && !adapter->secinfo.WPAenabled 93 && !adapter->secinfo.WPAenabled
97 && !adapter->secinfo.WPA2enabled 94 && !adapter->secinfo.WPA2enabled
98 && adapter->scantable[index].wpa_supplicant.wpa_ie[0] != 95 && adapter->scantable[index].wpa_ie[0] != WPA_IE
99 WPA_IE 96 && adapter->scantable[index].rsn_ie[0] != WPA2_IE
100 && adapter->scantable[index].wpa2_supplicant.wpa_ie[0] !=
101 WPA2_IE && adapter->secinfo.Encryptionmode == CIPHER_NONE
102 && !adapter->scantable[index].privacy) { 97 && !adapter->scantable[index].privacy) {
103 /* no security */ 98 /* no security */
104 LEAVE(); 99 LEAVE();
105 return index; 100 return index;
106 } else if (adapter->secinfo.WEPstatus == wlan802_11WEPenabled 101 } else if ( adapter->secinfo.wep_enabled
107 && !adapter->secinfo.WPAenabled 102 && !adapter->secinfo.WPAenabled
108 && !adapter->secinfo.WPA2enabled 103 && !adapter->secinfo.WPA2enabled
109 && adapter->scantable[index].privacy) { 104 && adapter->scantable[index].privacy) {
110 /* static WEP enabled */ 105 /* static WEP enabled */
111 LEAVE(); 106 LEAVE();
112 return index; 107 return index;
113 } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 108 } else if ( !adapter->secinfo.wep_enabled
114 && adapter->secinfo.WPAenabled 109 && adapter->secinfo.WPAenabled
115 && !adapter->secinfo.WPA2enabled 110 && !adapter->secinfo.WPA2enabled
116 && (adapter->scantable[index].wpa_supplicant. 111 && (adapter->scantable[index].wpa_ie[0] == WPA_IE)
117 wpa_ie[0]
118 == WPA_IE)
119 /* privacy bit may NOT be set in some APs like LinkSys WRT54G 112 /* privacy bit may NOT be set in some APs like LinkSys WRT54G
120 && adapter->scantable[index].privacy */ 113 && adapter->scantable[index].privacy */
121 ) { 114 ) {
122 /* WPA enabled */ 115 /* WPA enabled */
123 lbs_pr_debug(1, 116 lbs_pr_debug(1,
124 "is_network_compatible() WPA: index=%d wpa_ie=%#x " 117 "is_network_compatible() WPA: index=%d wpa_ie=%#x "
125 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " 118 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
126 "privacy=%#x\n", index, 119 "privacy=%#x\n", index,
127 adapter->scantable[index].wpa_supplicant. 120 adapter->scantable[index].wpa_ie[0],
128 wpa_ie[0], 121 adapter->scantable[index].rsn_ie[0],
129 adapter->scantable[index].wpa2_supplicant. 122 adapter->secinfo.wep_enabled ? "e" : "d",
130 wpa_ie[0], 123 adapter->secinfo.WPAenabled ? "e" : "d",
131 (adapter->secinfo.WEPstatus == 124 adapter->secinfo.WPA2enabled ? "e" : "d",
132 wlan802_11WEPenabled) ? "e" : "d",
133 (adapter->secinfo.WPAenabled) ? "e" : "d",
134 (adapter->secinfo.WPA2enabled) ? "e" : "d",
135 adapter->secinfo.Encryptionmode,
136 adapter->scantable[index].privacy); 125 adapter->scantable[index].privacy);
137 LEAVE(); 126 LEAVE();
138 return index; 127 return index;
139 } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 128 } else if ( !adapter->secinfo.wep_enabled
140 && !adapter->secinfo.WPAenabled 129 && !adapter->secinfo.WPAenabled
141 && adapter->secinfo.WPA2enabled 130 && adapter->secinfo.WPA2enabled
142 && (adapter->scantable[index].wpa2_supplicant. 131 && (adapter->scantable[index].rsn_ie[0] == WPA2_IE)
143 wpa_ie[0]
144 == WPA2_IE)
145 /* privacy bit may NOT be set in some APs like LinkSys WRT54G 132 /* privacy bit may NOT be set in some APs like LinkSys WRT54G
146 && adapter->scantable[index].privacy */ 133 && adapter->scantable[index].privacy */
147 ) { 134 ) {
148 /* WPA2 enabled */ 135 /* WPA2 enabled */
149 lbs_pr_debug(1, 136 lbs_pr_debug(1,
150 "is_network_compatible() WPA2: index=%d wpa_ie=%#x " 137 "is_network_compatible() WPA2: index=%d wpa_ie=%#x "
151 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " 138 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
152 "privacy=%#x\n", index, 139 "privacy=%#x\n", index,
153 adapter->scantable[index].wpa_supplicant. 140 adapter->scantable[index].wpa_ie[0],
154 wpa_ie[0], 141 adapter->scantable[index].rsn_ie[0],
155 adapter->scantable[index].wpa2_supplicant. 142 adapter->secinfo.wep_enabled ? "e" : "d",
156 wpa_ie[0], 143 adapter->secinfo.WPAenabled ? "e" : "d",
157 (adapter->secinfo.WEPstatus == 144 adapter->secinfo.WPA2enabled ? "e" : "d",
158 wlan802_11WEPenabled) ? "e" : "d",
159 (adapter->secinfo.WPAenabled) ? "e" : "d",
160 (adapter->secinfo.WPA2enabled) ? "e" : "d",
161 adapter->secinfo.Encryptionmode,
162 adapter->scantable[index].privacy); 145 adapter->scantable[index].privacy);
163 LEAVE(); 146 LEAVE();
164 return index; 147 return index;
165 } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 148 } else if ( !adapter->secinfo.wep_enabled
166 && !adapter->secinfo.WPAenabled 149 && !adapter->secinfo.WPAenabled
167 && !adapter->secinfo.WPA2enabled 150 && !adapter->secinfo.WPA2enabled
168 && (adapter->scantable[index].wpa_supplicant. 151 && (adapter->scantable[index].wpa_ie[0] != WPA_IE)
169 wpa_ie[0] 152 && (adapter->scantable[index].rsn_ie[0] != WPA2_IE)
170 != WPA_IE)
171 && (adapter->scantable[index].wpa2_supplicant.
172 wpa_ie[0]
173 != WPA2_IE)
174 && adapter->secinfo.Encryptionmode != CIPHER_NONE
175 && adapter->scantable[index].privacy) { 153 && adapter->scantable[index].privacy) {
176 /* dynamic WEP enabled */ 154 /* dynamic WEP enabled */
177 lbs_pr_debug(1, 155 lbs_pr_debug(1,
178 "is_network_compatible() dynamic WEP: index=%d " 156 "is_network_compatible() dynamic WEP: index=%d "
179 "wpa_ie=%#x wpa2_ie=%#x Encmode=%#x privacy=%#x\n", 157 "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
180 index, 158 index,
181 adapter->scantable[index].wpa_supplicant. 159 adapter->scantable[index].wpa_ie[0],
182 wpa_ie[0], 160 adapter->scantable[index].rsn_ie[0],
183 adapter->scantable[index].wpa2_supplicant.
184 wpa_ie[0], adapter->secinfo.Encryptionmode,
185 adapter->scantable[index].privacy); 161 adapter->scantable[index].privacy);
186 LEAVE(); 162 LEAVE();
187 return index; 163 return index;
188 } 164 }
189 165
190 /* security doesn't match */ 166 /* security doesn't match */
191 lbs_pr_debug(1, 167 lbs_pr_debug(1,
192 "is_network_compatible() FAILED: index=%d wpa_ie=%#x " 168 "is_network_compatible() FAILED: index=%d wpa_ie=%#x "
193 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x privacy=%#x\n", 169 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n",
194 index, 170 index,
195 adapter->scantable[index].wpa_supplicant.wpa_ie[0], 171 adapter->scantable[index].wpa_ie[0],
196 adapter->scantable[index].wpa2_supplicant.wpa_ie[0], 172 adapter->scantable[index].rsn_ie[0],
197 (adapter->secinfo.WEPstatus == 173 adapter->secinfo.wep_enabled ? "e" : "d",
198 wlan802_11WEPenabled) ? "e" : "d", 174 adapter->secinfo.WPAenabled ? "e" : "d",
199 (adapter->secinfo.WPAenabled) ? "e" : "d", 175 adapter->secinfo.WPA2enabled ? "e" : "d",
200 (adapter->secinfo.WPA2enabled) ? "e" : "d",
201 adapter->secinfo.Encryptionmode,
202 adapter->scantable[index].privacy); 176 adapter->scantable[index].privacy);
203 LEAVE(); 177 LEAVE();
204 return -ECONNREFUSED; 178 return -ECONNREFUSED;
@@ -924,8 +898,6 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
924 u8 founddatarateie; 898 u8 founddatarateie;
925 int bytesleftforcurrentbeacon; 899 int bytesleftforcurrentbeacon;
926 900
927 struct WPA_SUPPLICANT *pwpa_supplicant;
928 struct WPA_SUPPLICANT *pwpa2_supplicant;
929 struct IE_WPA *pIe; 901 struct IE_WPA *pIe;
930 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; 902 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 };
931 903
@@ -962,9 +934,6 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
962 934
963 bytesleftforcurrentbeacon = beaconsize; 935 bytesleftforcurrentbeacon = beaconsize;
964 936
965 pwpa_supplicant = &pBSSEntry->wpa_supplicant;
966 pwpa2_supplicant = &pBSSEntry->wpa2_supplicant;
967
968 memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN); 937 memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN);
969 lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n", 938 lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n",
970 pBSSEntry->macaddress[0], pBSSEntry->macaddress[1], 939 pBSSEntry->macaddress[0], pBSSEntry->macaddress[1],
@@ -1027,9 +996,9 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1027 } 996 }
1028 997
1029 if (pcap->ibss == 1) { 998 if (pcap->ibss == 1) {
1030 pBSSEntry->inframode = wlan802_11ibss; 999 pBSSEntry->mode = IW_MODE_ADHOC;
1031 } else { 1000 } else {
1032 pBSSEntry->inframode = wlan802_11infrastructure; 1001 pBSSEntry->mode = IW_MODE_INFRA;
1033 } 1002 }
1034 1003
1035 /* process variable IE */ 1004 /* process variable IE */
@@ -1116,7 +1085,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1116 sizeof(pcountryinfo->countrycode) 1085 sizeof(pcountryinfo->countrycode)
1117 || pcountryinfo->len > 254) { 1086 || pcountryinfo->len > 254) {
1118 lbs_pr_debug(1, "InterpretIE: 11D- Err " 1087 lbs_pr_debug(1, "InterpretIE: 11D- Err "
1119 "CountryInfo len =%d min=%d max=254\n", 1088 "CountryInfo len =%d min=%zd max=254\n",
1120 pcountryinfo->len, 1089 pcountryinfo->len,
1121 sizeof(pcountryinfo->countrycode)); 1090 sizeof(pcountryinfo->countrycode));
1122 LEAVE(); 1091 LEAVE();
@@ -1160,27 +1129,27 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1160#define IE_ID_LEN_FIELDS_BYTES 2 1129#define IE_ID_LEN_FIELDS_BYTES 2
1161 pIe = (struct IE_WPA *)pcurrentptr; 1130 pIe = (struct IE_WPA *)pcurrentptr;
1162 1131
1163 if (!memcmp(pIe->oui, oui01, sizeof(oui01))) { 1132 if (memcmp(pIe->oui, oui01, sizeof(oui01)))
1164 pwpa_supplicant->wpa_ie_len 1133 break;
1165 = min_t(size_t, elemlen + IE_ID_LEN_FIELDS_BYTES, 1134
1166 sizeof(pwpa_supplicant->wpa_ie)); 1135 pBSSEntry->wpa_ie_len = min_t(size_t,
1167 memcpy(pwpa_supplicant->wpa_ie, 1136 elemlen + IE_ID_LEN_FIELDS_BYTES,
1168 pcurrentptr, 1137 sizeof(pBSSEntry->wpa_ie));
1169 pwpa_supplicant->wpa_ie_len); 1138 memcpy(pBSSEntry->wpa_ie, pcurrentptr,
1170 lbs_dbg_hex("InterpretIE: Resp WPA_IE", 1139 pBSSEntry->wpa_ie_len);
1171 pwpa_supplicant->wpa_ie, elemlen); 1140 lbs_dbg_hex("InterpretIE: Resp WPA_IE",
1172 } 1141 pBSSEntry->wpa_ie, elemlen);
1173 break; 1142 break;
1174 case WPA2_IE: 1143 case WPA2_IE:
1175 pIe = (struct IE_WPA *)pcurrentptr; 1144 pIe = (struct IE_WPA *)pcurrentptr;
1176 pwpa2_supplicant->wpa_ie_len
1177 = min_t(size_t, elemlen + IE_ID_LEN_FIELDS_BYTES,
1178 sizeof(pwpa2_supplicant->wpa_ie));
1179 memcpy(pwpa2_supplicant->wpa_ie,
1180 pcurrentptr, pwpa2_supplicant->wpa_ie_len);
1181 1145
1146 pBSSEntry->rsn_ie_len = min_t(size_t,
1147 elemlen + IE_ID_LEN_FIELDS_BYTES,
1148 sizeof(pBSSEntry->rsn_ie));
1149 memcpy(pBSSEntry->rsn_ie, pcurrentptr,
1150 pBSSEntry->rsn_ie_len);
1182 lbs_dbg_hex("InterpretIE: Resp WPA2_IE", 1151 lbs_dbg_hex("InterpretIE: Resp WPA2_IE",
1183 pwpa2_supplicant->wpa_ie, elemlen); 1152 pBSSEntry->rsn_ie, elemlen);
1184 break; 1153 break;
1185 case TIM: 1154 case TIM:
1186 break; 1155 break;
@@ -1227,7 +1196,7 @@ int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *s
1227 * 1196 *
1228 * @return index in BSSID list, or error return code (< 0) 1197 * @return index in BSSID list, or error return code (< 0)
1229 */ 1198 */
1230int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode) 1199int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode)
1231{ 1200{
1232 int ret = -ENETUNREACH; 1201 int ret = -ENETUNREACH;
1233 int i; 1202 int i;
@@ -1247,8 +1216,8 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode)
1247 for (i = 0; ret < 0 && i < adapter->numinscantable; i++) { 1216 for (i = 0; ret < 0 && i < adapter->numinscantable; i++) {
1248 if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) { 1217 if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) {
1249 switch (mode) { 1218 switch (mode) {
1250 case wlan802_11infrastructure: 1219 case IW_MODE_INFRA:
1251 case wlan802_11ibss: 1220 case IW_MODE_ADHOC:
1252 ret = is_network_compatible(adapter, i, mode); 1221 ret = is_network_compatible(adapter, i, mode);
1253 break; 1222 break;
1254 default: 1223 default:
@@ -1272,7 +1241,7 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode)
1272 * @return index in BSSID list 1241 * @return index in BSSID list
1273 */ 1242 */
1274int libertas_find_SSID_in_list(wlan_adapter * adapter, 1243int libertas_find_SSID_in_list(wlan_adapter * adapter,
1275 struct WLAN_802_11_SSID *ssid, u8 * bssid, int mode) 1244 struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode)
1276{ 1245{
1277 int net = -ENETUNREACH; 1246 int net = -ENETUNREACH;
1278 u8 bestrssi = 0; 1247 u8 bestrssi = 0;
@@ -1287,8 +1256,8 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1287 !memcmp(adapter->scantable[i]. 1256 !memcmp(adapter->scantable[i].
1288 macaddress, bssid, ETH_ALEN))) { 1257 macaddress, bssid, ETH_ALEN))) {
1289 switch (mode) { 1258 switch (mode) {
1290 case wlan802_11infrastructure: 1259 case IW_MODE_INFRA:
1291 case wlan802_11ibss: 1260 case IW_MODE_ADHOC:
1292 j = is_network_compatible(adapter, i, mode); 1261 j = is_network_compatible(adapter, i, mode);
1293 1262
1294 if (j >= 0) { 1263 if (j >= 0) {
@@ -1311,7 +1280,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1311 } 1280 }
1312 } 1281 }
1313 break; 1282 break;
1314 case wlan802_11autounknown: 1283 case IW_MODE_AUTO:
1315 default: 1284 default:
1316 if (SCAN_RSSI(adapter->scantable[i].rssi) 1285 if (SCAN_RSSI(adapter->scantable[i].rssi)
1317 > bestrssi) { 1286 > bestrssi) {
@@ -1338,8 +1307,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1338 * 1307 *
1339 * @return index in BSSID list 1308 * @return index in BSSID list
1340 */ 1309 */
1341int libertas_find_best_SSID_in_list(wlan_adapter * adapter, 1310int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
1342 enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode)
1343{ 1311{
1344 int bestnet = -ENETUNREACH; 1312 int bestnet = -ENETUNREACH;
1345 u8 bestrssi = 0; 1313 u8 bestrssi = 0;
@@ -1351,8 +1319,8 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
1351 1319
1352 for (i = 0; i < adapter->numinscantable; i++) { 1320 for (i = 0; i < adapter->numinscantable; i++) {
1353 switch (mode) { 1321 switch (mode) {
1354 case wlan802_11infrastructure: 1322 case IW_MODE_INFRA:
1355 case wlan802_11ibss: 1323 case IW_MODE_ADHOC:
1356 if (is_network_compatible(adapter, i, mode) >= 0) { 1324 if (is_network_compatible(adapter, i, mode) >= 0) {
1357 if (SCAN_RSSI(adapter->scantable[i].rssi) > 1325 if (SCAN_RSSI(adapter->scantable[i].rssi) >
1358 bestrssi) { 1326 bestrssi) {
@@ -1363,7 +1331,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
1363 } 1331 }
1364 } 1332 }
1365 break; 1333 break;
1366 case wlan802_11autounknown: 1334 case IW_MODE_AUTO:
1367 default: 1335 default:
1368 if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) { 1336 if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) {
1369 bestrssi = 1337 bestrssi =
@@ -1388,8 +1356,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
1388 */ 1356 */
1389int libertas_find_best_network_SSID(wlan_private * priv, 1357int libertas_find_best_network_SSID(wlan_private * priv,
1390 struct WLAN_802_11_SSID *pSSID, 1358 struct WLAN_802_11_SSID *pSSID,
1391 enum WLAN_802_11_NETWORK_INFRASTRUCTURE preferred_mode, 1359 u8 preferred_mode, u8 *out_mode)
1392 enum WLAN_802_11_NETWORK_INFRASTRUCTURE *out_mode)
1393{ 1360{
1394 wlan_adapter *adapter = priv->adapter; 1361 wlan_adapter *adapter = priv->adapter;
1395 int ret = 0; 1362 int ret = 0;
@@ -1414,7 +1381,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
1414 preqbssid = &adapter->scantable[i]; 1381 preqbssid = &adapter->scantable[i];
1415 memcpy(pSSID, &preqbssid->ssid, 1382 memcpy(pSSID, &preqbssid->ssid,
1416 sizeof(struct WLAN_802_11_SSID)); 1383 sizeof(struct WLAN_802_11_SSID));
1417 *out_mode = preqbssid->inframode; 1384 *out_mode = preqbssid->mode;
1418 1385
1419 if (!pSSID->ssidlength) { 1386 if (!pSSID->ssidlength) {
1420 ret = -1; 1387 ret = -1;
@@ -1584,7 +1551,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1584 for (i = 0; i < adapter->numinscantable; i++) { 1551 for (i = 0; i < adapter->numinscantable; i++) {
1585 if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) { 1552 if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) {
1586 lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p " 1553 lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p "
1587 "MAX_SCAN_CELL_SIZE=%d\n", 1554 "MAX_SCAN_CELL_SIZE=%zd\n",
1588 i, current_ev, end_buf, MAX_SCAN_CELL_SIZE); 1555 i, current_ev, end_buf, MAX_SCAN_CELL_SIZE);
1589 break; 1556 break;
1590 } 1557 }
@@ -1632,7 +1599,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1632 1599
1633 //Add mode 1600 //Add mode
1634 iwe.cmd = SIOCGIWMODE; 1601 iwe.cmd = SIOCGIWMODE;
1635 iwe.u.mode = adapter->scantable[i].inframode + 1; 1602 iwe.u.mode = adapter->scantable[i].mode;
1636 iwe.len = IW_EV_UINT_LEN; 1603 iwe.len = IW_EV_UINT_LEN;
1637 current_ev = 1604 current_ev =
1638 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len); 1605 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
@@ -1666,7 +1633,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1666 iwe.u.qual.noise = 1633 iwe.u.qual.noise =
1667 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); 1634 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
1668 } 1635 }
1669 if ((adapter->inframode == wlan802_11ibss) && 1636 if ((adapter->mode == IW_MODE_ADHOC) &&
1670 !libertas_SSID_cmp(&adapter->curbssparams.ssid, 1637 !libertas_SSID_cmp(&adapter->curbssparams.ssid,
1671 &adapter->scantable[i].ssid) 1638 &adapter->scantable[i].ssid)
1672 && adapter->adhoccreate) { 1639 && adapter->adhoccreate) {
@@ -1731,7 +1698,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1731 end_buf, &iwe, iwe.len); 1698 end_buf, &iwe, iwe.len);
1732 1699
1733 } 1700 }
1734 if ((adapter->scantable[i].inframode == wlan802_11ibss) 1701 if ((adapter->scantable[i].mode == IW_MODE_ADHOC)
1735 && !libertas_SSID_cmp(&adapter->curbssparams.ssid, 1702 && !libertas_SSID_cmp(&adapter->curbssparams.ssid,
1736 &adapter->scantable[i].ssid) 1703 &adapter->scantable[i].ssid)
1737 && adapter->adhoccreate) { 1704 && adapter->adhoccreate) {
@@ -1745,30 +1712,24 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1745 /* Add new value to event */ 1712 /* Add new value to event */
1746 current_val = current_ev + IW_EV_LCP_LEN; 1713 current_val = current_ev + IW_EV_LCP_LEN;
1747 1714
1748 if (adapter->scantable[i].wpa2_supplicant.wpa_ie[0] == WPA2_IE) { 1715 if (adapter->scantable[i].rsn_ie[0] == WPA2_IE) {
1749 memset(&iwe, 0, sizeof(iwe)); 1716 memset(&iwe, 0, sizeof(iwe));
1750 memset(buf, 0, sizeof(buf)); 1717 memset(buf, 0, sizeof(buf));
1751 memcpy(buf, adapter->scantable[i]. 1718 memcpy(buf, adapter->scantable[i].rsn_ie,
1752 wpa2_supplicant.wpa_ie, 1719 adapter->scantable[i].rsn_ie_len);
1753 adapter->scantable[i].wpa2_supplicant.
1754 wpa_ie_len);
1755 iwe.cmd = IWEVGENIE; 1720 iwe.cmd = IWEVGENIE;
1756 iwe.u.data.length = adapter->scantable[i]. 1721 iwe.u.data.length = adapter->scantable[i].rsn_ie_len;
1757 wpa2_supplicant.wpa_ie_len;
1758 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; 1722 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
1759 current_ev = iwe_stream_add_point(current_ev, end_buf, 1723 current_ev = iwe_stream_add_point(current_ev, end_buf,
1760 &iwe, buf); 1724 &iwe, buf);
1761 } 1725 }
1762 if (adapter->scantable[i].wpa_supplicant.wpa_ie[0] == WPA_IE) { 1726 if (adapter->scantable[i].wpa_ie[0] == WPA_IE) {
1763 memset(&iwe, 0, sizeof(iwe)); 1727 memset(&iwe, 0, sizeof(iwe));
1764 memset(buf, 0, sizeof(buf)); 1728 memset(buf, 0, sizeof(buf));
1765 memcpy(buf, adapter->scantable[i]. 1729 memcpy(buf, adapter->scantable[i].wpa_ie,
1766 wpa_supplicant.wpa_ie, 1730 adapter->scantable[i].wpa_ie_len);
1767 adapter->scantable[i].wpa_supplicant.
1768 wpa_ie_len);
1769 iwe.cmd = IWEVGENIE; 1731 iwe.cmd = IWEVGENIE;
1770 iwe.u.data.length = adapter->scantable[i]. 1732 iwe.u.data.length = adapter->scantable[i].wpa_ie_len;
1771 wpa_supplicant.wpa_ie_len;
1772 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; 1733 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
1773 current_ev = iwe_stream_add_point(current_ev, end_buf, 1734 current_ev = iwe_stream_add_point(current_ev, end_buf,
1774 &iwe, buf); 1735 &iwe, buf);