View | Details | Raw Unified | Return to bug 264238 | Differences between
and this patch

Collapse All | Expand All

(-)b/contrib/wpa/src/drivers/driver_bsd.c (-16 / +26 lines)
Lines 14-19 Link Here
14
#include "driver.h"
14
#include "driver.h"
15
#include "eloop.h"
15
#include "eloop.h"
16
#include "common/ieee802_11_defs.h"
16
#include "common/ieee802_11_defs.h"
17
#include "common/ieee802_11_common.h"
17
#include "common/wpa_common.h"
18
#include "common/wpa_common.h"
18
19
19
#include <ifaddrs.h>
20
#include <ifaddrs.h>
Lines 1208-1213 wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params) Link Here
1208
	u32 mode;
1209
	u32 mode;
1209
	int privacy;
1210
	int privacy;
1210
	int ret = 0;
1211
	int ret = 0;
1212
	const u8 *wpa_ie;
1213
	size_t wpa_ie_len;
1211
1214
1212
	wpa_printf(MSG_DEBUG,
1215
	wpa_printf(MSG_DEBUG,
1213
		"%s: ssid '%.*s' wpa ie len %u pairwise %u group %u key mgmt %u"
1216
		"%s: ssid '%.*s' wpa ie len %u pairwise %u group %u key mgmt %u"
Lines 1256-1278 wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params) Link Here
1256
		ret = -1;
1259
		ret = -1;
1257
	if (wpa_driver_bsd_set_auth_alg(drv, params->auth_alg) < 0)
1260
	if (wpa_driver_bsd_set_auth_alg(drv, params->auth_alg) < 0)
1258
		ret = -1;
1261
		ret = -1;
1259
	/* 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)
1261
		return -1;
1262
1263
	privacy = !(params->pairwise_suite == WPA_CIPHER_NONE &&
1264
	    params->group_suite == WPA_CIPHER_NONE &&
1265
	    params->key_mgmt_suite == WPA_KEY_MGMT_NONE &&
1266
	    params->wpa_ie_len == 0);
1267
	wpa_printf(MSG_DEBUG, "%s: set PRIVACY %u", __func__, privacy);
1268
1269
	if (set80211param(drv, IEEE80211_IOC_PRIVACY, privacy) < 0)
1270
		return -1;
1271
1262
1272
	if (params->wpa_ie_len &&
1263
	if (params->wpa_ie_len) {
1273
	    set80211param(drv, IEEE80211_IOC_WPA,
1264
		wpa_ie = get_ie(params->wpa_ie, params->wpa_ie_len, WLAN_EID_RSN);
1274
			  params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0)
1265
		if (wpa_ie) {
1275
		return -1;
1266
			wpa_ie_len = wpa_ie[1] ? wpa_ie[1] + 2 : 0;
1267
			/* XXX error handling is wrong but unclear what to do... */
1268
			if (wpa_driver_bsd_set_wpa_ie(drv, wpa_ie, wpa_ie_len) < 0)
1269
				return -1;
1270
1271
			privacy = !(params->pairwise_suite == WPA_CIPHER_NONE &&
1272
			    params->group_suite == WPA_CIPHER_NONE &&
1273
			    params->key_mgmt_suite == WPA_KEY_MGMT_NONE);
1274
			wpa_printf(MSG_DEBUG, "%s: set PRIVACY %u", __func__,
1275
			    privacy);
1276
1277
			if (set80211param(drv, IEEE80211_IOC_PRIVACY, privacy) < 0)
1278
				return -1;
1279
1280
			if (wpa_ie_len &&
1281
			    set80211param(drv, IEEE80211_IOC_WPA,
1282
			    wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0)
1283
				return -1;
1284
		}
1285
	}
1276
1286
1277
	/*
1287
	/*
1278
	 * NB: interface must be marked UP for association
1288
	 * NB: interface must be marked UP for association

Return to bug 264238