aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-02-14 18:48:33 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-03-06 10:35:40 -0500
commit77ee7c891a04c3d254711ddf1bde5d7381339fb3 (patch)
tree0983da0e1067bcf1c4b34ffd6bc8a0fb97eb5dfd /include
parentff276691e9f13bc1619cc8f091fb887c2b4f98a1 (diff)
cfg80211: comprehensively check station changes
The station change API isn't being checked properly before drivers are called, and as a result it is difficult to see what should be allowed and what not. In order to comprehensively check the API parameters parse everything first, and then have the driver call a function (cfg80211_check_station_change()) with the additionally information about the kind of station that is being changed; this allows the function to make better decisions than the old code could. While at it, also add a few checks, particularly in mesh and clarify the TDLS station lifetime in documentation. To be able to reduce a few checks, ignore any flag set bits when the mask isn't set, they shouldn't be applied then. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/net/cfg80211.h48
-rw-r--r--include/uapi/linux/nl80211.h16
2 files changed, 60 insertions, 4 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7ca321d2b599..ed2b08da3b93 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -678,6 +678,49 @@ struct station_parameters {
678}; 678};
679 679
680/** 680/**
681 * enum cfg80211_station_type - the type of station being modified
682 * @CFG80211_STA_AP_CLIENT: client of an AP interface
683 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
684 * the AP MLME in the device
685 * @CFG80211_STA_AP_STA: AP station on managed interface
686 * @CFG80211_STA_IBSS: IBSS station
687 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
688 * while TDLS setup is in progress, it moves out of this state when
689 * being marked authorized; use this only if TDLS with external setup is
690 * supported/used)
691 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
692 * entry that is operating, has been marked authorized by userspace)
693 * @CFG80211_STA_MESH_PEER_NONSEC: peer on mesh interface (non-secured)
694 * @CFG80211_STA_MESH_PEER_SECURE: peer on mesh interface (secured)
695 */
696enum cfg80211_station_type {
697 CFG80211_STA_AP_CLIENT,
698 CFG80211_STA_AP_MLME_CLIENT,
699 CFG80211_STA_AP_STA,
700 CFG80211_STA_IBSS,
701 CFG80211_STA_TDLS_PEER_SETUP,
702 CFG80211_STA_TDLS_PEER_ACTIVE,
703 CFG80211_STA_MESH_PEER_NONSEC,
704 CFG80211_STA_MESH_PEER_SECURE,
705};
706
707/**
708 * cfg80211_check_station_change - validate parameter changes
709 * @wiphy: the wiphy this operates on
710 * @params: the new parameters for a station
711 * @statype: the type of station being modified
712 *
713 * Utility function for the @change_station driver method. Call this function
714 * with the appropriate station type looking up the station (and checking that
715 * it exists). It will verify whether the station change is acceptable, and if
716 * not will return an error code. Note that it may modify the parameters for
717 * backward compatibility reasons, so don't use them before calling this.
718 */
719int cfg80211_check_station_change(struct wiphy *wiphy,
720 struct station_parameters *params,
721 enum cfg80211_station_type statype);
722
723/**
681 * enum station_info_flags - station information flags 724 * enum station_info_flags - station information flags
682 * 725 *
683 * Used by the driver to indicate which info in &struct station_info 726 * Used by the driver to indicate which info in &struct station_info
@@ -1770,9 +1813,8 @@ struct cfg80211_gtk_rekey_data {
1770 * @change_station: Modify a given station. Note that flags changes are not much 1813 * @change_station: Modify a given station. Note that flags changes are not much
1771 * validated in cfg80211, in particular the auth/assoc/authorized flags 1814 * validated in cfg80211, in particular the auth/assoc/authorized flags
1772 * might come to the driver in invalid combinations -- make sure to check 1815 * might come to the driver in invalid combinations -- make sure to check
1773 * them, also against the existing state! Also, supported_rates changes are 1816 * them, also against the existing state! Drivers must call
1774 * not checked in station mode -- drivers need to reject (or ignore) them 1817 * cfg80211_check_station_change() to validate the information.
1775 * for anything but TDLS peers.
1776 * @get_station: get station information for the station identified by @mac 1818 * @get_station: get station information for the station identified by @mac
1777 * @dump_station: dump station callback -- resume dump at index @idx 1819 * @dump_station: dump station callback -- resume dump at index @idx
1778 * 1820 *
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 7dcc69f73d2c..523ed3d65b41 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -36,7 +36,21 @@
36 * The station is still assumed to belong to the AP interface it was added 36 * The station is still assumed to belong to the AP interface it was added
37 * to. 37 * to.
38 * 38 *
39 * TODO: need more info? 39 * Station handling varies per interface type and depending on the driver's
40 * capabilities.
41 *
42 * For drivers supporting TDLS with external setup (WIPHY_FLAG_SUPPORTS_TDLS
43 * and WIPHY_FLAG_TDLS_EXTERNAL_SETUP), the station lifetime is as follows:
44 * - a setup station entry is added, not yet authorized, without any rate
45 * or capability information, this just exists to avoid race conditions
46 * - when the TDLS setup is done, a single NL80211_CMD_SET_STATION is valid
47 * to add rate and capability information to the station and at the same
48 * time mark it authorized.
49 * - %NL80211_TDLS_ENABLE_LINK is then used
50 * - after this, the only valid operation is to remove it by tearing down
51 * the TDLS link (%NL80211_TDLS_DISABLE_LINK)
52 *
53 * TODO: need more info for other interface types
40 */ 54 */
41 55
42/** 56/**