aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/wireless/reg.c67
1 files changed, 27 insertions, 40 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index dc10071deaaa..a20dd13c7094 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -311,24 +311,25 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
311 case REGDOM_SET_BY_INIT: 311 case REGDOM_SET_BY_INIT:
312 return -EINVAL; 312 return -EINVAL;
313 case REGDOM_SET_BY_CORE: 313 case REGDOM_SET_BY_CORE:
314 /* Always respect new wireless core hints, should only 314 /*
315 * come in for updating the world regulatory domain at init 315 * Always respect new wireless core hints, should only happen
316 * anyway */ 316 * when updating the world regulatory domain at init.
317 */
317 return 0; 318 return 0;
318 case REGDOM_SET_BY_COUNTRY_IE: 319 case REGDOM_SET_BY_COUNTRY_IE:
320 if (unlikely(!is_an_alpha2(alpha2)))
321 return -EINVAL;
319 if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) { 322 if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) {
320 if (last_request->wiphy != wiphy) { 323 if (last_request->wiphy != wiphy) {
321 /* Two cards with two APs claiming different 324 /*
322 * different Country IE alpha2s! 325 * Two cards with two APs claiming different
323 * You're special!! */ 326 * different Country IE alpha2s. We could
324 if (!alpha2_equal(last_request->alpha2, 327 * intersect them, but that seems unlikely
325 cfg80211_regdomain->alpha2)) { 328 * to be correct. Reject second one for now.
326 /* XXX: Deal with conflict, consider 329 */
327 * building a new one out of the 330 if (!alpha2_equal(alpha2,
328 * intersection */ 331 cfg80211_regdomain->alpha2))
329 WARN_ON(1);
330 return -EOPNOTSUPP; 332 return -EOPNOTSUPP;
331 }
332 return -EALREADY; 333 return -EALREADY;
333 } 334 }
334 /* Two consecutive Country IE hints on the same wiphy */ 335 /* Two consecutive Country IE hints on the same wiphy */
@@ -336,42 +337,28 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
336 return 0; 337 return 0;
337 return -EALREADY; 338 return -EALREADY;
338 } 339 }
339 if (WARN_ON(!is_alpha2_set(alpha2) || !is_an_alpha2(alpha2)), 340 /*
340 "Invalid Country IE regulatory hint passed " 341 * Ignore Country IE hints for now, need to think about
341 "to the wireless core\n") 342 * what we need to do to support multi-domain operation.
342 return -EINVAL; 343 */
343 /* We ignore Country IE hints for now, as we haven't yet 344 return -EOPNOTSUPP;
344 * added the dot11MultiDomainCapabilityEnabled flag
345 * for wiphys */
346 return 1;
347 case REGDOM_SET_BY_DRIVER: 345 case REGDOM_SET_BY_DRIVER:
348 BUG_ON(!wiphy);
349 if (last_request->initiator == REGDOM_SET_BY_DRIVER) 346 if (last_request->initiator == REGDOM_SET_BY_DRIVER)
350 return -EALREADY; 347 return -EALREADY;
351 if (last_request->initiator == REGDOM_SET_BY_CORE)
352 return 0;
353 /* XXX: Handle intersection, and add the
354 * dot11MultiDomainCapabilityEnabled flag to wiphy. For now
355 * we assume the driver has this set to false, following the
356 * 802.11d dot11MultiDomainCapabilityEnabled documentation */
357 if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
358 return 0;
359 return 0; 348 return 0;
360 case REGDOM_SET_BY_USER: 349 case REGDOM_SET_BY_USER:
361 if (last_request->initiator == REGDOM_SET_BY_USER || 350 /*
362 last_request->initiator == REGDOM_SET_BY_CORE) 351 * If the user wants to override the AP's hint, we may
363 return 0; 352 * need to follow both and use the intersection. For now,
364 /* Drivers can use their wiphy's reg_notifier() 353 * reject any such attempt (but we don't support country
365 * to override any information */ 354 * IEs right now anyway.)
366 if (last_request->initiator == REGDOM_SET_BY_DRIVER) 355 */
367 return 0;
368 /* XXX: Handle intersection */
369 if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) 356 if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
370 return -EOPNOTSUPP; 357 return -EOPNOTSUPP;
371 return 0; 358 return 0;
372 default:
373 return -EINVAL;
374 } 359 }
360
361 return -EINVAL;
375} 362}
376 363
377/* Used by nl80211 before kmalloc'ing our regulatory domain */ 364/* Used by nl80211 before kmalloc'ing our regulatory domain */