您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ wpa_supplicant_set_state函数代码示例

51自学网 2021-06-03 10:02:20
  C++
这篇教程C++ wpa_supplicant_set_state函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中wpa_supplicant_set_state函数的典型用法代码示例。如果您正苦于以下问题:C++ wpa_supplicant_set_state函数的具体用法?C++ wpa_supplicant_set_state怎么用?C++ wpa_supplicant_set_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了wpa_supplicant_set_state函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: eapol_test_eapol_done_cb

static void eapol_test_eapol_done_cb(void *ctx){	struct eapol_test_data *e = ctx;	printf("WPA: EAPOL processing complete/n");	wpa_supplicant_cancel_auth_timeout(e->wpa_s);	wpa_supplicant_set_state(e->wpa_s, WPA_COMPLETED);}
开发者ID:2asoft,项目名称:freebsd,代码行数:8,


示例2: wpa_supplicant_eapol_cb

static void wpa_supplicant_eapol_cb(struct eapol_sm *eapol, int success,				    void *ctx){	struct wpa_supplicant *wpa_s = ctx;	int res, pmk_len;	u8 pmk[PMK_LEN];	wpa_printf(MSG_DEBUG, "EAPOL authentication completed %ssuccessfully",		   success ? "" : "un");	if (wpas_wps_eapol_cb(wpa_s) > 0)		return;	if (!success) {		/*		 * Make sure we do not get stuck here waiting for long EAPOL		 * timeout if the AP does not disconnect in case of		 * authentication failure.		 */		wpa_supplicant_req_auth_timeout(wpa_s, 2, 0);	}	if (!success || !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE))		return;	if (!wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt))		return;	wpa_printf(MSG_DEBUG, "Configure PMK for driver-based RSN 4-way "		   "handshake");	pmk_len = PMK_LEN;	res = eapol_sm_get_key(eapol, pmk, PMK_LEN);	if (res) {		/*		 * EAP-LEAP is an exception from other EAP methods: it		 * uses only 16-byte PMK.		 */		res = eapol_sm_get_key(eapol, pmk, 16);		pmk_len = 16;	}	if (res) {		wpa_printf(MSG_DEBUG, "Failed to get PMK from EAPOL state "			   "machines");		return;	}	if (wpa_drv_set_key(wpa_s, WPA_ALG_PMK, NULL, 0, 0, NULL, 0, pmk,			    pmk_len)) {		wpa_printf(MSG_DEBUG, "Failed to set PMK to the driver");	}	wpa_supplicant_cancel_scan(wpa_s);	wpa_supplicant_cancel_auth_timeout(wpa_s);	wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);}
开发者ID:springware,项目名称:92u10,代码行数:58,


示例3: sme_associate

void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,		   const u8 *bssid, u16 auth_type){	struct wpa_driver_associate_params params;	struct ieee802_11_elems elems;	os_memset(&params, 0, sizeof(params));	params.bssid = bssid;	params.ssid = wpa_s->sme.ssid;	params.ssid_len = wpa_s->sme.ssid_len;	params.freq = wpa_s->sme.freq;	params.wpa_ie = wpa_s->sme.assoc_req_ie_len ?		wpa_s->sme.assoc_req_ie : NULL;	params.wpa_ie_len = wpa_s->sme.assoc_req_ie_len;#ifdef CONFIG_IEEE80211R	if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies) {		params.wpa_ie = wpa_s->sme.ft_ies;		params.wpa_ie_len = wpa_s->sme.ft_ies_len;	}#endif /* CONFIG_IEEE80211R */	params.mode = mode;	params.mgmt_frame_protection = wpa_s->sme.mfp;	if (wpa_s->sme.prev_bssid_set)		params.prev_bssid = wpa_s->sme.prev_bssid;	wpa_msg(wpa_s, MSG_INFO, "Trying to associate with " MACSTR		" (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid),		params.ssid ? wpa_ssid_txt(params.ssid, params.ssid_len) : "",		params.freq);	wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATING);	if (params.wpa_ie == NULL ||	    ieee802_11_parse_elems(params.wpa_ie, params.wpa_ie_len, &elems, 0)	    < 0) {		wpa_printf(MSG_DEBUG, "SME: Could not parse own IEs?!");		os_memset(&elems, 0, sizeof(elems));	}	if (elems.rsn_ie)		wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.rsn_ie - 2,					elems.rsn_ie_len + 2);	else if (elems.wpa_ie)		wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.wpa_ie - 2,					elems.wpa_ie_len + 2);	else		wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);	if (wpa_drv_associate(wpa_s, &params) < 0) {		wpa_msg(wpa_s, MSG_INFO, "Association request to the driver "			"failed");		//wpa_supplicant_req_scan(wpa_s, 5, 0);                ros_assoc_failed(wpa_s, bssid, "Driver request to associate failed");		return;	}	/* TODO: add timeout on association */}
开发者ID:PR2,项目名称:linux_networking,代码行数:57,


示例4: wpas_ap_configured_cb

static void wpas_ap_configured_cb(void *ctx){	struct wpa_supplicant *wpa_s = ctx;	wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);	if (wpa_s->ap_configured_cb)		wpa_s->ap_configured_cb(wpa_s->ap_configured_cb_ctx,					wpa_s->ap_configured_cb_data);}
开发者ID:priyaanna,项目名称:wpa_supplicant_8,代码行数:10,


示例5: wpa_supplicant_mark_disassoc

void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s){	wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);	os_memset(wpa_s->bssid, 0, ETH_ALEN);	os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);	eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);	eapol_sm_notify_portValid(wpa_s->eapol, FALSE);	if (wpa_s->key_mgmt == WPA_KEY_MGMT_PSK)		eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);}
开发者ID:AxelLin,项目名称:Drv,代码行数:10,


示例6: wpa_supplicant_mark_disassoc

