aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-04-22 14:38:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:57:21 -0400
commit1965c85331ed29dc4fd32479ff31663e3e9a518f (patch)
tree1542f0fdf4121491671bbb604564cb4f6dd1ad58
parentff2ba188fc5eaae529cb2ef9b127c3ca2a7df4b9 (diff)
nl80211: Add event for authentication/association timeout
SME needs to be notified when the authentication or association attempt times out and MLME has stopped processing in order to allow the SME to decide what to do next. Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/linux/nl80211.h13
-rw-r--r--include/net/cfg80211.h22
-rw-r--r--net/mac80211/mlme.c4
-rw-r--r--net/wireless/mlme.c27
-rw-r--r--net/wireless/nl80211.c49
-rw-r--r--net/wireless/nl80211.h6
6 files changed, 115 insertions, 6 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index b6a48dd502ce..e9fd13aa79f0 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -203,8 +203,12 @@
203 * frame, i.e., it was for the local STA and was received in correct 203 * frame, i.e., it was for the local STA and was received in correct
204 * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the 204 * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the
205 * MLME SAP interface (kernel providing MLME, userspace SME). The 205 * MLME SAP interface (kernel providing MLME, userspace SME). The
206 * included NL80211_ATTR_FRAME attribute contains the management frame 206 * included %NL80211_ATTR_FRAME attribute contains the management frame
207 * (including both the header and frame body, but not FCS). 207 * (including both the header and frame body, but not FCS). This event is
208 * also used to indicate if the authentication attempt timed out. In that
209 * case the %NL80211_ATTR_FRAME attribute is replaced with a
210 * %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which
211 * pending authentication timed out).
208 * @NL80211_CMD_ASSOCIATE: association request and notification; like 212 * @NL80211_CMD_ASSOCIATE: association request and notification; like
209 * NL80211_CMD_AUTHENTICATE but for Association and Reassociation 213 * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
210 * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, 214 * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
@@ -487,6 +491,9 @@ enum nl80211_commands {
487 * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look 491 * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look
488 * for other networks on different channels 492 * for other networks on different channels
489 * 493 *
494 * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this
495 * is used, e.g., with %NL80211_CMD_AUTHENTICATE event
496 *
490 * @NL80211_ATTR_MAX: highest attribute number currently defined 497 * @NL80211_ATTR_MAX: highest attribute number currently defined
491 * @__NL80211_ATTR_AFTER_LAST: internal use 498 * @__NL80211_ATTR_AFTER_LAST: internal use
492 */ 499 */
@@ -587,6 +594,8 @@ enum nl80211_attrs {
587 NL80211_ATTR_WIPHY_FRAG_THRESHOLD, 594 NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
588 NL80211_ATTR_WIPHY_RTS_THRESHOLD, 595 NL80211_ATTR_WIPHY_RTS_THRESHOLD,
589 596
597 NL80211_ATTR_TIMED_OUT,
598
590 /* add attributes here, update the policy in nl80211.c */ 599 /* add attributes here, update the policy in nl80211.c */
591 600
592 __NL80211_ATTR_AFTER_LAST, 601 __NL80211_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7f7b53b69cb2..b8a76764e1c5 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1475,22 +1475,40 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
1475 * @len: length of the frame data 1475 * @len: length of the frame data
1476 * 1476 *
1477 * This function is called whenever an authentication has been processed in 1477 * This function is called whenever an authentication has been processed in
1478 * station mode. 1478 * station mode. The driver is required to call either this function or
1479 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
1480 * call.
1479 */ 1481 */
1480void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 1482void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
1481 1483
1482/** 1484/**
1485 * cfg80211_send_auth_timeout - notification of timed out authentication
1486 * @dev: network device
1487 * @addr: The MAC address of the device with which the authentication timed out
1488 */
1489void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1490
1491/**
1483 * cfg80211_send_rx_assoc - notification of processed association 1492 * cfg80211_send_rx_assoc - notification of processed association
1484 * @dev: network device 1493 * @dev: network device
1485 * @buf: (re)association response frame (header + body) 1494 * @buf: (re)association response frame (header + body)
1486 * @len: length of the frame data 1495 * @len: length of the frame data
1487 * 1496 *
1488 * This function is called whenever a (re)association response has been 1497 * This function is called whenever a (re)association response has been
1489 * processed in station mode. 1498 * processed in station mode. The driver is required to call either this
1499 * function or cfg80211_send_assoc_timeout() to indicate the result of
1500 * cfg80211_ops::assoc() call.
1490 */ 1501 */
1491void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 1502void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
1492 1503
1493/** 1504/**
1505 * cfg80211_send_assoc_timeout - notification of timed out association
1506 * @dev: network device
1507 * @addr: The MAC address of the device with which the association timed out
1508 */
1509void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1510
1511/**
1494 * cfg80211_send_deauth - notification of processed deauthentication 1512 * cfg80211_send_deauth - notification of processed deauthentication
1495 * @dev: network device 1513 * @dev: network device
1496 * @buf: deauthentication frame (header + body) 1514 * @buf: deauthentication frame (header + body)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index df27c68620c9..3610c11286bc 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -932,7 +932,7 @@ static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata)
932 " timed out\n", 932 " timed out\n",
933 sdata->dev->name, ifmgd->bssid); 933 sdata->dev->name, ifmgd->bssid);
934 ifmgd->state = IEEE80211_STA_MLME_DISABLED; 934 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
935 ieee80211_sta_send_apinfo(sdata); 935 cfg80211_send_auth_timeout(sdata->dev, ifmgd->bssid);
936 ieee80211_rx_bss_remove(sdata, ifmgd->bssid, 936 ieee80211_rx_bss_remove(sdata, ifmgd->bssid,
937 sdata->local->hw.conf.channel->center_freq, 937 sdata->local->hw.conf.channel->center_freq,
938 ifmgd->ssid, ifmgd->ssid_len); 938 ifmgd->ssid, ifmgd->ssid_len);
@@ -1115,7 +1115,7 @@ static void ieee80211_associate(struct ieee80211_sub_if_data *sdata)
1115 " timed out\n", 1115 " timed out\n",
1116 sdata->dev->name, ifmgd->bssid); 1116 sdata->dev->name, ifmgd->bssid);
1117 ifmgd->state = IEEE80211_STA_MLME_DISABLED; 1117 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
1118 ieee80211_sta_send_apinfo(sdata); 1118 cfg80211_send_assoc_timeout(sdata->dev, ifmgd->bssid);
1119 ieee80211_rx_bss_remove(sdata, ifmgd->bssid, 1119 ieee80211_rx_bss_remove(sdata, ifmgd->bssid,
1120 sdata->local->hw.conf.channel->center_freq, 1120 sdata->local->hw.conf.channel->center_freq,
1121 ifmgd->ssid, ifmgd->ssid_len); 1121 ifmgd->ssid, ifmgd->ssid_len);
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 1407244a647e..42184361a109 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -44,6 +44,33 @@ void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len)
44} 44}
45EXPORT_SYMBOL(cfg80211_send_disassoc); 45EXPORT_SYMBOL(cfg80211_send_disassoc);
46 46
47static void cfg80211_wext_disconnected(struct net_device *dev)
48{
49#ifdef CONFIG_WIRELESS_EXT
50 union iwreq_data wrqu;
51 memset(&wrqu, 0, sizeof(wrqu));
52 wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
53#endif
54}
55
56void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr)
57{
58 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
59 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
60 nl80211_send_auth_timeout(rdev, dev, addr);
61 cfg80211_wext_disconnected(dev);
62}
63EXPORT_SYMBOL(cfg80211_send_auth_timeout);
64
65void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr)
66{
67 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
68 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
69 nl80211_send_assoc_timeout(rdev, dev, addr);
70 cfg80211_wext_disconnected(dev);
71}
72EXPORT_SYMBOL(cfg80211_send_assoc_timeout);
73
47void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 74void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
48 enum nl80211_key_type key_type, int key_id, 75 enum nl80211_key_type key_type, int key_id,
49 const u8 *tsc) 76 const u8 *tsc)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 3b21b3e89e96..b1fc98225fd1 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -121,6 +121,7 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = {
121 [NL80211_ATTR_AUTH_TYPE] = { .type = NLA_U32 }, 121 [NL80211_ATTR_AUTH_TYPE] = { .type = NLA_U32 },
122 [NL80211_ATTR_REASON_CODE] = { .type = NLA_U16 }, 122 [NL80211_ATTR_REASON_CODE] = { .type = NLA_U16 },
123 [NL80211_ATTR_FREQ_FIXED] = { .type = NLA_FLAG }, 123 [NL80211_ATTR_FREQ_FIXED] = { .type = NLA_FLAG },
124 [NL80211_ATTR_TIMED_OUT] = { .type = NLA_FLAG },
124}; 125};
125 126
126/* IE validation */ 127/* IE validation */
@@ -3695,6 +3696,54 @@ void nl80211_send_disassoc(struct cfg80211_registered_device *rdev,
3695 NL80211_CMD_DISASSOCIATE); 3696 NL80211_CMD_DISASSOCIATE);
3696} 3697}
3697 3698
3699void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev,
3700 struct net_device *netdev, int cmd,
3701 const u8 *addr)
3702{
3703 struct sk_buff *msg;
3704 void *hdr;
3705
3706 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
3707 if (!msg)
3708 return;
3709
3710 hdr = nl80211hdr_put(msg, 0, 0, 0, cmd);
3711 if (!hdr) {
3712 nlmsg_free(msg);
3713 return;
3714 }
3715
3716 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
3717 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
3718 NLA_PUT_FLAG(msg, NL80211_ATTR_TIMED_OUT);
3719 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
3720
3721 if (genlmsg_end(msg, hdr) < 0) {
3722 nlmsg_free(msg);
3723 return;
3724 }
3725
3726 genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, GFP_ATOMIC);
3727 return;
3728
3729 nla_put_failure:
3730 genlmsg_cancel(msg, hdr);
3731 nlmsg_free(msg);
3732}
3733
3734void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev,
3735 struct net_device *netdev, const u8 *addr)
3736{
3737 nl80211_send_mlme_timeout(rdev, netdev, NL80211_CMD_AUTHENTICATE,
3738 addr);
3739}
3740
3741void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev,
3742 struct net_device *netdev, const u8 *addr)
3743{
3744 nl80211_send_mlme_timeout(rdev, netdev, NL80211_CMD_ASSOCIATE, addr);
3745}
3746
3698void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, 3747void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
3699 struct net_device *netdev, const u8 *bssid, 3748 struct net_device *netdev, const u8 *bssid,
3700 gfp_t gfp) 3749 gfp_t gfp)
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index 17d2d8bfaf75..5c12ad13499b 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -23,6 +23,12 @@ extern void nl80211_send_deauth(struct cfg80211_registered_device *rdev,
23extern void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, 23extern void nl80211_send_disassoc(struct cfg80211_registered_device *rdev,
24 struct net_device *netdev, 24 struct net_device *netdev,
25 const u8 *buf, size_t len); 25 const u8 *buf, size_t len);
26extern void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev,
27 struct net_device *netdev,
28 const u8 *addr);
29extern void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev,
30 struct net_device *netdev,
31 const u8 *addr);
26extern void 32extern void
27nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, 33nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
28 struct net_device *netdev, const u8 *addr, 34 struct net_device *netdev, const u8 *addr,