From patchwork Thu Jan 5 15:09:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 134491 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 70C0CB6F65 for ; Fri, 6 Jan 2012 02:09:56 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 28D1E9D25C; Thu, 5 Jan 2012 10:09:54 -0500 (EST) 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 iXZjh9HYb3M5; Thu, 5 Jan 2012 10:09:53 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id C1F399D21F; Thu, 5 Jan 2012 10:09:48 -0500 (EST) 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 EC4229D21F for ; Thu, 5 Jan 2012 10:09:47 -0500 (EST) 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 1fNGedJhVonb for ; Thu, 5 Jan 2012 10:09:42 -0500 (EST) Received: from latitanza.investici.org (latitanza.investici.org [82.94.249.234]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "smtp.autistici.org", Issuer "Autistici/Inventati Certification Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 45AA19C1B0 for ; Thu, 5 Jan 2012 10:09:42 -0500 (EST) Received: from [82.94.249.234] (latitanza [82.94.249.234]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 371D6982ED; Thu, 5 Jan 2012 15:09:39 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 latitanza.investici.org 371D6982ED From: Antonio Quartulli To: hostap@lists.shmoo.com Subject: [NOT-WORKING PATCH] wpa_supplicant: reinit peer sm in case of reconnection Date: Thu, 5 Jan 2012 16:09:05 +0100 Message-Id: <1325776145-5057-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <20120104144633.GA15391@ritirata.org> References: <20120104144633.GA15391@ritirata.org> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com In case of a node sending a new EAPOL message while the state is WPA_COMPLETED, the state machine has to be reinitialised and the keys have to be reset to permit a new renegotiation Signed-off-by: Antonio Quartulli --- To permit key renegotiation I actually deinit/reinit the ibss_rsn_peer structure associated with a "rebooting" peer. However with this patch, the rebooted node does not receive any EAPOL packet sent by the old one (the opposite works). Any clue about this problem? wpa_supplicant/ibss_rsn.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/wpa_supplicant/ibss_rsn.c b/wpa_supplicant/ibss_rsn.c index d4fa39d..ef91068 100644 --- a/wpa_supplicant/ibss_rsn.c +++ b/wpa_supplicant/ibss_rsn.c @@ -17,8 +17,10 @@ #include "common.h" #include "l2_packet/l2_packet.h" #include "rsn_supp/wpa.h" +#include "rsn_supp/wpa_i.h" #include "rsn_supp/wpa_ie.h" #include "ap/wpa_auth.h" +#include "ap/wpa_auth_i.h" #include "wpa_supplicant_i.h" #include "driver_i.h" #include "ibss_rsn.h" @@ -547,6 +549,7 @@ static int ibss_rsn_process_rx_eapol(struct ibss_rsn *ibss_rsn, { int supp; u8 *tmp; + u8 peermac[ETH_ALEN]; supp = ibss_rsn_eapol_dst_supp(buf, len); if (supp < 0) @@ -557,6 +560,26 @@ static int ibss_rsn_process_rx_eapol(struct ibss_rsn *ibss_rsn, return -1; os_memcpy(tmp, buf, len); if (supp) { + if (wpa_sm_get_state(peer->supp) == WPA_COMPLETED) { + memcpy(peermac, peer->addr, ETH_ALEN); + wpa_printf(MSG_DEBUG, "************* RESETTING! %pM\n", peermac); + ibss_rsn_stop(ibss_rsn, peermac); + + wpa_clear_keys(ibss_rsn->wpa_s, peermac); + + ibss_rsn_start(ibss_rsn, peermac); + + for (peer = ibss_rsn->peers; peer; peer = peer->next) { + if (os_memcmp(peermac, peer->addr, ETH_ALEN) == 0) + break; + } + + if (!peer) { + wpa_printf(MSG_DEBUG, "recreated peer not found!\n"); + return -1; + } + } + wpa_printf(MSG_DEBUG, "RSN: IBSS RX EAPOL for Supplicant"); wpa_sm_rx_eapol(peer->supp, peer->addr, tmp, len); } else {