void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s){	wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);	os_memset(wpa_s->bssid, 0, ETH_ALEN);	os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);	eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);	eapol_sm_notify_portValid(wpa_s->eapol, FALSE);	if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt))		eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);	wpa_s->ap_ies_from_associnfo = 0;}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:11,


示例7: wapi_supplicant_key_negotiation_state_report

voidwapi_supplicant_key_negotiation_state_report(enum wpa_states state){    struct wpa_supplicant *wpa_s = g_wpa_s;    if (wpa_s != NULL) {        wpa_supplicant_set_state(wpa_s, state);        if (state == WPA_COMPLETED) {            wpa_supplicant_cancel_auth_timeout(wpa_s);        }    }}
开发者ID:pocketbook,项目名称:801,代码行数:12,


示例8: sme_event_assoc_reject

void sme_event_assoc_reject(struct wpa_supplicant *wpa_s,			    union wpa_event_data *data){	int bssid_changed;	int timeout = 5000;	wpa_printf(MSG_DEBUG, "SME: Association with " MACSTR " failed: "		   "status code %d", MAC2STR(wpa_s->pending_bssid),		   data->assoc_reject.status_code);	bssid_changed = !is_zero_ether_addr(wpa_s->bssid);	/*	 * For now, unconditionally terminate the previous authentication. In	 * theory, this should not be needed, but mac80211 gets quite confused	 * if the authentication is left pending.. Some roaming cases might	 * benefit from using the previous authentication, so this could be	 * optimized in the future.	 */	if (wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid,				   WLAN_REASON_DEAUTH_LEAVING) < 0) {		wpa_msg(wpa_s, MSG_INFO,			"Deauth request to the driver failed");	}	wpa_s->sme.prev_bssid_set = 0;	if (wpa_blacklist_add(wpa_s, wpa_s->pending_bssid) == 0) {		struct wpa_blacklist *b;		b = wpa_blacklist_get(wpa_s, wpa_s->pending_bssid);		if (b && b->count < 3) {			/*			 * Speed up next attempt if there could be other APs			 * that could accept association.			 */			timeout = 100;		}	}	wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);	os_memset(wpa_s->bssid, 0, ETH_ALEN);	os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);	if (bssid_changed)		wpas_notify_bssid_changed(wpa_s);	/*	 * TODO: if more than one possible AP is available in scan results,	 * could try the other ones before requesting a new scan.	 */        ros_assoc_failed(wpa_s, wpa_s->pending_bssid, "Association rejected");	//wpa_supplicant_req_scan(wpa_s, timeout / 1000,	//			1000 * (timeout % 1000));}
开发者ID:PR2,项目名称:linux_networking,代码行数:51,


示例9: wpa_supplicant_req_new_scan

static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s,					int timeout_sec, int timeout_usec){	if (!wpa_supplicant_enabled_networks(wpa_s->conf)) {		/*		 * No networks are enabled; short-circuit request so		 * we don't wait timeout seconds before transitioning		 * to INACTIVE state.		 */		wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);		return;	}	wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec);}
开发者ID:Keepenjoying,项目名称:lw_hostap,代码行数:14,


示例10: wpas_ap_configured_cb

static void wpas_ap_configured_cb(void *ctx){	struct wpa_supplicant *wpa_s = ctx;#ifdef CONFIG_ACS	if (wpa_s->current_ssid && wpa_s->current_ssid->acs)		wpa_s->assoc_freq = wpa_s->ap_iface->freq;#endif /* CONFIG_ACS */	wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);	if (wpa_s->ap_configured_cb)		wpa_s->ap_configured_cb(wpa_s->ap_configured_cb_ctx,					wpa_s->ap_configured_cb_data);}
开发者ID:cococorp,项目名称:hostap-upstream,代码行数:15,


示例11: wpa_supplicant_mark_disassoc

void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s){#if ICS_LEGACY_WLAN_SUPPORT	if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)		return;#endif	wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);	wpa_s->conf->ap_scan = DEFAULT_AP_SCAN;	os_memset(wpa_s->bssid, 0, ETH_ALEN);	os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);	eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);	eapol_sm_notify_portValid(wpa_s->eapol, FALSE);	if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt))		eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);	wpa_s->ap_ies_from_associnfo = 0;}
开发者ID:AwaisKing,项目名称:mt6577_aosp_source,代码行数:16,


示例12: wpa_supplicant_mark_disassoc

void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s){	int bssid_changed;	wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);	bssid_changed = !is_zero_ether_addr(wpa_s->bssid);	os_memset(wpa_s->bssid, 0, ETH_ALEN);	os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);	wpa_s->current_bss = NULL;	if (bssid_changed)		wpas_notify_bssid_changed(wpa_s);	eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);	eapol_sm_notify_portValid(wpa_s->eapol, FALSE);	if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt))		eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);	wpa_s->ap_ies_from_associnfo = 0;}
开发者ID:cjenkin2,项目名称:wpasupplicant-0.7.3,代码行数:18,


示例13: sme_disassoc_while_authenticating

void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s,				       const u8 *prev_pending_bssid){	/*	 * mac80211-workaround to force deauth on failed auth cmd,	 * requires us to remain in authenticating state to allow the	 * second authentication attempt to be continued properly.	 */	wpa_dbg(wpa_s, MSG_DEBUG, "SME: Allow pending authentication "		"to proceed after disconnection event");	wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING);	os_memcpy(wpa_s->pending_bssid, prev_pending_bssid, ETH_ALEN);	/*	 * Re-arm authentication timer in case auth fails for whatever reason.	 */	eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL);	eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s,			       NULL);}
开发者ID:apc-io,项目名称:Vixen-external_wpa_supplicant_8_eagle,代码行数:20,


示例14: sme_deauth

