Commit 94ba9271 authored by Ilan Peer's avatar Ilan Peer Committed by Johannes Berg

mac80211: Call mgd_prep_tx before transmitting deauthentication

In multi channel scenarios, when disassociating from the AP before a
beacon was heard from the AP, it is not guaranteed that the virtual
interface is granted air time for the transmission of the
deauthentication frame. This in turn can lead to various issues as
the AP might never get the deauthentication frame.

To mitigate such possible issues, add a HW flag indicating that the
driver requires mac80211 to call the mgd_prep_tx() driver callback
to make sure that the virtual interface is granted immediate airtime
to be able to transmit the frame, in case that no beacon was heard
from the AP.
Signed-off-by: default avatarIlan Peer <ilan.peer@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent a1f2ba04
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
* Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright 2013-2014 Intel Mobile Communications GmbH
* Copyright (C) 2015 - 2017 Intel Deutschland GmbH * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
* Copyright (C) 2018 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -2069,6 +2070,14 @@ struct ieee80211_txq { ...@@ -2069,6 +2070,14 @@ struct ieee80211_txq {
* @IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA: Hardware supports buffer STA on * @IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA: Hardware supports buffer STA on
* TDLS links. * TDLS links.
* *
* @IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP: The driver requires the
* mgd_prepare_tx() callback to be called before transmission of a
* deauthentication frame in case the association was completed but no
* beacon was heard. This is required in multi-channel scenarios, where the
* virtual interface might not be given air time for the transmission of
* the frame, as it is not synced with the AP/P2P GO yet, and thus the
* deauthentication frame might not be transmitted.
*
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
*/ */
enum ieee80211_hw_flags { enum ieee80211_hw_flags {
...@@ -2112,6 +2121,7 @@ enum ieee80211_hw_flags { ...@@ -2112,6 +2121,7 @@ enum ieee80211_hw_flags {
IEEE80211_HW_REPORTS_LOW_ACK, IEEE80211_HW_REPORTS_LOW_ACK,
IEEE80211_HW_SUPPORTS_TX_FRAG, IEEE80211_HW_SUPPORTS_TX_FRAG,
IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA, IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA,
IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP,
/* keep last, obviously */ /* keep last, obviously */
NUM_IEEE80211_HW_FLAGS NUM_IEEE80211_HW_FLAGS
...@@ -3356,6 +3366,9 @@ enum ieee80211_reconfig_type { ...@@ -3356,6 +3366,9 @@ enum ieee80211_reconfig_type {
* management frame prior to having successfully associated to allow the * management frame prior to having successfully associated to allow the
* driver to give it channel time for the transmission, to get a response * driver to give it channel time for the transmission, to get a response
* and to be able to synchronize with the GO. * and to be able to synchronize with the GO.
* For drivers that set %IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, mac80211
* would also call this function before transmitting a deauthentication
* frame in case that no beacon was heard from the AP/P2P GO.
* The callback will be called before each transmission and upon return * The callback will be called before each transmission and upon return
* mac80211 will transmit the frame right away. * mac80211 will transmit the frame right away.
* The callback is optional and can (should!) sleep. * The callback is optional and can (should!) sleep.
......
...@@ -212,6 +212,7 @@ static const char *hw_flag_names[] = { ...@@ -212,6 +212,7 @@ static const char *hw_flag_names[] = {
FLAG(REPORTS_LOW_ACK), FLAG(REPORTS_LOW_ACK),
FLAG(SUPPORTS_TX_FRAG), FLAG(SUPPORTS_TX_FRAG),
FLAG(SUPPORTS_TDLS_BUFFER_STA), FLAG(SUPPORTS_TDLS_BUFFER_STA),
FLAG(DEAUTH_NEED_MGD_TX_PREP),
#undef FLAG #undef FLAG
}; };
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Copyright 2007, Michael Wu <flamingice@sourmilk.net> * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
* Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright 2013-2014 Intel Mobile Communications GmbH
* Copyright (C) 2015 - 2017 Intel Deutschland GmbH * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
* Copyright (C) 2018 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -2008,9 +2009,22 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -2008,9 +2009,22 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
ieee80211_flush_queues(local, sdata, true); ieee80211_flush_queues(local, sdata, true);
/* deauthenticate/disassociate now */ /* deauthenticate/disassociate now */
if (tx || frame_buf) if (tx || frame_buf) {
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
/*
* In multi channel scenarios guarantee that the virtual
* interface is granted immediate airtime to transmit the
* deauthentication frame by calling mgd_prepare_tx, if the
* driver requested so.
*/
if (ieee80211_hw_check(&local->hw, DEAUTH_NEED_MGD_TX_PREP) &&
!ifmgd->have_beacon)
drv_mgd_prepare_tx(sdata->local, sdata);
ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, stype, ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, stype,
reason, tx, frame_buf); reason, tx, frame_buf);
}
/* flush out frame - make sure the deauth was actually sent */ /* flush out frame - make sure the deauth was actually sent */
if (tx) if (tx)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment