ap.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. wdev->beacon_interval = 0;
  22. if (!err) {
  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. }
  29. return err;
  30. }
  31. int cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
  32. struct net_device *dev, bool notify)
  33. {
  34. struct wireless_dev *wdev = dev->ieee80211_ptr;
  35. int err;
  36. wdev_lock(wdev);
  37. err = __cfg80211_stop_ap(rdev, dev, notify);
  38. wdev_unlock(wdev);
  39. return err;
  40. }