static void sme_deauth(struct wpa_supplicant *wpa_s){	int bssid_changed;	bssid_changed = !is_zero_ether_addr(wpa_s->bssid);	if (wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid,				   WLAN_REASON_DEAUTH_LEAVING) < 0) {		wpa_msg(wpa_s, MSG_INFO, "SME: Deauth request to the driver "			"failed");	}	wpa_s->sme.prev_bssid_set = 0;	wpas_connection_failed(wpa_s, wpa_s->pending_bssid);	wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);	os_memset(wpa_s->bssid, 0, ETH_ALEN);	os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);	if (bssid_changed)		wpas_notify_bssid_changed(wpa_s);}
开发者ID:apc-io,项目名称:Vixen-external_wpa_supplicant_8_eagle,代码行数:20,


示例15: wpas_ap_configured_cb

static void wpas_ap_configured_cb(void *ctx){	struct wpa_supplicant *wpa_s = ctx;	size_t i;	wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);#if defined(CONFIG_AP) && defined(CONFIG_DRIVER_AR6003)        if((wpa_s->current_ssid->frequency <= 0) && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)) {            for(i =0; i < 10; i++){                if(wpa_s->current_ssid->frequency > 0)                   break;                wpa_s->current_ssid->frequency = wpa_drv_get_freq(wpa_s);                os_sleep(1, 0);            }         }#endif	if (wpa_s->ap_configured_cb)		wpa_s->ap_configured_cb(wpa_s->ap_configured_cb_ctx,					wpa_s->ap_configured_cb_data);}
开发者ID:pocketbook,项目名称:801,代码行数:21,


示例16: sme_disassoc_while_authenticating

void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s,				       const u8 *prev_pending_bssid){	/*	* Android to provide a "Scanning always available" since in Android 4.3	* to have a backround scan for Google's location service and other apps	* scan for networks even Wi-Fi is off. It is default enabled that when	* user switch Wi-Fi radio on/off quickly and Wi-Fi wouldn't reconnet	* back to remembered AP due to rejection from sme_authenticate() which	* would check if connect_work existed or not. If it is disabled,	* no such issue since  wpa_supplicant would be killed and restart when	* Wi-Fi enabled.	* wpa_supplicant_mark_disassoc() would set to WPA_DISCONNECTED before	* being here.	*/	if (wpa_s->connect_work && wpa_s->wpa_state == WPA_DISCONNECTED) {		wpa_dbg(wpa_s, MSG_DEBUG, "SME: reset "			"connect_work when disconnection");		wpas_connect_work_done(wpa_s);	}	/*	 * mac80211-workaround to force deauth on failed auth cmd,	 * requires us to remain in authenticating state to allow the	 * second authentication attempt to be continued properly.	 */	wpa_dbg(wpa_s, MSG_DEBUG, "SME: Allow pending authentication "		"to proceed after disconnection event");	wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING);	os_memcpy(wpa_s->pending_bssid, prev_pending_bssid, ETH_ALEN);	/*	 * Re-arm authentication timer in case auth fails for whatever reason.	 */	eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL);	eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s,			       NULL);}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_wpa_supplicant_8,代码行数:38,


示例17: mesh_rsn_auth_sae_sta

/* initiate new SAE authentication with sta */int mesh_rsn_auth_sae_sta(struct wpa_supplicant *wpa_s,			  struct sta_info *sta){	struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];	struct wpa_ssid *ssid = wpa_s->current_ssid;	unsigned int rnd;	int ret;	if (!ssid) {		wpa_msg(wpa_s, MSG_DEBUG,			"AUTH: No current_ssid known to initiate new SAE");		return -1;	}	if (!sta->sae) {		sta->sae = os_zalloc(sizeof(*sta->sae));		if (sta->sae == NULL)			return -1;	}	if (mesh_rsn_build_sae_commit(wpa_s, ssid, sta))		return -1;	wpa_msg(wpa_s, MSG_DEBUG,		"AUTH: started authentication with SAE peer: " MACSTR,		MAC2STR(sta->addr));	wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING);	ret = auth_sae_init_committed(hapd, sta);	if (ret)		return ret;	eloop_cancel_timeout(mesh_auth_timer, wpa_s, sta);	rnd = rand() % MESH_AUTH_TIMEOUT;	eloop_register_timeout(MESH_AUTH_TIMEOUT + rnd, 0, mesh_auth_timer,			       wpa_s, sta);	return 0;}
开发者ID:2asoft,项目名称:freebsd,代码行数:39,


示例18: wpa_supplicant_event_scan_results

