diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-08-28 17:01:53 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:48:47 -0400 |
commit | eb063c1702a84d58eb4c05a032bbff6f1c29049d (patch) | |
tree | 0aa15bc098e6e4ef0c84bc4944250bba971ac3ad /net/mac80211/rx.c | |
parent | 808718c1477b8350e9e329bf4a35391ac7c7f982 (diff) |
[MAC80211]: refactor event sending
Create a new file event.c that will contain code to send mac/mlme
events to userspace. For now put the Michael MIC failure condition
into it and remove sending of that condition via the management
interface, hostapd interestingly doesn't do anything when it gets
such a packet besides printing a message, it reacts only on the
private iwevent.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r-- | net/mac80211/rx.c | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 08ca066246b9..5a66269d9435 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/skbuff.h> | 13 | #include <linux/skbuff.h> |
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <linux/etherdevice.h> | 15 | #include <linux/etherdevice.h> |
16 | #include <net/iw_handler.h> | ||
17 | #include <net/mac80211.h> | 16 | #include <net/mac80211.h> |
18 | #include <net/ieee80211_radiotap.h> | 17 | #include <net/ieee80211_radiotap.h> |
19 | 18 | ||
@@ -1206,20 +1205,17 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev, | |||
1206 | } | 1205 | } |
1207 | 1206 | ||
1208 | if ((rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) && | 1207 | if ((rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) && |
1209 | rx->sdata->type == IEEE80211_IF_TYPE_AP) { | 1208 | rx->sdata->type == IEEE80211_IF_TYPE_AP && keyidx) { |
1210 | keyidx = ieee80211_wep_get_keyidx(rx->skb); | ||
1211 | /* AP with Pairwise keys support should never receive Michael | 1209 | /* AP with Pairwise keys support should never receive Michael |
1212 | * MIC errors for non-zero keyidx because these are reserved | 1210 | * MIC errors for non-zero keyidx because these are reserved |
1213 | * for group keys and only the AP is sending real multicast | 1211 | * for group keys and only the AP is sending real multicast |
1214 | * frames in BSS. */ | 1212 | * frames in BSS. */ |
1215 | if (keyidx) { | 1213 | if (net_ratelimit()) |
1216 | if (net_ratelimit()) | 1214 | printk(KERN_DEBUG "%s: ignored Michael MIC error for " |
1217 | printk(KERN_DEBUG "%s: ignored Michael MIC " | 1215 | "a frame with non-zero keyidx (%d)" |
1218 | "error for a frame with non-zero keyidx" | 1216 | " (src " MAC_FMT ")\n", dev->name, keyidx, |
1219 | " (%d) (src " MAC_FMT ")\n", dev->name, | 1217 | MAC_ARG(hdr->addr2)); |
1220 | keyidx, MAC_ARG(hdr->addr2)); | 1218 | goto ignore; |
1221 | goto ignore; | ||
1222 | } | ||
1223 | } | 1219 | } |
1224 | 1220 | ||
1225 | if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && | 1221 | if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && |
@@ -1233,32 +1229,11 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev, | |||
1233 | goto ignore; | 1229 | goto ignore; |
1234 | } | 1230 | } |
1235 | 1231 | ||
1236 | do { | ||
1237 | union iwreq_data wrqu; | ||
1238 | char *buf = kmalloc(128, GFP_ATOMIC); | ||
1239 | if (!buf) | ||
1240 | break; | ||
1241 | |||
1242 | /* TODO: needed parameters: count, key type, TSC */ | ||
1243 | sprintf(buf, "MLME-MICHAELMICFAILURE.indication(" | ||
1244 | "keyid=%d %scast addr=" MAC_FMT ")", | ||
1245 | keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni", | ||
1246 | MAC_ARG(hdr->addr2)); | ||
1247 | memset(&wrqu, 0, sizeof(wrqu)); | ||
1248 | wrqu.data.length = strlen(buf); | ||
1249 | wireless_send_event(rx->dev, IWEVCUSTOM, &wrqu, buf); | ||
1250 | kfree(buf); | ||
1251 | } while (0); | ||
1252 | |||
1253 | /* TODO: consider verifying the MIC error report with software | 1232 | /* TODO: consider verifying the MIC error report with software |
1254 | * implementation if we get too many spurious reports from the | 1233 | * implementation if we get too many spurious reports from the |
1255 | * hardware. */ | 1234 | * hardware. */ |
1256 | if (!rx->local->apdev) | ||
1257 | goto ignore; | ||
1258 | ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status, | ||
1259 | ieee80211_msg_michael_mic_failure); | ||
1260 | return; | ||
1261 | 1235 | ||
1236 | mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr); | ||
1262 | ignore: | 1237 | ignore: |
1263 | dev_kfree_skb(rx->skb); | 1238 | dev_kfree_skb(rx->skb); |
1264 | rx->skb = NULL; | 1239 | rx->skb = NULL; |