diff options
author | Eliad Peller <eliad@wizery.com> | 2011-12-07 02:50:00 +0200 |
---|---|---|
committer | Arik Nemtsov <arik@wizery.com> | 2012-08-02 13:00:26 +0300 |
commit | 40562272d5980b17aa0a56fec10ac892027186ba (patch) | |
tree | fa0a41d7bb5d2743befe2e7c5954df8c5a58c641 /src/ap | |
parent | 74d1e3e57787adc6db14ef95773758541ad7455b (diff) | |
download | external_wpa_supplicant_8_ti-40562272d5980b17aa0a56fec10ac892027186ba.zip external_wpa_supplicant_8_ti-40562272d5980b17aa0a56fec10ac892027186ba.tar.gz external_wpa_supplicant_8_ti-40562272d5980b17aa0a56fec10ac892027186ba.tar.bz2 |
save eapol for later use (EAPOL Start race)
[ Includes null check missing from the original patch - Arik ]
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Diffstat (limited to 'src/ap')
-rw-r--r-- | src/ap/hostapd.c | 3 | ||||
-rw-r--r-- | src/ap/hostapd.h | 5 | ||||
-rw-r--r-- | src/ap/ieee802_11.c | 19 | ||||
-rw-r--r-- | src/ap/ieee802_1x.c | 11 |
4 files changed, 38 insertions, 0 deletions
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 22c5e65..3406cd1 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -259,6 +259,9 @@ static void hostapd_free_hapd_data(struct hostapd_data *hapd) os_free(hapd->probereq_cb); hapd->probereq_cb = NULL; + wpabuf_free(hapd->pending_eapol_rx); + hapd->pending_eapol_rx = NULL; + #ifdef CONFIG_P2P wpabuf_free(hapd->p2p_beacon_ie); hapd->p2p_beacon_ie = NULL; diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index f7ed311..4fb3c51 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -123,6 +123,11 @@ struct hostapd_data { int beacon_set_done; struct wpabuf *wps_beacon_ie; struct wpabuf *wps_probe_resp_ie; + + struct wpabuf *pending_eapol_rx; + struct os_time pending_eapol_rx_time; + u8 pending_eapol_rx_src[ETH_ALEN]; + #ifdef CONFIG_WPS unsigned int ap_pin_failures; unsigned int ap_pin_failures_consecutive; diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index bf826ad..67745e9 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -1611,6 +1611,25 @@ static void handle_assoc_cb(struct hostapd_data *hapd, ieee802_1x_notify_port_enabled(sta->eapol_sm, 1); + if (hapd->pending_eapol_rx) { + struct os_time now, age; + os_get_time(&now); + os_time_sub(&now, &hapd->pending_eapol_rx_time, &age); + if (age.sec == 0 && /*age.usec < 100000 &&*/ + os_memcmp(hapd->pending_eapol_rx_src, + mgmt->da, ETH_ALEN) == 0) { + wpa_printf(MSG_DEBUG, "Process pending EAPOL " + "frame that was received just before " + "association notification"); + ieee802_1x_receive( + hapd, hapd->pending_eapol_rx_src, + wpabuf_head(hapd->pending_eapol_rx), + wpabuf_len(hapd->pending_eapol_rx)); + } + wpabuf_free(hapd->pending_eapol_rx); + hapd->pending_eapol_rx = NULL; + } + fail: /* Copy of the association request is not needed anymore */ if (sta->last_assoc_req) { diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c index dd0df1d..037bd0c 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c @@ -727,6 +727,17 @@ void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf, !(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_WIRED))) { wpa_printf(MSG_DEBUG, "IEEE 802.1X data frame from not " "associated/Pre-authenticating STA"); + if (sta && (sta->flags & WLAN_STA_ASSOC_REQ_OK)) { + wpa_printf(MSG_DEBUG, "Saving EAPOL for later use"); + wpabuf_free(hapd->pending_eapol_rx); + hapd->pending_eapol_rx = wpabuf_alloc_copy(buf, len); + if (hapd->pending_eapol_rx) { + os_get_time(&hapd->pending_eapol_rx_time); + os_memcpy(hapd->pending_eapol_rx_src, sa, + ETH_ALEN); + } + } + return; } |