static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s){	int prio, timeout;	struct wpa_scan_res *selected = NULL;	struct wpa_ssid *ssid = NULL;	wpa_supplicant_notify_scanning(wpa_s, 0);	if (wpa_supplicant_get_scan_results(wpa_s) < 0) {		if (wpa_s->conf->ap_scan == 2)			return;		wpa_printf(MSG_DEBUG, "Failed to get scan results - try "			   "scanning again");		timeout = 1;		goto req_scan;	}	/*	 * Don't post the results if this was the initial cached	 * and there were no results.	 */	if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1 &&	    wpa_s->scan_res->num == 0) {		wpa_msg(wpa_s, MSG_DEBUG, "Cached scan results are "			"empty - not posting");	} else {		wpa_printf(MSG_DEBUG, "New scan results available");		wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);		wpa_supplicant_dbus_notify_scan_results(wpa_s);		wpas_wps_notify_scan_results(wpa_s);	}	if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s)))		return;	if (wpa_s->disconnected) {		wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);		return;	}	while (selected == NULL) {		for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {			selected = wpa_supplicant_select_bss(				wpa_s, wpa_s->conf->pssid[prio], &ssid);			if (selected)				break;		}		if (selected == NULL && wpa_s->blacklist) {			wpa_printf(MSG_DEBUG, "No APs found - clear blacklist "				   "and try again");			wpa_blacklist_clear(wpa_s);			wpa_s->blacklist_cleared++;		} else if (selected == NULL) {			break;		}	}	if (selected) {		if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) {			wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP				"PBC session overlap");			timeout = 10;			goto req_scan;		}		/* Do not trigger new association unless the BSSID has changed		 * or if reassociation is requested. If we are in process of		 * associating with the selected BSSID, do not trigger new		 * attempt. */		if (wpa_s->reassociate ||		    (os_memcmp(selected->bssid, wpa_s->bssid, ETH_ALEN) != 0 &&		     (wpa_s->wpa_state != WPA_ASSOCIATING ||		      os_memcmp(selected->bssid, wpa_s->pending_bssid,				ETH_ALEN) != 0))) {			if (wpa_supplicant_scard_init(wpa_s, ssid)) {				wpa_supplicant_req_scan(wpa_s, 10, 0);				return;			}			wpa_supplicant_associate(wpa_s, selected, ssid);		} else {			wpa_printf(MSG_DEBUG, "Already associated with the "				   "selected AP.");		}		rsn_preauth_scan_results(wpa_s->wpa, wpa_s->scan_res);	} else {		wpa_printf(MSG_DEBUG, "No suitable AP found.");		timeout = 5;		goto req_scan;	}	return;req_scan:	if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1) {		/*		 * Quick recovery if the initial scan results were not		 * complete when fetched before the first scan request.		 */		wpa_s->scan_res_tried++;//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,


示例19: sme_authenticate

//.........这里部分代码省略.........		pos = wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len;		len = sizeof(wpa_s->sme.assoc_req_ie) -			wpa_s->sme.assoc_req_ie_len;		res = wpas_p2p_assoc_req_ie(wpa_s, bss, pos, len,					    ssid->p2p_group);		if (res >= 0)			wpa_s->sme.assoc_req_ie_len += res;	}#endif /* CONFIG_P2P */#ifdef CONFIG_HS20	if (wpa_s->conf->hs20) {		struct wpabuf *hs20;		hs20 = wpabuf_alloc(20);		if (hs20) {			wpas_hs20_add_indication(hs20);			os_memcpy(wpa_s->sme.assoc_req_ie +				  wpa_s->sme.assoc_req_ie_len,				  wpabuf_head(hs20), wpabuf_len(hs20));			wpa_s->sme.assoc_req_ie_len += wpabuf_len(hs20);			wpabuf_free(hs20);		}	}#endif /* CONFIG_HS20 */#ifdef CONFIG_INTERWORKING	if (wpa_s->conf->interworking) {		u8 *pos = wpa_s->sme.assoc_req_ie;		if (wpa_s->sme.assoc_req_ie_len > 0 && pos[0] == WLAN_EID_RSN)			pos += 2 + pos[1];		os_memmove(pos + 6, pos,			   wpa_s->sme.assoc_req_ie_len -			   (pos - wpa_s->sme.assoc_req_ie));		wpa_s->sme.assoc_req_ie_len += 6;		*pos++ = WLAN_EID_EXT_CAPAB;		*pos++ = 4;		*pos++ = 0x00;		*pos++ = 0x00;		*pos++ = 0x00;		*pos++ = 0x80; /* Bit 31 - Interworking */	}#endif /* CONFIG_INTERWORKING */	wpa_supplicant_cancel_sched_scan(wpa_s);	wpa_supplicant_cancel_scan(wpa_s);	wpa_msg(wpa_s, MSG_INFO, "SME: Trying to authenticate with " MACSTR		" (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid),		wpa_ssid_txt(params.ssid, params.ssid_len), params.freq);	wpa_clear_keys(wpa_s, bss->bssid);	wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING);	old_ssid = wpa_s->current_ssid;	wpa_s->current_ssid = ssid;	wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);	wpa_supplicant_initiate_eapol(wpa_s);	if (old_ssid != wpa_s->current_ssid)		wpas_notify_network_changed(wpa_s);	wpa_s->sme.auth_alg = params.auth_alg;#if defined(ANDROID_P2P) && defined(WIFI_EAGLE)	/* If multichannel concurrency is not supported, check for any frequency	 * conflict and take appropriate action.	 */	wpa_printf(MSG_DEBUG, "%s EAGLE: Priority choose", __func__);	if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) &&		((freq = wpa_drv_shared_freq(wpa_s)) > 0) && (freq != params.freq)) {		wpa_printf(MSG_DEBUG, "Shared interface with conflicting frequency found (%d != %d)"				, freq, params.freq);		if (wpas_p2p_handle_frequency_conflicts(wpa_s, params.freq) < 0) {			/* Handling conflicts failed. Disable the current connect req and			 * notify the userspace to take appropriate action */			wpa_printf(MSG_DEBUG, "proiritize is not set. Notifying user space to handle the case");			wpa_supplicant_disable_network(wpa_s, ssid);			wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_FREQ_CONFLICT				" id=%d", ssid->id);			os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);			return;		}	}#endif /* ANDROID_P2P && WIFI_EAGLE */	if (wpa_drv_authenticate(wpa_s, &params) < 0) {		wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the "			"driver failed");		wpas_connection_failed(wpa_s, bss->bssid);		wpa_supplicant_mark_disassoc(wpa_s);		return;	}	eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s,			       NULL);	/*	 * Association will be started based on the authentication event from	 * the driver.	 */}
开发者ID:apc-io,项目名称:Vixen-external_wpa_supplicant_8_eagle,代码行数:101,


示例20: sme_associate

void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,		   const u8 *bssid, u16 auth_type){	struct wpa_driver_associate_params params;	struct ieee802_11_elems elems;#ifdef CONFIG_HT_OVERRIDES	struct ieee80211_ht_capabilities htcaps;	struct ieee80211_ht_capabilities htcaps_mask;#endif /* CONFIG_HT_OVERRIDES */	os_memset(&params, 0, sizeof(params));	params.bssid = bssid;	params.ssid = wpa_s->sme.ssid;	params.ssid_len = wpa_s->sme.ssid_len;	params.freq = wpa_s->sme.freq;	params.bg_scan_period = wpa_s->current_ssid ?		wpa_s->current_ssid->bg_scan_period : -1;	params.wpa_ie = wpa_s->sme.assoc_req_ie_len ?		wpa_s->sme.assoc_req_ie : NULL;	params.wpa_ie_len = wpa_s->sme.assoc_req_ie_len;	params.pairwise_suite = cipher_suite2driver(wpa_s->pairwise_cipher);	params.group_suite = cipher_suite2driver(wpa_s->group_cipher);#ifdef CONFIG_HT_OVERRIDES	os_memset(&htcaps, 0, sizeof(htcaps));	os_memset(&htcaps_mask, 0, sizeof(htcaps_mask));	params.htcaps = (u8 *) &htcaps;	params.htcaps_mask = (u8 *) &htcaps_mask;	wpa_supplicant_apply_ht_overrides(wpa_s, wpa_s->current_ssid, &params);#endif /* CONFIG_HT_OVERRIDES */#ifdef CONFIG_IEEE80211R	if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies) {		params.wpa_ie = wpa_s->sme.ft_ies;		params.wpa_ie_len = wpa_s->sme.ft_ies_len;	}#endif /* CONFIG_IEEE80211R */	params.mode = mode;	params.mgmt_frame_protection = wpa_s->sme.mfp;	if (wpa_s->sme.prev_bssid_set)		params.prev_bssid = wpa_s->sme.prev_bssid;	wpa_msg(wpa_s, MSG_INFO, "Trying to associate with " MACSTR		" (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid),		params.ssid ? wpa_ssid_txt(params.ssid, params.ssid_len) : "",		params.freq);	wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATING);	if (params.wpa_ie == NULL ||	    ieee802_11_parse_elems(params.wpa_ie, params.wpa_ie_len, &elems, 0)	    < 0) {		wpa_dbg(wpa_s, MSG_DEBUG, "SME: Could not parse own IEs?!");		os_memset(&elems, 0, sizeof(elems));	}	if (elems.rsn_ie) {		params.wpa_proto = WPA_PROTO_RSN;		wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.rsn_ie - 2,					elems.rsn_ie_len + 2);	} else if (elems.wpa_ie) {		params.wpa_proto = WPA_PROTO_WPA;		wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.wpa_ie - 2,					elems.wpa_ie_len + 2);	} else		wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);	if (wpa_s->current_ssid && wpa_s->current_ssid->p2p_group)		params.p2p = 1;	if (wpa_s->parent->set_sta_uapsd)		params.uapsd = wpa_s->parent->sta_uapsd;	else		params.uapsd = -1;	if (wpa_drv_associate(wpa_s, &params) < 0) {		wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the "			"driver failed");		wpas_connection_failed(wpa_s, wpa_s->pending_bssid);		wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);		os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);		return;	}	eloop_register_timeout(SME_ASSOC_TIMEOUT, 0, sme_assoc_timer, wpa_s,			       NULL);}
开发者ID:apc-io,项目名称:Vixen-external_wpa_supplicant_8_eagle,代码行数:83,


示例21: sme_event_auth

void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data){	struct wpa_ssid *ssid = wpa_s->current_ssid;	if (ssid == NULL) {		wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication event "			"when network is not selected");		return;	}	if (wpa_s->wpa_state != WPA_AUTHENTICATING) {		wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication event "			"when not in authenticating state");		return;	}	if (os_memcmp(wpa_s->pending_bssid, data->auth.peer, ETH_ALEN) != 0) {		wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication with "			"unexpected peer " MACSTR,			MAC2STR(data->auth.peer));		return;	}	wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication response: peer=" MACSTR		" auth_type=%d status_code=%d",		MAC2STR(data->auth.peer), data->auth.auth_type,		data->auth.status_code);	wpa_hexdump(MSG_MSGDUMP, "SME: Authentication response IEs",		    data->auth.ies, data->auth.ies_len);	eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL);	if (data->auth.status_code != WLAN_STATUS_SUCCESS) {		wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication failed (status "			"code %d)", data->auth.status_code);		if (data->auth.status_code !=		    WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG ||		    wpa_s->sme.auth_alg == data->auth.auth_type ||		    wpa_s->current_ssid->auth_alg == WPA_AUTH_ALG_LEAP) {			wpas_connection_failed(wpa_s, wpa_s->pending_bssid);			wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);			return;		}		switch (data->auth.auth_type) {		case WLAN_AUTH_OPEN:			wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_SHARED;			wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying SHARED auth");			wpa_supplicant_associate(wpa_s, wpa_s->current_bss,						 wpa_s->current_ssid);			return;		case WLAN_AUTH_SHARED_KEY:			wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_LEAP;			wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying LEAP auth");			wpa_supplicant_associate(wpa_s, wpa_s->current_bss,						 wpa_s->current_ssid);			return;		default:			return;		}	}#ifdef CONFIG_IEEE80211R	if (data->auth.auth_type == WLAN_AUTH_FT) {		union wpa_event_data edata;		os_memset(&edata, 0, sizeof(edata));		edata.ft_ies.ies = data->auth.ies;		edata.ft_ies.ies_len = data->auth.ies_len;		os_memcpy(edata.ft_ies.target_ap, data->auth.peer, ETH_ALEN);		wpa_supplicant_event(wpa_s, EVENT_FT_RESPONSE, &edata);	}#endif /* CONFIG_IEEE80211R */	sme_associate(wpa_s, ssid->mode, data->auth.peer,		      data->auth.auth_type);}
开发者ID:apc-io,项目名称:Vixen-external_wpa_supplicant_8_eagle,代码行数:81,


