From patchwork Tue Oct 8 06:41:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Jance X-Patchwork-Id: 281339 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 45BD92C00B1 for ; Tue, 8 Oct 2013 17:41:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id CBD0F9C123; Tue, 8 Oct 2013 02:41:38 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6TPnZx6G77sh; Tue, 8 Oct 2013 02:41:38 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 0EAFA9C10D; Tue, 8 Oct 2013 02:41:34 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 659FC9C10D for ; Tue, 8 Oct 2013 02:41:33 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01QSL4W9sCfp for ; Tue, 8 Oct 2013 02:41:28 -0400 (EDT) Received: from mms3.broadcom.com (mms3.broadcom.com [216.31.210.19]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 365C39C0FB for ; Tue, 8 Oct 2013 02:41:28 -0400 (EDT) Received: from [10.9.208.57] by mms3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Mon, 07 Oct 2013 23:41:15 -0700 X-Server-Uuid: B86B6450-0931-4310-942E-F00ED04CA7AF Received: from IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.1.438.0; Mon, 7 Oct 2013 23:41:20 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) with Microsoft SMTP Server id 14.1.438.0; Mon, 7 Oct 2013 23:41:20 -0700 Received: from jithu?broadcom.com (lbblr-jithu01.ban.broadcom.com [10.132.24.37]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id D71C9246A4 for ; Mon, 7 Oct 2013 23:41:19 -0700 (PDT) Date: Tue, 8 Oct 2013 12:11:17 +0530 From: "Jithu Jance" To: hostap@lists.shmoo.com Subject: [PATCH 1/1] WPA: Delay processing of EAPOL-key 1/4 MSG Message-ID: <20131008064117.GA24593@jithu@broadcom.com> MIME-Version: 1.0 User-Agent: Mutt/1.5.21 (2010-09-15) X-WSS-ID: 7E4D76812L892547903-01-01 Content-Disposition: inline X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Sometimes EAPOL-key 1/4 message is received before the reassoc event(from Driver roaming). Delay the processing of EAPOL to let the re-assoc info get updated properly. Signed-hostap: Jithu Jance --- src/rsn_supp/wpa.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 1.7.9.5 diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c index 292255c..5db0a6f 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c @@ -1720,6 +1720,33 @@ int wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr, goto out; } + /* + * There is possible race condition between receiving the + * association event and the EAPOL frame since they are coming + * through different paths from the driver. In order to avoid + * issues in trying to process the EAPOL frame before receiving + * association information, lets queue it for processing until + * the association event is received. + */ + if (!peer_key && (key_info & WPA_KEY_INFO_KEY_TYPE) && + !(key_info & WPA_KEY_INFO_MIC) && + (supp->wpa_state == WPA_COMPLETED)) { + wpa_msg(sm->ctx->msg_ctx, MSG_INFO, + "WPA: EAPOL-Key 1/4 is received in WPA_COMPLETED state - Delay" + "processing of received EAPOL frame"); + wpabuf_free(supp->pending_eapol_rx); + supp->pending_eapol_rx = wpabuf_alloc_copy(buf, len); + + if (supp->pending_eapol_rx) { + os_get_time(&supp->pending_eapol_rx_time); + os_memcpy(supp->pending_eapol_rx_src,src_addr, ETH_ALEN); + } else { + wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, + "WPA: memalloc failed for pending_eapol_rx. Dropping packet"); + } + goto out; + } + if (!(key_info & (WPA_KEY_INFO_ACK | WPA_KEY_INFO_SMK_MESSAGE)) #ifdef CONFIG_PEERKEY && (peerkey == NULL || !peerkey->initiator)