diff options
author | Jouni Malinen <jouni@qca.qualcomm.com> | 2014-10-20 06:20:45 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-10-20 10:39:23 -0400 |
commit | 988568669d171774b96e59fe35ef575df7f8cffd (patch) | |
tree | 177772b25c1cc75c298d8cf1a4245dcffe38d691 | |
parent | 89c771e5a62b856f4705f189892c489190edaec1 (diff) |
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.
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | include/net/cfg80211.h | 5 | ||||
-rw-r--r-- | include/uapi/linux/nl80211.h | 6 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 21 | ||||
-rw-r--r-- | net/wireless/trace.h | 10 |
4 files changed, 39 insertions, 3 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index ebb69f671979..ed896c0b5b8b 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -804,9 +804,14 @@ struct station_parameters { | |||
804 | * Used to delete a station entry (or all stations). | 804 | * Used to delete a station entry (or all stations). |
805 | * | 805 | * |
806 | * @mac: MAC address of the station to remove or NULL to remove all stations | 806 | * @mac: MAC address of the station to remove or NULL to remove all stations |
807 | * @subtype: Management frame subtype to use for indicating removal | ||
808 | * (10 = Disassociation, 12 = Deauthentication) | ||
809 | * @reason_code: Reason code for the Disassociation/Deauthentication frame | ||
807 | */ | 810 | */ |
808 | struct station_del_parameters { | 811 | struct station_del_parameters { |
809 | const u8 *mac; | 812 | const u8 *mac; |
813 | u8 subtype; | ||
814 | u16 reason_code; | ||
810 | }; | 815 | }; |
811 | 816 | ||
812 | /** | 817 | /** |
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 846071b0cde9..b553c48404d3 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
@@ -227,7 +227,11 @@ | |||
227 | * the interface identified by %NL80211_ATTR_IFINDEX. | 227 | * the interface identified by %NL80211_ATTR_IFINDEX. |
228 | * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC | 228 | * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC |
229 | * or, if no MAC address given, all stations, on the interface identified | 229 | * or, if no MAC address given, all stations, on the interface identified |
230 | * by %NL80211_ATTR_IFINDEX. | 230 | * by %NL80211_ATTR_IFINDEX. %NL80211_ATTR_MGMT_SUBTYPE and |
231 | * %NL80211_ATTR_REASON_CODE can optionally be used to specify which type | ||
232 | * of disconnection indication should be sent to the station | ||
233 | * (Deauthentication or Disassociation frame and reason code for that | ||
234 | * frame). | ||
231 | * | 235 | * |
232 | * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to | 236 | * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to |
233 | * destination %NL80211_ATTR_MAC on the interface identified by | 237 | * destination %NL80211_ATTR_MAC on the interface identified by |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 40cf7b937926..0c0f2045e1f8 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -4414,6 +4414,27 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info) | |||
4414 | if (!rdev->ops->del_station) | 4414 | if (!rdev->ops->del_station) |
4415 | return -EOPNOTSUPP; | 4415 | return -EOPNOTSUPP; |
4416 | 4416 | ||
4417 | if (info->attrs[NL80211_ATTR_MGMT_SUBTYPE]) { | ||
4418 | params.subtype = | ||
4419 | nla_get_u8(info->attrs[NL80211_ATTR_MGMT_SUBTYPE]); | ||
4420 | if (params.subtype != IEEE80211_STYPE_DISASSOC >> 4 && | ||
4421 | params.subtype != IEEE80211_STYPE_DEAUTH >> 4) | ||
4422 | return -EINVAL; | ||
4423 | } else { | ||
4424 | /* Default to Deauthentication frame */ | ||
4425 | params.subtype = IEEE80211_STYPE_DEAUTH >> 4; | ||
4426 | } | ||
4427 | |||
4428 | if (info->attrs[NL80211_ATTR_REASON_CODE]) { | ||
4429 | params.reason_code = | ||
4430 | nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]); | ||
4431 | if (params.reason_code == 0) | ||
4432 | return -EINVAL; /* 0 is reserved */ | ||
4433 | } else { | ||
4434 | /* Default to reason code 2 */ | ||
4435 | params.reason_code = WLAN_REASON_PREV_AUTH_NOT_VALID; | ||
4436 | } | ||
4437 | |||
4417 | return rdev_del_station(rdev, dev, ¶ms); | 4438 | return rdev_del_station(rdev, dev, ¶ms); |
4418 | } | 4439 | } |
4419 | 4440 | ||
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index b1339400631d..cdb2c2ef1ae1 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -688,14 +688,20 @@ DECLARE_EVENT_CLASS(station_del, | |||
688 | WIPHY_ENTRY | 688 | WIPHY_ENTRY |
689 | NETDEV_ENTRY | 689 | NETDEV_ENTRY |
690 | MAC_ENTRY(sta_mac) | 690 | MAC_ENTRY(sta_mac) |
691 | __field(u8, subtype) | ||
692 | __field(u16, reason_code) | ||
691 | ), | 693 | ), |
692 | TP_fast_assign( | 694 | TP_fast_assign( |
693 | WIPHY_ASSIGN; | 695 | WIPHY_ASSIGN; |
694 | NETDEV_ASSIGN; | 696 | NETDEV_ASSIGN; |
695 | MAC_ASSIGN(sta_mac, params->mac); | 697 | MAC_ASSIGN(sta_mac, params->mac); |
698 | __entry->subtype = params->subtype; | ||
699 | __entry->reason_code = params->reason_code; | ||
696 | ), | 700 | ), |
697 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: " MAC_PR_FMT, | 701 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: " MAC_PR_FMT |
698 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac)) | 702 | ", subtype: %u, reason_code: %u", |
703 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac), | ||
704 | __entry->subtype, __entry->reason_code) | ||
699 | ); | 705 | ); |
700 | 706 | ||
701 | DEFINE_EVENT(station_del, rdev_del_station, | 707 | DEFINE_EVENT(station_del, rdev_del_station, |