aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-24 14:32:22 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:02:31 -0400
commit2083c4997b95fffe8d4f71741bef2298810805a3 (patch)
treeb3378f86c564bfd1eff5af34c7405c094c8782f1 /net
parentbe3d48106c1e5d075784e5e67928a6b5ffc0f3b6 (diff)
wireless: clean up regulatory ignore_request function
This function has a few WARNs that may eventually trigger when an AP sends rogue beacons, those must be removed. Some of the comments in the function are also inappropriate as this function is concerned with the global hint, not a per- wiphy thing (which a multidomain flag on a wiphy would imply). I'm convinced that we don't need to do anything to implement multi-domain capability as 802.11-2007 specifies it because it makes only two things mandatory: * starting of BSS/IBSS must have country information (this can easily be done with a mac80211 patch) * a STA must adopt the country information (we already have the framework for this) But we don't have anything implemented anyway for now. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-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 */