event.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * mac80211 - events
  9. */
  10. #include <linux/netdevice.h>
  11. #include <net/iw_handler.h>
  12. #include "ieee80211_i.h"
  13. /*
  14. * indicate a failed Michael MIC to userspace; the passed packet
  15. * (in the variable hdr) must be long enough to extract the TKIP
  16. * fields like TSC
  17. */
  18. void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx,
  19. struct ieee80211_hdr *hdr)
  20. {
  21. union iwreq_data wrqu;
  22. char *buf = kmalloc(128, GFP_ATOMIC);
  23. DECLARE_MAC_BUF(mac);
  24. if (buf) {
  25. /* TODO: needed parameters: count, key type, TSC */
  26. sprintf(buf, "MLME-MICHAELMICFAILURE.indication("
  27. "keyid=%d %scast addr=%s)",
  28. keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni",
  29. print_mac(mac, hdr->addr2));
  30. memset(&wrqu, 0, sizeof(wrqu));
  31. wrqu.data.length = strlen(buf);
  32. wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
  33. kfree(buf);
  34. }
  35. /*
  36. * TODO: re-add support for sending MIC failure indication
  37. * with all info via nl80211
  38. */
  39. }