Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4989100ybl; Tue, 14 Jan 2020 01:28:18 -0800 (PST) X-Google-Smtp-Source: APXvYqx8MHbRtFhEeTsh++bAzsIugtJsG0MtLrQKHI9fRKvZw+aJkwjDcUi3ilGhAgDDT40SHapY X-Received: by 2002:aca:5490:: with SMTP id i138mr16195040oib.69.1578994098352; Tue, 14 Jan 2020 01:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578994098; cv=none; d=google.com; s=arc-20160816; b=s56hlNmiPY6iEXfKVBEp3COVfNAK2NTaHYtsj0eKdgvJW0oC0R2pi6QCxOktxQXbGt 9Wm7T1qhq/k3UluTJCViRlzPVkrtrQtSGoI249Lq4Uwk4YgO5qeKVZaaWMHWM3TT7GDw hR+qYq2B77PU47hpOAWDOrGD/4Y4CBjrbo0vhrE5GtnO6XAt8URjTRskiv+UZKfhJaLg gUX866JUMp7A1YNMMDPRlHZKVlg5Y3Lfgk82IBcMlVEvjfGRqiOm2Im3vHALN3+G+eOz +Nl1FDAkel728uuJBuJoTxAi7tlPEvabAxoOHGqsPJo/QoMHU2ToRFcjfuWkj/nhq/T3 kFqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=3s/szZA2auHsjSbHB9xiorsv/iglmF77xkMxyC4fXNw=; b=xCjc5FxrTrSeJKhrc0jLqEyS38f5a7swkdPjAK8HrHlnU3UPD2PKGRcd9/ijUS/sdC PRHzLrvtWK96QackMvxFeNnXbYqkf8Ko0zSSxwZ8uexFwcNpQC28jVH2E4qwNZXjYLUR CrrE8zpSVEDCqx7bIKYVaarZlmhs08UMFMlTHNyf9Qf1HHn7uJNPg8EjoTNPy0Y2zRFs i+ql/UlHF9MZxGHA3njbQcD4jIfEB4/KyM1MSWHREsaToa+TGBqxhwnjVDeS4VOfSjtm LK85AmvziEOOlcidH9QcYIKiYxHTgiNWXE/G6f912S5u7pS3QqWSTgxWbeIyiNtHXmqH 5aOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l186si7283389oib.226.2020.01.14.01.28.01; Tue, 14 Jan 2020 01:28:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725956AbgANJ1z (ORCPT + 99 others); Tue, 14 Jan 2020 04:27:55 -0500 Received: from mout.perfora.net ([74.208.4.197]:56397 "EHLO mout.perfora.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgANJ1z (ORCPT ); Tue, 14 Jan 2020 04:27:55 -0500 Received: from [192.168.0.152] ([151.127.53.97]) by mrelay.perfora.net (mreueus001 [74.208.5.2]) with ESMTPSA (Nemesis) id 0LaE7U-1jWRGy04yM-00m1Qp; Tue, 14 Jan 2020 10:27:50 +0100 Subject: Re: [PATCH v2 0/2] Allow userspace to reset IBSS stations to fix aggregation issue To: Koen Vandeputte , Johannes Berg Cc: linux-wireless@vger.kernel.org, =?UTF-8?Q?Krzysztof_Ha=c5=82asa?= References: <20200103103457.22778-1-nicolas.cavallari@green-communications.fr> From: Nicolas Cavallari Message-ID: Date: Tue, 14 Jan 2020 10:27:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:oh1DwTgKmsCDWloRihLUwTp37qpiJ9fou1QZOG4DWFxpv0APx+7 cXXfnRAtN0F4dFew/3ErwHuu9GKmZ2wY1ql3RJBLgFdBJHdazL+UPX2Ewa/q19v2Ih+Vc0a P4XWO0zcziEgwwBVp9HEmazkcnW0glOeFVLTzsPP+9Yf2AnjdmiVq80eZHSN/qSzmEoRGVL uBofAAHvfZYBysmG90cgA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:uCHExjcsoMw=:p/nSPnnX4WEsCo5/0G0aKw hzpqHunrZT3iRUF7Hv1/cTxOy98mQuzd3u9FF3BFD8brmnrLLYeehBSndvkpkXTnsygPEDBO8 492SX5r8ZmUufNafD8Xl96BamYURx8IhINHCKEv6A4TzjxrHTlci9WLIUrlbjX5zy4aytaDvW ac+l0Hx8M3IVtg2qEm8Jv8d49J2hajjJT4VKwwMTX9ER8+cB7RsN6swmgnySQ1PU/2+x2zDu5 VPdg93bZ/uShTRGiCUYISC8Bxr8xAEir3e4QmrbGm8ZgLVshnsV+BrcKAbleUBqFx/TCLILS6 iLTbUbE6/On3fugMuqZp5TSraY8hX9ilWJQslKSuITV6+fGmjKV77Xuq+bFgEbxyaaqhR96lH cI3cHFiyGsgRTyXpD1fGAyXN5kQeTTaoRBPTb1mkHcpTNEV9VCPcXw9ABfi6M0aB0m62l/yaE kGltUMZxnmimPrCZbyy6ApEZmMAULAhH+KoRG808pnW3y15Zla+7hVWMtwkmrL1cxkP9diExq W0QalDJQZEokHGuzs81gkU5c1NtkUuqLCfPgcI30K2QwTFin2Teb6LV5LbvUrQpkuwgokd7NO GEjH1k5WUhqB228jDQXfBdKRoz81YesPNXe5g7PU7KFu44UdbaojTWYdzpFhen34NYGCzQebt OA6qi1yLYCEX88Wch9P/k0lTlkg/p1cwkkWZHLqUALaOAznkMjkWRQPepbJK6vIADQ/TjwrWB fY2chRM5//GcOeEXQRVcrILJDTWj/muZnpvb+ZchUKOv0eNeT7oNnqT9X2yhxuD7qEOx48hVW 1Tjrhi4KT8bHGYkZcXiOjo7gz2MM1JAj8oFO5BtXb8uB/eutvmRXsJQ22j+1qFHc4MipuxZ/b MOe12SslitvGrSR0tlou6W9WOybS4M6gvAXfAfeTle4G/fmKpPItkX8IapIPue Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 13/01/2020 12:45, Koen Vandeputte wrote: > I'm more than happy to give this a thorough test on dozens of devices offshore > > which I suspect are suffering from this issue as they sail in-out of range, > > but as a new flag is defined in nl80211.h, is anything additional required at wpa_sup side to use this? I use this blunt patch for now, until this issue settles. Note that it only work in IBSS RSN case, because that's the only mode where wpa_supplicant registers for auth frames (and thus the kernel doesn't handle them) and does reboot detection. diff --git a/wpa_supplicant/ibss_rsn.c b/wpa_supplicant/ibss_rsn.c index 37368c4cb..026750161 100644 --- a/wpa_supplicant/ibss_rsn.c +++ b/wpa_supplicant/ibss_rsn.c @@ -353,7 +353,11 @@ static int auth_set_key(void *ctx, int vlan_id, enum wpa_alg alg, static void ibss_rsn_disconnect(void *ctx, const u8 *addr, u16 reason) { struct ibss_rsn *ibss_rsn = ctx; - wpa_drv_sta_deauth(ibss_rsn->wpa_s, addr, reason); + struct ibss_rsn_peer *peer = ibss_rsn_get_peer(ibss_rsn, addr); + if (peer && wpa_drv_sta_remove(ibss_rsn->wpa_s, addr) == 0) + peer->authentication_status |= IBSS_RSN_PENDING_DELETION; + else + wpa_drv_sta_deauth(ibss_rsn->wpa_s, addr, reason); } @@ -810,6 +814,13 @@ int ibss_rsn_rx_eapol(struct ibss_rsn *ibss_rsn, const u8 *src_addr, return -1; peer = ibss_rsn_get_peer(ibss_rsn, src_addr); + if (peer->authentication_status & IBSS_RSN_PENDING_DELETION) { + wpa_printf(MSG_DEBUG, + "RSN: Ignoring RX EAPOL from removed peer " MACSTR, + MAC2STR(src_addr)); + return -1; + } + if (peer) return ibss_rsn_process_rx_eapol(ibss_rsn, peer, buf, len); @@ -849,6 +860,10 @@ static void ibss_rsn_handle_auth_1_of_2(struct ibss_rsn *ibss_rsn, { wpa_printf(MSG_DEBUG, "RSN: IBSS RX Auth frame (SEQ 1) from " MACSTR, MAC2STR(addr)); + if (peer && peer->authentication_status & IBSS_RSN_PENDING_DELETION) { + wpa_printf(MSG_DEBUG, "RSN: Ignoring auth from removed sta"); + return; + } if (peer && peer->authentication_status & (IBSS_RSN_SET_PTK_SUPP | @@ -883,8 +898,16 @@ static void ibss_rsn_handle_auth_1_of_2(struct ibss_rsn *ibss_rsn, wpa_printf(MSG_DEBUG, "RSN: IBSS Reinitializing station " MACSTR, MAC2STR(addr)); - ibss_rsn_stop(ibss_rsn, addr); - peer = NULL; + if (wpa_drv_sta_remove(ibss_rsn->wpa_s, addr) == 0) { + wpa_printf(MSG_DEBUG, + "RSN: IBSS sta deletion requested."); + peer->authentication_status + |= IBSS_RSN_PENDING_DELETION; + return; + } else { + ibss_rsn_stop(ibss_rsn, addr); + peer = NULL; + } } if (!peer) { @@ -935,6 +958,11 @@ void ibss_rsn_handle_auth(struct ibss_rsn *ibss_rsn, const u8 *auth_frame, "unknown STA " MACSTR, MAC2STR(header->sa)); break; } + if (peer->authentication_status & IBSS_RSN_PENDING_DELETION) { + wpa_printf(MSG_DEBUG, + "RSN: Ignoring auth from removed sta"); + break; + } /* authentication has been completed */ eloop_cancel_timeout(ibss_rsn_auth_timeout, peer, NULL); diff --git a/wpa_supplicant/ibss_rsn.h b/wpa_supplicant/ibss_rsn.h index 626c54354..17f5ca0ee 100644 --- a/wpa_supplicant/ibss_rsn.h +++ b/wpa_supplicant/ibss_rsn.h @@ -25,6 +25,8 @@ struct ibss_rsn; #define IBSS_RSN_SET_PTK_AUTH 0x10 /* PTK completion reported */ #define IBSS_RSN_REPORTED_PTK 0x20 +/* requested STA deletion to kernel */ +#define IBSS_RSN_PENDING_DELETION 0x40 struct ibss_rsn_peer { struct ibss_rsn_peer *next;