Lines 1209-1214
wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params)
Link Here
|
1209 |
int privacy; |
1209 |
int privacy; |
1210 |
int ret = 0; |
1210 |
int ret = 0; |
1211 |
|
1211 |
|
|
|
1212 |
/* XXX woraround for PR/264238 until a better solution can be found */ |
1213 |
const u8 *wpa_ie_save; |
1214 |
size_t wpa_ie_len_save; |
1215 |
|
1212 |
wpa_printf(MSG_DEBUG, |
1216 |
wpa_printf(MSG_DEBUG, |
1213 |
"%s: ssid '%.*s' wpa ie len %u pairwise %u group %u key mgmt %u" |
1217 |
"%s: ssid '%.*s' wpa ie len %u pairwise %u group %u key mgmt %u" |
1214 |
, __func__ |
1218 |
, __func__ |
Lines 1256-1264
wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params)
Link Here
|
1256 |
ret = -1; |
1260 |
ret = -1; |
1257 |
if (wpa_driver_bsd_set_auth_alg(drv, params->auth_alg) < 0) |
1261 |
if (wpa_driver_bsd_set_auth_alg(drv, params->auth_alg) < 0) |
1258 |
ret = -1; |
1262 |
ret = -1; |
|
|
1263 |
|
1264 |
/* XXX woraround for PR/264238 until a better solution can be found */ |
1265 |
if (params->pairwise_suite == WPA_CIPHER_NONE && |
1266 |
params->group_suite == WPA_CIPHER_NONE && |
1267 |
params->key_mgmt_suite == WPA_KEY_MGMT_NONE && |
1268 |
params->wpa_ie_len != 0) { |
1269 |
wpa_ie_save = params->wpa_ie; |
1270 |
wpa_ie_len_save = params->wpa_ie_len; |
1271 |
params->wpa_ie = NULL; |
1272 |
params->wpa_ie_len = 0; |
1273 |
} else { |
1274 |
wpa_ie_save = NULL; |
1275 |
wpa_ie_len_save = 0; |
1276 |
} |
1277 |
|
1259 |
/* XXX error handling is wrong but unclear what to do... */ |
1278 |
/* XXX error handling is wrong but unclear what to do... */ |
1260 |
if (wpa_driver_bsd_set_wpa_ie(drv, params->wpa_ie, params->wpa_ie_len) < 0) |
1279 |
if (wpa_driver_bsd_set_wpa_ie(drv, params->wpa_ie, params->wpa_ie_len) < 0) { |
1261 |
return -1; |
1280 |
ret = -1; |
|
|
1281 |
goto bsd_assoc_exit; |
1282 |
} |
1262 |
|
1283 |
|
1263 |
privacy = !(params->pairwise_suite == WPA_CIPHER_NONE && |
1284 |
privacy = !(params->pairwise_suite == WPA_CIPHER_NONE && |
1264 |
params->group_suite == WPA_CIPHER_NONE && |
1285 |
params->group_suite == WPA_CIPHER_NONE && |
Lines 1266-1285
wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params)
Link Here
|
1266 |
params->wpa_ie_len == 0); |
1287 |
params->wpa_ie_len == 0); |
1267 |
wpa_printf(MSG_DEBUG, "%s: set PRIVACY %u", __func__, privacy); |
1288 |
wpa_printf(MSG_DEBUG, "%s: set PRIVACY %u", __func__, privacy); |
1268 |
|
1289 |
|
1269 |
if (set80211param(drv, IEEE80211_IOC_PRIVACY, privacy) < 0) |
1290 |
if (set80211param(drv, IEEE80211_IOC_PRIVACY, privacy) < 0) { |
1270 |
return -1; |
1291 |
ret = -1; |
|
|
1292 |
goto bsd_assoc_exit; |
1293 |
} |
1271 |
|
1294 |
|
1272 |
if (params->wpa_ie_len && |
1295 |
if (params->wpa_ie_len && |
1273 |
set80211param(drv, IEEE80211_IOC_WPA, |
1296 |
set80211param(drv, IEEE80211_IOC_WPA, |
1274 |
params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0) |
1297 |
params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0) { |
1275 |
return -1; |
1298 |
ret = -1; |
|
|
1299 |
goto bsd_assoc_exit; |
1300 |
} |
1276 |
|
1301 |
|
1277 |
/* |
1302 |
/* |
1278 |
* NB: interface must be marked UP for association |
1303 |
* NB: interface must be marked UP for association |
1279 |
* or scanning (ap_scan=2) |
1304 |
* or scanning (ap_scan=2) |
1280 |
*/ |
1305 |
*/ |
1281 |
if (bsd_get_iface_flags(drv) < 0) |
1306 |
if (bsd_get_iface_flags(drv) < 0) { |
1282 |
return -1; |
1307 |
ret = -1; |
|
|
1308 |
goto bsd_assoc_exit; |
1309 |
} |
1283 |
|
1310 |
|
1284 |
os_memset(&mlme, 0, sizeof(mlme)); |
1311 |
os_memset(&mlme, 0, sizeof(mlme)); |
1285 |
mlme.im_op = IEEE80211_MLME_ASSOC; |
1312 |
mlme.im_op = IEEE80211_MLME_ASSOC; |
Lines 1289-1295
wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params)
Link Here
|
1289 |
if (params->bssid != NULL) |
1316 |
if (params->bssid != NULL) |
1290 |
os_memcpy(mlme.im_macaddr, params->bssid, IEEE80211_ADDR_LEN); |
1317 |
os_memcpy(mlme.im_macaddr, params->bssid, IEEE80211_ADDR_LEN); |
1291 |
if (set80211var(drv, IEEE80211_IOC_MLME, &mlme, sizeof(mlme)) < 0) |
1318 |
if (set80211var(drv, IEEE80211_IOC_MLME, &mlme, sizeof(mlme)) < 0) |
1292 |
return -1; |
1319 |
ret = -1; |
|
|
1320 |
bsd_assoc_exit: |
1321 |
params->wpa_ie = wpa_ie_save; |
1322 |
params->wpa_ie_len = wpa_ie_len_save; |
1293 |
return ret; |
1323 |
return ret; |
1294 |
} |
1324 |
} |
1295 |
|
1325 |
|