aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2009-07-01 15:26:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:51 -0400
commitb23aa676ab9d54469cda9f7151f51a2851c6f36e (patch)
treedd4af5fa38dbfec362ded1d655ed584bbcf60a53 /include
parent6a669e65c5ec393a650362874e13f7d3365a7827 (diff)
cfg80211: connect/disconnect API
This patch introduces the cfg80211 connect/disconnect API. The goal here is to run the AUTH and ASSOC steps in one call. This is needed for some fullmac cards that run both steps directly from the target, after the host driver sends a connect command. Additionally, all the new crypto parameters for connect() are now also valid for associate() -- although associate requires the IEs to be used, the information can be useful for drivers and should be given. Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nl80211.h80
-rw-r--r--include/net/cfg80211.h135
2 files changed, 209 insertions, 6 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 651b18839088..b34c17f52f3e 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -246,6 +246,22 @@
246 * to identify the device, and the TESTDATA blob attribute to pass through 246 * to identify the device, and the TESTDATA blob attribute to pass through
247 * to the driver. 247 * to the driver.
248 * 248 *
249 * @NL80211_CMD_CONNECT: connection request and notification; this command
250 * requests to connect to a specified network but without separating
251 * auth and assoc steps. For this, you need to specify the SSID in a
252 * %NL80211_ATTR_SSID attribute, and can optionally specify the association
253 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC,
254 * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_CONTROL_PORT.
255 * It is also sent as an event, with the BSSID and response IEs when the
256 * connection is established or failed to be established. This can be
257 * determined by the STATUS_CODE attribute.
258 * @NL80211_CMD_ROAM: request that the card roam (currently not implemented),
259 * sent as an event when the card/driver roamed by itself.
260 * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify
261 * userspace that a connection was dropped by the AP or due to other
262 * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and
263 * %NL80211_ATTR_REASON_CODE attributes are used.
264 *
249 * @NL80211_CMD_MAX: highest used command number 265 * @NL80211_CMD_MAX: highest used command number
250 * @__NL80211_CMD_AFTER_LAST: internal use 266 * @__NL80211_CMD_AFTER_LAST: internal use
251 */ 267 */
@@ -316,6 +332,10 @@ enum nl80211_commands {
316 332
317 NL80211_CMD_TESTMODE, 333 NL80211_CMD_TESTMODE,
318 334
335 NL80211_CMD_CONNECT,
336 NL80211_CMD_ROAM,
337 NL80211_CMD_DISCONNECT,
338
319 /* add new commands above here */ 339 /* add new commands above here */
320 340
321 /* used to define NL80211_CMD_MAX below */ 341 /* used to define NL80211_CMD_MAX below */
@@ -520,6 +540,30 @@ enum nl80211_commands {
520 * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. 540 * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
521 * We recommend using nested, driver-specific attributes within this. 541 * We recommend using nested, driver-specific attributes within this.
522 * 542 *
543 * @NL80211_ATTR_DISCONNECTED_BY_AP: A flag indicating that the DISCONNECT
544 * event was due to the AP disconnecting the station, and not due to
545 * a local disconnect request.
546 * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT
547 * event (u16)
548 * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating
549 * that protected APs should be used.
550 *
551 * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT and ASSOCIATE to
552 * indicate which unicast key ciphers will be used with the connection
553 * (an array of u32).
554 * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT and ASSOCIATE to indicate
555 * which group key cipher will be used with the connection (a u32).
556 * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT and ASSOCIATE to indicate
557 * which WPA version(s) the AP we want to associate with is using
558 * (a u32 with flags from &enum nl80211_wpa_versions).
559 * @NL80211_ATTR_AKM_SUITES: Used with CONNECT and ASSOCIATE to indicate
560 * which key management algorithm(s) to use (an array of u32).
561 *
562 * @NL80211_ATTR_REQ_IE: (Re)association request information elements as
563 * sent out by the card, for ROAM and successful CONNECT events.
564 * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
565 * sent by peer, for ROAM and successful CONNECT events.
566 *
523 * @NL80211_ATTR_MAX: highest attribute number currently defined 567 * @NL80211_ATTR_MAX: highest attribute number currently defined
524 * @__NL80211_ATTR_AFTER_LAST: internal use 568 * @__NL80211_ATTR_AFTER_LAST: internal use
525 */ 569 */
@@ -630,6 +674,19 @@ enum nl80211_attrs {
630 674
631 NL80211_ATTR_TESTDATA, 675 NL80211_ATTR_TESTDATA,
632 676
677 NL80211_ATTR_PRIVACY,
678
679 NL80211_ATTR_DISCONNECTED_BY_AP,
680 NL80211_ATTR_STATUS_CODE,
681
682 NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
683 NL80211_ATTR_CIPHER_SUITE_GROUP,
684 NL80211_ATTR_WPA_VERSIONS,
685 NL80211_ATTR_AKM_SUITES,
686
687 NL80211_ATTR_REQ_IE,
688 NL80211_ATTR_RESP_IE,
689
633 /* add attributes here, update the policy in nl80211.c */ 690 /* add attributes here, update the policy in nl80211.c */
634 691
635 __NL80211_ATTR_AFTER_LAST, 692 __NL80211_ATTR_AFTER_LAST,
@@ -640,6 +697,7 @@ enum nl80211_attrs {
640 * Allow user space programs to use #ifdef on new attributes by defining them 697 * Allow user space programs to use #ifdef on new attributes by defining them
641 * here 698 * here
642 */ 699 */
700#define NL80211_CMD_CONNECT NL80211_CMD_CONNECT
643#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY 701#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
644#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES 702#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
645#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS 703#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
@@ -653,6 +711,10 @@ enum nl80211_attrs {
653#define NL80211_ATTR_SSID NL80211_ATTR_SSID 711#define NL80211_ATTR_SSID NL80211_ATTR_SSID
654#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE 712#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE
655#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE 713#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE
714#define NL80211_ATTR_CIPHER_SUITES_PAIRWISE NL80211_ATTR_CIPHER_SUITES_PAIRWISE
715#define NL80211_ATTR_CIPHER_SUITE_GROUP NL80211_ATTR_CIPHER_SUITE_GROUP
716#define NL80211_ATTR_WPA_VERSIONS NL80211_ATTR_WPA_VERSIONS
717#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES
656 718
657#define NL80211_MAX_SUPP_RATES 32 719#define NL80211_MAX_SUPP_RATES 32
658#define NL80211_MAX_SUPP_REG_RULES 32 720#define NL80211_MAX_SUPP_REG_RULES 32
@@ -661,6 +723,9 @@ enum nl80211_attrs {
661#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 723#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
662#define NL80211_HT_CAPABILITY_LEN 26 724#define NL80211_HT_CAPABILITY_LEN 26
663 725
726#define NL80211_MAX_NR_CIPHER_SUITES 5
727#define NL80211_MAX_NR_AKM_SUITES 2
728
664/** 729/**
665 * enum nl80211_iftype - (virtual) interface types 730 * enum nl80211_iftype - (virtual) interface types
666 * 731 *
@@ -1205,12 +1270,22 @@ enum nl80211_bss {
1205 * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only) 1270 * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only)
1206 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r) 1271 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
1207 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP) 1272 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
1273 * @__NL80211_AUTHTYPE_NUM: internal
1274 * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm
1275 * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by
1276 * trying multiple times); this is invalid in netlink -- leave out
1277 * the attribute for this on CONNECT commands.
1208 */ 1278 */
1209enum nl80211_auth_type { 1279enum nl80211_auth_type {
1210 NL80211_AUTHTYPE_OPEN_SYSTEM, 1280 NL80211_AUTHTYPE_OPEN_SYSTEM,
1211 NL80211_AUTHTYPE_SHARED_KEY, 1281 NL80211_AUTHTYPE_SHARED_KEY,
1212 NL80211_AUTHTYPE_FT, 1282 NL80211_AUTHTYPE_FT,
1213 NL80211_AUTHTYPE_NETWORK_EAP, 1283 NL80211_AUTHTYPE_NETWORK_EAP,
1284
1285 /* keep last */
1286 __NL80211_AUTHTYPE_NUM,
1287 NL80211_AUTHTYPE_MAX = __NL80211_AUTHTYPE_NUM - 1,
1288 NL80211_AUTHTYPE_AUTOMATIC
1214}; 1289};
1215 1290
1216/** 1291/**
@@ -1235,4 +1310,9 @@ enum nl80211_mfp {
1235 NL80211_MFP_REQUIRED, 1310 NL80211_MFP_REQUIRED,
1236}; 1311};
1237 1312
1313enum nl80211_wpa_versions {
1314 NL80211_WPA_VERSION_1 = 1 << 0,
1315 NL80211_WPA_VERSION_2 = 1 << 1,
1316};
1317
1238#endif /* __LINUX_NL80211_H */ 1318#endif /* __LINUX_NL80211_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 885d4e5bc4b5..68e11321ed74 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -605,6 +605,30 @@ struct cfg80211_bss {
605}; 605};
606 606
607/** 607/**
608 * struct cfg80211_crypto_settings - Crypto settings
609 * @wpa_versions: indicates which, if any, WPA versions are enabled
610 * (from enum nl80211_wpa_versions)
611 * @cipher_group: group key cipher suite (or 0 if unset)
612 * @n_ciphers_pairwise: number of AP supported unicast ciphers
613 * @ciphers_pairwise: unicast key cipher suites
614 * @n_akm_suites: number of AKM suites
615 * @akm_suites: AKM suites
616 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
617 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
618 * required to assume that the port is unauthorized until authorized by
619 * user space. Otherwise, port is marked authorized by default.
620 */
621struct cfg80211_crypto_settings {
622 u32 wpa_versions;
623 u32 cipher_group;
624 int n_ciphers_pairwise;
625 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
626 int n_akm_suites;
627 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
628 bool control_port;
629};
630
631/**
608 * struct cfg80211_auth_request - Authentication request data 632 * struct cfg80211_auth_request - Authentication request data
609 * 633 *
610 * This structure provides information needed to complete IEEE 802.11 634 * This structure provides information needed to complete IEEE 802.11
@@ -658,10 +682,7 @@ struct cfg80211_auth_request {
658 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 682 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
659 * @ie_len: Length of ie buffer in octets 683 * @ie_len: Length of ie buffer in octets
660 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 684 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
661 * @control_port: Whether user space controls IEEE 802.1X port, i.e., 685 * @crypto: crypto settings
662 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
663 * required to assume that the port is unauthorized until authorized by
664 * user space. Otherwise, port is marked authorized by default.
665 */ 686 */
666struct cfg80211_assoc_request { 687struct cfg80211_assoc_request {
667 struct ieee80211_channel *chan; 688 struct ieee80211_channel *chan;
@@ -671,7 +692,7 @@ struct cfg80211_assoc_request {
671 const u8 *ie; 692 const u8 *ie;
672 size_t ie_len; 693 size_t ie_len;
673 bool use_mfp; 694 bool use_mfp;
674 bool control_port; 695 struct cfg80211_crypto_settings crypto;
675}; 696};
676 697
677/** 698/**
@@ -738,6 +759,36 @@ struct cfg80211_ibss_params {
738}; 759};
739 760
740/** 761/**
762 * struct cfg80211_connect_params - Connection parameters
763 *
764 * This structure provides information needed to complete IEEE 802.11
765 * authentication and association.
766 *
767 * @channel: The channel to use or %NULL if not specified (auto-select based
768 * on scan results)
769 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
770 * results)
771 * @ssid: SSID
772 * @ssid_len: Length of ssid in octets
773 * @auth_type: Authentication type (algorithm)
774 * @assoc_ie: IEs for association request
775 * @assoc_ie_len: Length of assoc_ie in octets
776 * @privacy: indicates whether privacy-enabled APs should be used
777 * @crypto: crypto settings
778 */
779struct cfg80211_connect_params {
780 struct ieee80211_channel *channel;
781 u8 *bssid;
782 u8 *ssid;
783 size_t ssid_len;
784 enum nl80211_auth_type auth_type;
785 u8 *ie;
786 size_t ie_len;
787 bool privacy;
788 struct cfg80211_crypto_settings crypto;
789};
790
791/**
741 * enum wiphy_params_flags - set_wiphy_params bitfield values 792 * enum wiphy_params_flags - set_wiphy_params bitfield values
742 * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 793 * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
743 * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 794 * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
@@ -841,6 +892,12 @@ enum tx_power_setting {
841 * @deauth: Request to deauthenticate from the specified peer 892 * @deauth: Request to deauthenticate from the specified peer
842 * @disassoc: Request to disassociate from the specified peer 893 * @disassoc: Request to disassociate from the specified peer
843 * 894 *
895 * @connect: Connect to the ESS with the specified parameters. When connected,
896 * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
897 * If the connection fails for some reason, call cfg80211_connect_result()
898 * with the status from the AP.
899 * @disconnect: Disconnect from the BSS/ESS.
900 *
844 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 901 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
845 * cfg80211_ibss_joined(), also call that function when changing BSSID due 902 * cfg80211_ibss_joined(), also call that function when changing BSSID due
846 * to a merge. 903 * to a merge.
@@ -946,6 +1003,11 @@ struct cfg80211_ops {
946 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1003 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
947 struct cfg80211_disassoc_request *req); 1004 struct cfg80211_disassoc_request *req);
948 1005
1006 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
1007 struct cfg80211_connect_params *sme);
1008 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
1009 u16 reason_code);
1010
949 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 1011 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
950 struct cfg80211_ibss_params *params); 1012 struct cfg80211_ibss_params *params);
951 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 1013 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
@@ -1174,10 +1236,15 @@ struct wireless_dev {
1174 struct list_head list; 1236 struct list_head list;
1175 struct net_device *netdev; 1237 struct net_device *netdev;
1176 1238
1177 /* currently used for IBSS - might be rearranged in the future */ 1239 /* currently used for IBSS and SME - might be rearranged later */
1178 struct cfg80211_bss *current_bss; 1240 struct cfg80211_bss *current_bss;
1179 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1241 u8 ssid[IEEE80211_MAX_SSID_LEN];
1180 u8 ssid_len; 1242 u8 ssid_len;
1243 enum {
1244 CFG80211_SME_IDLE,
1245 CFG80211_SME_CONNECTING, /* ->connect called */
1246 CFG80211_SME_CONNECTED,
1247 } sme_state;
1181 1248
1182#ifdef CONFIG_WIRELESS_EXT 1249#ifdef CONFIG_WIRELESS_EXT
1183 /* wext data */ 1250 /* wext data */
@@ -1788,4 +1855,60 @@ void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
1788#define CFG80211_TESTMODE_CMD(cmd) 1855#define CFG80211_TESTMODE_CMD(cmd)
1789#endif 1856#endif
1790 1857
1858/**
1859 * cfg80211_connect_result - notify cfg80211 of connection result
1860 *
1861 * @dev: network device
1862 * @bssid: the BSSID of the AP
1863 * @req_ie: association request IEs (maybe be %NULL)
1864 * @req_ie_len: association request IEs length
1865 * @resp_ie: association response IEs (may be %NULL)
1866 * @resp_ie_len: assoc response IEs length
1867 * @status: status code, 0 for successful connection, use
1868 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
1869 * the real status code for failures.
1870 * @gfp: allocation flags
1871 *
1872 * It should be called by the underlying driver whenever connect() has
1873 * succeeded.
1874 */
1875void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
1876 const u8 *req_ie, size_t req_ie_len,
1877 const u8 *resp_ie, size_t resp_ie_len,
1878 u16 status, gfp_t gfp);
1879
1880/**
1881 * cfg80211_roamed - notify cfg80211 of roaming
1882 *
1883 * @dev: network device
1884 * @bssid: the BSSID of the new AP
1885 * @req_ie: association request IEs (maybe be %NULL)
1886 * @req_ie_len: association request IEs length
1887 * @resp_ie: association response IEs (may be %NULL)
1888 * @resp_ie_len: assoc response IEs length
1889 * @gfp: allocation flags
1890 *
1891 * It should be called by the underlying driver whenever it roamed
1892 * from one AP to another while connected.
1893 */
1894void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
1895 const u8 *req_ie, size_t req_ie_len,
1896 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
1897
1898/**
1899 * cfg80211_disconnected - notify cfg80211 that connection was dropped
1900 *
1901 * @dev: network device
1902 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
1903 * @ie_len: length of IEs
1904 * @reason: reason code for the disconnection, set it to 0 if unknown
1905 * @gfp: allocation flags
1906 *
1907 * After it calls this function, the driver should enter an idle state
1908 * and not try to connect to any AP any more.
1909 */
1910void cfg80211_disconnected(struct net_device *dev, u16 reason,
1911 u8 *ie, size_t ie_len, gfp_t gfp);
1912
1913
1791#endif /* __NET_CFG80211_H */ 1914#endif /* __NET_CFG80211_H */