cfg80211: fix a crash in nl80211_send_station
[firefly-linux-kernel-4.4.55.git] / include / net / cfg80211.h
index 396e8fc8910e5901a8ae7e3b0c976fb3435b7e2b..96876d366c6a38359b00290057a124e8f9bf7750 100644 (file)
 #include <linux/ieee80211.h>
 #include <net/regulatory.h>
 
-/* remove once we remove the wext stuff */
-#include <net/iw_handler.h>
-#include <linux/wireless.h>
-
-
 /**
  * DOC: Introduction
  *
@@ -426,6 +421,7 @@ struct station_parameters {
  * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
  * @STATION_INFO_BSS_PARAM: @bss_param filled
  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
+ * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
  */
 enum station_info_flags {
        STATION_INFO_INACTIVE_TIME      = 1<<0,
@@ -444,7 +440,8 @@ enum station_info_flags {
        STATION_INFO_SIGNAL_AVG         = 1<<13,
        STATION_INFO_RX_BITRATE         = 1<<14,
        STATION_INFO_BSS_PARAM          = 1<<15,
-       STATION_INFO_CONNECTED_TIME     = 1<<16
+       STATION_INFO_CONNECTED_TIME     = 1<<16,
+       STATION_INFO_ASSOC_REQ_IES      = 1<<17
 };
 
 /**
@@ -536,6 +533,11 @@ struct sta_bss_parameters {
  *     This number should increase every time the list of stations
  *     changes, i.e. when a station is added or removed, so that
  *     userspace can tell whether it got a consistent snapshot.
+ * @assoc_req_ies: IEs from (Re)Association Request.
+ *     This is used only when in AP mode with drivers that do not use
+ *     user space MLME/SME implementation. The information is provided for
+ *     the cfg80211_new_sta() calls to notify user space of the IEs.
+ * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
  */
 struct station_info {
        u32 filled;
@@ -558,6 +560,9 @@ struct station_info {
        struct sta_bss_parameters bss_param;
 
        int generation;
+
+       const u8 *assoc_req_ies;
+       size_t assoc_req_ies_len;
 };
 
 /**
@@ -777,6 +782,7 @@ struct cfg80211_ssid {
  * @n_channels: total number of channels to scan
  * @ie: optional information element(s) to add into Probe Request or %NULL
  * @ie_len: length of ie in octets
+ * @rates: bitmap of rates to advertise for each band
  * @wiphy: the wiphy this was for
  * @dev: the interface
  * @aborted: (internal) scan request was notified as aborted
@@ -788,6 +794,8 @@ struct cfg80211_scan_request {
        const u8 *ie;
        size_t ie_len;
 
+       u32 rates[IEEE80211_NUM_BANDS];
+
        /* internal */
        struct wiphy *wiphy;
        struct net_device *dev;
@@ -1146,13 +1154,31 @@ struct cfg80211_wowlan_trig_pkt_pattern {
  * @magic_pkt: wake up on receiving magic packet
  * @patterns: wake up on receiving packet matching a pattern
  * @n_patterns: number of patterns
+ * @gtk_rekey_failure: wake up on GTK rekey failure
+ * @eap_identity_req: wake up on EAP identity request packet
+ * @four_way_handshake: wake up on 4-way handshake
+ * @rfkill_release: wake up when rfkill is released
  */
 struct cfg80211_wowlan {
-       bool any, disconnect, magic_pkt;
+       bool any, disconnect, magic_pkt, gtk_rekey_failure,
+            eap_identity_req, four_way_handshake,
+            rfkill_release;
        struct cfg80211_wowlan_trig_pkt_pattern *patterns;
        int n_patterns;
 };
 
+/**
+ * struct cfg80211_gtk_rekey_data - rekey data
+ * @kek: key encryption key
+ * @kck: key confirmation key
+ * @replay_ctr: replay counter
+ */
+struct cfg80211_gtk_rekey_data {
+       u8 kek[NL80211_KEK_LEN];
+       u8 kck[NL80211_KCK_LEN];
+       u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
+};
+
 /**
  * struct cfg80211_ops - backend description for wireless configuration
  *
@@ -1197,6 +1223,8 @@ struct cfg80211_wowlan {
  *
  * @set_default_mgmt_key: set the default management frame key on an interface
  *
+ * @set_rekey_data: give the data necessary for GTK rekeying to the driver
+ *
  * @add_beacon: Add a beacon with given parameters, @head, @interval
  *     and @dtim_period will be valid, @tail is optional.
  * @set_beacon: Change the beacon parameters for an access point mode
@@ -1284,6 +1312,12 @@ struct cfg80211_wowlan {
  *     frame on another channel
  *
  * @testmode_cmd: run a test mode command
+ * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
+ *     used by the function, but 0 and 1 must not be touched. Additionally,
+ *     return error codes other than -ENOBUFS and -ENOENT will terminate the
+ *     dump and return to userspace with an error, so be careful. If any data
+ *     was passed in from userspace then the data/len arguments will be present
+ *     and point to the data contained in %NL80211_ATTR_TESTDATA.
  *
  * @set_bitrate_mask: set the bitrate mask configuration
  *
@@ -1433,6 +1467,9 @@ struct cfg80211_ops {
 
 #ifdef CONFIG_NL80211_TESTMODE
        int     (*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
+       int     (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
+                                struct netlink_callback *cb,
+                                void *data, int len);
 #endif
 
        int     (*set_bitrate_mask)(struct wiphy *wiphy,
@@ -1490,6 +1527,9 @@ struct cfg80211_ops {
                                struct net_device *dev,
                                struct cfg80211_sched_scan_request *request);
        int     (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
+
+       int     (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
+                                 struct cfg80211_gtk_rekey_data *data);
 };
 
 /*
@@ -1647,11 +1687,21 @@ struct ieee80211_txrx_stypes {
  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
  *     (see nl80211.h)
  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
+ * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
+ * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
+ * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
+ * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
+ * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
  */
 enum wiphy_wowlan_support_flags {
-       WIPHY_WOWLAN_ANY        = BIT(0),
-       WIPHY_WOWLAN_MAGIC_PKT  = BIT(1),
-       WIPHY_WOWLAN_DISCONNECT = BIT(2),
+       WIPHY_WOWLAN_ANY                = BIT(0),
+       WIPHY_WOWLAN_MAGIC_PKT          = BIT(1),
+       WIPHY_WOWLAN_DISCONNECT         = BIT(2),
+       WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
+       WIPHY_WOWLAN_GTK_REKEY_FAILURE  = BIT(4),
+       WIPHY_WOWLAN_EAP_IDENTITY_REQ   = BIT(5),
+       WIPHY_WOWLAN_4WAY_HANDSHAKE     = BIT(6),
+       WIPHY_WOWLAN_RFKILL_RELEASE     = BIT(7),
 };
 
 /**
@@ -1716,9 +1766,13 @@ struct wiphy_wowlan_support {
  *     this variable determines its size
  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
  *     any given scan
+ * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
+ *     for in any given scheduled scan
  * @max_scan_ie_len: maximum length of user-controlled IEs device can
  *     add to probe request frames transmitted during a scan, must not
  *     include fixed IEs like supported rates
+ * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
+ *     scans
  * @coverage_class: current coverage class
  * @fw_version: firmware version for ethtool reporting
  * @hw_version: hardware version for ethtool reporting
@@ -1770,7 +1824,9 @@ struct wiphy {
 
        int bss_priv_size;
        u8 max_scan_ssids;
+       u8 max_sched_scan_ssids;
        u16 max_scan_ie_len;
+       u16 max_sched_scan_ie_len;
 
        int n_cipher_suites;
        const u32 *cipher_suites;
@@ -2341,113 +2397,6 @@ extern int freq_reg_info(struct wiphy *wiphy,
                         u32 desired_bw_khz,
                         const struct ieee80211_reg_rule **reg_rule);
 
-/*
- * Temporary wext handlers & helper functions
- *
- * In the future cfg80211 will simply assign the entire wext handler
- * structure to netdevs it manages, but we're not there yet.
- */
-int cfg80211_wext_giwname(struct net_device *dev,
-                         struct iw_request_info *info,
-                         char *name, char *extra);
-int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
-                         u32 *mode, char *extra);
-int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
-                         u32 *mode, char *extra);
-int cfg80211_wext_siwscan(struct net_device *dev,
-                         struct iw_request_info *info,
-                         union iwreq_data *wrqu, char *extra);
-int cfg80211_wext_giwscan(struct net_device *dev,
-                         struct iw_request_info *info,
-                         struct iw_point *data, char *extra);
-int cfg80211_wext_siwmlme(struct net_device *dev,
-                         struct iw_request_info *info,
-                         struct iw_point *data, char *extra);
-int cfg80211_wext_giwrange(struct net_device *dev,
-                          struct iw_request_info *info,
-                          struct iw_point *data, char *extra);
-int cfg80211_wext_siwgenie(struct net_device *dev,
-                          struct iw_request_info *info,
-                          struct iw_point *data, char *extra);
-int cfg80211_wext_siwauth(struct net_device *dev,
-                         struct iw_request_info *info,
-                         struct iw_param *data, char *extra);
-int cfg80211_wext_giwauth(struct net_device *dev,
-                         struct iw_request_info *info,
-                         struct iw_param *data, char *extra);
-
-int cfg80211_wext_siwfreq(struct net_device *dev,
-                         struct iw_request_info *info,
-                         struct iw_freq *freq, char *extra);
-int cfg80211_wext_giwfreq(struct net_device *dev,
-                         struct iw_request_info *info,
-                         struct iw_freq *freq, char *extra);
-int cfg80211_wext_siwessid(struct net_device *dev,
-                          struct iw_request_info *info,
-                          struct iw_point *data, char *ssid);
-int cfg80211_wext_giwessid(struct net_device *dev,
-                          struct iw_request_info *info,
-                          struct iw_point *data, char *ssid);
-int cfg80211_wext_siwrate(struct net_device *dev,
-                         struct iw_request_info *info,
-                         struct iw_param *rate, char *extra);
-int cfg80211_wext_giwrate(struct net_device *dev,
-                         struct iw_request_info *info,
-                         struct iw_param *rate, char *extra);
-
-int cfg80211_wext_siwrts(struct net_device *dev,
-                        struct iw_request_info *info,
-                        struct iw_param *rts, char *extra);
-int cfg80211_wext_giwrts(struct net_device *dev,
-                        struct iw_request_info *info,
-                        struct iw_param *rts, char *extra);
-int cfg80211_wext_siwfrag(struct net_device *dev,
-                         struct iw_request_info *info,
-                         struct iw_param *frag, char *extra);
-int cfg80211_wext_giwfrag(struct net_device *dev,
-                         struct iw_request_info *info,
-                         struct iw_param *frag, char *extra);
-int cfg80211_wext_siwretry(struct net_device *dev,
-                          struct iw_request_info *info,
-                          struct iw_param *retry, char *extra);
-int cfg80211_wext_giwretry(struct net_device *dev,
-                          struct iw_request_info *info,
-                          struct iw_param *retry, char *extra);
-int cfg80211_wext_siwencodeext(struct net_device *dev,
-                              struct iw_request_info *info,
-                              struct iw_point *erq, char *extra);
-int cfg80211_wext_siwencode(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct iw_point *erq, char *keybuf);
-int cfg80211_wext_giwencode(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct iw_point *erq, char *keybuf);
-int cfg80211_wext_siwtxpower(struct net_device *dev,
-                            struct iw_request_info *info,
-                            union iwreq_data *data, char *keybuf);
-int cfg80211_wext_giwtxpower(struct net_device *dev,
-                            struct iw_request_info *info,
-                            union iwreq_data *data, char *keybuf);
-struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev);
-
-int cfg80211_wext_siwpower(struct net_device *dev,
-                          struct iw_request_info *info,
-                          struct iw_param *wrq, char *extra);
-int cfg80211_wext_giwpower(struct net_device *dev,
-                          struct iw_request_info *info,
-                          struct iw_param *wrq, char *extra);
-
-int cfg80211_wext_siwap(struct net_device *dev,
-                       struct iw_request_info *info,
-                       struct sockaddr *ap_addr, char *extra);
-int cfg80211_wext_giwap(struct net_device *dev,
-                       struct iw_request_info *info,
-                       struct sockaddr *ap_addr, char *extra);
-
-int cfg80211_wext_siwpmksa(struct net_device *dev,
-                          struct iw_request_info *info,
-                          struct iw_point *data, char *extra);
-
 /*
  * callbacks for asynchronous cfg80211 methods, notification
  * functions and BSS handling helpers
@@ -2849,8 +2798,10 @@ struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
 void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
 
 #define CFG80211_TESTMODE_CMD(cmd)     .testmode_cmd = (cmd),
+#define CFG80211_TESTMODE_DUMP(cmd)    .testmode_dump = (cmd),
 #else
 #define CFG80211_TESTMODE_CMD(cmd)
+#define CFG80211_TESTMODE_DUMP(cmd)
 #endif
 
 /**
@@ -3022,6 +2973,16 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
 void cfg80211_cqm_pktloss_notify(struct net_device *dev,
                                 const u8 *peer, u32 num_packets, gfp_t gfp);
 
+/**
+ * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
+ * @dev: network device
+ * @bssid: BSSID of AP (to avoid races)
+ * @replay_ctr: new replay counter
+ * @gfp: allocation flags
+ */
+void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
+                              const u8 *replay_ctr, gfp_t gfp);
+
 /* Logging, debugging and troubleshooting/diagnostic helpers. */
 
 /* wiphy_printk helpers, similar to dev_printk */