cfg80211: disallow beacon_int_min_gcd with IBSS
authorJohannes Berg <johannes.berg@intel.com>
Fri, 21 Oct 2016 12:25:12 +0000 (14:25 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 27 Oct 2016 07:08:45 +0000 (09:08 +0200)
This can't really be supported right now, because the IBSS
interface may change its beacon interval at any time due to
joining another network; thus, there's already "support"
for different beacon intervals here, implicitly.

Until we figure out how we should handle this case (continue
to allow it to arbitrarily join? Join only if compatible?)
disallow advertising that different beacon intervals are
supported if IBSS is allowed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/core.c

index 725adff6c7d44d665f45587bb87df3747ef3f6d0..158c59ecf90a35a6af8ca353c7583e0bd0cda807 100644 (file)
@@ -562,6 +562,21 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
                                    c->limits[j].max > 1))
                                return -EINVAL;
 
+                       /*
+                        * This isn't well-defined right now. If you have an
+                        * IBSS interface, then its beacon interval may change
+                        * by joining other networks, and nothing prevents it
+                        * from doing that.
+                        * So technically we probably shouldn't even allow AP
+                        * and IBSS in the same interface, but it seems that
+                        * some drivers support that, possibly only with fixed
+                        * beacon intervals for IBSS.
+                        */
+                       if (WARN_ON(types & BIT(NL80211_IFTYPE_ADHOC) &&
+                                   c->beacon_int_min_gcd)) {
+                               return -EINVAL;
+                       }
+
                        cnt += c->limits[j].max;
                        /*
                         * Don't advertise an unsupported type