nl80211: Authentication and association events
Subsystems (2)
RFC 1/1 nl80211: Authentication and association events
This adds new nl80211 event notifications (and a new multicast group, "mlme") for informing user space about received Authentication and (Re)Association Response frames in station and IBSS modes (i.e., MLME SAP interface primitives MLME-AUTHENTICATE.confirm, MLME-RESOURCE_REQUEST.confirm, MLME-ASSOCIATE.confirm, and MLME-REASSOCIATE.confirm). The event data is encapsulated as the 802.11 management frame since we already have the frame in that format and it includes all the needed information.
This is the first step in providing MLME SAP interface for authentication and association with nl80211. In other words, kernel code will act as the MLME and a user space application can control it as SME.
The next goal is to introduce MLME-AUTHENTICATE.request and MLME-{,RE}ASSOCIATE.request primitives that will request the actual operations in two steps (assuming driver supports this; if not, separate authentication step is skipped).
The initial implementation will likely end up using 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.
--- include/linux/nl80211.h | 25 ++++++++++++++++++++++ include/net/cfg80211.h | 5 ++++ net/mac80211/mlme.c | 4 +++ net/wireless/Makefile | 2 - net/wireless/mlme.c | 29 +++++++++++++++++++++++++ net/wireless/nl80211.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ net/wireless/nl80211.h | 16 ++++++++++++++ 7 files changed, 134 insertions(+), 1 deletion(-)
include/linux/nl80211.h +25 -0
@@ -150,6 +150,22 @@* @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, * partial scan results may be available * +* @NL80211_CMD_RX_AUTH: authentication notification (on the "mlme" multicast +* group). This event reports reception of an Authentication frame in +* station and IBSS modes similarly to MLME-AUTHENTICATE.confirm primitive +* in the MLME SAP interface (kernel providing MLME, userspace SME). In +* addition, this event is used as MLME-RESOURCE_REQUEST.confirm primitive +* which is also reporting a reception of an Authentication frame. The +* included NL80211_ATTR_FRAME attribute contains the management frame +* (including both the header and frame body, but not FCS). +* @NL80211_CMD_RX_ASSOC: association notification (on the "mlme" multicast +* group). This event reports reception of an Association Response or +* Reassociation Response frame in station and IBSS modes similarly to +* MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitive in the +* MLME SAP interface (kernel providing MLME, userspace SME). The included +* NL80211_ATTR_FRAME contains the management frame (including both the +* header and frame body, but not FCS). +* * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */
@@ -204,6 +220,9 @@ enum nl80211_commands {NL80211_CMD_NEW_SCAN_RESULTS ,NL80211_CMD_SCAN_ABORTED , +NL80211_CMD_RX_AUTH , + NL80211_CMD_RX_ASSOC, +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
@@ -329,6 +348,10 @@ enum nl80211_commands {* messages carried the same generation number) * @NL80211_ATTR_BSS: scan result BSS * +* @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header +* and body, but not FCS; used, e.g., with NL80211_CMD_RX_AUTH and +* NL80211_CMD_RX_ASSOC events +* * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */
@@ -403,6 +426,8 @@ enum nl80211_attrs {NL80211_ATTR_SCAN_GENERATION ,NL80211_ATTR_BSS , +NL80211_ATTR_FRAME , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
include/net/cfg80211.h +5 -0
@@ -825,4 +825,9 @@ void cfg80211_put_bss(struct cfg80211_bs*/ void cfg80211_unlink_bss (struct wiphy *wiphy,struct cfg80211_bss *bss); +void cfg80211_send_rx_auth (struct wiphy *wiphy,struct net_device *dev, +struct sk_buff *skb); +void cfg80211_send_rx_assoc (struct wiphy *wiphy,struct net_device *dev, +struct sk_buff *skb); +#endif /* __NET_CFG80211_H */
net/mac80211/mlme.c +4 -0
@@ -1573,6 +1573,7 @@ ieee80211_rx_result ieee80211_sta_rx_mgmstatic void ieee80211_sta_rx_queued_mgmt (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb) { +struct ieee80211_local *local = sdata->local;struct ieee80211_rx_status *rx_status;struct ieee80211_mgmt *mgmt;u16 fc;
@@ -1592,12 +1593,15 @@ static void ieee80211_sta_rx_queued_mgmtbreak ;case IEEE80211_STYPE_AUTH :ieee80211_rx_mgmt_auth (sdata, mgmt, skb->len); +cfg80211_send_rx_auth (local->hw.wiphy, sdata->dev, skb);break ;case IEEE80211_STYPE_ASSOC_RESP :ieee80211_rx_mgmt_assoc_resp (sdata, mgmt, skb->len,0 ); +cfg80211_send_rx_assoc (local->hw.wiphy, sdata->dev, skb);break ;case IEEE80211_STYPE_REASSOC_RESP :ieee80211_rx_mgmt_assoc_resp (sdata, mgmt, skb->len,1 ); +cfg80211_send_rx_assoc (local->hw.wiphy, sdata->dev, skb);break ;case IEEE80211_STYPE_DEAUTH :ieee80211_rx_mgmt_deauth (sdata, mgmt, skb->len);
net/wireless/Makefile +1 -1
@@ -5,7 +5,7 @@ obj-$(CONFIG_LIB80211_CRYPT_WEP) += lib8 obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o -cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o +cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o mlme.o cfg80211-$(CONFIG_WIRELESS_EXT) += wext-compat.o cfg80211-$(CONFIG_NL80211) += nl80211.o
net/wireless/mlme.c new file +29 -0
@@ -0,0 +1,29 @@ +/* +* cfg80211 MLME SAP interface +* +* Copyright (c) 2009, Jouni Malinen <[email protected]> +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/netdevice.h> +#include <linux/nl80211.h> +#include <net/cfg80211.h> +#include "core.h" +#include "nl80211.h" + +void cfg80211_send_rx_auth (struct wiphy *wiphy,struct net_device *dev, +struct sk_buff *skb) +{ +struct cfg80211_registered_device *rdev =wiphy_to_dev (wiphy); +nl80211_send_rx_auth (rdev, dev, skb); +} +EXPORT_SYMBOL (cfg80211_send_rx_auth); + +void cfg80211_send_rx_assoc (struct wiphy *wiphy,struct net_device *dev, +struct sk_buff *skb) +{ +struct cfg80211_registered_device *rdev =wiphy_to_dev (wiphy); +nl80211_send_rx_assoc (rdev, dev, skb); +} +EXPORT_SYMBOL (cfg80211_send_rx_assoc);
net/wireless/nl80211.c +54 -0
72 lines not on this page · raw message
net/wireless/nl80211.h +16 -0
@@ -11,6 +11,12 @@ extern void nl80211_send_scan_done(struc struct net_device *netdev);extern void nl80211_send_scan_aborted (struct cfg80211_registered_device *rdev,struct net_device *netdev); +extern void nl80211_send_rx_auth (struct cfg80211_registered_device *rdev, +struct net_device *netdev, +struct sk_buff *skb); +extern void nl80211_send_rx_assoc (struct cfg80211_registered_device *rdev, +struct net_device *netdev, +struct sk_buff *skb);#else static inline int nl80211_init (void ) {
@@ -31,6 +37,16 @@ static inline void nl80211_send_scan_abo struct cfg80211_registered_device *rdev, struct net_device *netdev) {} +static inline void +nl80211_send_rx_auth (struct cfg80211_registered_device *rdev, +struct net_device *netdev,struct sk_buff *skb) +{ +} +static inline void +nl80211_send_rx_assoc (struct cfg80211_registered_device *rdev, +struct net_device *netdev,struct sk_buff *skb) +{ +}#endif /* CONFIG_NL80211 */ #endif /* __NET_WIRELESS_NL80211_H */
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Johannes Berg
maintainerQuoted 16 lines
+ * @NL80211_CMD_RX_AUTH: authentication notification (on the "mlme" multicast
+ * group). This event reports reception of an Authentication frame in
+ * station and IBSS modes similarly to MLME-AUTHENTICATE.confirm primitive
+ * in the MLME SAP interface (kernel providing MLME, userspace SME). In
+ * addition, this event is used as MLME-RESOURCE_REQUEST.confirm primitive
+ * which is also reporting a reception of an Authentication frame. The
+ * includedNL80211_ATTR_FRAMEattribute contains the management frame
+ * (including both the header and frame body, but not FCS).
+ * @NL80211_CMD_RX_ASSOC: association notification (on the "mlme" multicast
+ * group). This event reports reception of an Association Response or
+ * Reassociation Response frame in station and IBSS modes similarly to
+ * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitive in the
+ * MLME SAP interface (kernel providing MLME, userspace SME). The included
+ *NL80211_ATTR_FRAMEcontains the management frame (including both the
+ * header and frame body, but not FCS).
Shouldn't this specify that we send only frames that actually matter to us?
include/net/cfg80211.h void cfg80211_put_bss(struct cfg80211_bs · line 831
Quoted 4 lines
include/net/cfg80211.h +4
-0+void cfg80211_send_rx_auth (struct wiphy *wiphy,struct net_device *dev, +struct sk_buff *skb); +void cfg80211_send_rx_assoc (struct wiphy *wiphy,struct net_device *dev, +struct sk_buff *skb);
The wiphy parameter is somewhat useless, you can get it from dev->ieee80211_ptr->wiphy. I'd also prefer to not pass the skb but rather data/len separately since (a) that is all we use, and (b) in case some fullmac driver later doesn't actually have this in skb form it can still "build" a frame and then pass it.
net/mac80211/mlme.c static void ieee80211_sta_rx_queued_mgmt · line 1604
Quoted 13 lines
net/mac80211/mlme.c +3
-0@@ -1592,12 +1593,15 @@ static void ieee80211_sta_rx_queued_mgmtbreak ;case IEEE80211_STYPE_AUTH :ieee80211_rx_mgmt_auth (sdata, mgmt, skb->len); +cfg80211_send_rx_auth (local->hw.wiphy, sdata->dev, skb);break ;case IEEE80211_STYPE_ASSOC_RESP :ieee80211_rx_mgmt_assoc_resp (sdata, mgmt, skb->len,0 ); +cfg80211_send_rx_assoc (local->hw.wiphy, sdata->dev, skb);break ;case IEEE80211_STYPE_REASSOC_RESP :ieee80211_rx_mgmt_assoc_resp (sdata, mgmt, skb->len,1 ); +cfg80211_send_rx_assoc (local->hw.wiphy, sdata->dev, skb);
This seems somewhat wrong... imho we shouldn't be sending these events to userspace if we didn't act on the frames.
johannes
Quoted 5 lines · Johannes Berg
Quoted 2 lines
+ * @NL80211_CMD_RX_AUTH: authentication notification (on the "mlme" multicast
Shouldn't this specify that we send only frames that actually matter to us?
Yes.
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+void cfg80211_send_rx_auth(struct wiphy *wiphy, struct net_device *dev, + struct sk_buff *skb);The wiphy parameter is somewhat useless, you can get it from
dev->ieee80211_ptr->wiphy. I'd also prefer to not pass the skb but rather data/len separately since (a) that is all we use, and (b) in case some fullmac driver later doesn't actually have this in skb form it can still "build" a frame and then pass it.
OK.
Quoted 9 lines
Review static void ieee80211_sta_rx_queued_mgmt · line 1597
Quoted 6 lines
(quoted diff) +1
-0@@ -1592,12 +1593,15 @@ static void ieee80211_sta_rx_queued_mgmt break; case IEEE80211_STYPE_AUTH: ieee80211_rx_mgmt_auth(sdata, mgmt, skb->len); + cfg80211_send_rx_auth(local->hw.wiphy, sdata->dev, skb); break;This seems somewhat wrong... imho we shouldn't be sending these events to userspace if we didn't act on the frames.
Agreed.
Here's an update version of the MLME event patch. In addition, I started working on the MLME commands. The current work version of the changes is included after the event patch. At this point, it is very early (i.e., builds, have not tested at all and there are known missing parts). Anyway, it should show more details on how I was planning on getting the initial version working.
nl80211: Event notifications for MLME events
Add new nl80211 event notifications (and a new multicast group, "mlme") for informing user space about received and processed Authentication, (Re)Association Response, Deauthentication, and Disassociation frames in station and IBSS modes (i.e., MLME SAP interface primitives MLME-AUTHENTICATE.confirm, MLME-ASSOCIATE.confirm, MLME-REASSOCIATE.confirm, MLME-DEAUTHENTICATE.indicate, and MLME-DISASSOCIATE.indication). The event data is encapsulated as the 802.11 management frame since we already have the frame in that format and it includes all the needed information.
This is the first step in providing MLME SAP interface for authentication and association with nl80211. In other words, kernel code will act as the MLME and a user space application can control it as SME.
The next goal is to introduce MLME-AUTHENTICATE.request, MLME-{,RE}ASSOCIATE.request, MLME-DEAUTHENTICATE.request, and MLME-DISASSOCIATE.request primitives. The authentication and association commands will request the actual operations in two steps (assuming the driver supports this; if not, separate authentication step is skipped).
The initial implementation will likely end up using 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.
--- include/linux/nl80211.h | 35 +++++++++++++++++++++++ include/net/cfg80211.h | 46 ++++++++++++++++++++++++++++++ net/mac80211/mlme.c | 10 +++++- net/wireless/Makefile | 2 - net/wireless/mlme.c | 46 ++++++++++++++++++++++++++++++ net/wireless/nl80211.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ net/wireless/nl80211.h | 32 +++++++++++++++++++++ 7 files changed, 240 insertions(+), 3 deletions(-)
include/linux/nl80211.h +35 -0
@@ -150,6 +150,25 @@* @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, * partial scan results may be available * +* @NL80211_CMD_AUTHENTICATE: authentication notification (on the "mlme" +* multicast group). This event reports reception of an Authentication +* frame in station and IBSS modes when the local MLME processed the +* frame, i.e., it was for the local STA and was received in correct +* state. This is similar to MLME-AUTHENTICATE.confirm primitive in the +* MLME SAP interface (kernel providing MLME, userspace SME). The +* included NL80211_ATTR_FRAME attribute contains the management frame +* (including both the header and frame body, but not FCS). +* @NL80211_CMD_ASSOCIATE: association notification; like +* NL80211_CMD_AUTHENTICATE but for Association Response and Reassociation +* Response frames (similar to MLME-ASSOCIATE.confirm or +* MLME-REASSOCIATE.confirm primitives). +* @NL80211_CMD_DEAUTHENTICATE: deauthentication notification; like +* NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to +* MLME-DEAUTHENTICATE.indication primitive). +* @NL80211_CMD_DISASSOCIATE: disassociation notification; like +* NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to +* MLME-DISASSOCIATE.indication primitive). +* * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */
@@ -204,6 +223,11 @@ enum nl80211_commands {NL80211_CMD_NEW_SCAN_RESULTS ,NL80211_CMD_SCAN_ABORTED , +NL80211_CMD_AUTHENTICATE , +NL80211_CMD_ASSOCIATE , +NL80211_CMD_DEAUTHENTICATE , +NL80211_CMD_DISASSOCIATE , +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
@@ -217,6 +241,10 @@ enum nl80211_commands {*/ #define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS#define NL80211_CMD_SET_MGMT_EXTRA_IE NL80211_CMD_SET_MGMT_EXTRA_IE +#define NL80211_CMD_AUTHENTICATE NL80211_CMD_AUTHENTICATE +#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE +#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE +#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE/** * enum nl80211_attrs - nl80211 netlink attributes
@@ -329,6 +357,10 @@ enum nl80211_commands {* messages carried the same generation number) * @NL80211_ATTR_BSS: scan result BSS * +* @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header +* and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and +* NL80211_CMD_ASSOCIATE events +* * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */
@@ -403,6 +435,8 @@ enum nl80211_attrs {NL80211_ATTR_SCAN_GENERATION ,NL80211_ATTR_BSS , +NL80211_ATTR_FRAME , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
@@ -420,6 +454,7 @@ enum nl80211_attrs {#define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE#define NL80211_ATTR_MGMT_SUBTYPE NL80211_ATTR_MGMT_SUBTYPE#define NL80211_ATTR_IE NL80211_ATTR_IE +#define NL80211_ATTR_FRAME NL80211_ATTR_FRAME#define NL80211_MAX_SUPP_RATES 32#define NL80211_MAX_SUPP_REG_RULES 32
include/net/cfg80211.h +46 -0
50 lines not on this page · raw message
net/mac80211/mlme.c +8 -2
@@ -1066,11 +1066,13 @@ static void ieee80211_rx_mgmt_auth(struccase WLAN_AUTH_OPEN :case WLAN_AUTH_LEAP :ieee80211_auth_completed (sdata); +cfg80211_send_rx_auth (sdata->dev, (u8 *) mgmt, len);break ;case WLAN_AUTH_SHARED_KEY : -if (ifmgd->auth_transaction ==4 ) +if (ifmgd->auth_transaction ==4 ) {ieee80211_auth_completed (sdata); -else +cfg80211_send_rx_auth (sdata->dev, (u8 *) mgmt, len); + }else ieee80211_auth_challenge (sdata, mgmt, len);break ; }
@@ -1106,6 +1108,7 @@ static void ieee80211_rx_mgmt_deauth(strieee80211_set_disassoc (sdata, true, false,0 ); ifmgd->flags &= ~IEEE80211_STA_AUTHENTICATED ; +cfg80211_send_rx_deauth (sdata->dev, (u8 *) mgmt, len); }
@@ -1135,6 +1138,7 @@ static void ieee80211_rx_mgmt_disassoc(s }ieee80211_set_disassoc (sdata, false, false, reason_code); +cfg80211_send_rx_disassoc (sdata->dev, (u8 *) mgmt, len); }
@@ -1350,6 +1354,7 @@ static void ieee80211_rx_mgmt_assoc_respieee80211_set_associated (sdata, changed);ieee80211_associated (sdata); +cfg80211_send_rx_assoc (sdata->dev, (u8 *) mgmt, len); }
@@ -1598,6 +1603,7 @@ static void ieee80211_sta_rx_queued_mgmtbreak ;case IEEE80211_STYPE_REASSOC_RESP :ieee80211_rx_mgmt_assoc_resp (sdata, mgmt, skb->len,1 ); +cfg80211_send_rx_assoc (sdata->dev, skb->data, skb->len);break ;case IEEE80211_STYPE_DEAUTH :ieee80211_rx_mgmt_deauth (sdata, mgmt, skb->len);
net/wireless/Makefile +1 -1
@@ -5,7 +5,7 @@ obj-$(CONFIG_LIB80211_CRYPT_WEP) += lib8 obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o -cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o +cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o mlme.o cfg80211-$(CONFIG_WIRELESS_EXT) += wext-compat.o cfg80211-$(CONFIG_NL80211) += nl80211.o
net/wireless/mlme.c new file +46 -0
46 lines not on this page · raw message
net/wireless/nl80211.c +72 -0
90 lines not on this page · raw message
net/wireless/nl80211.h +32 -0
@@ -11,6 +11,18 @@ extern void nl80211_send_scan_done(struc struct net_device *netdev);extern void nl80211_send_scan_aborted (struct cfg80211_registered_device *rdev,struct net_device *netdev); +extern void nl80211_send_rx_auth (struct cfg80211_registered_device *rdev, +struct net_device *netdev, +const u8 *buf,size_t len); +extern void nl80211_send_rx_assoc (struct cfg80211_registered_device *rdev, +struct net_device *netdev, +const u8 *buf,size_t len); +extern void nl80211_send_rx_deauth (struct cfg80211_registered_device *rdev, +struct net_device *netdev, +const u8 *buf,size_t len); +extern void nl80211_send_rx_disassoc (struct cfg80211_registered_device *rdev, +struct net_device *netdev, +const u8 *buf,size_t len);#else static inline int nl80211_init (void ) {
@@ -31,6 +43,26 @@ static inline void nl80211_send_scan_abo struct cfg80211_registered_device *rdev, struct net_device *netdev) {} +static inline void +nl80211_send_rx_auth (struct cfg80211_registered_device *rdev, +struct net_device *netdev,const u8 *buf,size_t len) +{ +} +static inline void +nl80211_send_rx_assoc (struct cfg80211_registered_device *rdev, +struct net_device *netdev,const u8 *buf,size_t len) +{ +} +static inline void +nl80211_send_rx_deauth (struct cfg80211_registered_device *rdev, +struct net_device *netdev,const u8 *buf,size_t len) +{ +} +static inline void +nl80211_send_rx_disassoc (struct cfg80211_registered_device *rdev, +struct net_device *netdev,const u8 *buf,size_t len) +{ +}#endif /* CONFIG_NL80211 */ #endif /* __NET_WIRELESS_NL80211_H */
Very preliminary MLME commands:
--- include/linux/nl80211.h | 61 ++++++++++-- include/net/cfg80211.h | 42 ++++++++ net/mac80211/cfg.c | 136 +++++++++++++++++++++++++++ net/mac80211/ieee80211_i.h | 2 net/mac80211/mlme.c | 7 + net/mac80211/wext.c | 3 net/wireless/nl80211.c | 221 +++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 460 insertions(+), 12 deletions(-)
include/linux/nl80211.h +51 -10
97 lines not on this page · raw message
include/net/cfg80211.h +42 -0
54 lines not on this page · raw message
net/wireless/nl80211.c +221 -0
239 lines not on this page · raw message
net/mac80211/cfg.c +136 -0
146 lines not on this page · raw message
net/mac80211/ieee80211_i.h +2 -0
@@ -256,6 +256,7 @@ struct mesh_preq_queue {#define IEEE80211_STA_TKIP_WEP_USED BIT(14)#define IEEE80211_STA_CSA_RECEIVED BIT(15)#define IEEE80211_STA_MFP_ENABLED BIT(16) +#define IEEE80211_STA_EXT_SME BIT(17)/* flags for MLME request */ #define IEEE80211_STA_REQ_SCAN 0#define IEEE80211_STA_REQ_DIRECT_PROBE 1
@@ -266,6 +267,7 @@ struct mesh_preq_queue {#define IEEE80211_AUTH_ALG_OPEN BIT(0)#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)#define IEEE80211_AUTH_ALG_LEAP BIT(2) +#define IEEE80211_AUTH_ALG_FT BIT(3)struct ieee80211_if_managed {struct timer_list timer;
net/mac80211/mlme.c +5 -2
@@ -979,7 +979,8 @@ static void ieee80211_auth_completed(strprintk (KERN_DEBUG "%s: authenticated\n" , sdata->dev->name); ifmgd->flags |=IEEE80211_STA_AUTHENTICATED ; -ieee80211_associate (sdata); +if (!(ifmgd->flags &IEEE80211_STA_EXT_SME )) +ieee80211_associate (sdata); }
@@ -1856,7 +1857,9 @@ void ieee80211_sta_req_auth(struct ieee8ieee80211_set_disassoc (sdata, true, true,WLAN_REASON_DEAUTH_LEAVING ); -set_bit (IEEE80211_STA_REQ_AUTH , &ifmgd->request); +if (!(ifmgd->flags &IEEE80211_STA_EXT_SME ) || + ifmgd->state !=IEEE80211_STA_MLME_ASSOCIATE ) +set_bit (IEEE80211_STA_REQ_AUTH , &ifmgd->request);queue_work (local->hw.workqueue, &ifmgd->work); } }
net/mac80211/wext.c +3 -0
@@ -137,6 +137,7 @@ static int ieee80211_ioctl_siwgenie(struif (ret)return ret; sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL ; + sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME ;ieee80211_sta_req_auth (sdata);return 0 ; }
@@ -328,6 +329,7 @@ static int ieee80211_ioctl_siwessid(struif (ret)return ret; + sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME ;ieee80211_sta_req_auth (sdata);return 0 ; }else if (sdata->vif.type ==NL80211_IFTYPE_ADHOC )
@@ -391,6 +393,7 @@ static int ieee80211_ioctl_siwap(struct ret =ieee80211_sta_set_bssid (sdata, (u8 *) &ap_addr->sa_data);if (ret)return ret; + sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME ;ieee80211_sta_req_auth (sdata);return 0 ; }else if (sdata->vif.type ==NL80211_IFTYPE_ADHOC ) {
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Johannes Berg
maintainerQuoted 1 line · Jouni Malinen
nl80211: Event notifications for MLME events
That looks good to me.
include/linux/nl80211.h enum nl80211_bss { · line 979
Quoted 7 lines
include/linux/nl80211.h +7
-0+/** +* enum nl80211_auth_type - AuthenticationType +* +* @NL80211_AUTHTYPE_OPEN_SYSTEM +*/ +enum nl80211_auth_type { +NL80211_AUTHTYPE_UNSPECIFIED ,
This seems a little odd, is that really useful? And if it is, what do we do? Try all?
Quoted 22 lines
include/net/cfg80211.h +22
-0+struct cfg80211_auth_request { +struct ieee80211_channel *chan; +u8 *peer_addr; +const u8 *ssid; +size_t ssid_len; +enum nl80211_auth_type auth_type; +const u8 *ie; +size_t ie_len; +}; + +struct cfg80211_assoc_request { +struct ieee80211_channel *chan; +u8 *peer_addr; +const u8 *ssid; +size_t ssid_len; +const u8 *ie; +size_t ie_len; +}; + +struct cfg80211_deauth_request { +u8 *peer_addr; +u16 reason_code;
include/net/cfg80211.h struct cfg80211_bss { · line 633
Quoted 10 lines
include/net/cfg80211.h +10
-0+const u8 *ie; +size_t ie_len; +}; + +struct cfg80211_disassoc_request { +u8 *peer_addr; +u16 reason_code; +const u8 *ie; +size_t ie_len; +};
Seems sensible to me.
Should we have some more code in cfg80211 to keep track of the BSSes we're authenticated/the one we're associated to, and have some commands to query those from userspace?
johannes
Quoted 6 lines · Johannes Berg
include/linux/nl80211.h enum nl80211_bss { · line 979
Quoted 2 lines · Jouni Malinen
include/linux/nl80211.h +2
-0+enum nl80211_auth_type { +NL80211_AUTHTYPE_UNSPECIFIED ,This seems a little odd, is that really useful? And if it is, what do we do? Try all?
This is not supposed to be used and was there only to follow the do-not-use-zero-in-nl80211 policy.. However, it looks like the example I used (nl80211_iftype) actually uses the unspecified value or well at least it is documented as something that could potentially be used. I can just remove this and the _after_last, _max from here since they are not really supposed to be used anywhere..
Quoted 3 lines
Should we have some more code in cfg80211 to keep track of the BSSes we're authenticated/the one we're associated to, and have some commands to query those from userspace?
It would probably be useful to add this eventually. Whatever is requesting the association has most of the information, but it would be could to allow other applications have access to it and also remove the need to store that in the control application.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Johannes Berg
maintainerQuoted 8 lines · Jouni Malinen
Quoted 6 lines · Johannes Berg
include/linux/nl80211.h enum nl80211_bss { · line 979
Quoted 2 lines · Jouni Malinen
include/linux/nl80211.h +2
-0+enum nl80211_auth_type { +NL80211_AUTHTYPE_UNSPECIFIED ,This seems a little odd, is that really useful? And if it is, what do we do? Try all?
Quoted 6 lines
This is not supposed to be used and was there only to follow the do-not-use-zero-in-nl80211 policy.. However, it looks like the example I used (
nl80211_iftype) actually uses the unspecified value or well at least it is documented as something that could potentially be used. I can just remove this and the_after_last,_maxfrom here since they are not really supposed to be used anywhere..
Oh, ok, well you only need to reserve 0 for attribute numbers, not for attribute values.
Quoted 8 lines
Quoted 3 lines
Should we have some more code in cfg80211 to keep track of the BSSes we're authenticated/the one we're associated to, and have some commands to query those from userspace?
It would probably be useful to add this eventually. Whatever is requesting the association has most of the information, but it would be could to allow other applications have access to it and also remove the need to store that in the control application.
I guess we'll kinda need that to have iwconfig print out something useful.
johannes
Quoted 6 lines · Johannes Berg
Quoted 5 lines · Jouni Malinen
Quoted 3 lines · Johannes Berg
Should we have some more code in cfg80211 to keep track of the BSSes we're authenticated/the one we're associated to, and have some commands to query those from userspace?
Quoted 6 lines
Quoted 4 lines
It would probably be useful to add this eventually. Whatever is requesting the association has most of the information, but it would be could to allow other applications have access to it and also remove the need to store that in the control application.
I guess we'll kinda need that to have iwconfig print out something useful.
Actually, iwconfig works fine in my current version since it just uses the information from same functions that were used in net/mac80211/mlme.c. In other words, when I complete association with an external SME (wpa_supplicant), iwconfig can still show the BSSID etc. info.
I'm now able to complete authentication and association in two steps and use only nl80211 for it (i.e., no WEXT code needed in driver_nl80211.c for auth/assoc/deauth/disassoc processing). The mlme.c changes are not the cleanest possible and there are still couple of places where mlme.c shows its SME nature by deciding to automatically do something, but other than that, this seems to be functional.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Johannes Berg
maintainer[adding Kalle, Samuel]
Quoted 5 lines · Jouni Malinen
Actually, iwconfig works fine in my current version since it just uses the information from same functions that were used in
net/mac80211/mlme.c. In other words, when I complete association with an external SME (wpa_supplicant), iwconfig can still show the BSSID etc. info.
Yes, I know, but we really want to move the wext stuff into cfg80211 and then it won't really work this way any more.
Quoted 6 lines
I'm now able to complete authentication and association in two steps and use only nl80211 for it (i.e., no WEXT code needed in
driver_nl80211.cfor auth/assoc/deauth/disassoc processing). Themlme.cchanges are not the cleanest possible and there are still couple of places wheremlme.cshows its SME nature by deciding to automatically do something, but other than that, this seems to be functional.
Sounds good. I guess we can do things piecewise...
One thing we were saying yesterday is that it might make more sense to not do assoc w/o auth for those hardware that doesn't support it, but rather add a new "connect" command instead so the distinction is clearer. Not sure though.
Couple of thoughts. Trivial one: can the SSID really be 0 bytes as documented? Does that make any sense?
Another thing I would like to do -- instead of passing this struct:
+struct cfg80211_auth_request {
+ struct ieee80211_channel *chan; + u8 *peer_addr; + const u8 *ssid; + size_t ssid_len; + enum nl80211_auth_type auth_type; + const u8 *ie; + size_t ie_len;
+};
why don't we pass a cfg80211_bss pointer and the IE info? That might mean that cfg80211 would need to invoke scanning and have a small state machine, but that seems reasonable. Then we inc the ref on that bss struct and keep it around, so it stays in scan results too.
We'd probably need to change the event functions to include the BSS pointer (if we want to allow multiple authentications to be in flight at the same time) and whether the authentication was actually successful (maybe we can parse that out of the reported frame).
The result of that is that we can
* check, in MLME.associate, that we're already authenticated, and do it generically in cfg80211
* keep around the BSS in scan results without having to add some extra code to drivers/mac80211 when we start filtering beacons
* easily tell userspace what's going on
and we can keep around the BSS that we're associated with too for the same reasons and to verify we're only on one BSS at a time and catch userspace requesting a second one.
The other upside of this is that drivers will stop working entirely if they do not provide the proper events, which is good because it means all drivers will take great care to provide them.
johannes