diff options
author | Jouni Malinen <jouni.malinen@atheros.com> | 2009-03-19 07:39:22 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-03-27 20:13:02 -0400 |
commit | 636a5d3625993c5ca59abc81794b9ded93cdb740 (patch) | |
tree | 53ee8d522153c36c631f8cb733a6e808c20ef332 /include | |
parent | 6039f6d23fe792d615da5449e9fa1c6b43caacf6 (diff) |
nl80211: Add MLME primitives to support external SME
This patch adds new nl80211 commands to allow user space to request
authentication and association (and also deauthentication and
disassociation). The commands are structured to allow separate
authentication and association steps, i.e., the interface between
kernel and user space is similar to the MLME SAP interface in IEEE
802.11 standard and an user space application takes the role of the
SME.
The patch introduces MLME-AUTHENTICATE.request,
MLME-{,RE}ASSOCIATE.request, MLME-DEAUTHENTICATE.request, and
MLME-DISASSOCIATE.request primitives. The authentication and
association commands request the actual operations in two steps
(assuming the driver supports this; if not, separate authentication
step is skipped; this could end up being a separate "connect"
command).
The initial implementation for mac80211 uses the current
net/mac80211/mlme.c for actual sending and processing of management
frames and the new nl80211 commands will just stop the current state
machine from moving automatically from authentication to association.
Future cleanup may move more of the MLME operations into cfg80211.
The goal of this design is to provide more control of authentication and
association process to user space without having to move the full MLME
implementation. This should be enough to allow IEEE 802.11r FT protocol
and 802.11s SAE authentication to be implemented. Obviously, this will
also bring the extra benefit of not having to use WEXT for association
requests with mac80211. An example implementation of a user space SME
using the new nl80211 commands is available for wpa_supplicant.
This patch is enough to get IEEE 802.11r FT protocol working with
over-the-air mechanism (over-the-DS will need additional MLME
primitives for handling the FT Action frames).
Signed-off-by: Jouni Malinen <j@w1.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ieee80211.h | 1 | ||||
-rw-r--r-- | include/linux/nl80211.h | 58 | ||||
-rw-r--r-- | include/net/cfg80211.h | 113 |
3 files changed, 162 insertions, 10 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 382387e75b89..4b501b48ce86 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -867,6 +867,7 @@ struct ieee80211_ht_info { | |||
867 | /* Authentication algorithms */ | 867 | /* Authentication algorithms */ |
868 | #define WLAN_AUTH_OPEN 0 | 868 | #define WLAN_AUTH_OPEN 0 |
869 | #define WLAN_AUTH_SHARED_KEY 1 | 869 | #define WLAN_AUTH_SHARED_KEY 1 |
870 | #define WLAN_AUTH_FT 2 | ||
870 | #define WLAN_AUTH_LEAP 128 | 871 | #define WLAN_AUTH_LEAP 128 |
871 | 872 | ||
872 | #define WLAN_AUTH_CHALLENGE_LEN 128 | 873 | #define WLAN_AUTH_CHALLENGE_LEN 128 |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 5ce68ae8314e..9685eaab40a9 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -161,24 +161,37 @@ | |||
161 | * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on | 161 | * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on |
162 | * to (%NL80211_ATTR_REG_ALPHA2). | 162 | * to (%NL80211_ATTR_REG_ALPHA2). |
163 | * | 163 | * |
164 | * @NL80211_CMD_AUTHENTICATE: authentication notification (on the "mlme" | 164 | * @NL80211_CMD_AUTHENTICATE: authentication request and notification. |
165 | * multicast group). This event reports reception of an Authentication | 165 | * This command is used both as a command (request to authenticate) and |
166 | * as an event on the "mlme" multicast group indicating completion of the | ||
167 | * authentication process. | ||
168 | * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the | ||
169 | * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and | ||
170 | * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify | ||
171 | * the SSID (mainly for association, but is included in authentication | ||
172 | * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used | ||
173 | * to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE | ||
174 | * is used to specify the authentication type. %NL80211_ATTR_IE is used to | ||
175 | * define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs) | ||
176 | * to be added to the frame. | ||
177 | * When used as an event, this reports reception of an Authentication | ||
166 | * frame in station and IBSS modes when the local MLME processed the | 178 | * frame in station and IBSS modes when the local MLME processed the |
167 | * frame, i.e., it was for the local STA and was received in correct | 179 | * frame, i.e., it was for the local STA and was received in correct |
168 | * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the | 180 | * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the |
169 | * MLME SAP interface (kernel providing MLME, userspace SME). The | 181 | * MLME SAP interface (kernel providing MLME, userspace SME). The |
170 | * included NL80211_ATTR_FRAME attribute contains the management frame | 182 | * included NL80211_ATTR_FRAME attribute contains the management frame |
171 | * (including both the header and frame body, but not FCS). | 183 | * (including both the header and frame body, but not FCS). |
172 | * @NL80211_CMD_ASSOCIATE: association notification; like | 184 | * @NL80211_CMD_ASSOCIATE: association request and notification; like |
173 | * NL80211_CMD_AUTHENTICATE but for Association Response and Reassociation | 185 | * NL80211_CMD_AUTHENTICATE but for Association and Reassociation |
174 | * Response frames (similar to MLME-ASSOCIATE.confirm or | 186 | * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, |
175 | * MLME-REASSOCIATE.confirm primitives). | 187 | * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). |
176 | * @NL80211_CMD_DEAUTHENTICATE: deauthentication notification; like | 188 | * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like |
177 | * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to | 189 | * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to |
178 | * MLME-DEAUTHENTICATE.indication primitive). | 190 | * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication |
179 | * @NL80211_CMD_DISASSOCIATE: disassociation notification; like | 191 | * primitives). |
192 | * @NL80211_CMD_DISASSOCIATE: disassociation request and notification; like | ||
180 | * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to | 193 | * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to |
181 | * MLME-DISASSOCIATE.indication primitive). | 194 | * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). |
182 | * | 195 | * |
183 | * @NL80211_CMD_MAX: highest used command number | 196 | * @NL80211_CMD_MAX: highest used command number |
184 | * @__NL80211_CMD_AFTER_LAST: internal use | 197 | * @__NL80211_CMD_AFTER_LAST: internal use |
@@ -383,6 +396,11 @@ enum nl80211_commands { | |||
383 | * @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header | 396 | * @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header |
384 | * and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and | 397 | * and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and |
385 | * NL80211_CMD_ASSOCIATE events | 398 | * NL80211_CMD_ASSOCIATE events |
399 | * @NL80211_ATTR_SSID: SSID (binary attribute, 0..32 octets) | ||
400 | * @NL80211_ATTR_AUTH_TYPE: AuthenticationType, see &enum nl80211_auth_type, | ||
401 | * represented as a u32 | ||
402 | * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and | ||
403 | * %NL80211_CMD_DISASSOCIATE, u16 | ||
386 | * | 404 | * |
387 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 405 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
388 | * @__NL80211_ATTR_AFTER_LAST: internal use | 406 | * @__NL80211_ATTR_AFTER_LAST: internal use |
@@ -464,6 +482,9 @@ enum nl80211_attrs { | |||
464 | NL80211_ATTR_SUPPORTED_COMMANDS, | 482 | NL80211_ATTR_SUPPORTED_COMMANDS, |
465 | 483 | ||
466 | NL80211_ATTR_FRAME, | 484 | NL80211_ATTR_FRAME, |
485 | NL80211_ATTR_SSID, | ||
486 | NL80211_ATTR_AUTH_TYPE, | ||
487 | NL80211_ATTR_REASON_CODE, | ||
467 | 488 | ||
468 | /* add attributes here, update the policy in nl80211.c */ | 489 | /* add attributes here, update the policy in nl80211.c */ |
469 | 490 | ||
@@ -485,6 +506,9 @@ enum nl80211_attrs { | |||
485 | #define NL80211_ATTR_REG_INITIATOR NL80211_ATTR_REG_INITIATOR | 506 | #define NL80211_ATTR_REG_INITIATOR NL80211_ATTR_REG_INITIATOR |
486 | #define NL80211_ATTR_REG_TYPE NL80211_ATTR_REG_TYPE | 507 | #define NL80211_ATTR_REG_TYPE NL80211_ATTR_REG_TYPE |
487 | #define NL80211_ATTR_FRAME NL80211_ATTR_FRAME | 508 | #define NL80211_ATTR_FRAME NL80211_ATTR_FRAME |
509 | #define NL80211_ATTR_SSID NL80211_ATTR_SSID | ||
510 | #define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE | ||
511 | #define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE | ||
488 | 512 | ||
489 | #define NL80211_MAX_SUPP_RATES 32 | 513 | #define NL80211_MAX_SUPP_RATES 32 |
490 | #define NL80211_MAX_SUPP_REG_RULES 32 | 514 | #define NL80211_MAX_SUPP_REG_RULES 32 |
@@ -1018,4 +1042,18 @@ enum nl80211_bss { | |||
1018 | NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1 | 1042 | NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1 |
1019 | }; | 1043 | }; |
1020 | 1044 | ||
1045 | /** | ||
1046 | * enum nl80211_auth_type - AuthenticationType | ||
1047 | * | ||
1048 | * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication | ||
1049 | * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only) | ||
1050 | * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r) | ||
1051 | * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP) | ||
1052 | */ | ||
1053 | enum nl80211_auth_type { | ||
1054 | NL80211_AUTHTYPE_OPEN_SYSTEM, | ||
1055 | NL80211_AUTHTYPE_SHARED_KEY, | ||
1056 | NL80211_AUTHTYPE_FT, | ||
1057 | NL80211_AUTHTYPE_NETWORK_EAP, | ||
1058 | }; | ||
1021 | #endif /* __LINUX_NL80211_H */ | 1059 | #endif /* __LINUX_NL80211_H */ |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index ad44016021b1..0da9a55881a1 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -579,6 +579,105 @@ struct cfg80211_bss { | |||
579 | }; | 579 | }; |
580 | 580 | ||
581 | /** | 581 | /** |
582 | * struct cfg80211_auth_request - Authentication request data | ||
583 | * | ||
584 | * This structure provides information needed to complete IEEE 802.11 | ||
585 | * authentication. | ||
586 | * NOTE: This structure will likely change when more code from mac80211 is | ||
587 | * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too. | ||
588 | * Before using this in a driver that does not use mac80211, it would be better | ||
589 | * to check the status of that work and better yet, volunteer to work on it. | ||
590 | * | ||
591 | * @chan: The channel to use or %NULL if not specified (auto-select based on | ||
592 | * scan results) | ||
593 | * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case); | ||
594 | * this field is required to be present; if the driver wants to help with | ||
595 | * BSS selection, it should use (yet to be added) MLME event to allow user | ||
596 | * space SME to be notified of roaming candidate, so that the SME can then | ||
597 | * use the authentication request with the recommended BSSID and whatever | ||
598 | * other data may be needed for authentication/association | ||
599 | * @ssid: SSID or %NULL if not yet available | ||
600 | * @ssid_len: Length of ssid in octets | ||
601 | * @auth_type: Authentication type (algorithm) | ||
602 | * @ie: Extra IEs to add to Authentication frame or %NULL | ||
603 | * @ie_len: Length of ie buffer in octets | ||
604 | */ | ||
605 | struct cfg80211_auth_request { | ||
606 | struct ieee80211_channel *chan; | ||
607 | u8 *peer_addr; | ||
608 | const u8 *ssid; | ||
609 | size_t ssid_len; | ||
610 | enum nl80211_auth_type auth_type; | ||
611 | const u8 *ie; | ||
612 | size_t ie_len; | ||
613 | }; | ||
614 | |||
615 | /** | ||
616 | * struct cfg80211_assoc_request - (Re)Association request data | ||
617 | * | ||
618 | * This structure provides information needed to complete IEEE 802.11 | ||
619 | * (re)association. | ||
620 | * NOTE: This structure will likely change when more code from mac80211 is | ||
621 | * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too. | ||
622 | * Before using this in a driver that does not use mac80211, it would be better | ||
623 | * to check the status of that work and better yet, volunteer to work on it. | ||
624 | * | ||
625 | * @chan: The channel to use or %NULL if not specified (auto-select based on | ||
626 | * scan results) | ||
627 | * @peer_addr: The address of the peer STA (AP BSSID); this field is required | ||
628 | * to be present and the STA must be in State 2 (authenticated) with the | ||
629 | * peer STA | ||
630 | * @ssid: SSID | ||
631 | * @ssid_len: Length of ssid in octets | ||
632 | * @ie: Extra IEs to add to (Re)Association Request frame or %NULL | ||
633 | * @ie_len: Length of ie buffer in octets | ||
634 | */ | ||
635 | struct cfg80211_assoc_request { | ||
636 | struct ieee80211_channel *chan; | ||
637 | u8 *peer_addr; | ||
638 | const u8 *ssid; | ||
639 | size_t ssid_len; | ||
640 | const u8 *ie; | ||
641 | size_t ie_len; | ||
642 | }; | ||
643 | |||
644 | /** | ||
645 | * struct cfg80211_deauth_request - Deauthentication request data | ||
646 | * | ||
647 | * This structure provides information needed to complete IEEE 802.11 | ||
648 | * deauthentication. | ||
649 | * | ||
650 | * @peer_addr: The address of the peer STA (AP BSSID); this field is required | ||
651 | * to be present and the STA must be authenticated with the peer STA | ||
652 | * @ie: Extra IEs to add to Deauthentication frame or %NULL | ||
653 | * @ie_len: Length of ie buffer in octets | ||
654 | */ | ||
655 | struct cfg80211_deauth_request { | ||
656 | u8 *peer_addr; | ||
657 | u16 reason_code; | ||
658 | const u8 *ie; | ||
659 | size_t ie_len; | ||
660 | }; | ||
661 | |||
662 | /** | ||
663 | * struct cfg80211_disassoc_request - Disassociation request data | ||
664 | * | ||
665 | * This structure provides information needed to complete IEEE 802.11 | ||
666 | * disassocation. | ||
667 | * | ||
668 | * @peer_addr: The address of the peer STA (AP BSSID); this field is required | ||
669 | * to be present and the STA must be associated with the peer STA | ||
670 | * @ie: Extra IEs to add to Disassociation frame or %NULL | ||
671 | * @ie_len: Length of ie buffer in octets | ||
672 | */ | ||
673 | struct cfg80211_disassoc_request { | ||
674 | u8 *peer_addr; | ||
675 | u16 reason_code; | ||
676 | const u8 *ie; | ||
677 | size_t ie_len; | ||
678 | }; | ||
679 | |||
680 | /** | ||
582 | * struct cfg80211_ops - backend description for wireless configuration | 681 | * struct cfg80211_ops - backend description for wireless configuration |
583 | * | 682 | * |
584 | * This struct is registered by fullmac card drivers and/or wireless stacks | 683 | * This struct is registered by fullmac card drivers and/or wireless stacks |
@@ -650,6 +749,11 @@ struct cfg80211_bss { | |||
650 | * the driver, and will be valid until passed to cfg80211_scan_done(). | 749 | * the driver, and will be valid until passed to cfg80211_scan_done(). |
651 | * For scan results, call cfg80211_inform_bss(); you can call this outside | 750 | * For scan results, call cfg80211_inform_bss(); you can call this outside |
652 | * the scan/scan_done bracket too. | 751 | * the scan/scan_done bracket too. |
752 | * | ||
753 | * @auth: Request to authenticate with the specified peer | ||
754 | * @assoc: Request to (re)associate with the specified peer | ||
755 | * @deauth: Request to deauthenticate from the specified peer | ||
756 | * @disassoc: Request to disassociate from the specified peer | ||
653 | */ | 757 | */ |
654 | struct cfg80211_ops { | 758 | struct cfg80211_ops { |
655 | int (*suspend)(struct wiphy *wiphy); | 759 | int (*suspend)(struct wiphy *wiphy); |
@@ -730,6 +834,15 @@ struct cfg80211_ops { | |||
730 | 834 | ||
731 | int (*scan)(struct wiphy *wiphy, struct net_device *dev, | 835 | int (*scan)(struct wiphy *wiphy, struct net_device *dev, |
732 | struct cfg80211_scan_request *request); | 836 | struct cfg80211_scan_request *request); |
837 | |||
838 | int (*auth)(struct wiphy *wiphy, struct net_device *dev, | ||
839 | struct cfg80211_auth_request *req); | ||
840 | int (*assoc)(struct wiphy *wiphy, struct net_device *dev, | ||
841 | struct cfg80211_assoc_request *req); | ||
842 | int (*deauth)(struct wiphy *wiphy, struct net_device *dev, | ||
843 | struct cfg80211_deauth_request *req); | ||
844 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, | ||
845 | struct cfg80211_disassoc_request *req); | ||
733 | }; | 846 | }; |
734 | 847 | ||
735 | /* temporary wext handlers */ | 848 | /* temporary wext handlers */ |