示例22: wpa_supplicant_scan

static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx){	struct wpa_supplicant *wpa_s = eloop_ctx;	struct wpa_ssid *ssid;	int scan_req = 0, ret;	struct wpabuf *wps_ie = NULL;	const u8 *extra_ie = NULL;	size_t extra_ie_len = 0;	int wps = 0;#ifdef CONFIG_WPS	enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO;#endif /* CONFIG_WPS */	wpa_printf(MSG_DEBUG, "%s: scan_req = %d, ap_scan = %d", __func__,		wpa_s->scan_req, wpa_s->conf->ap_scan);#if ICS_LEGACY_WLAN_SUPPORT	if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {		wpa_printf(MSG_DEBUG, "Skip scan - interface disabled");		return;	}#endif	if (wpa_s->disconnected && !wpa_s->scan_req) {		wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);		return;	}	if (!wpa_supplicant_enabled_networks(wpa_s->conf) &&	    !wpa_s->scan_req) {		wpa_printf(MSG_DEBUG, "No enabled networks - do not scan");		wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);		return;	}	scan_req = wpa_s->scan_req;	wpa_s->scan_req = 0;	if (wpa_s->conf->ap_scan != 0 &&	    wpa_s->driver && IS_WIRED(wpa_s->driver)) {		wpa_printf(MSG_DEBUG, "Using wired authentication - "			   "overriding ap_scan configuration");		wpa_s->conf->ap_scan = 0;	}	if (wpa_s->conf->ap_scan == 0) {		wpa_supplicant_gen_assoc_event(wpa_s);		return;	}	if (wpa_s->wpa_state == WPA_DISCONNECTED ||	    wpa_s->wpa_state == WPA_INACTIVE)		wpa_supplicant_set_state(wpa_s, WPA_SCANNING);	ssid = wpa_s->conf->ssid;	if (wpa_s->prev_scan_ssid != BROADCAST_SSID_SCAN) {		while (ssid) {			if (ssid == wpa_s->prev_scan_ssid) {				ssid = ssid->next;				break;			}			ssid = ssid->next;		}	}	while (ssid) {//MTK_OP01_PROTECT_START#ifdef CONFIG_CMCC_SUPPORT /* CMCC */       if (#else//MTK_OP01_PROTECT_END		if (!ssid->disabled &&//MTK_OP01_PROTECT_START#endif//MTK_OP01_PROTECT_END		    (ssid->scan_ssid || wpa_s->conf->ap_scan == 2))			break;		ssid = ssid->next;	}	if (scan_req != 2 && wpa_s->conf->ap_scan == 2) {		/*		 * ap_scan=2 mode - try to associate with each SSID instead of		 * scanning for each scan_ssid=1 network.		 */		if (ssid == NULL) {			wpa_printf(MSG_DEBUG, "wpa_supplicant_scan: Reached "				   "end of scan list - go back to beginning");			wpa_s->prev_scan_ssid = BROADCAST_SSID_SCAN;			wpa_supplicant_req_scan(wpa_s, 0, 0);			return;		}		if (ssid->next) {			/* Continue from the next SSID on the next attempt. */			wpa_s->prev_scan_ssid = ssid;		} else {			/* Start from the beginning of the SSID list. */			wpa_s->prev_scan_ssid = BROADCAST_SSID_SCAN;		}		wpa_supplicant_associate(wpa_s, NULL, ssid);		return;	}//.........这里部分代码省略.........
开发者ID:mynameisjoyg,项目名称:mt6572_x201,代码行数:101,


示例23: wpa_supplicant_scan

static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx){	struct wpa_supplicant *wpa_s = eloop_ctx;	struct wpa_ssid *ssid;	int scan_req = 0, ret;	struct wpabuf *wps_ie = NULL;#ifdef CONFIG_WPS	int wps = 0;	enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO;#endif /* CONFIG_WPS */	struct wpa_driver_scan_params params;	size_t max_ssids;	enum wpa_states prev_state;	if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {		wpa_dbg(wpa_s, MSG_DEBUG, "Skip scan - interface disabled");		return;	}	if (wpa_s->disconnected && !wpa_s->scan_req) {		wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);		return;	}	if (!wpa_supplicant_enabled_networks(wpa_s->conf) &&	    !wpa_s->scan_req) {		wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks - do not scan");		wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);		return;	}	if (wpa_s->conf->ap_scan != 0 &&	    (wpa_s->drv_flags & WPA_DRIVER_FLAGS_WIRED)) {		wpa_dbg(wpa_s, MSG_DEBUG, "Using wired authentication - "			"overriding ap_scan configuration");		wpa_s->conf->ap_scan = 0;		wpas_notify_ap_scan_changed(wpa_s);	}	if (wpa_s->conf->ap_scan == 0) {		wpa_supplicant_gen_assoc_event(wpa_s);		return;	}	if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) ||	    wpa_s->conf->ap_scan == 2)		max_ssids = 1;	else {		max_ssids = wpa_s->max_scan_ssids;		if (max_ssids > WPAS_MAX_SCAN_SSIDS)			max_ssids = WPAS_MAX_SCAN_SSIDS;	}#ifdef CONFIG_WPS	wps = wpas_wps_in_use(wpa_s->conf, &req_type);#endif /* CONFIG_WPS */	scan_req = wpa_s->scan_req;	wpa_s->scan_req = 0;	os_memset(&params, 0, sizeof(params));	prev_state = wpa_s->wpa_state;	if (wpa_s->wpa_state == WPA_DISCONNECTED ||	    wpa_s->wpa_state == WPA_INACTIVE)		wpa_supplicant_set_state(wpa_s, WPA_SCANNING);	/* Find the starting point from which to continue scanning */	ssid = wpa_s->conf->ssid;	if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) {		while (ssid) {			if (ssid == wpa_s->prev_scan_ssid) {				ssid = ssid->next;				break;			}			ssid = ssid->next;		}	}	if (scan_req != 2 && (wpa_s->conf->ap_scan == 2 ||			      wpa_s->connect_without_scan)) {		wpa_s->connect_without_scan = 0;		wpa_supplicant_assoc_try(wpa_s, ssid);		return;	} else if (wpa_s->conf->ap_scan == 2) {		/*		 * User-initiated scan request in ap_scan == 2; scan with		 * wildcard SSID.		 */		ssid = NULL;	} else {		struct wpa_ssid *start = ssid, *tssid;		int freqs_set = 0;		if (ssid == NULL && max_ssids > 1)			ssid = wpa_s->conf->ssid;		while (ssid) {			if (!ssid->disabled && ssid->scan_ssid) {				wpa_hexdump_ascii(MSG_DEBUG, "Scan SSID",						  ssid->ssid, ssid->ssid_len);				params.ssids[params.num_ssids].ssid =//.........这里部分代码省略.........
开发者ID:AlexShadow,项目名称:RTL8188-hostapd,代码行数:101,


示例24: wpa_supplicant_event_assoc

static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,				       union wpa_event_data *data){	u8 bssid[ETH_ALEN];	int ft_completed = wpa_ft_is_completed(wpa_s->wpa);	if (data)		wpa_supplicant_event_associnfo(wpa_s, data);	wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATED);	if (wpa_s->use_client_mlme)		os_memcpy(bssid, wpa_s->bssid, ETH_ALEN);	if (wpa_s->use_client_mlme ||	    (wpa_drv_get_bssid(wpa_s, bssid) >= 0 &&	     os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0)) {		wpa_msg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID="			MACSTR, MAC2STR(bssid));		os_memcpy(wpa_s->bssid, bssid, ETH_ALEN);		os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);		if (wpa_supplicant_dynamic_keys(wpa_s) && !ft_completed) {			wpa_clear_keys(wpa_s, bssid);		}		if (wpa_supplicant_select_config(wpa_s) < 0) {			wpa_supplicant_disassociate(				wpa_s, WLAN_REASON_DEAUTH_LEAVING);			return;		}	}	wpa_msg(wpa_s, MSG_INFO, "Associated with " MACSTR, MAC2STR(bssid));	if (wpa_s->current_ssid) {		/* When using scanning (ap_scan=1), SIM PC/SC interface can be		 * initialized before association, but for other modes,		 * initialize PC/SC here, if the current configuration needs		 * smartcard or SIM/USIM. */		wpa_supplicant_scard_init(wpa_s, wpa_s->current_ssid);	}	wpa_sm_notify_assoc(wpa_s->wpa, bssid);	l2_packet_notify_auth_start(wpa_s->l2);	/*	 * Set portEnabled first to FALSE in order to get EAP state machine out	 * of the SUCCESS state and eapSuccess cleared. Without this, EAPOL PAE	 * state machine may transit to AUTHENTICATING state based on obsolete	 * eapSuccess and then trigger BE_AUTH to SUCCESS and PAE to	 * AUTHENTICATED without ever giving chance to EAP state machine to	 * reset the state.	 */	if (!ft_completed) {		eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);		eapol_sm_notify_portValid(wpa_s->eapol, FALSE);	}	if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || ft_completed)		eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);	/* 802.1X::portControl = Auto */	eapol_sm_notify_portEnabled(wpa_s->eapol, TRUE);	wpa_s->eapol_received = 0;	if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||	    wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {		wpa_supplicant_cancel_auth_timeout(wpa_s);		wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);	} else if (!ft_completed) {		/* Timeout for receiving the first EAPOL packet */		wpa_supplicant_req_auth_timeout(wpa_s, 10, 0);	}	wpa_supplicant_cancel_scan(wpa_s);	if (wpa_s->driver_4way_handshake &&	    wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {		/*		 * We are done; the driver will take care of RSN 4-way		 * handshake.		 */		wpa_supplicant_cancel_auth_timeout(wpa_s);		wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);		eapol_sm_notify_portValid(wpa_s->eapol, TRUE);		eapol_sm_notify_eap_success(wpa_s->eapol, TRUE);	}	if (wpa_s->pending_eapol_rx) {		struct os_time now, age;		os_get_time(&now);		os_time_sub(&now, &wpa_s->pending_eapol_rx_time, &age);		if (age.sec == 0 && age.usec < 100000 &&		    os_memcmp(wpa_s->pending_eapol_rx_src, bssid, ETH_ALEN) ==		    0) {			wpa_printf(MSG_DEBUG, "Process pending EAPOL frame "				   "that was received just before association "				   "notification");			wpa_supplicant_rx_eapol(				wpa_s, wpa_s->pending_eapol_rx_src,				wpabuf_head(wpa_s->pending_eapol_rx),				wpabuf_len(wpa_s->pending_eapol_rx));		}		wpabuf_free(wpa_s->pending_eapol_rx);		wpa_s->pending_eapol_rx = NULL;	}}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:98,


示例25: sme_send_authentication

//.........这里部分代码省略.........	sme_auth_handle_rrm(wpa_s, bss);#ifdef CONFIG_SAE	if (!skip_auth && params.auth_alg == WPA_AUTH_ALG_SAE &&	    pmksa_cache_set_current(wpa_s->wpa, NULL, bss->bssid, ssid, 0) == 0)	{		wpa_dbg(wpa_s, MSG_DEBUG,			"PMKSA cache entry found - try to use PMKSA caching instead of new SAE authentication");		params.auth_alg = WPA_AUTH_ALG_OPEN;		wpa_s->sme.sae_pmksa_caching = 1;	}	if (!skip_auth && params.auth_alg == WPA_AUTH_ALG_SAE) {		if (start)			resp = sme_auth_build_sae_commit(wpa_s, ssid,							 bss->bssid);		else			resp = sme_auth_build_sae_confirm(wpa_s);		if (resp == NULL) {			wpas_connection_failed(wpa_s, bss->bssid, 1);			return;		}		params.sae_data = wpabuf_head(resp);		params.sae_data_len = wpabuf_len(resp);		wpa_s->sme.sae.state = start ? SAE_COMMITTED : SAE_CONFIRMED;	}#endif /* CONFIG_SAE */	wpa_supplicant_cancel_sched_scan(wpa_s);	wpa_supplicant_cancel_scan(wpa_s);	wpa_msg(wpa_s, MSG_INFO, "SME: Trying to authenticate with " MACSTR		" (SSID='%s' freq=%d MHz)", MAC2STR(params.bssid),		wpa_ssid_txt(params.ssid, params.ssid_len), params.freq);	wpa_clear_keys(wpa_s, bss->bssid);	wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING);	old_ssid = wpa_s->current_ssid;	wpa_s->current_ssid = ssid;	wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);	wpa_supplicant_initiate_eapol(wpa_s);	if (old_ssid != wpa_s->current_ssid)		wpas_notify_network_changed(wpa_s);#ifdef CONFIG_P2P	/*	 * If multi-channel concurrency is not supported, check for any	 * frequency conflict. In case of any frequency conflict, remove the	 * least prioritized connection.	 */	if (wpa_s->num_multichan_concurrent < 2) {		int freq, num;		num = get_shared_radio_freqs(wpa_s, &freq, 1);		if (num > 0 && freq > 0 && freq != params.freq) {			wpa_printf(MSG_DEBUG,				   "Conflicting frequency found (%d != %d)",				   freq, params.freq);			if (wpas_p2p_handle_frequency_conflicts(wpa_s,								params.freq,								ssid) < 0) {				wpas_connection_failed(wpa_s, bss->bssid, 0);				wpa_supplicant_mark_disassoc(wpa_s);				wpabuf_free(resp);				wpas_connect_work_done(wpa_s);				return;			}		}	}#endif /* CONFIG_P2P */	if (skip_auth) {		wpa_msg(wpa_s, MSG_DEBUG,			"SME: Skip authentication step on reassoc-to-same-BSS");		wpabuf_free(resp);		sme_associate(wpa_s, ssid->mode, bss->bssid, WLAN_AUTH_OPEN);		return;	}	wpa_s->sme.auth_alg = params.auth_alg;	if (wpa_drv_authenticate(wpa_s, &params) < 0) {		wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the "			"driver failed");		wpas_connection_failed(wpa_s, bss->bssid, 1);		wpa_supplicant_mark_disassoc(wpa_s);		wpabuf_free(resp);		wpas_connect_work_done(wpa_s);		return;	}	eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s,			       NULL);	/*	 * Association will be started based on the authentication event from	 * the driver.	 */	wpabuf_free(resp);}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_wpa_supplicant_8,代码行数:101,


示例26: wpa_supplicant_event

void wpa_supplicant_event(void *ctx, wpa_event_type event,			  union wpa_event_data *data){	struct wpa_supplicant *wpa_s = ctx;#if ICS_LEGACY_WLAN_SUPPORT	if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED &&	    event != EVENT_INTERFACE_ENABLED &&	    event != EVENT_INTERFACE_STATUS) {		wpa_printf(MSG_DEBUG, "Ignore event %d while interface is "			"disabled", event);		return;	}#endif	switch (event) {	case EVENT_ASSOC:		wpa_supplicant_event_assoc(wpa_s, data);		break;	case EVENT_DISASSOC:		wpa_supplicant_event_disassoc(wpa_s);		break;	case EVENT_MICHAEL_MIC_FAILURE:		wpa_supplicant_event_michael_mic_failure(wpa_s, data);		break;#if ICS_LEGACY_WLAN_SUPPORT	case EVENT_INTERFACE_ENABLED:		wpa_printf(MSG_DEBUG, "Interface was enabled");		if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {			wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);			wpa_supplicant_req_scan(wpa_s, 0, 0);		}		break;	case EVENT_INTERFACE_DISABLED:		wpa_printf(MSG_DEBUG, "Interface was disabled");		wpa_supplicant_mark_disassoc(wpa_s);		wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);		break;#endif#ifndef CONFIG_NO_SCAN_PROCESSING	case EVENT_SCAN_RESULTS:		wpa_supplicant_event_scan_results(wpa_s);		break;#endif /* CONFIG_NO_SCAN_PROCESSING */	case EVENT_ASSOCINFO:		wpa_supplicant_event_associnfo(wpa_s, data);		break;	case EVENT_INTERFACE_STATUS:		wpa_supplicant_event_interface_status(wpa_s, data);		break;	case EVENT_PMKID_CANDIDATE:		wpa_supplicant_event_pmkid_candidate(wpa_s, data);		break;#ifdef CONFIG_PEERKEY	case EVENT_STKSTART:		wpa_supplicant_event_stkstart(wpa_s, data);		break;#endif /* CONFIG_PEERKEY */#ifdef CONFIG_IEEE80211R	case EVENT_FT_RESPONSE:		wpa_supplicant_event_ft_response(wpa_s, data);		break;#endif /* CONFIG_IEEE80211R */	default:		wpa_printf(MSG_INFO, "Unknown event %d", event);		break;	}}
开发者ID:AwaisKing,项目名称:mt6577_aosp_source,代码行数:68,



注:本文中的wpa_supplicant_set_state函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ wpabuf_alloc函数代码示例
C++ wpa_supplicant_req_scan函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。