void wpa_supplicant_event(void *ctx, enum wpa_event_type event, union wpa_event_data *data) { struct wpa_supplicant *wpa_s = ctx; u16 reason_code = 0; switch (event) { case EVENT_AUTH: sme_event_auth(wpa_s, data); break; case EVENT_ASSOC: wpa_supplicant_event_assoc(wpa_s, data); break; case EVENT_DISASSOC: wpa_printf(MSG_DEBUG, "Disassociation notification"); #ifdef CONFIG_AP if (wpa_s->ap_iface && data && data->disassoc_info.addr) { hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], data->disassoc_info.addr); break; } #endif /* CONFIG_AP */ if (data) reason_code = data->deauth_info.reason_code; if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) sme_event_disassoc(wpa_s, data); /* fall through */ case EVENT_DEAUTH: if (event == EVENT_DEAUTH) { wpa_printf(MSG_DEBUG, "Deauthentication notification"); if (data) reason_code = data->deauth_info.reason_code; } #ifdef CONFIG_AP if (wpa_s->ap_iface && data && data->deauth_info.addr) { hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], data->deauth_info.addr); break; } #endif /* CONFIG_AP */ wpa_supplicant_event_disassoc(wpa_s, reason_code); break; case EVENT_MICHAEL_MIC_FAILURE: wpa_supplicant_event_michael_mic_failure(wpa_s, data); break; #ifndef CONFIG_NO_SCAN_PROCESSING case EVENT_SCAN_RESULTS: wpa_supplicant_event_scan_results(wpa_s, data); 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 */ #ifdef CONFIG_IBSS_RSN case EVENT_IBSS_RSN_START: wpa_supplicant_event_ibss_rsn_start(wpa_s, data); break; #endif /* CONFIG_IBSS_RSN */ case EVENT_ASSOC_REJECT: sme_event_assoc_reject(wpa_s, data); break; case EVENT_AUTH_TIMED_OUT: sme_event_auth_timed_out(wpa_s, data); break; case EVENT_ASSOC_TIMED_OUT: sme_event_assoc_timed_out(wpa_s, data); break; #ifdef CONFIG_AP case EVENT_TX_STATUS: if (wpa_s->ap_iface == NULL) break; switch (data->tx_status.type) { case WLAN_FC_TYPE_MGMT: ap_mgmt_tx_cb(wpa_s, data->tx_status.data, data->tx_status.data_len, data->tx_status.stype, data->tx_status.ack); break; case WLAN_FC_TYPE_DATA: ap_tx_status(wpa_s, data->tx_status.dst, data->tx_status.data, data->tx_status.data_len, data->tx_status.ack); break; } break; case EVENT_RX_FROM_UNKNOWN: if (wpa_s->ap_iface == NULL) break; ap_rx_from_unknown_sta(wpa_s, data->rx_from_unknown.frame, data->rx_from_unknown.len); break; case EVENT_RX_MGMT: if (wpa_s->ap_iface == NULL) break; ap_mgmt_rx(wpa_s, &data->rx_mgmt); break; #endif /* CONFIG_AP */ case EVENT_RX_ACTION: wpa_printf(MSG_DEBUG, "Received Action frame: SA=" MACSTR " Category=%u DataLen=%d freq=%d MHz", MAC2STR(data->rx_action.sa), data->rx_action.category, (int) data->rx_action.len, data->rx_action.freq); #ifdef CONFIG_IEEE80211R if (data->rx_action.category == WLAN_ACTION_FT) { ft_rx_action(wpa_s, data->rx_action.data, data->rx_action.len); break; } #endif /* CONFIG_IEEE80211R */ break; #ifdef CONFIG_CLIENT_MLME case EVENT_MLME_RX: { struct ieee80211_rx_status rx_status; os_memset(&rx_status, 0, sizeof(rx_status)); rx_status.freq = data->mlme_rx.freq; rx_status.channel = data->mlme_rx.channel; rx_status.ssi = data->mlme_rx.ssi; ieee80211_sta_rx(wpa_s, data->mlme_rx.buf, data->mlme_rx.len, &rx_status); break; } #endif /* CONFIG_CLIENT_MLME */ case EVENT_EAPOL_RX: wpa_supplicant_rx_eapol(wpa_s, data->eapol_rx.src, data->eapol_rx.data, data->eapol_rx.data_len); break; case EVENT_SIGNAL_CHANGE: bgscan_notify_signal_change( wpa_s, data->signal_change.above_threshold); break; default: wpa_printf(MSG_INFO, "Unknown event %d", event); break; } }
void wpa_supplicant_event(void *ctx, enum wpa_event_type event, union wpa_event_data *data) { struct wpa_supplicant *wpa_s = ctx; switch (event) { case EVENT_AUTH: sme_event_auth(wpa_s, data); break; case EVENT_ASSOC: wpa_supplicant_event_assoc(wpa_s, data); break; case EVENT_DISASSOC: #ifdef CONFIG_AP if (wpa_s->ap_iface && data) { hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], data->disassoc_info.addr); break; } #endif /* CONFIG_AP */ if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) sme_event_disassoc(wpa_s, data); /* fall through */ case EVENT_DEAUTH: #ifdef CONFIG_AP if (wpa_s->ap_iface && data) { hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], data->deauth_info.addr); break; } #endif /* CONFIG_AP */ wpa_supplicant_event_disassoc(wpa_s); break; case EVENT_MICHAEL_MIC_FAILURE: wpa_supplicant_event_michael_mic_failure(wpa_s, data); break; #ifndef CONFIG_NO_SCAN_PROCESSING case EVENT_SCAN_RESULTS: wpa_supplicant_event_scan_results(wpa_s, data); 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 */ #ifdef CONFIG_IBSS_RSN case EVENT_IBSS_RSN_START: wpa_supplicant_event_ibss_rsn_start(wpa_s, data); break; #endif /* CONFIG_IBSS_RSN */ case EVENT_ASSOC_REJECT: sme_event_assoc_reject(wpa_s, data); break; case EVENT_AUTH_TIMED_OUT: sme_event_auth_timed_out(wpa_s, data); break; case EVENT_ASSOC_TIMED_OUT: sme_event_assoc_timed_out(wpa_s, data); break; #ifdef CONFIG_AP case EVENT_TX_STATUS: if (wpa_s->ap_iface == NULL) break; switch (data->tx_status.type) { case WLAN_FC_TYPE_MGMT: ap_mgmt_tx_cb(wpa_s, data->tx_status.data, data->tx_status.data_len, data->tx_status.stype, data->tx_status.ack); break; case WLAN_FC_TYPE_DATA: ap_tx_status(wpa_s, data->tx_status.dst, data->tx_status.data, data->tx_status.data_len, data->tx_status.ack); break; } break; case EVENT_RX_FROM_UNKNOWN: if (wpa_s->ap_iface == NULL) break; ap_rx_from_unknown_sta(wpa_s, data->rx_from_unknown.frame, data->rx_from_unknown.len); break; case EVENT_RX_MGMT: if (wpa_s->ap_iface == NULL) break; ap_mgmt_rx(wpa_s, &data->rx_mgmt); break; #endif /* CONFIG_AP */ #ifdef CONFIG_CLIENT_MLME case EVENT_MLME_RX: { struct ieee80211_rx_status rx_status; os_memset(&rx_status, 0, sizeof(rx_status)); rx_status.freq = data->mlme_rx.freq; rx_status.channel = data->mlme_rx.channel; rx_status.ssi = data->mlme_rx.ssi; ieee80211_sta_rx(wpa_s, data->mlme_rx.buf, data->mlme_rx.len, &rx_status); break; } #endif /* CONFIG_CLIENT_MLME */ case EVENT_EAPOL_RX: wpa_supplicant_rx_eapol(wpa_s, data->eapol_rx.src, data->eapol_rx.data, data->eapol_rx.data_len); break; default: wpa_printf(MSG_INFO, "Unknown event %d", event); break; } }