diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-05-09 12:41:15 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-12 14:10:47 -0400 |
commit | 56d1893d94bc06d0b1aa3a53f924ed02f9e207bf (patch) | |
tree | 90862ae6788cf267631bd9ddebf4bc450d0d2b26 /net/wireless/util.c | |
parent | 15cb309614f35df344b9f06a9ea9f077d1e449db (diff) |
cfg80211: restrict AP beacon intervals
Multiple virtual AP interfaces can currently try
to use different beacon intervals, but that just
leads to problems since it won't actually be done
that way by drivers. Return an error in this case
to make sure it won't be done wrong.
Also, ignore attempts to change the DTIM period
or beacon interval during the lifetime of the BSS.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r-- | net/wireless/util.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c index 6a750bc6bcfe..414c9f604df6 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -896,3 +896,28 @@ u16 cfg80211_calculate_bitrate(struct rate_info *rate) | |||
896 | /* do NOT round down here */ | 896 | /* do NOT round down here */ |
897 | return (bitrate + 50000) / 100000; | 897 | return (bitrate + 50000) / 100000; |
898 | } | 898 | } |
899 | |||
900 | int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev, | ||
901 | u32 beacon_int) | ||
902 | { | ||
903 | struct wireless_dev *wdev; | ||
904 | int res = 0; | ||
905 | |||
906 | if (!beacon_int) | ||
907 | return -EINVAL; | ||
908 | |||
909 | mutex_lock(&rdev->devlist_mtx); | ||
910 | |||
911 | list_for_each_entry(wdev, &rdev->netdev_list, list) { | ||
912 | if (!wdev->beacon_interval) | ||
913 | continue; | ||
914 | if (wdev->beacon_interval != beacon_int) { | ||
915 | res = -EINVAL; | ||
916 | break; | ||
917 | } | ||
918 | } | ||
919 | |||
920 | mutex_unlock(&rdev->devlist_mtx); | ||
921 | |||
922 | return res; | ||
923 | } | ||