Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1186001ybt; Thu, 18 Jun 2020 02:39:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtKE/lUK102ryVDo6GPwc1wsWnMVujptLrWOxvXSkHb0i7sqZjD41+ISUV2b5X6jH/ia7G X-Received: by 2002:aa7:da14:: with SMTP id r20mr3263449eds.7.1592473180572; Thu, 18 Jun 2020 02:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592473180; cv=none; d=google.com; s=arc-20160816; b=g2dSOlM8RK2rFkEDpKdnFEoWDBJAcfi1oIKjYQ0J86DHIvnVklTWprbm8jvRZFF62u 3GXGk04yd4yTE7phJCqGVVj/Fk437N91Xel55VJl6sJQG+K3cn0JL7gmgCxwScL4q4GZ ImuG43zMiUT19C41ilsdydsj0jBVsiIb4MaL0QqGoC/GMpQh5MudtSR/bg167dv428jw hoPD9Yplf23rt2sQQ/vGsMNoKIbVZcJ+2BLhzBqii39LvzA6iadievAP2i7QqAWzCcWO GPFUr8Rik88KqZl7sxyuuiToIAfKfKz7Wtu+mjOoRs3A4Q+QR4A6Ns9oKnc8Stl8i8Y1 0BBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=3Y+4bGmxUuBrJ2wELVbf7b/jmN3ZRc9RtHKxx4HqB5o=; b=Av2OwGBoPXwxxPz4URWXQK3cGegRKWw01chgSzXeTSVxMU3ALy7fNNT1own8ktChR1 IdmZEo8x+rxk2rWH2cIxqU5tbuh8+uFN9paMbiKy56h+36qndYoXpTvobdyqwFduEC8a FrVBsP4S6lVBRkPx/LjmleL5pmJzfLQleTsCdNrks/0qD6V/BZd2dCybQHDLWA80JJXt jY3ZtJ/1NpEHAY/uWnTBlEydHScD9+HOBOY0DNtHTCxJvq5kcW/NIu+JMJAk5+5cdQa9 0FDxXVRL640V8pjlRG/My1uEPoiAA+B0/Tl3vqp1Rkl2urgSx1H4P4AAV6VgZ/c6Us6y uu8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c21si1481714ejx.217.2020.06.18.02.39.08; Thu, 18 Jun 2020 02:39:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729170AbgFRJg3 (ORCPT + 99 others); Thu, 18 Jun 2020 05:36:29 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42470 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729060AbgFRJg3 (ORCPT ); Thu, 18 Jun 2020 05:36:29 -0400 Received: by mail-wr1-f68.google.com with SMTP id p5so5287417wrw.9 for ; Thu, 18 Jun 2020 02:36:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3Y+4bGmxUuBrJ2wELVbf7b/jmN3ZRc9RtHKxx4HqB5o=; b=Fywi3+OtMk/W/HGWwGMSeBciS8lOE36K8gK9AnzM0AUtyFHMNJ0aS+Z+NeuaY+gBIu CcERG2e5t5SFwTmcWWl5qscaIGLYPdtTFJxkMCW2Jop8exFl5iOB8JBYF3YmL053dmSW ntLG3FdSx4jKrADYye5z5kGrE8oiYrw6r69tJKvX3mL0hHy022RIBQwaHM9kqUozPNh5 /tcA2km8SuGab2NnxtaRnzLUZWO+U6pABWjCLPvPLMawoh7XMHgQjrRNiRk9DJebLaED gjnjqLi8K0XQdFAlAo5d3FJ+0ro863ACnzenW4rkF4ost97nZGX4YFrfNjCCPFR5n2k5 Ttcg== X-Gm-Message-State: AOAM530MzUzd7Q2TAEbEEjzCwuAWmLiRSFnz4GWQ0rMopxF+QqD4/lEv /fSRkGWumWS6Gxh+jkT1VNRs6znn X-Received: by 2002:adf:f552:: with SMTP id j18mr3466415wrp.279.1592472987038; Thu, 18 Jun 2020 02:36:27 -0700 (PDT) Received: from localhost.localdomain ([87.70.42.213]) by smtp.gmail.com with ESMTPSA id g18sm2859190wme.17.2020.06.18.02.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 02:36:26 -0700 (PDT) From: Shay Bar To: Johannes Berg Cc: linux-wireless@vger.kernel.org, shay.bar@celeno.com Subject: [PATCH] mac80211: Send deauth to STA's upon AP stop Date: Thu, 18 Jun 2020 12:36:09 +0300 Message-Id: <20200618093609.16514-1-shay.bar@celeno.com> X-Mailer: git-send-email 2.17.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In current code, AP is not informing STA when its going down. So STA keep looking the AP (Null function etc.) and can't find it (it is down). Fix is to send deauth to all associated STA's upon AP stop. __sta_info_flush() with a true bool is only called from ieee80211_stop_ap(). Rename "vlans" -> "ap_stop". Signed-off-by: Shay Bar --- net/mac80211/sta_info.c | 20 ++++++++++++++++---- net/mac80211/sta_info.h | 5 +++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index cd8487bc6fc2..46b26e66430a 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -1179,7 +1179,7 @@ void sta_info_stop(struct ieee80211_local *local) } -int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans) +int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool ap_stop) { struct ieee80211_local *local = sdata->local; struct sta_info *sta, *tmp; @@ -1188,13 +1188,25 @@ int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans) might_sleep(); - WARN_ON(vlans && sdata->vif.type != NL80211_IFTYPE_AP); - WARN_ON(vlans && !sdata->bss); + WARN_ON(ap_stop && sdata->vif.type != NL80211_IFTYPE_AP); + WARN_ON(ap_stop && !sdata->bss); mutex_lock(&local->sta_mtx); list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { if (sdata == sta->sdata || - (vlans && sdata->bss == sta->sdata->bss)) { + (ap_stop && sdata->bss == sta->sdata->bss)) { + if (ap_stop) { + u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; + u16 stype = IEEE80211_STYPE_DEAUTH; + u16 reason = WLAN_REASON_DEAUTH_LEAVING; + ieee80211_send_deauth_disassoc(sdata, + sta->sta.addr, + sdata->vif.addr, + stype, + reason, + true, + frame_buf); + } if (!WARN_ON(__sta_info_destroy_part1(sta))) list_add(&sta->free_list, &free_list); ret++; diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 49728047dfad..f0aedfa221c2 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -789,9 +789,10 @@ void sta_info_stop(struct ieee80211_local *local); * Returns the number of removed STA entries. * * @sdata: sdata to remove all stations from - * @vlans: if the given interface is an AP interface, also flush VLANs + * @ap_stop: if the given interface is an AP being stopped, we should send + * deauth to STA's and flush VLANs */ -int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans); +int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool ap_stop); static inline int sta_info_flush(struct ieee80211_sub_if_data *sdata) { -- 2.17.1