linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [RFC v5 4/9] cfg80211: Support all iftypes in autodisconnect_wk
Date: Tue, 13 Mar 2018 16:59:37 -0500	[thread overview]
Message-ID: <20180313215942.29176-5-denkenz@gmail.com> (raw)
In-Reply-To: <20180313215942.29176-1-denkenz@gmail.com>

Currently autodisconnect_wk assumes that only interface types of
P2P_CLIENT and STATION use conn_owner_nlportid.  Change this so all
interface types are supported.

Signed-off-by: Denis Kenzior <denkenz@gmail.com>
---
 net/wireless/sme.c | 43 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 701cfd7acc1b..5df6b33db786 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -1239,17 +1239,38 @@ void cfg80211_autodisconnect_wk(struct work_struct *work)
 	wdev_lock(wdev);
 
 	if (wdev->conn_owner_nlportid) {
-		/*
-		 * Use disconnect_bssid if still connecting and ops->disconnect
-		 * not implemented.  Otherwise we can use cfg80211_disconnect.
-		 */
-		if (rdev->ops->disconnect || wdev->current_bss)
-			cfg80211_disconnect(rdev, wdev->netdev,
-					    WLAN_REASON_DEAUTH_LEAVING, true);
-		else
-			cfg80211_mlme_deauth(rdev, wdev->netdev,
-					     wdev->disconnect_bssid, NULL, 0,
-					     WLAN_REASON_DEAUTH_LEAVING, false);
+		switch (wdev->iftype) {
+		case NL80211_IFTYPE_ADHOC:
+			cfg80211_leave_ibss(rdev, wdev->netdev, false);
+			break;
+		case NL80211_IFTYPE_AP:
+		case NL80211_IFTYPE_P2P_GO:
+			cfg80211_stop_ap(rdev, wdev->netdev, false);
+			break;
+		case NL80211_IFTYPE_MESH_POINT:
+			cfg80211_leave_mesh(rdev, wdev->netdev);
+			break;
+		case NL80211_IFTYPE_STATION:
+		case NL80211_IFTYPE_P2P_CLIENT:
+			/*
+			 * Use disconnect_bssid if still connecting and
+			 * ops->disconnect not implemented.  Otherwise we can
+			 * use cfg80211_disconnect.
+			 */
+			if (rdev->ops->disconnect || wdev->current_bss)
+				cfg80211_disconnect(rdev, wdev->netdev,
+						    WLAN_REASON_DEAUTH_LEAVING,
+						    true);
+			else
+				cfg80211_mlme_deauth(rdev, wdev->netdev,
+						     wdev->disconnect_bssid,
+						     NULL, 0,
+						     WLAN_REASON_DEAUTH_LEAVING,
+						     false);
+			break;
+		default:
+			break;
+		}
 	}
 
 	wdev_unlock(wdev);
-- 
2.13.5

  parent reply	other threads:[~2018-03-13 21:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 21:59 [RFC v5 0/9] EAPoL over NL80211 Denis Kenzior
2018-03-13 21:59 ` [RFC v5 1/9] nl80211: Add CMD_CONTROL_PORT_FRAME API Denis Kenzior
2018-03-13 21:59 ` [RFC v5 2/9] nl80211: Implement TX of control port frames Denis Kenzior
2018-03-13 21:59 ` [RFC v5 3/9] nl80211: Add CONTROL_PORT_OVER_NL80211 attribute Denis Kenzior
2018-03-21  7:47   ` Johannes Berg
2018-03-21 15:01     ` Denis Kenzior
2018-03-21 15:09       ` Johannes Berg
2018-03-13 21:59 ` Denis Kenzior [this message]
2018-03-21  7:46   ` [RFC v5 4/9] cfg80211: Support all iftypes in autodisconnect_wk Johannes Berg
2018-03-21 15:27     ` Denis Kenzior
2018-03-21 15:40       ` Johannes Berg
2018-03-13 21:59 ` [RFC v5 5/9] nl80211: Add SOCKET_OWNER support to JOIN_IBSS Denis Kenzior
2018-03-13 21:59 ` [RFC v5 6/9] nl80211: Add SOCKET_OWNER support to JOIN_MESH Denis Kenzior
2018-03-13 21:59 ` [RFC v5 7/9] nl80211: Add SOCKET_OWNER support to START_AP Denis Kenzior
2018-03-13 21:59 ` [RFC v5 8/9] mac80211: Add support for tx_control_port Denis Kenzior
2018-03-13 21:59 ` [RFC v5 9/9] mac80211: Send control port frames over nl80211 Denis Kenzior
2018-03-21 15:13 ` [RFC v5 0/9] EAPoL over NL80211 Johannes Berg
2018-03-21 15:18   ` Denis Kenzior
2018-03-22 10:28     ` Johannes Berg
2018-03-22 13:54       ` Denis Kenzior
2018-03-23  8:04         ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180313215942.29176-5-denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).