Ejemplo n.º 1
0
void ieee80211_michael_mic_failure(struct hostapd_data *hapd, u8 *addr,
                                   int local)
{
    time_t now;

    if (addr && local) {
        struct sta_info *sta = ap_get_sta(hapd, addr);
        if (sta != NULL) {
            sta->dot11RSNAStatsTKIPLocalMICFailures++;
            hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
                           HOSTAPD_LEVEL_INFO,
                           "Michael MIC failure detected in "
                           "received frame");
        } else {
            HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL,
                          "MLME-MICHAELMICFAILURE.indication "
                          "for not associated STA (" MACSTR
                          ") ignored\n", MAC2STR(addr));
            return;
        }
    }

    time(&now);
    if (now > hapd->michael_mic_failure + 60) {
        hapd->michael_mic_failures = 1;
    } else {
        hapd->michael_mic_failures++;
        if (hapd->michael_mic_failures > 1)
            ieee80211_tkip_countermeasures_start(hapd);
    }
    hapd->michael_mic_failure = now;
}
Ejemplo n.º 2
0
void michael_mic_failure(struct hostapd_data *hapd, const u8 *addr, int local)
{
	struct os_time now;

	if (addr && local) {
		struct sta_info *sta = ap_get_sta(hapd, addr);
		if (sta != NULL) {
			wpa_auth_sta_local_mic_failure_report(sta->wpa_sm);
			hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
				       HOSTAPD_LEVEL_INFO,
				       "Michael MIC failure detected in "
				       "received frame");
			mlme_michaelmicfailure_indication(hapd, addr);
		} else {
			wpa_printf(MSG_DEBUG,
				   "MLME-MICHAELMICFAILURE.indication "
				   "for not associated STA (" MACSTR
				   ") ignored", MAC2STR(addr));
			return;
		}
	}

	os_get_time(&now);
	if (now.sec > hapd->michael_mic_failure + 60) {
		hapd->michael_mic_failures = 1;
	} else {
		hapd->michael_mic_failures++;
		if (hapd->michael_mic_failures > 1)
			ieee80211_tkip_countermeasures_start(hapd);
	}
	hapd->michael_mic_failure = now.sec;
}