Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f3d883b authored by Jouni Malinen's avatar Jouni Malinen Committed by Gerrit - the friendly Code Review server
Browse files

cfg80211: Specify frame and reason code for NL80211_CMD_DEL_STATION

The optional NL80211_ATTR_MGMT_SUBTYPE and NL80211_ATTR_REASON_CODE
attributes can now be included in NL80211_CMD_DEL_STATION to indicate to
the driver which frame (Deauthentication/Disassociation) and reason code
in that frame should be used to indicate removal to the specific
station. This is used by drivers that implement AP SME and generate
those frames internally.

Change-Id: Ic1b8ba98b5154909c2886a3e130f2846d9e88e76
CRs-Fixed: 743605
Git-commit: 988568669d171774b96e59fe35ef575df7f8cffd
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/linville/wireless-next.git


Signed-off-by: default avatarJouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarAnand N Sunkad <asunka@codeaurora.org>
parent d96e78b2
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -227,7 +227,11 @@
 *	the interface identified by %NL80211_ATTR_IFINDEX.
 * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
 *	or, if no MAC address given, all stations, on the interface identified
 *	by %NL80211_ATTR_IFINDEX.
 *	by %NL80211_ATTR_IFINDEX. %NL80211_ATTR_MGMT_SUBTYPE and
 *	%NL80211_ATTR_REASON_CODE can optionally be used to specify which type
 *	of disconnection indication should be sent to the station
 *	(Deauthentication or Disassociation frame and reason code for that
 *	frame).
 *
 * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to
 * 	destination %NL80211_ATTR_MAC on the interface identified by
+21 −0
Original line number Diff line number Diff line
@@ -4423,6 +4423,27 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
	if (!rdev->ops->del_station)
		return -EOPNOTSUPP;

	if (info->attrs[NL80211_ATTR_MGMT_SUBTYPE]) {
		params.subtype =
			nla_get_u8(info->attrs[NL80211_ATTR_MGMT_SUBTYPE]);
		if (params.subtype != IEEE80211_STYPE_DISASSOC >> 4 &&
		    params.subtype != IEEE80211_STYPE_DEAUTH >> 4)
			return -EINVAL;
	} else {
		/* Default to Deauthentication frame */
		params.subtype = IEEE80211_STYPE_DEAUTH >> 4;
	}

	if (info->attrs[NL80211_ATTR_REASON_CODE]) {
		params.reason_code =
			nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]);
		if (params.reason_code == 0)
			return -EINVAL; /* 0 is reserved */
	} else {
		/* Default to reason code 2 */
		params.reason_code = WLAN_REASON_PREV_AUTH_NOT_VALID;
	}

	return rdev_del_station(rdev, dev, &params);
}

+8 −2
Original line number Diff line number Diff line
@@ -688,14 +688,20 @@ DECLARE_EVENT_CLASS(station_del,
		WIPHY_ENTRY
		NETDEV_ENTRY
		MAC_ENTRY(sta_mac)
		__field(u8, subtype)
		__field(u16, reason_code)
	),
	TP_fast_assign(
		WIPHY_ASSIGN;
		NETDEV_ASSIGN;
		MAC_ASSIGN(sta_mac, params->mac);
		__entry->subtype = params->subtype;
		__entry->reason_code = params->reason_code;
	),
	TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: " MAC_PR_FMT,
		  WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac))
	TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: " MAC_PR_FMT
		  ", subtype: %u, reason_code: %u",
		  WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac),
		  __entry->subtype, __entry->reason_code)
);

DEFINE_EVENT(station_del, rdev_del_station,