mlme.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * cfg80211 MLME SAP interface
  3. *
  4. * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/module.h>
  8. #include <linux/netdevice.h>
  9. #include <linux/nl80211.h>
  10. #include <net/cfg80211.h>
  11. #include "core.h"
  12. #include "nl80211.h"
  13. void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len)
  14. {
  15. struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
  16. struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
  17. nl80211_send_rx_auth(rdev, dev, buf, len);
  18. }
  19. EXPORT_SYMBOL(cfg80211_send_rx_auth);
  20. void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len)
  21. {
  22. struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
  23. struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
  24. nl80211_send_rx_assoc(rdev, dev, buf, len);
  25. }
  26. EXPORT_SYMBOL(cfg80211_send_rx_assoc);
  27. void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len)
  28. {
  29. struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
  30. struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
  31. nl80211_send_deauth(rdev, dev, buf, len);
  32. }
  33. EXPORT_SYMBOL(cfg80211_send_deauth);
  34. void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len)
  35. {
  36. struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
  37. struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
  38. nl80211_send_disassoc(rdev, dev, buf, len);
  39. }
  40. EXPORT_SYMBOL(cfg80211_send_disassoc);
  41. static void cfg80211_wext_disconnected(struct net_device *dev)
  42. {
  43. #ifdef CONFIG_WIRELESS_EXT
  44. union iwreq_data wrqu;
  45. memset(&wrqu, 0, sizeof(wrqu));
  46. wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
  47. #endif
  48. }
  49. void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr)
  50. {
  51. struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
  52. struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
  53. nl80211_send_auth_timeout(rdev, dev, addr);
  54. cfg80211_wext_disconnected(dev);
  55. }
  56. EXPORT_SYMBOL(cfg80211_send_auth_timeout);
  57. void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr)
  58. {
  59. struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
  60. struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
  61. nl80211_send_assoc_timeout(rdev, dev, addr);
  62. cfg80211_wext_disconnected(dev);
  63. }
  64. EXPORT_SYMBOL(cfg80211_send_assoc_timeout);
  65. void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
  66. enum nl80211_key_type key_type, int key_id,
  67. const u8 *tsc)
  68. {
  69. struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
  70. struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
  71. nl80211_michael_mic_failure(rdev, dev, addr, key_type, key_id, tsc);
  72. }
  73. EXPORT_SYMBOL(cfg80211_michael_mic_failure);