ap.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include <linux/ieee80211.h>
  2. #include <linux/export.h>
  3. #include <net/cfg80211.h>
  4. #include "nl80211.h"
  5. #include "core.h"
  6. #include "rdev-ops.h"
  7. int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
  8. struct net_device *dev, bool notify)
  9. {
  10. struct wireless_dev *wdev = dev->ieee80211_ptr;
  11. int err;
  12. ASSERT_WDEV_LOCK(wdev);
  13. if (!rdev->ops->stop_ap)
  14. return -EOPNOTSUPP;
  15. if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
  16. dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
  17. return -EOPNOTSUPP;
  18. if (!wdev->beacon_interval)
  19. return -ENOENT;
  20. err = rdev_stop_ap(rdev, dev);
  21. if (!err) {
  22. wdev->beacon_interval = 0;
  23. memset(&wdev->chandef, 0, sizeof(wdev->chandef));
  24. wdev->ssid_len = 0;
  25. rdev_set_qos_map(rdev, dev, NULL);
  26. if (notify)
  27. nl80211_send_ap_stopped(wdev);
  28. /* Should we apply the grace period during beaconing interface
  29. * shutdown also?
  30. */
  31. cfg80211_sched_dfs_chan_update(rdev);
  32. }
  33. return err;
  34. }
  35. int cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
  36. struct net_device *dev, bool notify)
  37. {
  38. struct wireless_dev *wdev = dev->ieee80211_ptr;
  39. int err;
  40. wdev_lock(wdev);
  41. err = __cfg80211_stop_ap(rdev, dev, notify);
  42. wdev_unlock(wdev);
  43. return err;
  44. }